equal
deleted
inserted
replaced
40 .requires = NULL, |
40 .requires = NULL, |
41 .init = lastmsg_init, |
41 .init = lastmsg_init, |
42 .uninit = lastmsg_uninit, |
42 .uninit = lastmsg_uninit, |
43 .next = NULL, |
43 .next = NULL, |
44 }; |
44 }; |
|
45 |
|
46 #ifdef MCABBER_API_HAVE_CMD_ID |
|
47 static gpointer lastmsg_cmdid; |
|
48 #endif |
45 |
49 |
46 static GSList *lastmsg_list; |
50 static GSList *lastmsg_list; |
47 |
51 |
48 static guint last_message_hid, last_status_hid; |
52 static guint last_message_hid, last_status_hid; |
49 |
53 |
151 |
155 |
152 /* Initialization */ |
156 /* Initialization */ |
153 static void lastmsg_init(void) |
157 static void lastmsg_init(void) |
154 { |
158 { |
155 /* Add command */ |
159 /* Add command */ |
|
160 #ifdef MCABBER_API_HAVE_CMD_ID |
|
161 lastmsg_cmdid = cmd_add("lastmsg", "Display last missed messages", 0, 0, |
|
162 do_lastmsg, NULL); |
|
163 #else |
156 cmd_add("lastmsg", "Display last missed messages", 0, 0, do_lastmsg, NULL); |
164 cmd_add("lastmsg", "Display last missed messages", 0, 0, do_lastmsg, NULL); |
|
165 #endif |
157 |
166 |
158 /* Add hook handlers */ |
167 /* Add hook handlers */ |
159 last_message_hid = hk_add_handler(last_message_hh, HOOK_POST_MESSAGE_IN, |
168 last_message_hid = hk_add_handler(last_message_hh, HOOK_POST_MESSAGE_IN, |
160 G_PRIORITY_DEFAULT_IDLE, NULL); |
169 G_PRIORITY_DEFAULT_IDLE, NULL); |
161 last_status_hid = hk_add_handler(last_status_hh, HOOK_MY_STATUS_CHANGE, |
170 last_status_hid = hk_add_handler(last_status_hh, HOOK_MY_STATUS_CHANGE, |
166 static void lastmsg_uninit(void) |
175 static void lastmsg_uninit(void) |
167 { |
176 { |
168 GSList *li; |
177 GSList *li; |
169 |
178 |
170 /* Unregister command */ |
179 /* Unregister command */ |
|
180 #ifdef MCABBER_API_HAVE_CMD_ID |
|
181 cmd_del(lastmsg_cmdid); |
|
182 #else |
171 cmd_del("lastmsg"); |
183 cmd_del("lastmsg"); |
|
184 #endif |
172 /* Unregister handlers */ |
185 /* Unregister handlers */ |
173 hk_del_handler(HOOK_POST_MESSAGE_IN, last_message_hid); |
186 hk_del_handler(HOOK_POST_MESSAGE_IN, last_message_hid); |
174 hk_del_handler(HOOK_MY_STATUS_CHANGE, last_status_hid); |
187 hk_del_handler(HOOK_MY_STATUS_CHANGE, last_status_hid); |
175 |
188 |
176 /* Clean up data */ |
189 /* Clean up data */ |