comparison src/protocols/irc/msgs.c @ 13522:5ddae6fe983e

[gaim-migrate @ 15898] SF Patch #1451956 from Philip Derrin "The IRC client displays any /notice in an IM window, even when the /notice was actually sent to a channel. It does so even if the sender of the /notice is being ignored in that channel. A patch to fix this is attached. I'm aware the fix is a little seedy, but so is the code it's fixing." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 17 Mar 2006 05:45:48 +0000
parents eb0ce960ff60
children 57bde2deabcb
comparison
equal deleted inserted replaced
13521:d593b7d4f29c 13522:5ddae6fe983e
844 g_free(newnick); 844 g_free(newnick);
845 } 845 }
846 846
847 void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args) 847 void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args)
848 { 848 {
849 char *newargs[2]; 849 char *newargs[3];
850 850
851 newargs[0] = " notice "; /* The spaces are magic, leave 'em in! */ 851 newargs[0] = " notice "; /* The spaces are magic, leave 'em in! */
852 newargs[1] = args[1]; 852 newargs[1] = args[1];
853 newargs[2] = args[0];
853 irc_msg_privmsg(irc, name, from, newargs); 854 irc_msg_privmsg(irc, name, from, newargs);
854 } 855 }
855 856
856 void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args) 857 void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args)
857 { 858 {
949 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args) 950 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args)
950 { 951 {
951 GaimConnection *gc = gaim_account_get_connection(irc->account); 952 GaimConnection *gc = gaim_account_get_connection(irc->account);
952 GaimConversation *convo; 953 GaimConversation *convo;
953 char *nick = irc_mask_nick(from), *tmp, *msg; 954 char *nick = irc_mask_nick(from), *tmp, *msg;
954 int notice = 0; 955 gboolean notice = FALSE;
955 956
956 if (!args || !args[0] || !args[1] || !gc) { 957 if (!args || !args[0] || !args[1] || !gc) {
957 g_free(nick); 958 g_free(nick);
958 return; 959 return;
959 } 960 }
960 961
961 notice = !strcmp(args[0], " notice "); 962 notice = !strcmp(args[0], " notice ");
963 if (notice) {
964 args[0] = args[2];
965 }
962 tmp = irc_parse_ctcp(irc, nick, args[0], args[1], notice); 966 tmp = irc_parse_ctcp(irc, nick, args[0], args[1], notice);
963 if (!tmp) { 967 if (!tmp) {
964 g_free(nick); 968 g_free(nick);
965 return; 969 return;
966 } 970 }
977 msg = tmp; 981 msg = tmp;
978 } 982 }
979 983
980 if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) { 984 if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) {
981 serv_got_im(gc, nick, msg, 0, time(NULL)); 985 serv_got_im(gc, nick, msg, 0, time(NULL));
982 } else if (notice) {
983 serv_got_im(gc, nick, msg, 0, time(NULL));
984 } else { 986 } else {
985 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account); 987 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account);
986 if (convo) 988 if (convo)
987 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); 989 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL));
988 else 990 else