| 108 } |
108 } |
| 109 |
109 |
| 110 irc_blist_timeout(irc); |
110 irc_blist_timeout(irc); |
| 111 if (!irc->timer) |
111 if (!irc->timer) |
| 112 irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc); |
112 irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc); |
| |
113 if (!irc->who_channel_timer) |
| |
114 irc->who_channel_timer = purple_timeout_add_seconds(300, (GSourceFunc)irc_who_channel_timeout, (gpointer)irc); |
| 113 } |
115 } |
| 114 |
116 |
| 115 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) |
117 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 116 { |
118 { |
| 117 char *clean; |
119 char *clean; |
| 396 purple_notify_userinfo(gc, irc->whois.nick, user_info, NULL, NULL); |
398 purple_notify_userinfo(gc, irc->whois.nick, user_info, NULL, NULL); |
| 397 purple_notify_user_info_destroy(user_info); |
399 purple_notify_user_info_destroy(user_info); |
| 398 |
400 |
| 399 g_free(irc->whois.nick); |
401 g_free(irc->whois.nick); |
| 400 memset(&irc->whois, 0, sizeof(irc->whois)); |
402 memset(&irc->whois, 0, sizeof(irc->whois)); |
| |
403 } |
| |
404 |
| |
405 void irc_msg_who(struct irc_conn *irc, const char *name, const char *from, char **args) |
| |
406 { |
| |
407 if (!strcmp(name, "352")) { |
| |
408 PurpleConversation *conv; |
| |
409 PurpleConvChat *chat; |
| |
410 PurpleConvChatBuddy *cb; |
| |
411 |
| |
412 char *userhost, *realname; |
| |
413 |
| |
414 PurpleConvChatBuddyFlags flags; |
| |
415 GList *keys = NULL, *values = NULL; |
| |
416 |
| |
417 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); |
| |
418 if (!conv) { |
| |
419 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a WHO response for %s, which doesn't exist\n", args[1]); |
| |
420 return; |
| |
421 } |
| |
422 |
| |
423 cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), args[5]); |
| |
424 if (!cb) { |
| |
425 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a WHO response for %s who isn't a buddy.\n", args[5]); |
| |
426 return; |
| |
427 } |
| |
428 |
| |
429 chat = PURPLE_CONV_CHAT(conv); |
| |
430 |
| |
431 userhost = g_strdup_printf("%s@%s", args[2], args[3]); |
| |
432 realname = g_strdup(args[8]); |
| |
433 |
| |
434 keys = g_list_prepend(keys, "userhost"); |
| |
435 values = g_list_prepend(values, userhost); |
| |
436 |
| |
437 keys = g_list_prepend(keys, "realname"); |
| |
438 values = g_list_prepend(values, realname); |
| |
439 |
| |
440 purple_conv_chat_cb_set_attributes(chat, cb, keys, values); |
| |
441 |
| |
442 g_list_free(keys); |
| |
443 g_list_free(values); |
| |
444 |
| |
445 g_free(userhost); |
| |
446 g_free(realname); |
| |
447 |
| |
448 flags = purple_conv_chat_user_get_flags(chat, cb->name); |
| |
449 |
| |
450 if (args[6][0] == 'G' && !(flags & PURPLE_CBFLAGS_AWAY)) { |
| |
451 purple_conv_chat_user_set_flags(chat, cb->name, flags | PURPLE_CBFLAGS_AWAY); |
| |
452 } else if(args[6][0] == 'H' && (flags & PURPLE_CBFLAGS_AWAY)) { |
| |
453 purple_conv_chat_user_set_flags(chat, cb->name, flags & ~PURPLE_CBFLAGS_AWAY); |
| |
454 } |
| |
455 } |
| 401 } |
456 } |
| 402 |
457 |
| 403 void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args) |
458 void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 404 { |
459 { |
| 405 if (!irc->roomlist) |
460 if (!irc->roomlist) |
| 795 |
850 |
| 796 void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args) |
851 void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args) |
| 797 { |
852 { |
| 798 PurpleConnection *gc = purple_account_get_connection(irc->account); |
853 PurpleConnection *gc = purple_account_get_connection(irc->account); |
| 799 PurpleConversation *convo; |
854 PurpleConversation *convo; |
| 800 char *nick = irc_mask_nick(from), *userhost; |
855 PurpleConvChat *chat; |
| |
856 PurpleConvChatBuddy *cb; |
| |
857 |
| |
858 char *nick = irc_mask_nick(from), *userhost, *buf; |
| 801 struct irc_buddy *ib; |
859 struct irc_buddy *ib; |
| 802 static int id = 1; |
860 static int id = 1; |
| 803 |
861 |
| 804 if (!gc) { |
862 if (!gc) { |
| 805 g_free(nick); |
863 g_free(nick); |
| 818 purple_debug_error("irc", "tried to join %s but couldn't\n", args[0]); |
876 purple_debug_error("irc", "tried to join %s but couldn't\n", args[0]); |
| 819 return; |
877 return; |
| 820 } |
878 } |
| 821 purple_conversation_set_data(convo, IRC_NAMES_FLAG, |
879 purple_conversation_set_data(convo, IRC_NAMES_FLAG, |
| 822 GINT_TO_POINTER(FALSE)); |
880 GINT_TO_POINTER(FALSE)); |
| |
881 |
| |
882 // Get the real name and user host for all participants. |
| |
883 buf = irc_format(irc, "vc", "WHO", args[0]); |
| |
884 irc_send(irc, buf); |
| |
885 g_free(buf); |
| |
886 |
| 823 /* Until purple_conversation_present does something that |
887 /* Until purple_conversation_present does something that |
| 824 * one would expect in Pidgin, this call produces buggy |
888 * one would expect in Pidgin, this call produces buggy |
| 825 * behavior both for the /join and auto-join cases. */ |
889 * behavior both for the /join and auto-join cases. */ |
| 826 /* purple_conversation_present(convo); */ |
890 /* purple_conversation_present(convo); */ |
| 827 return; |
891 return; |
| 833 g_free(nick); |
897 g_free(nick); |
| 834 return; |
898 return; |
| 835 } |
899 } |
| 836 |
900 |
| 837 userhost = irc_mask_userhost(from); |
901 userhost = irc_mask_userhost(from); |
| 838 purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), nick, userhost, PURPLE_CBFLAGS_NONE, TRUE); |
902 chat = PURPLE_CONV_CHAT(convo); |
| 839 |
903 |
| |
904 purple_conv_chat_add_user(chat, nick, userhost, PURPLE_CBFLAGS_NONE, TRUE); |
| |
905 |
| |
906 cb = purple_conv_chat_cb_find(chat, nick); |
| |
907 |
| |
908 if (cb) { |
| |
909 purple_conv_chat_cb_set_attribute(chat, cb, "userhost", userhost); |
| |
910 } |
| |
911 |
| 840 if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) { |
912 if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) { |
| 841 ib->new_online_status = TRUE; |
913 ib->new_online_status = TRUE; |
| 842 irc_buddy_status(nick, ib, irc); |
914 irc_buddy_status(nick, ib, irc); |
| 843 } |
915 } |
| 844 |
916 |