Sat, 03 Sep 2011 23:30:40 +0000
Move struct_size to the beginning of the struct. Even if we don't
rewrite this somehow (as a GObject or otherwise), it really belongs at
the start.
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1 | /** |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
2 | * @file irc.c |
|
6459
b5169664b142
[gaim-migrate @ 6968]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
3 | * |
| 15884 | 4 | * purple |
| 2086 | 5 | * |
| 15884 | 6 | * Copyright (C) 2003, Robbert Haarman <purple@inglorion.net> |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
7 | * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu> |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
8 | * Copyright (C) 2000-2003, Rob Flynn <rob@tgflinux.com> |
| 2086 | 9 | * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> |
|
6459
b5169664b142
[gaim-migrate @ 6968]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
10 | * |
| 2086 | 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19785
diff
changeset
|
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 2086 | 24 | */ |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
25 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5791
diff
changeset
|
26 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5791
diff
changeset
|
27 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5791
diff
changeset
|
28 | #include "accountopt.h" |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
29 | #include "blist.h" |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
30 | #include "conversation.h" |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
31 | #include "debug.h" |
| 7148 | 32 | #include "notify.h" |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
33 | #include "prpl.h" |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
34 | #include "plugin.h" |
| 6350 | 35 | #include "util.h" |
| 9943 | 36 | #include "version.h" |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
37 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
38 | #include "irc.h" |
|
4422
d7d5938502f0
[gaim-migrate @ 4695]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
4416
diff
changeset
|
39 | |
|
14544
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
40 | #define PING_TIMEOUT 60 |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
41 | |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
42 | static void irc_ison_buddy_init(char *name, struct irc_buddy *ib, GList **list); |
| 2086 | 43 | |
|
31565
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
44 | static void irc_who_channel(PurpleConversation *conv, struct irc_conn *irc); |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
45 | |
| 15884 | 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); | |
|
14173
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
52 | static void irc_login_cb(gpointer data, gint source, const gchar *error_message); |
| 15884 | 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); | |
| 3751 | 60 | |
| 7711 | 61 | static guint irc_nick_hash(const char *nick); |
| 62 | static gboolean irc_nick_equal(const char *nick1, const char *nick2); | |
| 63 | static void irc_buddy_free(struct irc_buddy *ib); | |
| 64 | ||
| 15884 | 65 | PurplePlugin *_irc_plugin = NULL; |
| 7711 | 66 | |
| 15884 | 67 | static void irc_view_motd(PurplePluginAction *action) |
| 7148 | 68 | { |
| 15884 | 69 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 7148 | 70 | struct irc_conn *irc; |
| 71 | char *title; | |
| 72 | ||
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
73 | if (gc == NULL || purple_connection_get_protocol_data(gc) == NULL) { |
| 15884 | 74 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); |
| 7148 | 75 | return; |
| 76 | } | |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
77 | irc = purple_connection_get_protocol_data(gc); |
| 7148 | 78 | if (irc->motd == NULL) { |
| 15884 | 79 | purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"), |
| 7148 | 80 | _("There is no MOTD associated with this connection.")); |
| 81 | return; | |
| 82 | } | |
| 83 | title = g_strdup_printf(_("MOTD for %s"), irc->server); | |
| 15884 | 84 | purple_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL); |
|
14534
c9d0843d8c19
[gaim-migrate @ 17188]
Daniel Atallah <datallah@pidgin.im>
parents:
14324
diff
changeset
|
85 | g_free(title); |
| 7148 | 86 | } |
| 87 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
88 | static int do_send(struct irc_conn *irc, const char *buf, gsize len) |
| 3751 | 89 | { |
| 9440 | 90 | int ret; |
| 91 | ||
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
92 | if (irc->gsc) { |
| 15884 | 93 | ret = purple_ssl_write(irc->gsc, buf, len); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
94 | } else { |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
95 | ret = write(irc->fd, buf, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
96 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
97 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
98 | return ret; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
99 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
100 | |
| 15884 | 101 | static int irc_send_raw(PurpleConnection *gc, const char *buf, int len) |
| 14604 | 102 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
103 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
31929
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
104 | if (len == -1) { |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
105 | len = strlen(buf); |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
106 | } |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
107 | irc_send_len(irc, buf, len); |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
108 | return len; |
| 14604 | 109 | } |
| 110 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
111 | static void |
| 15884 | 112 | irc_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
113 | { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
114 | struct irc_conn *irc = data; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
115 | int ret, writelen; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
116 | |
| 15884 | 117 | writelen = purple_circ_buffer_get_max_read(irc->outbuf); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
118 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
119 | if (writelen == 0) { |
| 15884 | 120 | purple_input_remove(irc->writeh); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
121 | irc->writeh = 0; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
122 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
123 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
124 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
125 | ret = do_send(irc, irc->outbuf->outptr, writelen); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
126 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
127 | if (ret < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
128 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
129 | else if (ret <= 0) { |
|
20440
42e5e5445a2f
Move prpl-irc to purple_connection_error_reason.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
130 | PurpleConnection *gc = purple_account_get_connection(irc->account); |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
131 | gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
132 | g_strerror(errno)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
133 | purple_connection_error (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
134 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
135 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
136 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
137 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
138 | |
| 15884 | 139 | purple_circ_buffer_mark_read(irc->outbuf, ret); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
140 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
141 | #if 0 |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
142 | /* We *could* try to write more if we wrote it all */ |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
143 | if (ret == write_len) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
144 | irc_send_cb(data, source, cond); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
145 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
146 | #endif |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
147 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
148 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
149 | int irc_send(struct irc_conn *irc, const char *buf) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
150 | { |
|
31929
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
151 | return irc_send_len(irc, buf, strlen(buf)); |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
152 | } |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
153 | |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
154 | int irc_send_len(struct irc_conn *irc, const char *buf, int buflen) |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
155 | { |
|
3c1f2bba1933
Fix races between irc_send_raw() and normal prpl-internal sends.
Ethan Blanton <elb@pidgin.im>
parents:
31646
diff
changeset
|
156 | int ret; |
| 14683 | 157 | char *tosend= g_strdup(buf); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
158 | |
| 15884 | 159 | purple_signal_emit(_irc_plugin, "irc-sending-text", purple_account_get_connection(irc->account), &tosend); |
| 14683 | 160 | if (tosend == NULL) |
| 161 | return 0; | |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
162 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
163 | /* If we're not buffering writes, try to send immediately */ |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
164 | if (!irc->writeh) |
| 14683 | 165 | ret = do_send(irc, tosend, buflen); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
166 | else { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
167 | ret = -1; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
168 | errno = EAGAIN; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
169 | } |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2171
diff
changeset
|
170 | |
| 15884 | 171 | /* purple_debug(PURPLE_DEBUG_MISC, "irc", "sent%s: %s", |
| 14683 | 172 | irc->gsc ? " (ssl)" : "", tosend); */ |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
173 | if (ret <= 0 && errno != EAGAIN) { |
|
20440
42e5e5445a2f
Move prpl-irc to purple_connection_error_reason.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
174 | PurpleConnection *gc = purple_account_get_connection(irc->account); |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
175 | gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
176 | g_strerror(errno)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
177 | purple_connection_error (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
178 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
179 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
180 | } else if (ret < buflen) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
181 | if (ret < 0) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
182 | ret = 0; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
183 | if (!irc->writeh) |
| 15884 | 184 | irc->writeh = purple_input_add( |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
185 | irc->gsc ? irc->gsc->fd : irc->fd, |
| 15884 | 186 | PURPLE_INPUT_WRITE, irc_send_cb, irc); |
| 187 | purple_circ_buffer_append(irc->outbuf, tosend + ret, | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
188 | buflen - ret); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
189 | } |
| 14683 | 190 | g_free(tosend); |
| 9440 | 191 | return ret; |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2171
diff
changeset
|
192 | } |
|
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2171
diff
changeset
|
193 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
194 | /* XXX I don't like messing directly with these buddies */ |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
195 | gboolean irc_blist_timeout(struct irc_conn *irc) |
| 2086 | 196 | { |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
197 | if (irc->ison_outstanding) { |
|
2137
b0c18ea1dee8
[gaim-migrate @ 2147]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2131
diff
changeset
|
198 | return TRUE; |
| 2086 | 199 | } |
|
4416
008b56d257e1
[gaim-migrate @ 4689]
Christian Hammond <chipx86@chipx86.com>
parents:
4373
diff
changeset
|
200 | |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
201 | g_hash_table_foreach(irc->buddies, (GHFunc)irc_ison_buddy_init, |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
202 | (gpointer *)&irc->buddies_outstanding); |
|
4416
008b56d257e1
[gaim-migrate @ 4689]
Christian Hammond <chipx86@chipx86.com>
parents:
4373
diff
changeset
|
203 | |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
204 | irc_buddy_query(irc); |
|
21736
8de85200908d
applied changes from 5dc4cf40c038206bcf06fe7407e1e308b0264e32
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21503
diff
changeset
|
205 | |
|
2131
ef072ae1b2b8
[gaim-migrate @ 2141]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2123
diff
changeset
|
206 | return TRUE; |
| 2086 | 207 | } |
| 208 | ||
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
209 | void irc_buddy_query(struct irc_conn *irc) |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
210 | { |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
211 | GList *lp; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
212 | GString *string; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
213 | struct irc_buddy *ib; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
214 | char *buf; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
215 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
216 | string = g_string_sized_new(512); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
217 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
218 | while ((lp = g_list_first(irc->buddies_outstanding))) { |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
219 | ib = (struct irc_buddy *)lp->data; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
220 | if (string->len + strlen(ib->name) + 1 > 450) |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
221 | break; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
222 | g_string_append_printf(string, "%s ", ib->name); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
223 | ib->new_online_status = FALSE; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
224 | irc->buddies_outstanding = g_list_remove_link(irc->buddies_outstanding, lp); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
225 | } |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
226 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
227 | if (string->len) { |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
228 | buf = irc_format(irc, "vn", "ISON", string->str); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
229 | irc_send(irc, buf); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
230 | g_free(buf); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
231 | irc->ison_outstanding = TRUE; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
232 | } else |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
233 | irc->ison_outstanding = FALSE; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
234 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
235 | g_string_free(string, TRUE); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
236 | } |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
237 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
238 | static void irc_ison_buddy_init(char *name, struct irc_buddy *ib, GList **list) |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
239 | { |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
240 | *list = g_list_append(*list, ib); |
| 3511 | 241 | } |
| 242 | ||
|
31565
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
243 | |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
244 | gboolean irc_who_channel_timeout(struct irc_conn *irc) |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
245 | { |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
246 | // WHO all of our channels. |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
247 | g_list_foreach(purple_get_conversations(), (GFunc)irc_who_channel, (gpointer)irc); |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
248 | |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
249 | return TRUE; |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
250 | } |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
251 | |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
252 | static void irc_who_channel(PurpleConversation *conv, struct irc_conn *irc) |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
253 | { |
|
31950
85edbfdf10bd
Suppress error spews when we've left an IRC channel but the window is open.
Ethan Blanton <elb@pidgin.im>
parents:
31940
diff
changeset
|
254 | if (purple_conversation_get_account(conv) == irc->account |
|
85edbfdf10bd
Suppress error spews when we've left an IRC channel but the window is open.
Ethan Blanton <elb@pidgin.im>
parents:
31940
diff
changeset
|
255 | && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT |
|
85edbfdf10bd
Suppress error spews when we've left an IRC channel but the window is open.
Ethan Blanton <elb@pidgin.im>
parents:
31940
diff
changeset
|
256 | && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { |
|
31565
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
257 | char *buf = irc_format(irc, "vc", "WHO", purple_conversation_get_name(conv)); |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
258 | |
|
31940
e21eefd6503b
Fix debug message for IRC periodic WHO
Ethan Blanton <elb@pidgin.im>
parents:
31929
diff
changeset
|
259 | purple_debug(PURPLE_DEBUG_INFO, "irc", |
|
e21eefd6503b
Fix debug message for IRC periodic WHO
Ethan Blanton <elb@pidgin.im>
parents:
31929
diff
changeset
|
260 | "Performing periodic who on %s\n", |
|
e21eefd6503b
Fix debug message for IRC periodic WHO
Ethan Blanton <elb@pidgin.im>
parents:
31929
diff
changeset
|
261 | purple_conversation_get_name(conv)); |
|
31565
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
262 | irc_send(irc, buf); |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
263 | g_free(buf); |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
264 | } |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
265 | } |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
266 | |
|
9553
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
267 | static void irc_ison_one(struct irc_conn *irc, struct irc_buddy *ib) |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
268 | { |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
269 | char *buf; |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
270 | |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
271 | if (irc->buddies_outstanding != NULL) { |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
272 | irc->buddies_outstanding = g_list_append(irc->buddies_outstanding, ib); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
273 | return; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
274 | } |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
275 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
276 | ib->new_online_status = FALSE; |
|
9553
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
277 | buf = irc_format(irc, "vn", "ISON", ib->name); |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
278 | irc_send(irc, buf); |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
279 | g_free(buf); |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
280 | } |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
281 | |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
282 | |
| 15884 | 283 | static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b) |
| 3029 | 284 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
285 | return "irc"; |
|
2339
b42203c69d52
[gaim-migrate @ 2352]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2331
diff
changeset
|
286 | } |
|
b42203c69d52
[gaim-migrate @ 2352]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2331
diff
changeset
|
287 | |
| 15884 | 288 | static GList *irc_status_types(PurpleAccount *account) |
| 2086 | 289 | { |
| 15884 | 290 | PurpleStatusType *type; |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
291 | GList *types = NULL; |
|
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
292 | |
| 15884 | 293 | type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE); |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
294 | types = g_list_append(types, type); |
|
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
295 | |
| 15884 | 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), | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
299 | NULL); |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
300 | types = g_list_append(types, type); |
|
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
301 | |
| 15884 | 302 | type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE); |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
303 | types = g_list_append(types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
304 | |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
305 | return types; |
| 3452 | 306 | } |
| 307 | ||
| 15884 | 308 | static GList *irc_actions(PurplePlugin *plugin, gpointer context) |
| 7148 | 309 | { |
| 310 | GList *list = NULL; | |
| 15884 | 311 | PurplePluginAction *act = NULL; |
| 7148 | 312 | |
| 15884 | 313 | act = purple_plugin_action_new(_("View MOTD"), irc_view_motd); |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
314 | list = g_list_append(list, act); |
| 7148 | 315 | |
| 316 | return list; | |
| 317 | } | |
| 318 | ||
| 15884 | 319 | static GList *irc_chat_join_info(PurpleConnection *gc) |
| 2086 | 320 | { |
|
2170
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
321 | GList *m = NULL; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
322 | struct proto_chat_entry *pce; |
|
2170
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
323 | |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
324 | pce = g_new0(struct proto_chat_entry, 1); |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7711
diff
changeset
|
325 | pce->label = _("_Channel:"); |
| 5234 | 326 | pce->identifier = "channel"; |
|
10954
cd5771cb6cf8
[gaim-migrate @ 12754]
Richard Laager <rlaager@pidgin.im>
parents:
10903
diff
changeset
|
327 | pce->required = TRUE; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
328 | m = g_list_append(m, pce); |
|
2170
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
329 | |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
330 | pce = g_new0(struct proto_chat_entry, 1); |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7711
diff
changeset
|
331 | pce->label = _("_Password:"); |
| 5234 | 332 | pce->identifier = "password"; |
| 6499 | 333 | pce->secret = TRUE; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
334 | m = g_list_append(m, pce); |
|
2170
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
335 | |
|
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
336 | return m; |
| 2086 | 337 | } |
| 338 | ||
| 15884 | 339 | static GHashTable *irc_chat_info_defaults(PurpleConnection *gc, const char *chat_name) |
|
9754
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
340 | { |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
341 | GHashTable *defaults; |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
342 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
343 | defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
344 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
345 | if (chat_name != NULL) |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
346 | g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
347 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
348 | return defaults; |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
349 | } |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
350 | |
| 15884 | 351 | static void irc_login(PurpleAccount *account) |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
352 | { |
| 15884 | 353 | PurpleConnection *gc; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
354 | struct irc_conn *irc; |
| 10494 | 355 | char **userparts; |
| 15884 | 356 | const char *username = purple_account_get_username(account); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
357 | |
| 15884 | 358 | gc = purple_account_get_connection(account); |
| 359 | gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
360 | |
| 6752 | 361 | if (strpbrk(username, " \t\v\r\n") != NULL) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
362 | purple_connection_error (gc, |
| 21279 | 363 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
27184
13344d18390e
Clarify the error message when an IRC server contains spaces.
Paul Aurich <darkrain42@pidgin.im>
parents:
26611
diff
changeset
|
364 | _("IRC nick and server may not contain whitespace")); |
| 6752 | 365 | return; |
| 366 | } | |
| 367 | ||
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
368 | irc = g_new0(struct irc_conn, 1); |
|
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
369 | purple_connection_set_protocol_data(gc, irc); |
|
10960
add2b4dbaa36
[gaim-migrate @ 12763]
Richard Laager <rlaager@pidgin.im>
parents:
10954
diff
changeset
|
370 | irc->fd = -1; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
371 | irc->account = account; |
| 15884 | 372 | irc->outbuf = purple_circ_buffer_new(512); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
373 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
374 | userparts = g_strsplit(username, "@", 2); |
| 15884 | 375 | purple_connection_set_display_name(gc, userparts[0]); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
376 | irc->server = g_strdup(userparts[1]); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
377 | g_strfreev(userparts); |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
378 | |
|
10159
5e8afc7db137
[gaim-migrate @ 11240]
Mark Doliner <markdoliner@pidgin.im>
parents:
10010
diff
changeset
|
379 | irc->buddies = g_hash_table_new_full((GHashFunc)irc_nick_hash, (GEqualFunc)irc_nick_equal, |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
380 | NULL, (GDestroyNotify)irc_buddy_free); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
381 | irc->cmds = g_hash_table_new(g_str_hash, g_str_equal); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
382 | irc_cmd_table_build(irc); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
383 | irc->msgs = g_hash_table_new(g_str_hash, g_str_equal); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
384 | irc_msg_table_build(irc); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
385 | |
| 15884 | 386 | purple_connection_update_progress(gc, _("Connecting"), 1, 2); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
387 | |
| 15884 | 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), | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
392 | irc_login_cb_ssl, irc_ssl_connect_failure, gc); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
393 | } else { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
394 | purple_connection_error (gc, |
| 21279 | 395 | PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, |
|
20440
42e5e5445a2f
Move prpl-irc to purple_connection_error_reason.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
396 | _("SSL support unavailable")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
397 | return; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
398 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
399 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
400 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
401 | if (!irc->gsc) { |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
402 | |
| 15884 | 403 | if (purple_proxy_connect(gc, account, irc->server, |
| 404 | purple_account_get_int(account, "port", IRC_DEFAULT_PORT), | |
|
14899
c65f0b4fb351
[gaim-migrate @ 17606]
Mark Doliner <markdoliner@pidgin.im>
parents:
14684
diff
changeset
|
405 | irc_login_cb, gc) == NULL) |
|
c65f0b4fb351
[gaim-migrate @ 17606]
Mark Doliner <markdoliner@pidgin.im>
parents:
14684
diff
changeset
|
406 | { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
407 | purple_connection_error (gc, |
| 21279 | 408 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27627
diff
changeset
|
409 | _("Unable to connect")); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
410 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
411 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
412 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
413 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
414 | |
| 15884 | 415 | static gboolean do_login(PurpleConnection *gc) { |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
416 | char *buf, *tmp = NULL; |
|
31646
ebe3510fbdb1
Send * as our local hostname for the USER message at signon.
Ethan Blanton <elb@pidgin.im>
parents:
31595
diff
changeset
|
417 | char *server; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
418 | const char *username, *realname; |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
419 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
| 15884 | 420 | const char *pass = purple_connection_get_password(gc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
421 | |
| 10555 | 422 | if (pass && *pass) { |
|
29812
8c34380ada83
Provide IRC server passwords in a way which allows for an initial :.
Ethan Blanton <elb@pidgin.im>
parents:
29757
diff
changeset
|
423 | buf = irc_format(irc, "v:", "PASS", pass); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
424 | if (irc_send(irc, buf) < 0) { |
|
10903
7d32f4448a95
[gaim-migrate @ 12630]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10740
diff
changeset
|
425 | g_free(buf); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
426 | return FALSE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
427 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
428 | g_free(buf); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
429 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
430 | |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
431 | realname = purple_account_get_string(irc->account, "realname", ""); |
| 15884 | 432 | username = purple_account_get_string(irc->account, "username", ""); |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
433 | |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
434 | if (username == NULL || *username == '\0') { |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
435 | username = g_get_user_name(); |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
436 | } |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
437 | |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
438 | if (username != NULL && strchr(username, ' ') != NULL) { |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
439 | tmp = g_strdup(username); |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
440 | while ((buf = strchr(tmp, ' ')) != NULL) { |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
441 | *buf = '_'; |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
442 | } |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
443 | } |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
444 | |
|
23905
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
445 | if (*irc->server == ':') { |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
446 | /* Same as hostname, above. */ |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
447 | server = g_strdup_printf("0%s", irc->server); |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
448 | } else { |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
449 | server = g_strdup(irc->server); |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
450 | } |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
451 | |
|
31646
ebe3510fbdb1
Send * as our local hostname for the USER message at signon.
Ethan Blanton <elb@pidgin.im>
parents:
31595
diff
changeset
|
452 | buf = irc_format(irc, "vvvv:", "USER", tmp ? tmp : username, "*", server, |
|
23905
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
453 | strlen(realname) ? realname : IRC_DEFAULT_ALIAS); |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
454 | g_free(tmp); |
|
23905
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
455 | g_free(server); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
456 | if (irc_send(irc, buf) < 0) { |
|
10903
7d32f4448a95
[gaim-migrate @ 12630]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10740
diff
changeset
|
457 | g_free(buf); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
458 | return FALSE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
459 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
460 | g_free(buf); |
|
23118
7ba846a8187f
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
461 | username = purple_connection_get_display_name(gc); |
|
7ba846a8187f
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
462 | buf = irc_format(irc, "vn", "NICK", username); |
|
7ba846a8187f
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
463 | irc->reqnick = g_strdup(username); |
|
7ba846a8187f
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
464 | irc->nickused = FALSE; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
465 | if (irc_send(irc, buf) < 0) { |
|
10903
7d32f4448a95
[gaim-migrate @ 12630]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10740
diff
changeset
|
466 | g_free(buf); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
467 | return FALSE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
468 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
469 | g_free(buf); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
470 | |
|
14544
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
471 | irc->recv_time = time(NULL); |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
472 | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
473 | return TRUE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
474 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
475 | |
| 15884 | 476 | static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
| 477 | PurpleInputCondition cond) | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
478 | { |
| 15884 | 479 | PurpleConnection *gc = data; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
480 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
481 | if (do_login(gc)) { |
| 15884 | 482 | purple_ssl_input_add(gsc, irc_input_cb_ssl, gc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
483 | } |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
484 | } |
|
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
485 | |
|
14173
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
486 | static void irc_login_cb(gpointer data, gint source, const gchar *error_message) |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
487 | { |
| 15884 | 488 | PurpleConnection *gc = data; |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
489 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
14173
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
490 | |
| 8778 | 491 | if (source < 0) { |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
492 | gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
493 | error_message); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
494 | purple_connection_error (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
495 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
496 | g_free(tmp); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
497 | return; |
| 8778 | 498 | } |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
499 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
500 | irc->fd = source; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
501 | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
502 | if (do_login(gc)) { |
| 15884 | 503 | gc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
504 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
505 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
506 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
507 | static void |
| 15884 | 508 | irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
509 | gpointer data) |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
510 | { |
| 15884 | 511 | PurpleConnection *gc = data; |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
512 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
513 | |
|
14310
a71aba2f6249
[gaim-migrate @ 16930]
Mark Doliner <markdoliner@pidgin.im>
parents:
14309
diff
changeset
|
514 | irc->gsc = NULL; |
|
a71aba2f6249
[gaim-migrate @ 16930]
Mark Doliner <markdoliner@pidgin.im>
parents:
14309
diff
changeset
|
515 | |
|
20444
cc02f15b7a91
Use purple_connection_ssl_error in prpl-irc
Will Thompson <resiak@pidgin.im>
parents:
20441
diff
changeset
|
516 | purple_connection_ssl_error (gc, error); |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
517 | } |
|
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
518 | |
| 15884 | 519 | static void irc_close(PurpleConnection *gc) |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
520 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
521 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
522 | |
| 6752 | 523 | if (irc == NULL) |
| 524 | return; | |
| 525 | ||
|
14173
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
526 | if (irc->gsc || (irc->fd >= 0)) |
|
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
527 | irc_cmd_quit(irc, "quit", NULL, NULL); |
|
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
528 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
529 | if (gc->inpa) |
| 15884 | 530 | purple_input_remove(gc->inpa); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
531 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
532 | g_free(irc->inbuf); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
533 | if (irc->gsc) { |
| 15884 | 534 | purple_ssl_close(irc->gsc); |
|
14222
71d8761db708
[gaim-migrate @ 16808]
Mark Doliner <markdoliner@pidgin.im>
parents:
14173
diff
changeset
|
535 | } else if (irc->fd >= 0) { |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
536 | close(irc->fd); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
537 | } |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
538 | if (irc->timer) |
| 15884 | 539 | purple_timeout_remove(irc->timer); |
|
31565
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
540 | if (irc->who_channel_timer) |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
541 | purple_timeout_remove(irc->who_channel_timer); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
542 | g_hash_table_destroy(irc->cmds); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
543 | g_hash_table_destroy(irc->msgs); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
544 | g_hash_table_destroy(irc->buddies); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
545 | if (irc->motd) |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
546 | g_string_free(irc->motd, TRUE); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
547 | g_free(irc->server); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
548 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
549 | if (irc->writeh) |
| 15884 | 550 | purple_input_remove(irc->writeh); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
551 | |
| 15884 | 552 | purple_circ_buffer_destroy(irc->outbuf); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
553 | |
|
16167
8536102557ba
Make non-standard mode characters support connection-specific instead of
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
554 | g_free(irc->mode_chars); |
|
23118
7ba846a8187f
Fix irc nick collision handling, as requested by that demanding user elb.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22277
diff
changeset
|
555 | g_free(irc->reqnick); |
|
16167
8536102557ba
Make non-standard mode characters support connection-specific instead of
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
556 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
557 | g_free(irc); |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
558 | } |
|
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
559 | |
| 15884 | 560 | static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
561 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
562 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
563 | char *plain; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
564 | const char *args[2]; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
565 | |
|
24574
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
566 | args[0] = irc_nick_skip_mode(irc, who); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
567 | |
|
16168
5a602ddb698f
Fix the HTML-on-IRC issues observed as a result of the bi-di text support
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16167
diff
changeset
|
568 | purple_markup_html_to_xhtml(what, NULL, &plain); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
569 | args[1] = plain; |
| 9442 | 570 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
571 | irc_cmd_privmsg(irc, "msg", NULL, args); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
572 | g_free(plain); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
573 | return 1; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
574 | } |
| 2086 | 575 | |
| 15884 | 576 | static void irc_get_info(PurpleConnection *gc, const char *who) |
| 2086 | 577 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
578 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
10618
6613664e683c
[gaim-migrate @ 12083]
Daniel Atallah <datallah@pidgin.im>
parents:
10555
diff
changeset
|
579 | const char *args[2]; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
580 | args[0] = who; |
| 10624 | 581 | args[1] = NULL; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
582 | irc_cmd_whois(irc, "whois", NULL, args); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
583 | } |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
584 | |
| 15884 | 585 | static void irc_set_status(PurpleAccount *account, PurpleStatus *status) |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
586 | { |
| 15884 | 587 | PurpleConnection *gc = purple_account_get_connection(account); |
|
13438
f57f4ecc3302
[gaim-migrate @ 15812]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
588 | struct irc_conn *irc; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
589 | const char *args[1]; |
| 15884 | 590 | const char *status_id = purple_status_get_id(status); |
| 2086 | 591 | |
|
13438
f57f4ecc3302
[gaim-migrate @ 15812]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
592 | g_return_if_fail(gc != NULL); |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
593 | irc = purple_connection_get_protocol_data(gc); |
| 10646 | 594 | |
| 15884 | 595 | if (!purple_status_is_active(status)) |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
596 | return; |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
597 | |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
598 | args[0] = NULL; |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
599 | |
|
11718
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11522
diff
changeset
|
600 | if (!strcmp(status_id, "away")) { |
| 15884 | 601 | args[0] = purple_status_get_attr_string(status, "message"); |
|
12001
512c45efaccb
[gaim-migrate @ 14294]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
602 | if ((args[0] == NULL) || (*args[0] == '\0')) |
|
512c45efaccb
[gaim-migrate @ 14294]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
603 | args[0] = _("Away"); |
| 10646 | 604 | irc_cmd_away(irc, "away", NULL, args); |
|
12210
d7e2c9f73e16
[gaim-migrate @ 14512]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
605 | } else if (!strcmp(status_id, "available")) { |
|
d7e2c9f73e16
[gaim-migrate @ 14512]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
606 | irc_cmd_away(irc, "back", NULL, args); |
| 10646 | 607 | } |
| 4916 | 608 | } |
| 609 | ||
|
32315
2550a39e0285
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32276
diff
changeset
|
610 | static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) |
| 3029 | 611 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
612 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
28118
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
613 | struct irc_buddy *ib; |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
614 | const char *bname = purple_buddy_get_name(buddy); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
615 | |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
616 | ib = g_hash_table_lookup(irc->buddies, bname); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
617 | if (ib != NULL) { |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
618 | ib->ref++; |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
619 | purple_prpl_got_user_status(irc->account, bname, |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
620 | ib->online ? "available" : "offline", NULL); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
621 | } else { |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
622 | ib = g_new0(struct irc_buddy, 1); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
623 | ib->name = g_strdup(bname); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
624 | ib->ref = 1; |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
625 | g_hash_table_replace(irc->buddies, ib->name, ib); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
626 | } |
| 9238 | 627 | |
|
9553
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
628 | /* if the timer isn't set, this is during signon, so we don't want to flood |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
629 | * ourself off with ISON's, so we don't, but after that we want to know when |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
630 | * someone's online asap */ |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
631 | if (irc->timer) |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
632 | irc_ison_one(irc, ib); |
| 3029 | 633 | } |
| 3622 | 634 | |
| 15884 | 635 | static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
636 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
637 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
28118
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
638 | struct irc_buddy *ib; |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
639 | |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
640 | ib = g_hash_table_lookup(irc->buddies, purple_buddy_get_name(buddy)); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
641 | if (ib && --ib->ref == 0) { |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
642 | g_hash_table_remove(irc->buddies, purple_buddy_get_name(buddy)); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
643 | } |
| 3616 | 644 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4509
diff
changeset
|
645 | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
646 | static void read_input(struct irc_conn *irc, int len) |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
647 | { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
648 | char *cur, *end; |
| 6369 | 649 | |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
21736
diff
changeset
|
650 | irc->account->gc->last_received = time(NULL); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
651 | irc->inbufused += len; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
652 | irc->inbuf[irc->inbufused] = '\0'; |
| 3616 | 653 | |
| 8156 | 654 | cur = irc->inbuf; |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
655 | |
| 12752 | 656 | /* This is a hack to work around the fact that marv gets messages |
| 657 | * with null bytes in them while using some weird irc server at work | |
| 658 | */ | |
| 659 | while ((cur < (irc->inbuf + irc->inbufused)) && !*cur) | |
| 660 | cur++; | |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
661 | |
| 8156 | 662 | while (cur < irc->inbuf + irc->inbufused && |
| 663 | ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { | |
| 664 | int step = (*end == '\r' ? 2 : 1); | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
665 | *end = '\0'; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
666 | irc_parse_msg(irc, cur); |
| 8156 | 667 | cur = end + step; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
668 | } |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
669 | if (cur != irc->inbuf + irc->inbufused) { /* leftover */ |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
670 | irc->inbufused -= (cur - irc->inbuf); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
671 | memmove(irc->inbuf, cur, irc->inbufused); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
672 | } else { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
673 | irc->inbufused = 0; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
674 | } |
| 3616 | 675 | } |
| 676 | ||
| 15884 | 677 | static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
| 678 | PurpleInputCondition cond) | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
679 | { |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
680 | |
| 15884 | 681 | PurpleConnection *gc = data; |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
682 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
683 | int len; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
684 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
685 | if(!g_list_find(purple_connections_get_all(), gc)) { |
| 15884 | 686 | purple_ssl_close(gsc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
687 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
688 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
689 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
690 | if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
691 | irc->inbuflen += IRC_INITIAL_BUFSIZE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
692 | irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
693 | } |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
694 | |
| 15884 | 695 | len = purple_ssl_read(gsc, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
696 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
697 | if (len < 0 && errno == EAGAIN) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
698 | /* Try again later */ |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
699 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
700 | } else if (len < 0) { |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
701 | gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
702 | g_strerror(errno)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
703 | purple_connection_error (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
704 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
705 | g_free(tmp); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
706 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
707 | } else if (len == 0) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
708 | purple_connection_error (gc, |
| 21279 | 709 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
710 | _("Server closed the connection")); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
711 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
712 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
713 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
714 | read_input(irc, len); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
715 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
716 | |
| 15884 | 717 | static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
718 | { |
| 15884 | 719 | PurpleConnection *gc = data; |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
720 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
721 | int len; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
722 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
723 | if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
724 | irc->inbuflen += IRC_INITIAL_BUFSIZE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
725 | irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
726 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
727 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
728 | len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
729 | if (len < 0 && errno == EAGAIN) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
730 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
731 | } else if (len < 0) { |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
732 | gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
733 | g_strerror(errno)); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
734 | purple_connection_error (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
735 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
736 | g_free(tmp); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
737 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
738 | } else if (len == 0) { |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31950
diff
changeset
|
739 | purple_connection_error (gc, |
| 21279 | 740 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
741 | _("Server closed the connection")); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
742 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
743 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
744 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
745 | read_input(irc, len); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
746 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
747 | |
| 15884 | 748 | static void irc_chat_join (PurpleConnection *gc, GHashTable *data) |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
749 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
750 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
751 | const char *args[2]; |
| 3616 | 752 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
753 | args[0] = g_hash_table_lookup(data, "channel"); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
754 | args[1] = g_hash_table_lookup(data, "password"); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
755 | irc_cmd_join(irc, "join", NULL, args); |
| 3622 | 756 | } |
| 757 | ||
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
758 | static char *irc_get_chat_name(GHashTable *data) { |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
759 | return g_strdup(g_hash_table_lookup(data, "channel")); |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
760 | } |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
761 | |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
762 | static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) |
| 3751 | 763 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
764 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
| 15884 | 765 | PurpleConversation *convo = purple_find_chat(gc, id); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
766 | const char *args[2]; |
| 3751 | 767 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
768 | if (!convo) { |
| 15884 | 769 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got chat invite request for bogus chat\n"); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
770 | return; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
771 | } |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
772 | args[0] = name; |
| 15884 | 773 | args[1] = purple_conversation_get_name(convo); |
| 774 | irc_cmd_invite(irc, "invite", purple_conversation_get_name(convo), args); | |
| 3707 | 775 | } |
| 776 | ||
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
777 | |
| 15884 | 778 | static void irc_chat_leave (PurpleConnection *gc, int id) |
| 3707 | 779 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
780 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
| 15884 | 781 | PurpleConversation *convo = purple_find_chat(gc, id); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
782 | const char *args[2]; |
| 5298 | 783 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
784 | if (!convo) |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
785 | return; |
| 3735 | 786 | |
| 15884 | 787 | args[0] = purple_conversation_get_name(convo); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
788 | args[1] = NULL; |
| 15884 | 789 | irc_cmd_part(irc, "part", purple_conversation_get_name(convo), args); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
790 | serv_got_chat_left(gc, id); |
| 3735 | 791 | } |
| 792 | ||
| 15884 | 793 | static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) |
| 3735 | 794 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
795 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
| 15884 | 796 | PurpleConversation *convo = purple_find_chat(gc, id); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
797 | const char *args[2]; |
| 8163 | 798 | char *tmp; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
799 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
800 | if (!convo) { |
| 15884 | 801 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "chat send on nonexistent chat\n"); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
802 | return -EINVAL; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
803 | } |
| 9130 | 804 | #if 0 |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
805 | if (*what == '/') { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
806 | return irc_parse_cmd(irc, convo->name, what + 1); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
807 | } |
| 9130 | 808 | #endif |
|
16168
5a602ddb698f
Fix the HTML-on-IRC issues observed as a result of the bi-di text support
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16167
diff
changeset
|
809 | purple_markup_html_to_xhtml(what, NULL, &tmp); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
810 | args[0] = convo->name; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
811 | args[1] = tmp; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
812 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
813 | irc_cmd_privmsg(irc, "msg", NULL, args); |
| 8163 | 814 | |
|
23295
5d3a2fd59439
When calling serv_got_chat_in() after sending a group chat message (to let
Evan Schoenberg <evands@pidgin.im>
parents:
23277
diff
changeset
|
815 | serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), flags, what, time(NULL)); |
| 8163 | 816 | g_free(tmp); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
817 | return 0; |
| 3707 | 818 | } |
| 819 | ||
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
820 | static guint irc_nick_hash(const char *nick) |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
821 | { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
822 | char *lc; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
823 | guint bucket; |
|
6270
e3cb3b0c6c82
[gaim-migrate @ 6767]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
824 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
825 | lc = g_utf8_strdown(nick, -1); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
826 | bucket = g_str_hash(lc); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
827 | g_free(lc); |
|
6270
e3cb3b0c6c82
[gaim-migrate @ 6767]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
828 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
829 | return bucket; |
| 3029 | 830 | } |
| 831 | ||
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
832 | static gboolean irc_nick_equal(const char *nick1, const char *nick2) |
|
2619
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
833 | { |
| 15884 | 834 | return (purple_utf8_strcasecmp(nick1, nick2) == 0); |
|
2619
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
835 | } |
|
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
836 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
837 | static void irc_buddy_free(struct irc_buddy *ib) |
|
2619
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
838 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
839 | g_free(ib->name); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
840 | g_free(ib); |
|
2619
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
841 | } |
|
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
842 | |
| 15884 | 843 | static void irc_chat_set_topic(PurpleConnection *gc, int id, const char *topic) |
| 9154 | 844 | { |
| 845 | char *buf; | |
| 846 | const char *name = NULL; | |
| 847 | struct irc_conn *irc; | |
| 848 | ||
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
849 | irc = purple_connection_get_protocol_data(gc); |
| 15884 | 850 | name = purple_conversation_get_name(purple_find_chat(gc, id)); |
| 9154 | 851 | |
| 852 | if (name == NULL) | |
| 853 | return; | |
| 854 | ||
| 855 | buf = irc_format(irc, "vt:", "TOPIC", name, topic); | |
| 856 | irc_send(irc, buf); | |
| 857 | g_free(buf); | |
| 858 | } | |
| 859 | ||
| 15884 | 860 | static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) |
| 8114 | 861 | { |
| 862 | struct irc_conn *irc; | |
| 863 | GList *fields = NULL; | |
| 15884 | 864 | PurpleRoomlistField *f; |
| 8352 | 865 | char *buf; |
| 8114 | 866 | |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
867 | irc = purple_connection_get_protocol_data(gc); |
| 8114 | 868 | |
| 869 | if (irc->roomlist) | |
| 15884 | 870 | purple_roomlist_unref(irc->roomlist); |
| 8114 | 871 | |
| 15884 | 872 | irc->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); |
| 8114 | 873 | |
| 15884 | 874 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); |
| 8114 | 875 | fields = g_list_append(fields, f); |
| 876 | ||
| 15884 | 877 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); |
| 8114 | 878 | fields = g_list_append(fields, f); |
| 879 | ||
| 15884 | 880 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); |
| 8114 | 881 | fields = g_list_append(fields, f); |
| 882 | ||
| 15884 | 883 | purple_roomlist_set_fields(irc->roomlist, fields); |
| 8114 | 884 | |
| 8352 | 885 | buf = irc_format(irc, "v", "LIST"); |
| 886 | irc_send(irc, buf); | |
| 887 | g_free(buf); | |
| 8114 | 888 | |
| 889 | return irc->roomlist; | |
| 890 | } | |
| 891 | ||
| 15884 | 892 | static void irc_roomlist_cancel(PurpleRoomlist *list) |
| 8114 | 893 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
894 | PurpleAccount *account = purple_roomlist_get_account(list); |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
32157
diff
changeset
|
895 | PurpleConnection *gc = purple_account_get_connection(account); |
| 8114 | 896 | struct irc_conn *irc; |
| 897 | ||
| 898 | if (gc == NULL) | |
| 899 | return; | |
| 900 | ||
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
901 | irc = purple_connection_get_protocol_data(gc); |
| 8114 | 902 | |
| 15884 | 903 | purple_roomlist_set_in_progress(list, FALSE); |
| 8114 | 904 | |
| 905 | if (irc->roomlist == list) { | |
| 906 | irc->roomlist = NULL; | |
| 15884 | 907 | purple_roomlist_unref(list); |
| 8114 | 908 | } |
| 909 | } | |
| 910 | ||
| 15884 | 911 | static void irc_keepalive(PurpleConnection *gc) |
|
14544
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
912 | { |
|
32276
abc0b7c0cb86
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
913 | struct irc_conn *irc = purple_connection_get_protocol_data(gc); |
|
14544
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
914 | if ((time(NULL) - irc->recv_time) > PING_TIMEOUT) |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
915 | irc_cmd_ping(irc, NULL, NULL, NULL); |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
916 | } |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
917 | |
| 15884 | 918 | static PurplePluginProtocolInfo prpl_info = |
| 2086 | 919 | { |
|
32316
21dab55b4699
Move struct_size to the beginning of the struct. Even if we don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32315
diff
changeset
|
920 | sizeof(PurplePluginProtocolInfo), /* struct_size */ |
|
18092
1a2362194473
Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17077
diff
changeset
|
921 | OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | |
|
1a2362194473
Mostly taken from the patch on ticket #410, don't send unknown slash
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17077
diff
changeset
|
922 | OPT_PROTO_SLASH_COMMANDS_NATIVE, |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
923 | NULL, /* user_splits */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
924 | NULL, /* protocol_options */ |
| 9951 | 925 | NO_BUDDY_ICONS, /* icon_spec */ |
| 926 | irc_blist_icon, /* list_icon */ | |
| 15524 | 927 | NULL, /* list_emblems */ |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
928 | NULL, /* status_text */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
929 | NULL, /* tooltip_text */ |
| 9951 | 930 | irc_status_types, /* away_states */ |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
931 | NULL, /* blist_node_menu */ |
| 9951 | 932 | irc_chat_join_info, /* chat_info */ |
|
9754
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
933 | irc_chat_info_defaults, /* chat_info_defaults */ |
| 9951 | 934 | irc_login, /* login */ |
| 935 | irc_close, /* close */ | |
| 936 | irc_im_send, /* send_im */ | |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
937 | NULL, /* set_info */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
938 | NULL, /* send_typing */ |
| 9951 | 939 | irc_get_info, /* get_info */ |
| 940 | irc_set_status, /* set_status */ | |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
941 | NULL, /* set_idle */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
942 | NULL, /* change_passwd */ |
| 9951 | 943 | irc_add_buddy, /* add_buddy */ |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
944 | NULL, /* add_buddies */ |
| 9951 | 945 | irc_remove_buddy, /* remove_buddy */ |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
946 | NULL, /* remove_buddies */ |
| 9741 | 947 | NULL, /* add_permit */ |
| 948 | NULL, /* add_deny */ | |
| 949 | NULL, /* rem_permit */ | |
| 950 | NULL, /* rem_deny */ | |
| 951 | NULL, /* set_permit_deny */ | |
| 9951 | 952 | irc_chat_join, /* join_chat */ |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
953 | NULL, /* reject_chat */ |
| 9951 | 954 | irc_get_chat_name, /* get_chat_name */ |
| 955 | irc_chat_invite, /* chat_invite */ | |
| 956 | irc_chat_leave, /* chat_leave */ | |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
957 | NULL, /* chat_whisper */ |
| 9951 | 958 | irc_chat_send, /* chat_send */ |
|
14544
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
959 | irc_keepalive, /* keepalive */ |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
960 | NULL, /* register_user */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
961 | NULL, /* get_cb_info */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
962 | NULL, /* get_cb_away */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
963 | NULL, /* alias_buddy */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
964 | NULL, /* group_buddy */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
965 | NULL, /* rename_group */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
966 | NULL, /* buddy_free */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
967 | NULL, /* convo_closed */ |
| 15884 | 968 | purple_normalize_nocase, /* normalize */ |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
969 | NULL, /* set_buddy_icon */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
970 | NULL, /* remove_group */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
971 | NULL, /* get_cb_real_name */ |
| 9951 | 972 | irc_chat_set_topic, /* set_chat_topic */ |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
973 | NULL, /* find_blist_chat */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
974 | irc_roomlist_get_list, /* roomlist_get_list */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
975 | irc_roomlist_cancel, /* roomlist_cancel */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
976 | NULL, /* roomlist_expand_category */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
977 | NULL, /* can_receive_file */ |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
12130
diff
changeset
|
978 | irc_dccsend_send_file, /* send_file */ |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12595
diff
changeset
|
979 | irc_dccsend_new_xfer, /* new_xfer */ |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
980 | NULL, /* offline_message */ |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12595
diff
changeset
|
981 | NULL, /* whiteboard_prpl_ops */ |
| 15185 | 982 | irc_send_raw, /* send_raw */ |
| 983 | NULL, /* roomlist_room_serialize */ | |
|
22071
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
984 | NULL, /* unregister_user */ |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
985 | NULL, /* send_attention */ |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
986 | NULL, /* get_attention_types */ |
| 23708 | 987 | NULL, /* get_account_text_table */ |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22398
diff
changeset
|
988 | NULL, /* initiate_media */ |
|
29757
f137c1386384
Add a NULL for PurplePluginProtocolInfo::get_moods to all the plugins I build
Paul Aurich <darkrain42@pidgin.im>
parents:
28118
diff
changeset
|
989 | NULL, /* get_media_caps */ |
|
30138
cca9685df785
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents:
29812
diff
changeset
|
990 | NULL, /* get_moods */ |
|
cca9685df785
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents:
29812
diff
changeset
|
991 | NULL, /* set_public_alias */ |
|
32315
2550a39e0285
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32276
diff
changeset
|
992 | NULL /* get_public_alias */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
993 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
994 | |
| 15884 | 995 | static gboolean load_plugin (PurplePlugin *plugin) { |
| 14683 | 996 | |
| 15884 | 997 | purple_signal_register(plugin, "irc-sending-text", |
| 998 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
| 999 | purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), | |
| 1000 | purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
| 1001 | purple_signal_register(plugin, "irc-receiving-text", | |
| 1002 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
| 1003 | purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), | |
| 1004 | purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
| 14683 | 1005 | return TRUE; |
| 1006 | } | |
| 1007 | ||
| 8114 | 1008 | |
| 15884 | 1009 | static PurplePluginInfo info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1010 | { |
| 15884 | 1011 | PURPLE_PLUGIN_MAGIC, |
| 1012 | PURPLE_MAJOR_VERSION, | |
| 1013 | PURPLE_MINOR_VERSION, | |
| 1014 | PURPLE_PLUGIN_PROTOCOL, /**< type */ | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1015 | NULL, /**< ui_requirement */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1016 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1017 | NULL, /**< dependencies */ |
| 15884 | 1018 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1019 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1020 | "prpl-irc", /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1021 | "IRC", /**< name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1022 | DISPLAY_VERSION, /**< version */ |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1023 | N_("IRC Protocol Plugin"), /** summary */ |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1024 | N_("The IRC Protocol Plugin that Sucks Less"), /** description */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1025 | NULL, /**< author */ |
| 15884 | 1026 | PURPLE_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1027 | |
| 14683 | 1028 | load_plugin, /**< load */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1029 | NULL, /**< unload */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1030 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1031 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1032 | NULL, /**< ui_info */ |
| 8993 | 1033 | &prpl_info, /**< extra_info */ |
| 11763 | 1034 | NULL, /**< prefs_info */ |
|
16746
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1035 | irc_actions, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1036 | |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1037 | /* padding */ |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1038 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1039 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1040 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1041 | NULL |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1042 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1043 | |
| 15884 | 1044 | static void _init_plugin(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1045 | { |
| 15884 | 1046 | PurpleAccountUserSplit *split; |
| 1047 | PurpleAccountOption *option; | |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1048 | |
| 15884 | 1049 | split = purple_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1050 | prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); |
|
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1051 | |
| 15884 | 1052 | option = purple_account_option_int_new(_("Port"), "port", IRC_DEFAULT_PORT); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1053 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1054 | |
| 15884 | 1055 | option = purple_account_option_string_new(_("Encodings"), "encoding", IRC_DEFAULT_CHARSET); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1056 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1057 | |
|
23906
6962e96ddd38
This adds an "auto-detect UTF-8" option to IRC which, when enabled,
Ethan Blanton <elb@pidgin.im>
parents:
23905
diff
changeset
|
1058 | option = purple_account_option_bool_new(_("Auto-detect incoming UTF-8"), "autodetect_utf8", IRC_DEFAULT_AUTODETECT); |
|
6962e96ddd38
This adds an "auto-detect UTF-8" option to IRC which, when enabled,
Ethan Blanton <elb@pidgin.im>
parents:
23905
diff
changeset
|
1059 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
6962e96ddd38
This adds an "auto-detect UTF-8" option to IRC which, when enabled,
Ethan Blanton <elb@pidgin.im>
parents:
23905
diff
changeset
|
1060 | |
| 15884 | 1061 | option = purple_account_option_string_new(_("Username"), "username", ""); |
| 7323 | 1062 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1063 | ||
| 15884 | 1064 | option = purple_account_option_string_new(_("Real name"), "realname", ""); |
| 10002 | 1065 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1066 | ||
| 11763 | 1067 | /* |
| 15884 | 1068 | option = purple_account_option_string_new(_("Quit message"), "quitmsg", IRC_DEFAULT_QUIT); |
| 11763 | 1069 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1070 | */ | |
| 1071 | ||
| 15884 | 1072 | option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
1073 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
1074 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1075 | _irc_plugin = plugin; |
| 9130 | 1076 | |
| 15884 | 1077 | purple_prefs_remove("/plugins/prpl/irc/quitmsg"); |
| 1078 | purple_prefs_remove("/plugins/prpl/irc"); | |
| 11073 | 1079 | |
| 9130 | 1080 | irc_register_commands(); |
| 2086 | 1081 | } |
| 1082 | ||
| 15884 | 1083 | PURPLE_INIT_PLUGIN(irc, _init_plugin, info); |