annotate libpurple/protocols/irc/msgs.c @ 29286:ce876e58cf6a

propagate from branch 'im.pidgin.pidgin' (head 6a70c2c1325aeb644bff8476f94c5a25f83044fb) to branch 'im.pidgin.cpw.attention_ui' (head d6820cc133d1dfee9b288131b6b7a92fb082e658)
author Marcus Lundblad <ml@update.uu.se>
date Wed, 22 Apr 2009 07:56:16 +0000
parents fcd7d4c24230
children bed515729afe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file msgs.c
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
4 * purple
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 17353
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include "conversation.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "blist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "irc.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include <stdio.h>
22655
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
33 #include <stdlib.h>
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 static char *irc_mask_nick(const char *mask);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 static char *irc_mask_userhost(const char *mask);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
37 static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc);
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
39 static void irc_connected(struct irc_conn *irc, const char *nick);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 const char *from, const char *to,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 const char *rawmsg, gboolean notice);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 static char *irc_mask_nick(const char *mask)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 char *end, *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 end = strchr(mask, '!');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 if (!end)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 buf = g_strdup(mask);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 buf = g_strndup(mask, end - mask);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 return buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 static char *irc_mask_userhost(const char *mask)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 return g_strdup(strchr(mask, '!') + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
63 static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2])
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 {
22649
bc9845b6f9c0 Strip mIRC formatting codes from PART and QUIT messages.
Ethan Blanton <elb@pidgin.im>
parents: 22340
diff changeset
65 char *message, *stripped;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
22649
bc9845b6f9c0 Strip mIRC formatting codes from PART and QUIT messages.
Ethan Blanton <elb@pidgin.im>
parents: 22340
diff changeset
67 stripped = data[1] ? irc_mirc2txt(data[1]) : NULL;
bc9845b6f9c0 Strip mIRC formatting codes from PART and QUIT messages.
Ethan Blanton <elb@pidgin.im>
parents: 22340
diff changeset
68 message = g_strdup_printf("quit: %s", stripped);
bc9845b6f9c0 Strip mIRC formatting codes from PART and QUIT messages.
Ethan Blanton <elb@pidgin.im>
parents: 22340
diff changeset
69 g_free(stripped);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
71 if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), data[0]))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
72 purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), data[0], message);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 g_free(message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76
17097
31c49d31edea Oops; I made some errors in the last commit. This is a fix of my
Ethan Blanton <elb@pidgin.im>
parents: 17096
diff changeset
77 static void irc_connected(struct irc_conn *irc, const char *nick)
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
78 {
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
79 PurpleConnection *gc;
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
80 PurpleStatus *status;
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
81 PurpleBlistNode *gnode, *cnode, *bnode;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23439
diff changeset
82 PurpleAccount *account;
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
83
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
84 if ((gc = purple_account_get_connection(irc->account)) == NULL
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
85 || PURPLE_CONNECTION_IS_CONNECTED(gc))
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
86 return;
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
87
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
88 purple_connection_set_display_name(gc, nick);
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
89 purple_connection_set_state(gc, PURPLE_CONNECTED);
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23439
diff changeset
90 account = purple_connection_get_account(gc);
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
91
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
92 /* If we're away then set our away message */
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
93 status = purple_account_get_active_status(irc->account);
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
94 if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) {
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
95 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
96 prpl_info->set_status(irc->account, status);
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
97 }
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
98
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
99 /* this used to be in the core, but it's not now */
25793
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
100 for (gnode = purple_blist_get_root();
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
101 gnode;
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
102 gnode = purple_blist_node_get_sibling_next(gnode))
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
103 {
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
104 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
105 continue;
25793
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
106 for(cnode = purple_blist_node_get_first_child(gnode);
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
107 cnode;
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
108 cnode = purple_blist_node_get_sibling_next(cnode))
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
109 {
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
110 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
111 continue;
25793
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
112 for(bnode = purple_blist_node_get_first_child(cnode);
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
113 bnode;
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
114 bnode = purple_blist_node_get_sibling_next(bnode))
985ab911753e updated irc to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 24203
diff changeset
115 {
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
116 PurpleBuddy *b;
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
117 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
118 continue;
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
119 b = (PurpleBuddy *)bnode;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23439
diff changeset
120 if(purple_buddy_get_account(b) == account) {
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
121 struct irc_buddy *ib = g_new0(struct irc_buddy, 1);
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23439
diff changeset
122 ib->name = g_strdup(purple_buddy_get_name(b));
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
123 g_hash_table_insert(irc->buddies, ib->name, ib);
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
124 }
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
125 }
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
126 }
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
127 }
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
128
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
129 irc_blist_timeout(irc);
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
130 if (!irc->timer)
26530
b87843de7c6a A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
foss@abala.me
parents: 26263
diff changeset
131 irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc);
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
132 }
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
133
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 {
23026
f47438e456c2 applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22956
diff changeset
136 char *clean;
24491
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
137 /* This, too, should be escaped somehow (smarter) */
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
138 clean = purple_utf8_salvage(args[0]);
23026
f47438e456c2 applied changes from 904a276588f7de13ba13b578905c82c0493184ce
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22956
diff changeset
139 purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", clean);
24491
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
140 g_free(clean);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142
15439
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
143 void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args)
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
144 {
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
145 gchar **features;
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
146 int i;
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
147
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
148 if (!args || !args[0] || !args[1])
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
149 return;
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
150
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
151 features = g_strsplit(args[1], " ", -1);
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
152 for (i = 0; features[i]; i++) {
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
153 char *val;
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
154 if (!strncmp(features[i], "PREFIX=", 7)) {
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
155 if ((val = strchr(features[i] + 7, ')')) != NULL)
16107
1980273186a4 Make non-standard mode characters support connection-specific instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 15822
diff changeset
156 irc->mode_chars = g_strdup(val + 1);
15439
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
157 }
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
158 }
21599
b8f5e76bbfe9 another patch from my coworker Andrew Gaul that plugged a leak, I fixed it
Ka-Hing Cheung <khc@hxbc.us>
parents: 21358
diff changeset
159
b8f5e76bbfe9 another patch from my coworker Andrew Gaul that plugged a leak, I fixed it
Ka-Hing Cheung <khc@hxbc.us>
parents: 21358
diff changeset
160 g_strfreev(features);
15439
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
161 }
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
162
15446
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
163 void irc_msg_luser(struct irc_conn *irc, const char *name, const char *from, char **args)
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
164 {
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
165 if (!args || !args[0])
15446
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
166 return;
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
167
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
168 if (!strcmp(name, "251")) {
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
169 /* 251 is required, so we pluck our nick from here and
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
170 * finalize connection */
17097
31c49d31edea Oops; I made some errors in the last commit. This is a fix of my
Ethan Blanton <elb@pidgin.im>
parents: 17096
diff changeset
171 irc_connected(irc, args[0]);
16840
a82444e61ece Fix broken IRC servers which do not send a 255 numeric
Ethan Blanton <elb@pidgin.im>
parents: 16422
diff changeset
172 /* Some IRC servers seem to not send a 255 numeric, so
a82444e61ece Fix broken IRC servers which do not send a 255 numeric
Ethan Blanton <elb@pidgin.im>
parents: 16422
diff changeset
173 * I guess we can't require it; 251 will do. */
a82444e61ece Fix broken IRC servers which do not send a 255 numeric
Ethan Blanton <elb@pidgin.im>
parents: 16422
diff changeset
174 /* } else if (!strcmp(name, "255")) { */
15446
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
175 }
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
176 }
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
177
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
180 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 if (!args || !args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
186 if (irc->whois.nick && !purple_utf8_strcasecmp(irc->whois.nick, args[1])) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 /* We're doing a whois, show this in the whois dialog */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 irc_msg_whois(irc, name, from, args);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
192 gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 if (gc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 msg = g_markup_escape_text(args[2], -1);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
195 serv_got_im(gc, args[1], msg, PURPLE_MESSAGE_AUTO_RESP, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
202 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 if (!args || !args[1] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
207 purple_notify_error(gc, NULL, _("Bad mode"), args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
22655
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
210 void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char **args)
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
211 {
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
212 PurpleConversation *convo;
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
213
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
214 if (!args || !args[0] || !args[1])
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
215 return;
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
216
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
217 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
218 args[1], irc->account);
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
219
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
220 if (!strcmp(name, "367")) {
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
221 char *msg = NULL;
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
222 /* Ban list entry */
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
223 if (!args[2])
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
224 return;
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
225 if (args[3] && args[4]) {
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
226 /* This is an extended syntax, not in RFC 1459 */
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
227 int t1 = atoi(args[4]);
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
228 time_t t2 = time(NULL);
24203
Stu Tomlinson <stu@nosnilmot.com>
parents: 23439
diff changeset
229 char *time = purple_str_seconds_to_string(t2 - t1);
23439
819346c150f1 Use a more friendly format for the timestamp in the banlist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23431
diff changeset
230 msg = g_strdup_printf(_("Ban on %s by %s, set %s ago"),
24203
Stu Tomlinson <stu@nosnilmot.com>
parents: 23439
diff changeset
231 args[2], args[3], time);
Stu Tomlinson <stu@nosnilmot.com>
parents: 23439
diff changeset
232 g_free(time);
22655
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
233 } else {
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
234 msg = g_strdup_printf(_("Ban on %s"), args[2]);
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
235 }
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
236 if (convo) {
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
237 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg,
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
238 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG,
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
239 time(NULL));
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
240 } else {
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
241 purple_debug_info("irc", "%s\n", msg);
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
242 }
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
243 g_free(msg);
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
244 } else if (!strcmp(name, "368")) {
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
245 if (!convo)
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
246 return;
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
247 /* End of ban list */
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
248 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "",
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
249 _("End of ban list"),
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
250 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG,
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
251 time(NULL));
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
252 }
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
253 }
ef4ac2a83e1c Handle IRC ban lists in-channel. Channels which are not joined are
Ethan Blanton <elb@pidgin.im>
parents: 22649
diff changeset
254
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
257 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 char *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 if (!args || !args[1] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 buf = g_strdup_printf(_("You are banned from %s."), args[1]);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
264 purple_notify_error(gc, _("Banned"), _("Banned"), buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
270 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 char *buf, *nick;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 if (!args || !args[0] || !args[1] || !args[2])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
276 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 if (!convo)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 nick = g_markup_escape_text(args[2], -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 buf = g_strdup_printf(_("Cannot ban %s: banlist is full"), nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 g_free(nick);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
283 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", buf,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
284 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
291 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 char *buf, *escaped;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 if (!args || !args[1] || !args[2])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
297 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 if (!convo) /* XXX punt on channels we are not in for now */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 escaped = (args[3] != NULL) ? g_markup_escape_text(args[3], -1) : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], escaped ? escaped : "");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
303 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 g_free(escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 if (!irc->whois.nick) {
16422
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
313 purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unexpected %s reply for %s\n", !strcmp(name, "314") ? "WHOWAS" : "WHOIS"
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
314 , args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
318 if (purple_utf8_strcasecmp(irc->whois.nick, args[1])) {
16422
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
319 purple_debug(PURPLE_DEBUG_WARNING, "irc", "Got %s reply for %s while waiting for %s\n", !strcmp(name, "314") ? "WHOWAS" : "WHOIS"
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
320 , args[1], irc->whois.nick);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 if (!strcmp(name, "301")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 irc->whois.away = g_strdup(args[2]);
16422
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
326 } else if (!strcmp(name, "311") || !strcmp(name, "314")) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 irc->whois.userhost = g_strdup_printf("%s@%s", args[2], args[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 irc->whois.name = g_strdup(args[5]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 } else if (!strcmp(name, "312")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 irc->whois.server = g_strdup(args[2]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 irc->whois.serverinfo = g_strdup(args[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 } else if (!strcmp(name, "313")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 irc->whois.ircop = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 } else if (!strcmp(name, "317")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 irc->whois.idle = atoi(args[2]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 if (args[3])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 irc->whois.signon = (time_t)atoi(args[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 } else if (!strcmp(name, "319")) {
26263
c67bf2e1e6c0 Handle multiple 319 (channels joined) messages for IRC WHOIS.
Ethan Blanton <elb@pidgin.im>
parents: 25843
diff changeset
339 if (irc->whois.channels == NULL) {
c67bf2e1e6c0 Handle multiple 319 (channels joined) messages for IRC WHOIS.
Ethan Blanton <elb@pidgin.im>
parents: 25843
diff changeset
340 irc->whois.channels = g_string_new(args[2]);
c67bf2e1e6c0 Handle multiple 319 (channels joined) messages for IRC WHOIS.
Ethan Blanton <elb@pidgin.im>
parents: 25843
diff changeset
341 } else {
c67bf2e1e6c0 Handle multiple 319 (channels joined) messages for IRC WHOIS.
Ethan Blanton <elb@pidgin.im>
parents: 25843
diff changeset
342 irc->whois.channels = g_string_append(irc->whois.channels, args[2]);
c67bf2e1e6c0 Handle multiple 319 (channels joined) messages for IRC WHOIS.
Ethan Blanton <elb@pidgin.im>
parents: 25843
diff changeset
343 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 } else if (!strcmp(name, "320")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 irc->whois.identified = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
351 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 char *tmp, *tmp2;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
353 PurpleNotifyUserInfo *user_info;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 if (!irc->whois.nick) {
16422
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
356 purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unexpected End of %s for %s\n", !strcmp(name, "369") ? "WHOWAS" : "WHOIS"
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
357 , args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
360 if (purple_utf8_strcasecmp(irc->whois.nick, args[1])) {
16422
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
361 purple_debug(PURPLE_DEBUG_WARNING, "irc", "Received end of %s for %s, expecting %s\n", !strcmp(name, "369") ? "WHOWAS" : "WHOIS"
6447865b2d08 /whowas for IRC. Thanks, achris.
Ethan Blanton <elb@pidgin.im>
parents: 16107
diff changeset
362 , args[1], irc->whois.nick);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
366 user_info = purple_notify_user_info_new();
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 tmp2 = g_markup_escape_text(args[1], -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 tmp = g_strdup_printf("%s%s%s", tmp2,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 (irc->whois.ircop ? _(" <i>(ircop)</i>") : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 (irc->whois.identified ? _(" <i>(identified)</i>") : ""));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
372 purple_notify_user_info_add_pair(user_info, _("Nick"), tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 g_free(tmp2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 if (irc->whois.away) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 tmp = g_markup_escape_text(irc->whois.away, strlen(irc->whois.away));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 g_free(irc->whois.away);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
379 purple_notify_user_info_add_pair(user_info, _("Away"), tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 if (irc->whois.userhost) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 tmp = g_markup_escape_text(irc->whois.name, strlen(irc->whois.name));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 g_free(irc->whois.name);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
385 purple_notify_user_info_add_pair(user_info, _("Username"), irc->whois.userhost);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
386 purple_notify_user_info_add_pair(user_info, _("Real name"), tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 g_free(irc->whois.userhost);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 if (irc->whois.server) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 tmp = g_strdup_printf("%s (%s)", irc->whois.server, irc->whois.serverinfo);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
392 purple_notify_user_info_add_pair(user_info, _("Server"), tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 g_free(irc->whois.server);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 g_free(irc->whois.serverinfo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 if (irc->whois.channels) {
26263
c67bf2e1e6c0 Handle multiple 319 (channels joined) messages for IRC WHOIS.
Ethan Blanton <elb@pidgin.im>
parents: 25843
diff changeset
398 purple_notify_user_info_add_pair(user_info, _("Currently on"), irc->whois.channels->str);
c67bf2e1e6c0 Handle multiple 319 (channels joined) messages for IRC WHOIS.
Ethan Blanton <elb@pidgin.im>
parents: 25843
diff changeset
399 g_string_free(irc->whois.channels, TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 if (irc->whois.idle) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
402 gchar *timex = purple_str_seconds_to_string(irc->whois.idle);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
403 purple_notify_user_info_add_pair(user_info, _("Idle for"), timex);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 g_free(timex);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
405 purple_notify_user_info_add_pair(user_info,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
406 _("Online since"), purple_date_format_full(localtime(&irc->whois.signon)));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 if (!strcmp(irc->whois.nick, "Paco-Paco")) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
409 purple_notify_user_info_add_pair(user_info,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 _("<b>Defining adjective:</b>"), _("Glorious"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
413 gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
415 purple_notify_userinfo(gc, irc->whois.nick, user_info, NULL, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
416 purple_notify_user_info_destroy(user_info);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 g_free(irc->whois.nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 memset(&irc->whois, 0, sizeof(irc->whois));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 if (!irc->roomlist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 if (!strcmp(name, "321")) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
428 purple_roomlist_set_in_progress(irc->roomlist, TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 if (!strcmp(name, "323")) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
433 purple_roomlist_set_in_progress(irc->roomlist, FALSE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
434 purple_roomlist_unref(irc->roomlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 irc->roomlist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 if (!strcmp(name, "322")) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
440 PurpleRoomlistRoom *room;
17353
82a02dbf2fa2 This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents: 17205
diff changeset
441 char *topic;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 if (!args[0] || !args[1] || !args[2] || !args[3])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445
22846
f09acca60066 Patch from sadrul to fix IRC servers which neglect to send RPL_LISTSTART
Ethan Blanton <elb@pidgin.im>
parents: 22834
diff changeset
446 if (!purple_roomlist_get_in_progress(irc->roomlist)) {
f09acca60066 Patch from sadrul to fix IRC servers which neglect to send RPL_LISTSTART
Ethan Blanton <elb@pidgin.im>
parents: 22834
diff changeset
447 purple_debug_warning("irc", "Buggy server didn't send RPL_LISTSTART.\n");
f09acca60066 Patch from sadrul to fix IRC servers which neglect to send RPL_LISTSTART
Ethan Blanton <elb@pidgin.im>
parents: 22834
diff changeset
448 purple_roomlist_set_in_progress(irc->roomlist, TRUE);
f09acca60066 Patch from sadrul to fix IRC servers which neglect to send RPL_LISTSTART
Ethan Blanton <elb@pidgin.im>
parents: 22834
diff changeset
449 }
f09acca60066 Patch from sadrul to fix IRC servers which neglect to send RPL_LISTSTART
Ethan Blanton <elb@pidgin.im>
parents: 22834
diff changeset
450
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
451 room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, args[1], NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
452 purple_roomlist_room_add_field(irc->roomlist, room, args[1]);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
453 purple_roomlist_room_add_field(irc->roomlist, room, GINT_TO_POINTER(strtol(args[2], NULL, 10)));
17353
82a02dbf2fa2 This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents: 17205
diff changeset
454 topic = irc_mirc2txt(args[3]);
82a02dbf2fa2 This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents: 17205
diff changeset
455 purple_roomlist_room_add_field(irc->roomlist, room, topic);
82a02dbf2fa2 This performs mIRC formatting code stripping for the room list, as
Ethan Blanton <elb@pidgin.im>
parents: 17205
diff changeset
456 g_free(topic);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
457 purple_roomlist_room_add(irc->roomlist, room);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 char *chan, *topic, *msg, *nick, *tmp, *tmp2;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
464 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 if (!strcmp(name, "topic")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 chan = args[0];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 topic = irc_mirc2txt (args[1]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 chan = args[1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 topic = irc_mirc2txt (args[2]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
474 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chan, irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 if (!convo) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
476 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 g_free(topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 /* If this is an interactive update, print it out */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 tmp = g_markup_escape_text(topic, -1);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
483 tmp2 = purple_markup_linkify(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 if (!strcmp(name, "topic")) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
486 const char *current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(convo));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 if (!(current_topic != NULL && strcmp(tmp2, current_topic) == 0))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 char *nick_esc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 nick = irc_mask_nick(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 nick_esc = g_markup_escape_text(nick, -1);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
492 purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), nick, topic);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 if (*tmp2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 msg = g_strdup_printf(_("%s has cleared the topic."), nick_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 g_free(nick_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 g_free(nick);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
499 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), from, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 char *chan_esc = g_markup_escape_text(chan, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 g_free(chan_esc);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
506 purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, topic);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
507 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 g_free(tmp2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 g_free(topic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
516 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 char *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 if (!args || !args[1] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 buf = g_strdup_printf(_("Unknown message '%s'"), args[1]);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
523 purple_notify_error(gc, _("Unknown message"), buf, _("The IRC server received a message it did not understand."));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 char *names, *cur, *end, *tmp, *msg;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
530 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 if (!strcmp(name, "366")) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
533 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, args[1], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 if (!convo) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
535 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 g_string_free(irc->names, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 irc->names = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 names = cur = g_string_free(irc->names, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 irc->names = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
543 if (purple_conversation_get_data(convo, IRC_NAMES_FLAG)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 msg = g_strdup_printf(_("Users on %s: %s"), args[1], names ? names : "");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
545 if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
546 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
548 purple_conv_im_write(PURPLE_CONV_IM(convo), "", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 GList *users = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 GList *flags = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 while (*cur) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
555 PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 end = strchr(cur, ' ');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 if (!end)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 end = cur + strlen(cur);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 if (*cur == '@') {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
560 f = PURPLE_CBFLAGS_OP;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 cur++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 } else if (*cur == '%') {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
563 f = PURPLE_CBFLAGS_HALFOP;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 cur++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 } else if(*cur == '+') {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
566 f = PURPLE_CBFLAGS_VOICE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 cur++;
16107
1980273186a4 Make non-standard mode characters support connection-specific instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 15822
diff changeset
568 } else if(irc->mode_chars
1980273186a4 Make non-standard mode characters support connection-specific instead of
Stu Tomlinson <stu@nosnilmot.com>
parents: 15822
diff changeset
569 && strchr(irc->mode_chars, *cur)) {
22340
208780a99083 Give IRC channel owners the founder icon on networks that report supporting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21768
diff changeset
570 if (*cur == '~')
208780a99083 Give IRC channel owners the founder icon on networks that report supporting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21768
diff changeset
571 f = PURPLE_CBFLAGS_FOUNDER;
15439
8ff4af28c9f9 Recognize non-standard mode characters communicated in an 005 numeric for IRC
Ethan Blanton <elb@pidgin.im>
parents: 15382
diff changeset
572 cur++;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 tmp = g_strndup(cur, end - cur);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 users = g_list_prepend(users, tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 flags = g_list_prepend(flags, GINT_TO_POINTER(f));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 cur = end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 if (*cur)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 cur++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 if (users != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
585 purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 for (l = users; l != NULL; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 g_free(l->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 g_list_free(users);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 g_list_free(flags);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 }
15455
79f25bbe69bf This makes IRC /names handling generally more robust, as well as
Ethan Blanton <elb@pidgin.im>
parents: 15446
diff changeset
593
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
594 purple_conversation_set_data(convo, IRC_NAMES_FLAG,
15455
79f25bbe69bf This makes IRC /names handling generally more robust, as well as
Ethan Blanton <elb@pidgin.im>
parents: 15446
diff changeset
595 GINT_TO_POINTER(TRUE));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 g_free(names);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 if (!irc->names)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 irc->names = g_string_new("");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 if (irc->names->len && irc->names->str[irc->names->len - 1] != ' ')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 irc->names = g_string_append_c(irc->names, ' ');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 irc->names = g_string_append(irc->names, args[3]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 char *escaped;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
612 if (!args || !args[0])
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
613 return;
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
614
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 if (!irc->motd)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 irc->motd = g_string_new("");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617
15446
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
618 if (!strcmp(name, "375")) {
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
619 if (irc->motd)
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
620 g_string_free(irc->motd, TRUE);
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
621 irc->motd = g_string_new("");
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
622 return;
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
623 } else if (!strcmp(name, "376")) {
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
624 /* dircproxy 1.0.5 does not send 251 on reconnection, so
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
625 * finalize the connection here if it is not already done. */
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
626 irc_connected(irc, args[0]);
15446
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
627 return;
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
628 }
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
629
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
630 if (!irc->motd) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
631 purple_debug_error("irc", "IRC server sent MOTD without STARTMOTD\n");
15446
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
632 return;
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
633 }
8c81db398f56 This should fix up IRC logins for servers which do not provide an
Ethan Blanton <elb@pidgin.im>
parents: 15439
diff changeset
634
17096
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
635 if (!args[1])
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
636 return;
7a88187629ff Fix up IRC connections with dircproxy by allowing 376 to indicate success.
Ethan Blanton <elb@pidgin.im>
parents: 16935
diff changeset
637
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 escaped = g_markup_escape_text(args[1], -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 g_string_append_printf(irc->motd, "%s<br>", escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 g_free(escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
645 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
647 gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 if (gc == NULL || args == NULL || args[2] == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
651 purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, _("Time Response"),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 _("The IRC server's local time is:"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 args[2], NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656 void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
658 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 if (gc == NULL || args == NULL || args[1] == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
663 purple_notify_error(gc, NULL, _("No such channel"), args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
668 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
669 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
671 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, args[1], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 if (convo) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
673 if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) /* does this happen? */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
674 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], _("no such channel"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
675 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
677 purple_conv_im_write(PURPLE_CONV_IM(convo), args[1], _("User is not logged in"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
678 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
680 if ((gc = purple_account_get_connection(irc->account)) == NULL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 return;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
682 purple_notify_error(gc, NULL, _("No such nick or channel"), args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
685 if (irc->whois.nick && !purple_utf8_strcasecmp(irc->whois.nick, args[1])) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 g_free(irc->whois.nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 irc->whois.nick = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
693 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
694 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
696 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 if (convo) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
698 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], args[2], PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
700 if ((gc = purple_account_get_connection(irc->account)) == NULL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 return;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
702 purple_notify_error(gc, NULL, _("Could not send"), args[2]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
708 PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
710 purple_debug(PURPLE_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 if (convo) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 /*g_slist_remove(irc->gc->buddy_chats, convo);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
713 purple_conversation_set_account(convo, NULL);*/
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
714 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], args[2], PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
720 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 if (!args || !args[1] || !args[2])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
725 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 if (!convo)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
729 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", args[2], PURPLE_MESSAGE_SYSTEM, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
734 PurpleConnection *gc = purple_account_get_connection(irc->account);
22732
8d3c68a8eed4 Avoid allocating and freeing stuff unnecessarily.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22727
diff changeset
735 GHashTable *components;
8d3c68a8eed4 Avoid allocating and freeing stuff unnecessarily.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22727
diff changeset
736 gchar *nick;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737
22732
8d3c68a8eed4 Avoid allocating and freeing stuff unnecessarily.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22727
diff changeset
738 if (!args || !args[1] || !gc)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 return;
22732
8d3c68a8eed4 Avoid allocating and freeing stuff unnecessarily.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22727
diff changeset
740
8d3c68a8eed4 Avoid allocating and freeing stuff unnecessarily.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22727
diff changeset
741 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
8d3c68a8eed4 Avoid allocating and freeing stuff unnecessarily.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22727
diff changeset
742 nick = irc_mask_nick(from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
743
22727
cd682b57b6e4 Use g_strdup to match the subsequent g_free.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22655
diff changeset
744 g_hash_table_insert(components, g_strdup("channel"), g_strdup(args[1]));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
746 serv_got_chat_invite(gc, args[1], nick, NULL, components);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
752 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 char *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 if (!args || !args[1] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758 buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
759 purple_notify_error(gc, _("Invitation only"), _("Invitation only"), buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 char **nicks;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 struct irc_buddy *ib;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 if (!args || !args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 nicks = g_strsplit(args[1], " ", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 for (i = 0; nicks[i]; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 if ((ib = g_hash_table_lookup(irc->buddies, (gconstpointer)nicks[i])) == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778 ib->flag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 g_strfreev(nicks);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_status, (gpointer)irc);
21768
6b42bed44324 Do not allow ISON requests to stack in IRC
Ethan Blanton <elb@pidgin.im>
parents: 21599
diff changeset
784 irc->ison_outstanding = FALSE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
789 PurpleConnection *gc = purple_account_get_connection(irc->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
790 PurpleBuddy *buddy = purple_find_buddy(irc->account, name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 if (!gc || !buddy)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795 if (ib->online && !ib->flag) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
796 purple_prpl_got_user_status(irc->account, name, "offline", NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 ib->online = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 } else if (!ib->online && ib->flag) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
799 purple_prpl_got_user_status(irc->account, name, "available", NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 ib->online = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
806 PurpleConnection *gc = purple_account_get_connection(irc->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
807 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 char *nick = irc_mask_nick(from), *userhost;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 struct irc_buddy *ib;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 static int id = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 if (!gc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
817 if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 /* We are joining a channel for the first time */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 serv_got_joined_chat(gc, id++, args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 g_free(nick);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
821 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 args[0],
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823 irc->account);
15455
79f25bbe69bf This makes IRC /names handling generally more robust, as well as
Ethan Blanton <elb@pidgin.im>
parents: 15446
diff changeset
824
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 if (convo == NULL) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
826 purple_debug_error("irc", "tried to join %s but couldn't\n", args[0]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
829 purple_conversation_set_data(convo, IRC_NAMES_FLAG,
15455
79f25bbe69bf This makes IRC /names handling generally more robust, as well as
Ethan Blanton <elb@pidgin.im>
parents: 15446
diff changeset
830 GINT_TO_POINTER(FALSE));
20302
67a7e0868618 applied changes from 26c05ed157a02643cbb12b04045422b123312bcf
Ethan Blanton <elb@pidgin.im>
parents: 19681
diff changeset
831 /* Until purple_conversation_present does something that
24491
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
832 * one would expect in Pidgin, this call produces buggy
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
833 * behavior both for the /join and auto-join cases. */
20302
67a7e0868618 applied changes from 26c05ed157a02643cbb12b04045422b123312bcf
Ethan Blanton <elb@pidgin.im>
parents: 19681
diff changeset
834 /* purple_conversation_present(convo); */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
836 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
838 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839 if (convo == NULL) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
840 purple_debug(PURPLE_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845 userhost = irc_mask_userhost(from);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
846 purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), nick, userhost, PURPLE_CBFLAGS_NONE, TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848 if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849 ib->flag = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 irc_buddy_status(nick, ib, irc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
852
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 g_free(userhost);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
859 PurpleConnection *gc = purple_account_get_connection(irc->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
860 PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 char *nick = irc_mask_nick(from), *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
863 if (!gc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
865 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 if (!convo) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
869 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Recieved a KICK for unknown channel %s\n", args[0]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
874 if (!purple_utf8_strcasecmp(purple_connection_get_display_name(gc), args[1])) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
876 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 g_free(buf);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
878 serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880 buf = g_strdup_printf(_("Kicked by %s (%s)"), nick, args[2]);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
881 purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), args[1], buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889 void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
891 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 char *nick = irc_mask_nick(from), *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 if (*args[0] == '#' || *args[0] == '&') { /* Channel */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 char *escaped;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
896 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 if (!convo) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
898 purple_debug(PURPLE_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 escaped = (args[2] != NULL) ? g_markup_escape_text(args[2], -1) : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], escaped ? escaped : "", nick);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
904 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 g_free(escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 if(args[2]) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
908 PurpleConvChatBuddyFlags newflag, flags;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 char *mcur, *cur, *end, *user;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 gboolean add = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 mcur = args[1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 cur = args[2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 while (*cur && *mcur) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 if ((*mcur == '+') || (*mcur == '-')) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 add = (*mcur == '+') ? TRUE : FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 mcur++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 end = strchr(cur, ' ');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 if (!end)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 end = cur + strlen(cur);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 user = g_strndup(cur, end - cur);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
923 flags = purple_conv_chat_user_get_flags(PURPLE_CONV_CHAT(convo), user);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
924 newflag = PURPLE_CBFLAGS_NONE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 if (*mcur == 'o')
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
926 newflag = PURPLE_CBFLAGS_OP;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 else if (*mcur =='h')
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
928 newflag = PURPLE_CBFLAGS_HALFOP;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 else if (*mcur == 'v')
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
930 newflag = PURPLE_CBFLAGS_VOICE;
22340
208780a99083 Give IRC channel owners the founder icon on networks that report supporting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21768
diff changeset
931 else if(irc->mode_chars
208780a99083 Give IRC channel owners the founder icon on networks that report supporting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21768
diff changeset
932 && strchr(irc->mode_chars, '~') && (*mcur == 'q'))
208780a99083 Give IRC channel owners the founder icon on networks that report supporting
Stu Tomlinson <stu@nosnilmot.com>
parents: 21768
diff changeset
933 newflag = PURPLE_CBFLAGS_FOUNDER;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 if (newflag) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 if (add)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 flags |= newflag;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 flags &= ~newflag;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
939 purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), user, flags);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 g_free(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 cur = end;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 if (*cur)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 cur++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 if (*mcur)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 mcur++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 } else { /* User */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
956 PurpleConnection *gc = purple_account_get_connection(irc->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
957 PurpleConversation *conv;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 GSList *chats;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 char *nick = irc_mask_nick(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960
22956
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
961 irc->nickused = FALSE;
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
962
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 if (!gc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 chats = gc->buddy_chats;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
969 if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
970 purple_connection_set_display_name(gc, args[0]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973 while (chats) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
974 PurpleConvChat *chat = PURPLE_CONV_CHAT(chats->data);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 /* This is ugly ... */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
976 if (purple_conv_chat_find_user(chat, nick))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
977 purple_conv_chat_rename_user(chat, nick, args[0]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978 chats = chats->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
981 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, nick,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 irc->account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 if (conv != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
984 purple_conversation_set_name(conv, args[0]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989 void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
991 PurpleConnection *gc = purple_account_get_connection(irc->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
992 if (purple_connection_get_state(gc) == PURPLE_CONNECTED) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
993 purple_notify_error(gc, _("Invalid nickname"),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994 _("Invalid nickname"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 _("Your selected nickname was rejected by the server. It probably contains invalid characters."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 } else {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
998 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
999 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
20112
1b420901ca3b Move prpl-irc to purple_connection_error_reason.
Will Thompson <will.thompson@collabora.co.uk>
parents: 19681
diff changeset
1000 _("Your selected account name was rejected by the server. It probably contains invalid characters."));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 char *newnick, *buf, *end;
26627
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1007 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 if (!args || !args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011
26627
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1012 if (gc && purple_connection_get_state(gc) == PURPLE_CONNECTED) {
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1013 /* We only want to do the following dance if the connection
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1014 has not been successfully completed. If it has, just
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1015 notify the user that their /nick command didn't go. */
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1016 buf = g_strdup_printf(_("The nickname \"%s\" is already being used."),
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1017 irc->reqnick);
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1018 purple_notify_error(gc, _("Nickname in use"),
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1019 _("Nickname in use"), buf);
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1020 g_free(buf);
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1021 g_free(irc->reqnick);
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1022 }
fcd7d4c24230 Notify the user if an IRC /nick command fails, rather than trying fallbacks.
Ethan Blanton <elb@pidgin.im>
parents: 26530
diff changeset
1023
22956
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
1024 if (strlen(args[1]) < strlen(irc->reqnick) || irc->nickused)
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
1025 newnick = g_strdup(args[1]);
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
1026 else
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
1027 newnick = g_strdup_printf("%s0", args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 end = newnick + strlen(newnick) - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 /* try fallbacks */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030 if((*end < '9') && (*end >= '1')) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 *end = *end + 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032 } else *end = '1';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033
22956
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
1034 g_free(irc->reqnick);
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
1035 irc->reqnick = newnick;
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
1036 irc->nickused = TRUE;
f1dfc0d70d19 Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents: 22846
diff changeset
1037
23431
7139ce8a6ece set the purple connection name to the one we are about to try
Ka-Hing Cheung <khc@hxbc.us>
parents: 23332
diff changeset
1038 purple_connection_set_display_name(
7139ce8a6ece set the purple connection name to the one we are about to try
Ka-Hing Cheung <khc@hxbc.us>
parents: 23332
diff changeset
1039 purple_account_get_connection(irc->account), newnick);
7139ce8a6ece set the purple connection name to the one we are about to try
Ka-Hing Cheung <khc@hxbc.us>
parents: 23332
diff changeset
1040
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 buf = irc_format(irc, "vn", "NICK", newnick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042 irc_send(irc, buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1046 void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 if (!args || !args[0] || !args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 irc_msg_handle_privmsg(irc, name, from, args[0], args[1], TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054 void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1056 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058 if (!args || !args[2] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1059 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1061 purple_notify_error(gc, _("Cannot change nick"), _("Could not change nick"), args[2]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064 void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1066 PurpleConnection *gc = purple_account_get_connection(irc->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1067 PurpleConversation *convo;
22834
1fbc49b46e09 Fix IRC handling of PART without a part message on Undernet IRCds.
Ethan Blanton <elb@pidgin.im>
parents: 22732
diff changeset
1068 char *nick, *msg, *channel;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070 if (!args || !args[0] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072
22834
1fbc49b46e09 Fix IRC handling of PART without a part message on Undernet IRCds.
Ethan Blanton <elb@pidgin.im>
parents: 22732
diff changeset
1073 /* Undernet likes to :-quote the channel name, for no good reason
24491
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
1074 * that I can see. This catches that. */
22834
1fbc49b46e09 Fix IRC handling of PART without a part message on Undernet IRCds.
Ethan Blanton <elb@pidgin.im>
parents: 22732
diff changeset
1075 channel = (args[0][0] == ':') ? &args[0][1] : args[0];
1fbc49b46e09 Fix IRC handling of PART without a part message on Undernet IRCds.
Ethan Blanton <elb@pidgin.im>
parents: 22732
diff changeset
1076
1fbc49b46e09 Fix IRC handling of PART without a part message on Undernet IRCds.
Ethan Blanton <elb@pidgin.im>
parents: 22732
diff changeset
1077 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, channel, irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 if (!convo) {
22834
1fbc49b46e09 Fix IRC handling of PART without a part message on Undernet IRCds.
Ethan Blanton <elb@pidgin.im>
parents: 22732
diff changeset
1079 purple_debug(PURPLE_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", channel);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 nick = irc_mask_nick(from);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1084 if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 char *escaped = g_markup_escape_text(args[1], -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 msg = g_strdup_printf(_("You have parted the channel%s%s"),
24491
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
1087 (args[1] && *args[1]) ? ": " : "",
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
1088 (escaped && *escaped) ? escaped : "");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 g_free(escaped);
22834
1fbc49b46e09 Fix IRC handling of PART without a part message on Undernet IRCds.
Ethan Blanton <elb@pidgin.im>
parents: 22732
diff changeset
1090 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 g_free(msg);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1092 serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093 } else {
22649
bc9845b6f9c0 Strip mIRC formatting codes from PART and QUIT messages.
Ethan Blanton <elb@pidgin.im>
parents: 22340
diff changeset
1094 msg = args[1] ? irc_mirc2txt(args[1]) : NULL;
bc9845b6f9c0 Strip mIRC formatting codes from PART and QUIT messages.
Ethan Blanton <elb@pidgin.im>
parents: 22340
diff changeset
1095 purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nick, msg);
bc9845b6f9c0 Strip mIRC formatting codes from PART and QUIT messages.
Ethan Blanton <elb@pidgin.im>
parents: 22340
diff changeset
1096 g_free(msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101 void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1102 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 char *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104 if (!args || !args[0])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 buf = irc_format(irc, "v:", "PONG", args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1108 irc_send(irc, buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1109 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1110 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112 void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1114 PurpleConversation *convo;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1115 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1116 char **parts, *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1117 time_t oldstamp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1119 if (!args || !args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122 parts = g_strsplit(args[1], " ", 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 if (!parts[0] || !parts[1]) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125 g_strfreev(parts);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129 if (sscanf(parts[1], "%lu", &oldstamp) != 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1130 msg = g_strdup(_("Error: invalid PONG from server"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1131 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1132 msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1135 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, parts[0], irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136 g_strfreev(parts);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137 if (convo) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1138 if (purple_conversation_get_type (convo) == PURPLE_CONV_TYPE_CHAT)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1139 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "PONG", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1140 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1141 purple_conv_im_write(PURPLE_CONV_IM(convo), "PONG", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1143 gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1144 if (!gc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1148 purple_notify_info(gc, NULL, "PONG", msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1154 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1155 if (!args || !args[0] || !args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158 irc_msg_handle_privmsg(irc, name, from, args[0], args[1], FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161 static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, const char *from, const char *to, const char *rawmsg, gboolean notice)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1163 PurpleConnection *gc = purple_account_get_connection(irc->account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1164 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1165 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1166 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1167 char *nick;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1168
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169 if (!gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1170 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1171
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172 nick = irc_mask_nick(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173 tmp = irc_parse_ctcp(irc, nick, to, rawmsg, notice);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174 if (!tmp) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1177 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1178
20325
4ff4e3aeab27 applied changes from 6c08c628ee64e16c824829c25befc0ca09338f9d
Luke Schierer <lschiere@pidgin.im>
parents: 20302
diff changeset
1179 msg = irc_escape_privmsg(tmp, -1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1182 tmp = irc_mirc2html(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1183 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1184 msg = tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1185 if (notice) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1186 tmp = g_strdup_printf("(notice) %s", msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 msg = tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1189 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1191 if (!purple_utf8_strcasecmp(to, purple_connection_get_display_name(gc))) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192 serv_got_im(gc, nick, msg, 0, time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1193 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1194 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, to, irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1195 if (convo)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1196 serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), nick, 0, msg, time(NULL));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1198 purple_debug_error("irc", "Got a %s on %s, which does not exist\n",
24491
4f46eb13b540 Replace spaces wth tabs in indentation and tabs with spaces in line continuations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24203
diff changeset
1199 notice ? "NOTICE" : "PRIVMSG", to);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1200 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1201 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1202 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1203 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1204
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1205 void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1206 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1207 PurpleConnection *gc = purple_account_get_connection(irc->account);
17205
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1208 PurpleConversation *convo;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1210
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1211 if (!args || !args[1] || !args[2] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1212 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213
17205
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1214 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1215 if (convo) {
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1216 /* This is a channel we're already in; for some reason,
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1217 * freenode feels the need to notify us that in some
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1218 * hypothetical other situation this might not have
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1219 * succeeded. Suppress that. */
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1220 return;
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1221 }
d04b1617da3d This should suppress an annoying 477 numeric on channel joins if you
Ethan Blanton <elb@pidgin.im>
parents: 17097
diff changeset
1222
16935
c417cc8403e3 Handle channel joins when registration is required more gracefully.
Ethan Blanton <elb@pidgin.im>
parents: 16840
diff changeset
1223 msg = g_strdup_printf(_("Cannot join %s: Registration is required."), args[1]);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1224 purple_notify_error(gc, _("Cannot join channel"), msg, args[2]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1225 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1227
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228 void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1230 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231 struct irc_buddy *ib;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232 char *data[2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1234 if (!args || !args[0] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237 data[0] = irc_mask_nick(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1238 data[1] = args[0];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 /* XXX this should have an API, I shouldn't grab this directly */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240 g_slist_foreach(gc->buddy_chats, (GFunc)irc_chat_remove_buddy, data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1242 if ((ib = g_hash_table_lookup(irc->buddies, data[0])) != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243 ib->flag = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 irc_buddy_status(data[0], ib, irc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 g_free(data[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1252 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1253 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 if (!args || !args[1])
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1256 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1258 purple_notify_error(gc, NULL, _("Nick or channel is temporarily unavailable."), args[1]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1263 PurpleConnection *gc = purple_account_get_connection(irc->account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1264 char *nick, *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1265
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266 if (!args || !args[0] || !gc)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1269 nick = irc_mask_nick(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 msg = g_strdup_printf (_("Wallops from %s"), nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271 g_free(nick);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15455
diff changeset
1272 purple_notify_info(gc, NULL, msg, args[0]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1276 void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1277 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1278 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1279 }