| 2 * @file irc.c |
2 * @file irc.c |
| 3 * |
3 * |
| 4 * purple |
4 * purple |
| 5 * |
5 * |
| 6 * Copyright (C) 2003, Robbert Haarman <purple@inglorion.net> |
6 * Copyright (C) 2003, Robbert Haarman <purple@inglorion.net> |
| 7 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu> |
7 * Copyright (C) 2003, 2012 Ethan Blanton <elb@pidgin.im> |
| 8 * Copyright (C) 2000-2003, Rob Flynn <rob@tgflinux.com> |
8 * Copyright (C) 2000-2003, Rob Flynn <rob@tgflinux.com> |
| 9 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> |
9 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> |
| 10 * |
10 * |
| 11 * This program is free software; you can redistribute it and/or modify |
11 * This program is free software; you can redistribute it and/or modify |
| 12 * it under the terms of the GNU General Public License as published by |
12 * it under the terms of the GNU General Public License as published by |
| 38 #include "irc.h" |
38 #include "irc.h" |
| 39 |
39 |
| 40 #define PING_TIMEOUT 60 |
40 #define PING_TIMEOUT 60 |
| 41 |
41 |
| 42 static void irc_ison_buddy_init(char *name, struct irc_buddy *ib, GList **list); |
42 static void irc_ison_buddy_init(char *name, struct irc_buddy *ib, GList **list); |
| 43 |
|
| 44 static void irc_who_channel(PurpleConversation *conv, struct irc_conn *irc); |
|
| 45 |
43 |
| 46 static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b); |
44 static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b); |
| 47 static GList *irc_status_types(PurpleAccount *account); |
45 static GList *irc_status_types(PurpleAccount *account); |
| 48 static GList *irc_actions(PurplePlugin *plugin, gpointer context); |
46 static GList *irc_actions(PurplePlugin *plugin, gpointer context); |
| 49 /* static GList *irc_chat_info(PurpleConnection *gc); */ |
47 /* static GList *irc_chat_info(PurpleConnection *gc); */ |
| 239 { |
237 { |
| 240 *list = g_list_append(*list, ib); |
238 *list = g_list_append(*list, ib); |
| 241 } |
239 } |
| 242 |
240 |
| 243 |
241 |
| 244 gboolean irc_who_channel_timeout(struct irc_conn *irc) |
|
| 245 { |
|
| 246 // WHO all of our channels. |
|
| 247 g_list_foreach(purple_get_conversations(), (GFunc)irc_who_channel, (gpointer)irc); |
|
| 248 |
|
| 249 return TRUE; |
|
| 250 } |
|
| 251 |
|
| 252 static void irc_who_channel(PurpleConversation *conv, struct irc_conn *irc) |
|
| 253 { |
|
| 254 if (purple_conversation_get_account(conv) == irc->account |
|
| 255 && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT |
|
| 256 && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { |
|
| 257 char *buf = irc_format(irc, "vc", "WHO", purple_conversation_get_name(conv)); |
|
| 258 |
|
| 259 purple_debug(PURPLE_DEBUG_INFO, "irc", |
|
| 260 "Performing periodic who on %s\n", |
|
| 261 purple_conversation_get_name(conv)); |
|
| 262 irc_send(irc, buf); |
|
| 263 g_free(buf); |
|
| 264 } |
|
| 265 } |
|
| 266 |
|
| 267 static void irc_ison_one(struct irc_conn *irc, struct irc_buddy *ib) |
242 static void irc_ison_one(struct irc_conn *irc, struct irc_buddy *ib) |
| 268 { |
243 { |
| 269 char *buf; |
244 char *buf; |
| 270 |
245 |
| 271 if (irc->buddies_outstanding != NULL) { |
246 if (irc->buddies_outstanding != NULL) { |
| 534 } else if (irc->fd >= 0) { |
509 } else if (irc->fd >= 0) { |
| 535 close(irc->fd); |
510 close(irc->fd); |
| 536 } |
511 } |
| 537 if (irc->timer) |
512 if (irc->timer) |
| 538 purple_timeout_remove(irc->timer); |
513 purple_timeout_remove(irc->timer); |
| 539 if (irc->who_channel_timer) |
|
| 540 purple_timeout_remove(irc->who_channel_timer); |
|
| 541 g_hash_table_destroy(irc->cmds); |
514 g_hash_table_destroy(irc->cmds); |
| 542 g_hash_table_destroy(irc->msgs); |
515 g_hash_table_destroy(irc->msgs); |
| 543 g_hash_table_destroy(irc->buddies); |
516 g_hash_table_destroy(irc->buddies); |
| 544 if (irc->motd) |
517 if (irc->motd) |
| 545 g_string_free(irc->motd, TRUE); |
518 g_string_free(irc->motd, TRUE); |