Mercurial > pidgin.yaz
annotate libpurple/protocols/irc/irc.c @ 32827:4a34689eeb33 default tip
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 19 Nov 2011 14:42:54 +0900 |
parents | 0f94ec89f0bc a78523019e7a |
children |
rev | line source |
---|---|
15374
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 irc.c |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15823 | 4 * purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15823 | 6 * Copyright (C) 2003, Robbert Haarman <purple@inglorion.net> |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * 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
|
8 * Copyright (C) 2000-2003, Rob Flynn <rob@tgflinux.com> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * 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
|
12 * 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
|
13 * 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
|
14 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * 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
|
17 * 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
|
18 * 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
|
19 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * 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
|
22 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19622
diff
changeset
|
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "accountopt.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "blist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "plugin.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "version.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "irc.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #define PING_TIMEOUT 60 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 |
31529
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
42 static void irc_ison_buddy_init(char *name, struct irc_buddy *ib, GList **list); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
31823
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
44 static void irc_who_channel(PurpleConversation *conv, struct irc_conn *irc); |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
45 |
15823 | 46 static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b); |
47 static GList *irc_status_types(PurpleAccount *account); | |
48 static GList *irc_actions(PurplePlugin *plugin, gpointer context); | |
49 /* static GList *irc_chat_info(PurpleConnection *gc); */ | |
50 static void irc_login(PurpleAccount *account); | |
51 static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 static void irc_login_cb(gpointer data, gint source, const gchar *error_message); |
15823 | 53 static void irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, gpointer data); |
54 static void irc_close(PurpleConnection *gc); | |
55 static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags); | |
56 static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags); | |
57 static void irc_chat_join (PurpleConnection *gc, GHashTable *data); | |
58 static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond); | |
59 static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 static guint irc_nick_hash(const char *nick); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 static gboolean irc_nick_equal(const char *nick1, const char *nick2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 static void irc_buddy_free(struct irc_buddy *ib); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 |
15823 | 65 PurplePlugin *_irc_plugin = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 |
15823 | 67 static void irc_view_motd(PurplePluginAction *action) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 { |
15823 | 69 PurpleConnection *gc = (PurpleConnection *) action->context; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 struct irc_conn *irc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 char *title; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
73 if (gc == NULL || purple_connection_get_protocol_data(gc) == NULL) { |
15823 | 74 purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 } |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
77 irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 if (irc->motd == NULL) { |
15823 | 79 purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 _("There is no MOTD associated with this connection.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 title = g_strdup_printf(_("MOTD for %s"), irc->server); |
15823 | 84 purple_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 g_free(title); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 static int do_send(struct irc_conn *irc, const char *buf, gsize len) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 int ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 if (irc->gsc) { |
15823 | 93 ret = purple_ssl_write(irc->gsc, buf, len); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 ret = write(irc->fd, buf, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
15823 | 101 static int irc_send_raw(PurpleConnection *gc, const char *buf, int len) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
103 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
32159
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
104 if (len == -1) { |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
105 len = strlen(buf); |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
106 } |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
107 irc_send_len(irc, buf, len); |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
108 return len; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 static void |
15823 | 112 irc_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 struct irc_conn *irc = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 int ret, writelen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
15823 | 117 writelen = purple_circ_buffer_get_max_read(irc->outbuf); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 if (writelen == 0) { |
15823 | 120 purple_input_remove(irc->writeh); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 irc->writeh = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 ret = do_send(irc, irc->outbuf->outptr, writelen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 if (ret < 0 && errno == EAGAIN) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 else if (ret <= 0) { |
20112
1b420901ca3b
Move prpl-irc to purple_connection_error_reason.
Will Thompson <will.thompson@collabora.co.uk>
parents:
19680
diff
changeset
|
130 PurpleConnection *gc = purple_account_get_connection(irc->account); |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
131 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
132 g_strerror(errno)); |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
133 purple_connection_error (gc, |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
134 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
135 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
15823 | 139 purple_circ_buffer_mark_read(irc->outbuf, ret); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 /* We *could* try to write more if we wrote it all */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 if (ret == write_len) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 irc_send_cb(data, source, cond); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 int irc_send(struct irc_conn *irc, const char *buf) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 { |
32159
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
151 return irc_send_len(irc, buf, strlen(buf)); |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
152 } |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
153 |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
154 int irc_send_len(struct irc_conn *irc, const char *buf, int buflen) |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
155 { |
54a700cedb38
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31897
diff
changeset
|
156 int ret; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 char *tosend= g_strdup(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 |
15823 | 159 purple_signal_emit(_irc_plugin, "irc-sending-text", purple_account_get_connection(irc->account), &tosend); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 if (tosend == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 return 0; |
17033
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
162 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 /* If we're not buffering writes, try to send immediately */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 if (!irc->writeh) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 ret = do_send(irc, tosend, buflen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 ret = -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 errno = EAGAIN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 |
15823 | 171 /* purple_debug(PURPLE_DEBUG_MISC, "irc", "sent%s: %s", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 irc->gsc ? " (ssl)" : "", tosend); */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 if (ret <= 0 && errno != EAGAIN) { |
20112
1b420901ca3b
Move prpl-irc to purple_connection_error_reason.
Will Thompson <will.thompson@collabora.co.uk>
parents:
19680
diff
changeset
|
174 PurpleConnection *gc = purple_account_get_connection(irc->account); |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
175 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
176 g_strerror(errno)); |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
177 purple_connection_error (gc, |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
178 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
179 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 } else if (ret < buflen) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 if (ret < 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 if (!irc->writeh) |
15823 | 184 irc->writeh = purple_input_add( |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 irc->gsc ? irc->gsc->fd : irc->fd, |
15823 | 186 PURPLE_INPUT_WRITE, irc_send_cb, irc); |
187 purple_circ_buffer_append(irc->outbuf, tosend + ret, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 buflen - ret); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 g_free(tosend); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 /* XXX I don't like messing directly with these buddies */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 gboolean irc_blist_timeout(struct irc_conn *irc) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 { |
31529
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
197 if (irc->ison_outstanding) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 return TRUE; |
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 |
31529
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
201 g_hash_table_foreach(irc->buddies, (GHFunc)irc_ison_buddy_init, |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
202 (gpointer *)&irc->buddies_outstanding); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
31529
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
204 irc_buddy_query(irc); |
21768
6b42bed44324
Do not allow ISON requests to stack in IRC
Ethan Blanton <elb@pidgin.im>
parents:
21418
diff
changeset
|
205 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 |
31529
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
209 void irc_buddy_query(struct irc_conn *irc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 { |
31529
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
211 GList *lp; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
212 GString *string; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
213 struct irc_buddy *ib; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
214 char *buf; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
215 |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
216 string = g_string_sized_new(512); |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
217 |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
218 while ((lp = g_list_first(irc->buddies_outstanding))) { |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
219 ib = (struct irc_buddy *)lp->data; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
220 if (string->len + strlen(ib->name) + 1 > 450) |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
221 break; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
222 g_string_append_printf(string, "%s ", ib->name); |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
223 ib->new_online_status = FALSE; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
224 irc->buddies_outstanding = g_list_remove_link(irc->buddies_outstanding, lp); |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
225 } |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
226 |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
227 if (string->len) { |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
228 buf = irc_format(irc, "vn", "ISON", string->str); |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
229 irc_send(irc, buf); |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
230 g_free(buf); |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
231 irc->ison_outstanding = TRUE; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
232 } else |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
233 irc->ison_outstanding = FALSE; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
234 |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
235 g_string_free(string, TRUE); |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
236 } |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
237 |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
238 static void irc_ison_buddy_init(char *name, struct irc_buddy *ib, GList **list) |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
239 { |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
240 *list = g_list_append(*list, ib); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 |
31823
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
243 |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
244 gboolean irc_who_channel_timeout(struct irc_conn *irc) |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
245 { |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
246 // WHO all of our channels. |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
247 g_list_foreach(purple_get_conversations(), (GFunc)irc_who_channel, (gpointer)irc); |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
248 |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
249 return TRUE; |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
250 } |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
251 |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
252 static void irc_who_channel(PurpleConversation *conv, struct irc_conn *irc) |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
253 { |
32193
7d08ac041588
Suppress error spews when we've left an IRC channel but the window is open.
Ethan Blanton <elb@pidgin.im>
parents:
32183
diff
changeset
|
254 if (purple_conversation_get_account(conv) == irc->account |
7d08ac041588
Suppress error spews when we've left an IRC channel but the window is open.
Ethan Blanton <elb@pidgin.im>
parents:
32183
diff
changeset
|
255 && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT |
7d08ac041588
Suppress error spews when we've left an IRC channel but the window is open.
Ethan Blanton <elb@pidgin.im>
parents:
32183
diff
changeset
|
256 && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { |
31823
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
257 char *buf = irc_format(irc, "vc", "WHO", purple_conversation_get_name(conv)); |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
258 |
32183
3f47428bd4de
Fix debug message for IRC periodic WHO
Ethan Blanton <elb@pidgin.im>
parents:
32159
diff
changeset
|
259 purple_debug(PURPLE_DEBUG_INFO, "irc", |
3f47428bd4de
Fix debug message for IRC periodic WHO
Ethan Blanton <elb@pidgin.im>
parents:
32159
diff
changeset
|
260 "Performing periodic who on %s\n", |
3f47428bd4de
Fix debug message for IRC periodic WHO
Ethan Blanton <elb@pidgin.im>
parents:
32159
diff
changeset
|
261 purple_conversation_get_name(conv)); |
31823
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
262 irc_send(irc, buf); |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
263 g_free(buf); |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
264 } |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
265 } |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
266 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 static void irc_ison_one(struct irc_conn *irc, struct irc_buddy *ib) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 char *buf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 |
31529
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
271 if (irc->buddies_outstanding != NULL) { |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
272 irc->buddies_outstanding = g_list_append(irc->buddies_outstanding, ib); |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
273 return; |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
274 } |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
275 |
e023b0378887
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
jch@honig.net
parents:
30262
diff
changeset
|
276 ib->new_online_status = FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 buf = irc_format(irc, "vn", "ISON", ib->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 irc_send(irc, buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 |
15823 | 283 static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 return "irc"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 |
15823 | 288 static GList *irc_status_types(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 { |
15823 | 290 PurpleStatusType *type; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 GList *types = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 |
15823 | 293 type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 |
15823 | 296 type = purple_status_type_new_with_attrs( |
297 PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, | |
298 "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 |
15823 | 302 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 types = g_list_append(types, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 return types; |
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 |
15823 | 308 static GList *irc_actions(PurplePlugin *plugin, gpointer context) |
15374
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 GList *list = NULL; |
15823 | 311 PurplePluginAction *act = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 |
15823 | 313 act = purple_plugin_action_new(_("View MOTD"), irc_view_motd); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 list = g_list_append(list, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 return list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 |
15823 | 319 static GList *irc_chat_join_info(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 GList *m = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 struct proto_chat_entry *pce; |
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 pce = g_new0(struct proto_chat_entry, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 pce->label = _("_Channel:"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 pce->identifier = "channel"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 pce->required = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 m = g_list_append(m, pce); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 pce = g_new0(struct proto_chat_entry, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 pce->label = _("_Password:"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 pce->identifier = "password"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 pce->secret = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 m = g_list_append(m, pce); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 |
15823 | 339 static GHashTable *irc_chat_info_defaults(PurpleConnection *gc, const char *chat_name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 GHashTable *defaults; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 if (chat_name != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); |
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 return defaults; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 |
15823 | 351 static void irc_login(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 { |
15823 | 353 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 struct irc_conn *irc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 char **userparts; |
15823 | 356 const char *username = purple_account_get_username(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 |
15823 | 358 gc = purple_account_get_connection(account); |
32767
2ec94166be43
On the way to hiding the PurpleConnection struct.
andrew.victor@mxit.com
parents:
32708
diff
changeset
|
359 purple_connection_set_flags(gc, PURPLE_CONNECTION_NO_NEWLINES); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 if (strpbrk(username, " \t\v\r\n") != NULL) { |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
362 purple_connection_error (gc, |
21358 | 363 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
27042
da9d25c582c1
Clarify the error message when an IRC server contains spaces.
Paul Aurich <paul@darkrain42.org>
parents:
26479
diff
changeset
|
364 _("IRC nick and server may not contain whitespace")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
368 irc = g_new0(struct irc_conn, 1); |
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
369 purple_connection_set_protocol_data(gc, irc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 irc->fd = -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 irc->account = account; |
15823 | 372 irc->outbuf = purple_circ_buffer_new(512); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 userparts = g_strsplit(username, "@", 2); |
15823 | 375 purple_connection_set_display_name(gc, userparts[0]); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 irc->server = g_strdup(userparts[1]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 g_strfreev(userparts); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 irc->buddies = g_hash_table_new_full((GHashFunc)irc_nick_hash, (GEqualFunc)irc_nick_equal, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 NULL, (GDestroyNotify)irc_buddy_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 irc->cmds = g_hash_table_new(g_str_hash, g_str_equal); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 irc_cmd_table_build(irc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 irc->msgs = g_hash_table_new(g_str_hash, g_str_equal); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 irc_msg_table_build(irc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 |
15823 | 386 purple_connection_update_progress(gc, _("Connecting"), 1, 2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 |
15823 | 388 if (purple_account_get_bool(account, "ssl", FALSE)) { |
389 if (purple_ssl_is_supported()) { | |
390 irc->gsc = purple_ssl_connect(account, irc->server, | |
391 purple_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 irc_login_cb_ssl, irc_ssl_connect_failure, gc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 } else { |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
394 purple_connection_error (gc, |
21358 | 395 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
20112
1b420901ca3b
Move prpl-irc to purple_connection_error_reason.
Will Thompson <will.thompson@collabora.co.uk>
parents:
19680
diff
changeset
|
396 _("SSL support unavailable")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 } |
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->gsc) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 |
15823 | 403 if (purple_proxy_connect(gc, account, irc->server, |
404 purple_account_get_int(account, "port", IRC_DEFAULT_PORT), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 irc_login_cb, gc) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 { |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
407 purple_connection_error (gc, |
21358 | 408 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27463
f541583e31bd
More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents:
27455
diff
changeset
|
409 _("Unable to connect")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 return; |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
15823 | 415 static gboolean do_login(PurpleConnection *gc) { |
17033
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
416 char *buf, *tmp = NULL; |
31897
1a248102e437
Send * as our local hostname for the USER message at signon.
Ethan Blanton <elb@pidgin.im>
parents:
31847
diff
changeset
|
417 char *server; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 const char *username, *realname; |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
419 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15823 | 420 const char *pass = purple_connection_get_password(gc); |
15374
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 if (pass && *pass) { |
29927
70de81d95bf3
Provide IRC server passwords in a way which allows for an initial :.
Ethan Blanton <elb@pidgin.im>
parents:
29874
diff
changeset
|
423 buf = irc_format(irc, "v:", "PASS", pass); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 if (irc_send(irc, buf) < 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 |
17033
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
431 realname = purple_account_get_string(irc->account, "realname", ""); |
15823 | 432 username = purple_account_get_string(irc->account, "username", ""); |
17033
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
433 |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
434 if (username == NULL || *username == '\0') { |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
435 username = g_get_user_name(); |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
436 } |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
437 |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
438 if (username != NULL && strchr(username, ' ') != NULL) { |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
439 tmp = g_strdup(username); |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
440 while ((buf = strchr(tmp, ' ')) != NULL) { |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
441 *buf = '_'; |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
442 } |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
443 } |
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
444 |
23638
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
445 if (*irc->server == ':') { |
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
446 /* Same as hostname, above. */ |
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
447 server = g_strdup_printf("0%s", irc->server); |
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
448 } else { |
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
449 server = g_strdup(irc->server); |
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
450 } |
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
451 |
31897
1a248102e437
Send * as our local hostname for the USER message at signon.
Ethan Blanton <elb@pidgin.im>
parents:
31847
diff
changeset
|
452 buf = irc_format(irc, "vvvv:", "USER", tmp ? tmp : username, "*", server, |
23638
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
453 strlen(realname) ? realname : IRC_DEFAULT_ALIAS); |
17033
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
454 g_free(tmp); |
23638
1b7dea5ce0cd
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23583
diff
changeset
|
455 g_free(server); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 if (irc_send(irc, buf) < 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 return FALSE; |
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 g_free(buf); |
22958
f1dfc0d70d19
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
461 username = purple_connection_get_display_name(gc); |
f1dfc0d70d19
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
462 buf = irc_format(irc, "vn", "NICK", username); |
f1dfc0d70d19
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
463 irc->reqnick = g_strdup(username); |
f1dfc0d70d19
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
464 irc->nickused = FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 if (irc_send(irc, buf) < 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 irc->recv_time = time(NULL); |
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 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 |
15823 | 476 static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
477 PurpleInputCondition cond) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 { |
15823 | 479 PurpleConnection *gc = data; |
15374
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 (do_login(gc)) { |
15823 | 482 purple_ssl_input_add(gsc, irc_input_cb_ssl, gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 static void irc_login_cb(gpointer data, gint source, const gchar *error_message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 { |
15823 | 488 PurpleConnection *gc = data; |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
489 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 if (source < 0) { |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
492 gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
493 error_message); |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
494 purple_connection_error (gc, |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
495 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
496 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 irc->fd = source; |
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 if (do_login(gc)) { |
32771
a78523019e7a
IRC: Move the "inpa" input watcher into protocol_data.
andrew.victor@mxit.com
parents:
32768
diff
changeset
|
503 irc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 static void |
15823 | 508 irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 { |
15823 | 511 PurpleConnection *gc = data; |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
512 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
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 irc->gsc = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 |
20116
a61aa7cc757d
Use purple_connection_ssl_error in prpl-irc
Will Thompson <will.thompson@collabora.co.uk>
parents:
20113
diff
changeset
|
516 purple_connection_ssl_error (gc, error); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 |
15823 | 519 static void irc_close(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
521 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 if (irc == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 return; |
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 if (irc->gsc || (irc->fd >= 0)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 irc_cmd_quit(irc, "quit", NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 |
32771
a78523019e7a
IRC: Move the "inpa" input watcher into protocol_data.
andrew.victor@mxit.com
parents:
32768
diff
changeset
|
529 if (irc->inpa) { |
a78523019e7a
IRC: Move the "inpa" input watcher into protocol_data.
andrew.victor@mxit.com
parents:
32768
diff
changeset
|
530 purple_input_remove(irc->inpa); |
a78523019e7a
IRC: Move the "inpa" input watcher into protocol_data.
andrew.victor@mxit.com
parents:
32768
diff
changeset
|
531 irc->inpa = 0; |
a78523019e7a
IRC: Move the "inpa" input watcher into protocol_data.
andrew.victor@mxit.com
parents:
32768
diff
changeset
|
532 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 g_free(irc->inbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 if (irc->gsc) { |
15823 | 536 purple_ssl_close(irc->gsc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 } else if (irc->fd >= 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 close(irc->fd); |
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 if (irc->timer) |
15823 | 541 purple_timeout_remove(irc->timer); |
31823
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
542 if (irc->who_channel_timer) |
d72d728226dc
propagate from branch 'im.pidgin.pidgin' (head fb4d2b014576462db99d919dea15fbed03f1f48a)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31697
diff
changeset
|
543 purple_timeout_remove(irc->who_channel_timer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 g_hash_table_destroy(irc->cmds); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 g_hash_table_destroy(irc->msgs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 g_hash_table_destroy(irc->buddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 if (irc->motd) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 g_string_free(irc->motd, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 g_free(irc->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 if (irc->writeh) |
15823 | 552 purple_input_remove(irc->writeh); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 |
15823 | 554 purple_circ_buffer_destroy(irc->outbuf); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 |
16107
1980273186a4
Make non-standard mode characters support connection-specific instead of
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
556 g_free(irc->mode_chars); |
22958
f1dfc0d70d19
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <stu@nosnilmot.com>
parents:
22149
diff
changeset
|
557 g_free(irc->reqnick); |
16107
1980273186a4
Make non-standard mode characters support connection-specific instead of
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
558 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 g_free(irc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 |
15823 | 562 static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
564 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 char *plain; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 const char *args[2]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 |
24296
c204239bef48
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23639
diff
changeset
|
568 args[0] = irc_nick_skip_mode(irc, who); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 |
16108
6dab5732a4fd
Fix the HTML-on-IRC issues observed as a result of the bi-di text support
Stu Tomlinson <stu@nosnilmot.com>
parents:
16107
diff
changeset
|
570 purple_markup_html_to_xhtml(what, NULL, &plain); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 args[1] = plain; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 irc_cmd_privmsg(irc, "msg", NULL, args); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 g_free(plain); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 return 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 |
15823 | 578 static void irc_get_info(PurpleConnection *gc, const char *who) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
580 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 const char *args[2]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 args[0] = who; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 args[1] = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 irc_cmd_whois(irc, "whois", NULL, args); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 |
15823 | 587 static void irc_set_status(PurpleAccount *account, PurpleStatus *status) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 { |
15823 | 589 PurpleConnection *gc = purple_account_get_connection(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 struct irc_conn *irc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 const char *args[1]; |
15823 | 592 const char *status_id = purple_status_get_id(status); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 g_return_if_fail(gc != NULL); |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
595 irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 |
15823 | 597 if (!purple_status_is_active(status)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 args[0] = NULL; |
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 (!strcmp(status_id, "away")) { |
15823 | 603 args[0] = purple_status_get_attr_string(status, "message"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 if ((args[0] == NULL) || (*args[0] == '\0')) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 args[0] = _("Away"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 irc_cmd_away(irc, "away", NULL, args); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 } else if (!strcmp(status_id, "available")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 irc_cmd_away(irc, "back", NULL, 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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 |
32492
cd1d9e04c587
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
612 static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
614 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
28184
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
615 struct irc_buddy *ib; |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
616 const char *bname = purple_buddy_get_name(buddy); |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
617 |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
618 ib = g_hash_table_lookup(irc->buddies, bname); |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
619 if (ib != NULL) { |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
620 ib->ref++; |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
621 purple_prpl_got_user_status(irc->account, bname, |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
622 ib->online ? "available" : "offline", NULL); |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
623 } else { |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
624 ib = g_new0(struct irc_buddy, 1); |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
625 ib->name = g_strdup(bname); |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
626 ib->ref = 1; |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
627 g_hash_table_replace(irc->buddies, ib->name, ib); |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
628 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 /* if the timer isn't set, this is during signon, so we don't want to flood |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 * ourself off with ISON's, so we don't, but after that we want to know when |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 * someone's online asap */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 if (irc->timer) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 irc_ison_one(irc, ib); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 |
15823 | 637 static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
639 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
28184
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
640 struct irc_buddy *ib; |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
641 |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
642 ib = g_hash_table_lookup(irc->buddies, purple_buddy_get_name(buddy)); |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
643 if (ib && --ib->ref == 0) { |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
644 g_hash_table_remove(irc->buddies, purple_buddy_get_name(buddy)); |
f9cf1e14838b
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <paul@darkrain42.org>
parents:
27463
diff
changeset
|
645 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 static void read_input(struct irc_conn *irc, int len) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 { |
32708
10e5000326a5
Convert code to use the purple_account accessor functions.
andrew.victor@mxit.com
parents:
32700
diff
changeset
|
650 PurpleConnection *connection = purple_account_get_connection(irc->account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 char *cur, *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 |
32768
50cd80d3554e
Add a purple_connection_update_last_received() function to update the
andrew.victor@mxit.com
parents:
32767
diff
changeset
|
653 purple_connection_update_last_received(connection); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 irc->inbufused += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 irc->inbuf[irc->inbufused] = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 cur = irc->inbuf; |
17033
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
658 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 /* This is a hack to work around the fact that marv gets messages |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 * with null bytes in them while using some weird irc server at work |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 while ((cur < (irc->inbuf + irc->inbufused)) && !*cur) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 cur++; |
17033
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
664 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 while (cur < irc->inbuf + irc->inbufused && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 int step = (*end == '\r' ? 2 : 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 *end = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 irc_parse_msg(irc, cur); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 cur = end + step; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 if (cur != irc->inbuf + irc->inbufused) { /* leftover */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 irc->inbufused -= (cur - irc->inbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 memmove(irc->inbuf, cur, irc->inbufused); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 irc->inbufused = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 |
15823 | 680 static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
681 PurpleInputCondition cond) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 |
15823 | 684 PurpleConnection *gc = data; |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
685 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
688 if(!g_list_find(purple_connections_get_all(), gc)) { |
15823 | 689 purple_ssl_close(gsc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 irc->inbuflen += IRC_INITIAL_BUFSIZE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 |
15823 | 698 len = purple_ssl_read(gsc, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 if (len < 0 && errno == EAGAIN) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 /* Try again later */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 } else if (len < 0) { |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
704 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
705 g_strerror(errno)); |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
706 purple_connection_error (gc, |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
707 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
708 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 } else if (len == 0) { |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
711 purple_connection_error (gc, |
21358 | 712 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
713 _("Server closed the connection")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 return; |
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 read_input(irc, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 |
15823 | 720 static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 { |
15823 | 722 PurpleConnection *gc = data; |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
723 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 int len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 irc->inbuflen += IRC_INITIAL_BUFSIZE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 } |
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 len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 if (len < 0 && errno == EAGAIN) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 } else if (len < 0) { |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
735 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
736 g_strerror(errno)); |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
737 purple_connection_error (gc, |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
738 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
739 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 } else if (len == 0) { |
32330
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
32193
diff
changeset
|
742 purple_connection_error (gc, |
21358 | 743 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27455
2873ee6a960d
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <mark@kingant.net>
parents:
27042
diff
changeset
|
744 _("Server closed the connection")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 read_input(irc, len); |
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 |
15823 | 751 static void irc_chat_join (PurpleConnection *gc, GHashTable *data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
753 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 const char *args[2]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 args[0] = g_hash_table_lookup(data, "channel"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 args[1] = g_hash_table_lookup(data, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 irc_cmd_join(irc, "join", NULL, args); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 static char *irc_get_chat_name(GHashTable *data) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 return g_strdup(g_hash_table_lookup(data, "channel")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 |
17033
4c8a2054fd81
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16675
diff
changeset
|
765 static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
767 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15823 | 768 PurpleConversation *convo = purple_find_chat(gc, id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 const char *args[2]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 if (!convo) { |
15823 | 772 purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got chat invite request for bogus chat\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 args[0] = name; |
15823 | 776 args[1] = purple_conversation_get_name(convo); |
777 irc_cmd_invite(irc, "invite", purple_conversation_get_name(convo), args); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 } |
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 |
15823 | 781 static void irc_chat_leave (PurpleConnection *gc, int id) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
783 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15823 | 784 PurpleConversation *convo = purple_find_chat(gc, id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 const char *args[2]; |
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 if (!convo) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 |
15823 | 790 args[0] = purple_conversation_get_name(convo); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 args[1] = NULL; |
15823 | 792 irc_cmd_part(irc, "part", purple_conversation_get_name(convo), args); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 serv_got_chat_left(gc, id); |
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 |
15823 | 796 static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
798 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15823 | 799 PurpleConversation *convo = purple_find_chat(gc, id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 const char *args[2]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 char *tmp; |
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 if (!convo) { |
15823 | 804 purple_debug(PURPLE_DEBUG_ERROR, "irc", "chat send on nonexistent chat\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 if (*what == '/') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 return irc_parse_cmd(irc, convo->name, what + 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 #endif |
16108
6dab5732a4fd
Fix the HTML-on-IRC issues observed as a result of the bi-di text support
Stu Tomlinson <stu@nosnilmot.com>
parents:
16107
diff
changeset
|
812 purple_markup_html_to_xhtml(what, NULL, &tmp); |
32700
1f68af4afe67
Use purple_conversation accessor methods.
andrew.victor@mxit.com
parents:
32514
diff
changeset
|
813 args[0] = purple_conversation_get_name(convo); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 args[1] = tmp; |
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 irc_cmd_privmsg(irc, "msg", NULL, args); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 |
23154
caa533b62902
When calling serv_got_chat_in() after sending a group chat message (to let
Evan Schoenberg <evan.s@dreskin.net>
parents:
23112
diff
changeset
|
818 serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), flags, what, time(NULL)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 static guint irc_nick_hash(const char *nick) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 char *lc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 guint bucket; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 lc = g_utf8_strdown(nick, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 bucket = g_str_hash(lc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 g_free(lc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 return bucket; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 static gboolean irc_nick_equal(const char *nick1, const char *nick2) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 { |
15823 | 837 return (purple_utf8_strcasecmp(nick1, nick2) == 0); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 static void irc_buddy_free(struct irc_buddy *ib) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 g_free(ib->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 g_free(ib); |
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 |
15823 | 846 static void irc_chat_set_topic(PurpleConnection *gc, int id, const char *topic) |
15374
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 char *buf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 const char *name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 struct irc_conn *irc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
852 irc = purple_connection_get_protocol_data(gc); |
15823 | 853 name = purple_conversation_get_name(purple_find_chat(gc, id)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 if (name == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 buf = irc_format(irc, "vt:", "TOPIC", name, topic); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 irc_send(irc, buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 |
15823 | 863 static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 struct irc_conn *irc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 GList *fields = NULL; |
15823 | 867 PurpleRoomlistField *f; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 char *buf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
870 irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 if (irc->roomlist) |
15823 | 873 purple_roomlist_unref(irc->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 |
15823 | 875 irc->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 |
15823 | 877 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 fields = g_list_append(fields, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 |
15823 | 880 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 fields = g_list_append(fields, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 |
15823 | 883 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
884 fields = g_list_append(fields, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 |
15823 | 886 purple_roomlist_set_fields(irc->roomlist, fields); |
15374
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 buf = irc_format(irc, "v", "LIST"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 irc_send(irc, buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 return irc->roomlist; |
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 |
15823 | 895 static void irc_roomlist_cancel(PurpleRoomlist *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 { |
32393
5dafa68c8eb0
Some struct hiding. What a pain.
Mark Doliner <mark@kingant.net>
parents:
32330
diff
changeset
|
897 PurpleAccount *account = purple_roomlist_get_account(list); |
5dafa68c8eb0
Some struct hiding. What a pain.
Mark Doliner <mark@kingant.net>
parents:
32330
diff
changeset
|
898 PurpleConnection *gc = purple_account_get_connection(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 struct irc_conn *irc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 if (gc == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
904 irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 |
15823 | 906 purple_roomlist_set_in_progress(list, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 if (irc->roomlist == list) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 irc->roomlist = NULL; |
15823 | 910 purple_roomlist_unref(list); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 |
15823 | 914 static void irc_keepalive(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 { |
32455
cf796628b2c0
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
andrew.victor@mxit.com
parents:
32393
diff
changeset
|
916 struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 if ((time(NULL) - irc->recv_time) > PING_TIMEOUT) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 irc_cmd_ping(irc, NULL, NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 |
15823 | 921 static PurplePluginProtocolInfo prpl_info = |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 { |
32493
743bb6b1aa30
Move struct_size to the beginning of the struct. Even if we don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32492
diff
changeset
|
923 sizeof(PurplePluginProtocolInfo), /* struct_size */ |
18030
62a71bb085ef
Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents:
17033
diff
changeset
|
924 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | |
62a71bb085ef
Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <stu@nosnilmot.com>
parents:
17033
diff
changeset
|
925 OPT_PROTO_SLASH_COMMANDS_NATIVE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 NULL, /* user_splits */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 NULL, /* protocol_options */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 NO_BUDDY_ICONS, /* icon_spec */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 irc_blist_icon, /* list_icon */ |
15463 | 930 NULL, /* list_emblems */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 NULL, /* status_text */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 NULL, /* tooltip_text */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 irc_status_types, /* away_states */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 NULL, /* blist_node_menu */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 irc_chat_join_info, /* chat_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 irc_chat_info_defaults, /* chat_info_defaults */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 irc_login, /* login */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 irc_close, /* close */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 irc_im_send, /* send_im */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 NULL, /* set_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 NULL, /* send_typing */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
942 irc_get_info, /* get_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 irc_set_status, /* set_status */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 NULL, /* set_idle */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 NULL, /* change_passwd */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 irc_add_buddy, /* add_buddy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 NULL, /* add_buddies */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
948 irc_remove_buddy, /* remove_buddy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 NULL, /* remove_buddies */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 NULL, /* add_permit */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 NULL, /* add_deny */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 NULL, /* rem_permit */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 NULL, /* rem_deny */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 NULL, /* set_permit_deny */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 irc_chat_join, /* join_chat */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 NULL, /* reject_chat */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 irc_get_chat_name, /* get_chat_name */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 irc_chat_invite, /* chat_invite */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 irc_chat_leave, /* chat_leave */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 NULL, /* chat_whisper */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 irc_chat_send, /* chat_send */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 irc_keepalive, /* keepalive */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 NULL, /* register_user */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 NULL, /* get_cb_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 NULL, /* alias_buddy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
966 NULL, /* group_buddy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 NULL, /* rename_group */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
968 NULL, /* buddy_free */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 NULL, /* convo_closed */ |
15823 | 970 purple_normalize_nocase, /* normalize */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 NULL, /* set_buddy_icon */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 NULL, /* remove_group */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 NULL, /* get_cb_real_name */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 irc_chat_set_topic, /* set_chat_topic */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 NULL, /* find_blist_chat */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 irc_roomlist_get_list, /* roomlist_get_list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 irc_roomlist_cancel, /* roomlist_cancel */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 NULL, /* roomlist_expand_category */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 NULL, /* can_receive_file */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 irc_dccsend_send_file, /* send_file */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 irc_dccsend_new_xfer, /* new_xfer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 NULL, /* offline_message */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 NULL, /* whiteboard_prpl_ops */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 irc_send_raw, /* send_raw */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 NULL, /* roomlist_room_serialize */ |
25560
750d700098c1
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25557
diff
changeset
|
986 NULL, /* unregister_user */ |
750d700098c1
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25557
diff
changeset
|
987 NULL, /* send_attention */ |
750d700098c1
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25557
diff
changeset
|
988 NULL, /* get_attention_types */ |
25658 | 989 NULL, /* get_account_text_table */ |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25632
diff
changeset
|
990 NULL, /* initiate_media */ |
29874
2cb6ea4420a0
Add a NULL for PurplePluginProtocolInfo::get_moods to all the plugins I build
Paul Aurich <paul@darkrain42.org>
parents:
28184
diff
changeset
|
991 NULL, /* get_media_caps */ |
30262
2a436e0ce977
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents:
29927
diff
changeset
|
992 NULL, /* get_moods */ |
2a436e0ce977
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents:
29927
diff
changeset
|
993 NULL, /* set_public_alias */ |
32492
cd1d9e04c587
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
994 NULL /* get_public_alias */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 |
15823 | 997 static gboolean load_plugin (PurplePlugin *plugin) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
998 |
15823 | 999 purple_signal_register(plugin, "irc-sending-text", |
1000 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
1001 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), | |
1002 purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
1003 purple_signal_register(plugin, "irc-receiving-text", | |
1004 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
1005 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), | |
1006 purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 return TRUE; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1010 |
15823 | 1011 static PurplePluginInfo info = |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 { |
15823 | 1013 PURPLE_PLUGIN_MAGIC, |
1014 PURPLE_MAJOR_VERSION, | |
1015 PURPLE_MINOR_VERSION, | |
1016 PURPLE_PLUGIN_PROTOCOL, /**< type */ | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1017 NULL, /**< ui_requirement */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1018 0, /**< flags */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 NULL, /**< dependencies */ |
15823 | 1020 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1021 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 "prpl-irc", /**< id */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1023 "IRC", /**< name */ |
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
19680
diff
changeset
|
1024 DISPLAY_VERSION, /**< version */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1025 N_("IRC Protocol Plugin"), /** summary */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1026 N_("The IRC Protocol Plugin that Sucks Less"), /** description */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 NULL, /**< author */ |
15823 | 1028 PURPLE_WEBSITE, /**< homepage */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1029 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1030 load_plugin, /**< load */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 NULL, /**< unload */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 NULL, /**< destroy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 NULL, /**< ui_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 &prpl_info, /**< extra_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 NULL, /**< prefs_info */ |
16675
a338acd14365
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16108
diff
changeset
|
1037 irc_actions, |
a338acd14365
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16108
diff
changeset
|
1038 |
a338acd14365
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16108
diff
changeset
|
1039 /* padding */ |
a338acd14365
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16108
diff
changeset
|
1040 NULL, |
a338acd14365
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16108
diff
changeset
|
1041 NULL, |
a338acd14365
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16108
diff
changeset
|
1042 NULL, |
a338acd14365
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16108
diff
changeset
|
1043 NULL |
15374
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 |
15823 | 1046 static void _init_plugin(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 { |
15823 | 1048 PurpleAccountUserSplit *split; |
1049 PurpleAccountOption *option; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 |
15823 | 1051 split = purple_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 |
15823 | 1054 option = purple_account_option_int_new(_("Port"), "port", IRC_DEFAULT_PORT); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 |
15823 | 1057 option = purple_account_option_string_new(_("Encodings"), "encoding", IRC_DEFAULT_CHARSET); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 |
23639
aac5753e2528
This adds an "auto-detect UTF-8" option to IRC which, when enabled,
Ethan Blanton <elb@pidgin.im>
parents:
23638
diff
changeset
|
1060 option = purple_account_option_bool_new(_("Auto-detect incoming UTF-8"), "autodetect_utf8", IRC_DEFAULT_AUTODETECT); |
aac5753e2528
This adds an "auto-detect UTF-8" option to IRC which, when enabled,
Ethan Blanton <elb@pidgin.im>
parents:
23638
diff
changeset
|
1061 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
aac5753e2528
This adds an "auto-detect UTF-8" option to IRC which, when enabled,
Ethan Blanton <elb@pidgin.im>
parents:
23638
diff
changeset
|
1062 |
25504
e556eb2f38d2
- add hankaku kana support to irc.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
17033
diff
changeset
|
1063 option = purple_account_option_bool_new(_("Use SO/SI to send hankaku kana"), "irc_use_sosi", FALSE); |
e556eb2f38d2
- add hankaku kana support to irc.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
17033
diff
changeset
|
1064 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
e556eb2f38d2
- add hankaku kana support to irc.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
17033
diff
changeset
|
1065 |
e556eb2f38d2
- add hankaku kana support to irc.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
17033
diff
changeset
|
1066 option = purple_account_option_bool_new(_("Use 8bit to send hankaku kana"), "irc_use_8bit", FALSE); |
e556eb2f38d2
- add hankaku kana support to irc.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
17033
diff
changeset
|
1067 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
e556eb2f38d2
- add hankaku kana support to irc.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
17033
diff
changeset
|
1068 |
15823 | 1069 option = purple_account_option_string_new(_("Username"), "username", ""); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 |
15823 | 1072 option = purple_account_option_string_new(_("Real name"), "realname", ""); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 /* |
15823 | 1076 option = purple_account_option_string_new(_("Quit message"), "quitmsg", IRC_DEFAULT_QUIT); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1078 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1079 |
15823 | 1080 option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
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 _irc_plugin = plugin; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 |
15823 | 1085 purple_prefs_remove("/plugins/prpl/irc/quitmsg"); |
1086 purple_prefs_remove("/plugins/prpl/irc"); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 irc_register_commands(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 |
15823 | 1091 PURPLE_INIT_PLUGIN(irc, _init_plugin, info); |