1 /* Copyright (C) 2016-2017 Shengyu Zhang <i@silverrainz.me> 2 * 3 * This file is part of Srain. 4 * 5 * Srain is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef __SUI_EVENT_H 20 #define __SUI_EVENT_H 21 22 #include <glib.h> 23 24 #include "srain.h" 25 26 #ifndef __IN_SUI_H 27 #error This file should not be included directly, include just sui.h 28 #endif 29 30 #define SUI_EVENT_PARAM_BOOL "b" 31 #define SUI_EVENT_PARAM_INT "i" 32 #define SUI_EVENT_PARAM_STRING "&s" 33 #define SUI_EVENT_PARAM_STRINGS "^a&s" 34 35 typedef enum { 36 SUI_EVENT_OPEN = 0, 37 SUI_EVENT_ACTIVATE, 38 SUI_EVENT_SHUTDOWN, 39 SUI_EVENT_CONNECT, 40 SUI_EVENT_DISCONNECT, 41 SUI_EVENT_QUIT, 42 SUI_EVENT_SEND, 43 SUI_EVENT_JOIN, 44 SUI_EVENT_PART, 45 SUI_EVENT_QUERY, 46 SUI_EVENT_UNQUERY, 47 SUI_EVENT_KICK, 48 SUI_EVENT_INVITE, 49 SUI_EVENT_WHOIS, 50 SUI_EVENT_IGNORE, 51 SUI_EVENT_CUTOVER, 52 SUI_EVENT_SERVER_LIST, 53 SUI_EVENT_CHAN_LIST, 54 SUI_EVENT_RECONNECT, 55 SUI_EVENT_UNKNOWN, 56 } SuiEvent; 57 58 typedef int (*SuiApplicationEventCallback) (SuiApplication *sui, SuiEvent event, GVariantDict *params); 59 60 typedef int (*SuiWindowEventCallback) (SuiWindow *sui, SuiEvent event, GVariantDict *params); 61 62 typedef int (*SuiEventCallback) (SuiBuffer *sui, SuiEvent event, GVariantDict *params); 63 64 typedef struct { 65 SuiApplicationEventCallback open; 66 SuiApplicationEventCallback activate; 67 SuiApplicationEventCallback shutdown; 68 } SuiApplicationEvents; 69 70 typedef struct { 71 SuiWindowEventCallback connect; 72 SuiWindowEventCallback server_list; 73 } SuiWindowEvents; 74 75 typedef struct { 76 SuiEventCallback disconnect; 77 SuiEventCallback reconnect; 78 SuiEventCallback quit; 79 SuiEventCallback send; 80 SuiEventCallback join; 81 SuiEventCallback part; 82 SuiEventCallback query; 83 SuiEventCallback unquery; 84 SuiEventCallback kick; 85 SuiEventCallback invite; 86 SuiEventCallback whois; 87 SuiEventCallback ignore; 88 SuiEventCallback cutover; 89 SuiEventCallback chan_list; 90 } SuiBufferEvents; 91 92 #endif /* __SUI_EVENT_H */ 93