| 31 #include "irc.h" |
31 #include "irc.h" |
| 32 |
32 |
| 33 #include <stdio.h> |
33 #include <stdio.h> |
| 34 #include <stdlib.h> |
34 #include <stdlib.h> |
| 35 #include <ctype.h> |
35 #include <ctype.h> |
| |
36 |
| |
37 static GSList *cmds = NULL; |
| 36 |
38 |
| 37 static char *irc_send_convert(struct irc_conn *irc, const char *string); |
39 static char *irc_send_convert(struct irc_conn *irc, const char *string); |
| 38 static char *irc_recv_convert(struct irc_conn *irc, const char *string); |
40 static char *irc_recv_convert(struct irc_conn *irc, const char *string); |
| 39 |
41 |
| 40 static void irc_parse_error_cb(struct irc_conn *irc, char *input); |
42 static void irc_parse_error_cb(struct irc_conn *irc, char *input); |
| 219 break; |
222 break; |
| 220 } |
223 } |
| 221 |
224 |
| 222 args[i] = '\0'; |
225 args[i] = '\0'; |
| 223 |
226 |
| 224 purple_cmd_register(c->name, args, PURPLE_CMD_P_PROTOCOL, f, "irc", |
227 id = purple_cmd_register(c->name, args, PURPLE_CMD_P_PROTOCOL, f, "irc", |
| 225 irc_parse_purple_cmd, _(c->help), NULL); |
228 irc_parse_purple_cmd, _(c->help), NULL); |
| |
229 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id)); |
| 226 } |
230 } |
| 227 |
231 |
| 228 void irc_register_commands(void) |
232 void irc_register_commands(void) |
| 229 { |
233 { |
| 230 struct _irc_user_cmd *c; |
234 struct _irc_user_cmd *c; |
| 231 |
235 |
| 232 for (c = _irc_cmds; c && c->name; c++) |
236 for (c = _irc_cmds; c && c->name; c++) |
| 233 irc_register_command(c); |
237 irc_register_command(c); |
| |
238 } |
| |
239 |
| |
240 void irc_unregister_commands(void) |
| |
241 { |
| |
242 while (cmds) { |
| |
243 PurpleCmdId id = GPOINTER_TO_UINT(cmds->data); |
| |
244 purple_cmd_unregister(id); |
| |
245 cmds = g_slist_delete_link(cmds, cmds); |
| |
246 } |
| 234 } |
247 } |
| 235 |
248 |
| 236 static char *irc_send_convert(struct irc_conn *irc, const char *string) |
249 static char *irc_send_convert(struct irc_conn *irc, const char *string) |
| 237 { |
250 { |
| 238 char *utf8; |
251 char *utf8; |