Sun, 13 Mar 2011 18:14:04 +0000
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
to branch 'im.pidgin.pidgin.next.minor' (head b50f1cf05a5e1362ad4c28e4a136ef75239da19f)
|
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 | ||
| 73 | if (gc == NULL || gc->proto_data == NULL) { | |
| 15884 | 74 | purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); |
| 7148 | 75 | return; |
| 76 | } | |
| 77 | irc = gc->proto_data; | |
| 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 | { |
| 103 | struct irc_conn *irc = (struct irc_conn*)gc->proto_data; | |
| 104 | return do_send(irc, buf, len); | |
| 105 | } | |
| 106 | ||
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
107 | static void |
| 15884 | 108 | irc_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
109 | { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
110 | struct irc_conn *irc = data; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
111 | int ret, writelen; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
112 | |
| 15884 | 113 | writelen = purple_circ_buffer_get_max_read(irc->outbuf); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
114 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
115 | if (writelen == 0) { |
| 15884 | 116 | purple_input_remove(irc->writeh); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
117 | irc->writeh = 0; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
118 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
119 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
120 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
121 | ret = do_send(irc, irc->outbuf->outptr, writelen); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
122 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
123 | if (ret < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
124 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
125 | else if (ret <= 0) { |
|
20440
42e5e5445a2f
Move prpl-irc to purple_connection_error_reason.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
126 | 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
|
127 | 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
|
128 | g_strerror(errno)); |
| 21279 | 129 | purple_connection_error_reason (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
130 | 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
|
131 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
132 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
133 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
134 | |
| 15884 | 135 | purple_circ_buffer_mark_read(irc->outbuf, ret); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
136 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
137 | #if 0 |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
138 | /* We *could* try to write more if we wrote it all */ |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
139 | if (ret == write_len) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
140 | irc_send_cb(data, source, cond); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
141 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
142 | #endif |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
143 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
144 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
145 | int irc_send(struct irc_conn *irc, const char *buf) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
146 | { |
| 14683 | 147 | int ret, buflen; |
| 148 | char *tosend= g_strdup(buf); | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
149 | |
| 15884 | 150 | purple_signal_emit(_irc_plugin, "irc-sending-text", purple_account_get_connection(irc->account), &tosend); |
| 14683 | 151 | if (tosend == NULL) |
| 152 | return 0; | |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
153 | |
| 14683 | 154 | buflen = strlen(tosend); |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
155 | |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
156 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
157 | /* If we're not buffering writes, try to send immediately */ |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
158 | if (!irc->writeh) |
| 14683 | 159 | ret = do_send(irc, tosend, buflen); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
160 | else { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
161 | ret = -1; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
162 | errno = EAGAIN; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
163 | } |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2171
diff
changeset
|
164 | |
| 15884 | 165 | /* purple_debug(PURPLE_DEBUG_MISC, "irc", "sent%s: %s", |
| 14683 | 166 | irc->gsc ? " (ssl)" : "", tosend); */ |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
167 | if (ret <= 0 && errno != EAGAIN) { |
|
20440
42e5e5445a2f
Move prpl-irc to purple_connection_error_reason.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
168 | 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
|
169 | 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
|
170 | g_strerror(errno)); |
| 21279 | 171 | purple_connection_error_reason (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
172 | 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
|
173 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
174 | } else if (ret < buflen) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
175 | if (ret < 0) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
176 | ret = 0; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
177 | if (!irc->writeh) |
| 15884 | 178 | irc->writeh = purple_input_add( |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
179 | irc->gsc ? irc->gsc->fd : irc->fd, |
| 15884 | 180 | PURPLE_INPUT_WRITE, irc_send_cb, irc); |
| 181 | purple_circ_buffer_append(irc->outbuf, tosend + ret, | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
182 | buflen - ret); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
183 | } |
| 14683 | 184 | g_free(tosend); |
| 9440 | 185 | return ret; |
|
2205
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2171
diff
changeset
|
186 | } |
|
68c42ce8eba6
[gaim-migrate @ 2215]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2171
diff
changeset
|
187 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
188 | /* XXX I don't like messing directly with these buddies */ |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
189 | gboolean irc_blist_timeout(struct irc_conn *irc) |
| 2086 | 190 | { |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
191 | if (irc->ison_outstanding) { |
|
2137
b0c18ea1dee8
[gaim-migrate @ 2147]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2131
diff
changeset
|
192 | return TRUE; |
| 2086 | 193 | } |
|
4416
008b56d257e1
[gaim-migrate @ 4689]
Christian Hammond <chipx86@chipx86.com>
parents:
4373
diff
changeset
|
194 | |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
195 | 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
|
196 | (gpointer *)&irc->buddies_outstanding); |
|
4416
008b56d257e1
[gaim-migrate @ 4689]
Christian Hammond <chipx86@chipx86.com>
parents:
4373
diff
changeset
|
197 | |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
198 | irc_buddy_query(irc); |
|
21736
8de85200908d
applied changes from 5dc4cf40c038206bcf06fe7407e1e308b0264e32
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21503
diff
changeset
|
199 | |
|
2131
ef072ae1b2b8
[gaim-migrate @ 2141]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2123
diff
changeset
|
200 | return TRUE; |
| 2086 | 201 | } |
| 202 | ||
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
203 | void irc_buddy_query(struct irc_conn *irc) |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
204 | { |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
205 | GList *lp; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
206 | GString *string; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
207 | struct irc_buddy *ib; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
208 | char *buf; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
209 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
210 | 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
|
211 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
212 | 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
|
213 | 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
|
214 | 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
|
215 | break; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
216 | 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
|
217 | 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
|
218 | 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
|
219 | } |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
220 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
221 | if (string->len) { |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
222 | 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
|
223 | irc_send(irc, buf); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
224 | g_free(buf); |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
225 | irc->ison_outstanding = TRUE; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
226 | } else |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
227 | irc->ison_outstanding = FALSE; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
228 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
229 | 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
|
230 | } |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
231 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
232 | 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
|
233 | { |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
234 | *list = g_list_append(*list, ib); |
| 3511 | 235 | } |
| 236 | ||
|
31565
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
237 | |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
238 | 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
|
239 | { |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
240 | // WHO all of our channels. |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
241 | 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
|
242 | |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
243 | return TRUE; |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
244 | } |
|
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 | 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
|
247 | { |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
248 | if (purple_conversation_get_account(conv) == irc->account && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
249 | 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
|
250 | |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
251 | purple_debug(PURPLE_DEBUG_INFO, "irc", "Performing periodic who on %s", purple_conversation_get_name(conv)); |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
252 | irc_send(irc, buf); |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
253 | g_free(buf); |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
254 | } |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
255 | } |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
256 | |
|
9553
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
257 | 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
|
258 | { |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
259 | char *buf; |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
260 | |
|
31284
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
261 | 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
|
262 | 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
|
263 | return; |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
264 | } |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
265 | |
|
893f2d78d438
Prevent sending ISON messages larger than 512 bytes. Fixes #9692.
Jeffrey Honig <jch@honig.net>
parents:
30138
diff
changeset
|
266 | ib->new_online_status = FALSE; |
|
9553
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
267 | buf = irc_format(irc, "vn", "ISON", ib->name); |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
268 | irc_send(irc, buf); |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
269 | g_free(buf); |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
270 | } |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
271 | |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
272 | |
| 15884 | 273 | static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b) |
| 3029 | 274 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
275 | return "irc"; |
|
2339
b42203c69d52
[gaim-migrate @ 2352]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2331
diff
changeset
|
276 | } |
|
b42203c69d52
[gaim-migrate @ 2352]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2331
diff
changeset
|
277 | |
| 15884 | 278 | static GList *irc_status_types(PurpleAccount *account) |
| 2086 | 279 | { |
| 15884 | 280 | PurpleStatusType *type; |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
281 | GList *types = NULL; |
|
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
282 | |
| 15884 | 283 | 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
|
284 | types = g_list_append(types, type); |
|
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
285 | |
| 15884 | 286 | type = purple_status_type_new_with_attrs( |
| 287 | PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, | |
| 288 | "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), | |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
289 | NULL); |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
290 | types = g_list_append(types, type); |
|
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
291 | |
| 15884 | 292 | 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
|
293 | types = g_list_append(types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
294 | |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9943
diff
changeset
|
295 | return types; |
| 3452 | 296 | } |
| 297 | ||
| 15884 | 298 | static GList *irc_actions(PurplePlugin *plugin, gpointer context) |
| 7148 | 299 | { |
| 300 | GList *list = NULL; | |
| 15884 | 301 | PurplePluginAction *act = NULL; |
| 7148 | 302 | |
| 15884 | 303 | 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
|
304 | list = g_list_append(list, act); |
| 7148 | 305 | |
| 306 | return list; | |
| 307 | } | |
| 308 | ||
| 15884 | 309 | static GList *irc_chat_join_info(PurpleConnection *gc) |
| 2086 | 310 | { |
|
2170
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
311 | GList *m = NULL; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
312 | struct proto_chat_entry *pce; |
|
2170
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
313 | |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
314 | pce = g_new0(struct proto_chat_entry, 1); |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7711
diff
changeset
|
315 | pce->label = _("_Channel:"); |
| 5234 | 316 | pce->identifier = "channel"; |
|
10954
cd5771cb6cf8
[gaim-migrate @ 12754]
Richard Laager <rlaager@pidgin.im>
parents:
10903
diff
changeset
|
317 | pce->required = TRUE; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
318 | m = g_list_append(m, pce); |
|
2170
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
319 | |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
320 | pce = g_new0(struct proto_chat_entry, 1); |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7711
diff
changeset
|
321 | pce->label = _("_Password:"); |
| 5234 | 322 | pce->identifier = "password"; |
| 6499 | 323 | pce->secret = TRUE; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
324 | m = g_list_append(m, pce); |
|
2170
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
325 | |
|
5c93594ff522
[gaim-migrate @ 2180]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
326 | return m; |
| 2086 | 327 | } |
| 328 | ||
| 15884 | 329 | 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
|
330 | { |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
331 | GHashTable *defaults; |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
332 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
333 | 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
|
334 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
335 | if (chat_name != NULL) |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
336 | g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
337 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
338 | return defaults; |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
339 | } |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9741
diff
changeset
|
340 | |
| 15884 | 341 | static void irc_login(PurpleAccount *account) |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
342 | { |
| 15884 | 343 | PurpleConnection *gc; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
344 | struct irc_conn *irc; |
| 10494 | 345 | char **userparts; |
| 15884 | 346 | const char *username = purple_account_get_username(account); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
347 | |
| 15884 | 348 | gc = purple_account_get_connection(account); |
| 349 | gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
350 | |
| 6752 | 351 | if (strpbrk(username, " \t\v\r\n") != NULL) { |
| 21279 | 352 | purple_connection_error_reason (gc, |
| 353 | 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
|
354 | _("IRC nick and server may not contain whitespace")); |
| 6752 | 355 | return; |
| 356 | } | |
| 357 | ||
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
358 | gc->proto_data = irc = g_new0(struct irc_conn, 1); |
|
10960
add2b4dbaa36
[gaim-migrate @ 12763]
Richard Laager <rlaager@pidgin.im>
parents:
10954
diff
changeset
|
359 | irc->fd = -1; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
360 | irc->account = account; |
| 15884 | 361 | irc->outbuf = purple_circ_buffer_new(512); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
362 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
363 | userparts = g_strsplit(username, "@", 2); |
| 15884 | 364 | purple_connection_set_display_name(gc, userparts[0]); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
365 | irc->server = g_strdup(userparts[1]); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
366 | g_strfreev(userparts); |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
367 | |
|
10159
5e8afc7db137
[gaim-migrate @ 11240]
Mark Doliner <markdoliner@pidgin.im>
parents:
10010
diff
changeset
|
368 | 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
|
369 | NULL, (GDestroyNotify)irc_buddy_free); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
370 | 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
|
371 | irc_cmd_table_build(irc); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
372 | 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
|
373 | irc_msg_table_build(irc); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
374 | |
| 15884 | 375 | purple_connection_update_progress(gc, _("Connecting"), 1, 2); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
376 | |
| 15884 | 377 | if (purple_account_get_bool(account, "ssl", FALSE)) { |
| 378 | if (purple_ssl_is_supported()) { | |
| 379 | irc->gsc = purple_ssl_connect(account, irc->server, | |
| 380 | purple_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
381 | irc_login_cb_ssl, irc_ssl_connect_failure, gc); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
382 | } else { |
| 21279 | 383 | purple_connection_error_reason (gc, |
| 384 | 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
|
385 | _("SSL support unavailable")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
386 | return; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
387 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
388 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
389 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
390 | if (!irc->gsc) { |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
391 | |
| 15884 | 392 | if (purple_proxy_connect(gc, account, irc->server, |
| 393 | purple_account_get_int(account, "port", IRC_DEFAULT_PORT), | |
|
14899
c65f0b4fb351
[gaim-migrate @ 17606]
Mark Doliner <markdoliner@pidgin.im>
parents:
14684
diff
changeset
|
394 | irc_login_cb, gc) == NULL) |
|
c65f0b4fb351
[gaim-migrate @ 17606]
Mark Doliner <markdoliner@pidgin.im>
parents:
14684
diff
changeset
|
395 | { |
| 21279 | 396 | purple_connection_error_reason (gc, |
| 397 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27627
diff
changeset
|
398 | _("Unable to connect")); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
399 | return; |
|
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 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
402 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
403 | |
| 15884 | 404 | 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
|
405 | char *buf, *tmp = NULL; |
|
23905
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
406 | char *hostname, *server; |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
407 | const char *hosttmp; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
408 | const char *username, *realname; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
409 | struct irc_conn *irc = gc->proto_data; |
| 15884 | 410 | const char *pass = purple_connection_get_password(gc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
411 | |
| 10555 | 412 | 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
|
413 | buf = irc_format(irc, "v:", "PASS", pass); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
414 | if (irc_send(irc, buf) < 0) { |
|
10903
7d32f4448a95
[gaim-migrate @ 12630]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10740
diff
changeset
|
415 | g_free(buf); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
416 | return FALSE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
417 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
418 | g_free(buf); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
419 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
420 | |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
421 | realname = purple_account_get_string(irc->account, "realname", ""); |
| 15884 | 422 | 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
|
423 | |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
424 | 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
|
425 | 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
|
426 | } |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
427 | |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
428 | 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
|
429 | tmp = g_strdup(username); |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
430 | 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
|
431 | *buf = '_'; |
|
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
432 | } |
|
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 | |
|
23905
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
435 | hosttmp = purple_get_host_name(); |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
436 | if (*hosttmp == ':') { |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
437 | /* This is either an IPv6 address, or something which |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
438 | * doesn't belong here. Either way, we need to escape |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
439 | * it. */ |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
440 | hostname = g_strdup_printf("0%s", hosttmp); |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
441 | } else { |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
442 | /* Ugly, I know. */ |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
443 | hostname = g_strdup(hosttmp); |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
444 | } |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
445 | |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
446 | if (*irc->server == ':') { |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
447 | /* Same as hostname, above. */ |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
448 | 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
|
449 | } else { |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
450 | 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
|
451 | } |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
452 | |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
453 | buf = irc_format(irc, "vvvv:", "USER", tmp ? tmp : username, hostname, server, |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
454 | 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
|
455 | g_free(tmp); |
|
23905
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
456 | g_free(hostname); |
|
5c736d337ee0
Escape IRC hostnames beginning with : in the USER command. This
Ethan Blanton <elb@pidgin.im>
parents:
23850
diff
changeset
|
457 | g_free(server); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
458 | if (irc_send(irc, buf) < 0) { |
|
10903
7d32f4448a95
[gaim-migrate @ 12630]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10740
diff
changeset
|
459 | g_free(buf); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
460 | return FALSE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
461 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
462 | 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
|
463 | 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
|
464 | 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
|
465 | 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
|
466 | irc->nickused = FALSE; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
467 | if (irc_send(irc, buf) < 0) { |
|
10903
7d32f4448a95
[gaim-migrate @ 12630]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10740
diff
changeset
|
468 | g_free(buf); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
469 | return FALSE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
470 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
471 | g_free(buf); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
472 | |
|
14544
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
473 | irc->recv_time = time(NULL); |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
474 | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
475 | return TRUE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
476 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
477 | |
| 15884 | 478 | static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
| 479 | PurpleInputCondition cond) | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
480 | { |
| 15884 | 481 | PurpleConnection *gc = data; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
482 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
483 | if (do_login(gc)) { |
| 15884 | 484 | purple_ssl_input_add(gsc, irc_input_cb_ssl, gc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
485 | } |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
486 | } |
|
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
487 | |
|
14173
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
488 | 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
|
489 | { |
| 15884 | 490 | PurpleConnection *gc = data; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
491 | struct irc_conn *irc = gc->proto_data; |
|
14173
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
492 | |
| 8778 | 493 | if (source < 0) { |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
494 | 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
|
495 | error_message); |
| 21279 | 496 | purple_connection_error_reason (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
497 | 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
|
498 | g_free(tmp); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
499 | return; |
| 8778 | 500 | } |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
501 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
502 | irc->fd = source; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
503 | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
504 | if (do_login(gc)) { |
| 15884 | 505 | 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
|
506 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
507 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
508 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
509 | static void |
| 15884 | 510 | irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
511 | gpointer data) |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
512 | { |
| 15884 | 513 | PurpleConnection *gc = data; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
514 | struct irc_conn *irc = gc->proto_data; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
515 | |
|
14310
a71aba2f6249
[gaim-migrate @ 16930]
Mark Doliner <markdoliner@pidgin.im>
parents:
14309
diff
changeset
|
516 | irc->gsc = NULL; |
|
a71aba2f6249
[gaim-migrate @ 16930]
Mark Doliner <markdoliner@pidgin.im>
parents:
14309
diff
changeset
|
517 | |
|
20444
cc02f15b7a91
Use purple_connection_ssl_error in prpl-irc
Will Thompson <resiak@pidgin.im>
parents:
20441
diff
changeset
|
518 | purple_connection_ssl_error (gc, error); |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
519 | } |
|
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
520 | |
| 15884 | 521 | static void irc_close(PurpleConnection *gc) |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
522 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
523 | struct irc_conn *irc = gc->proto_data; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
524 | |
| 6752 | 525 | if (irc == NULL) |
| 526 | return; | |
| 527 | ||
|
14173
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
528 | if (irc->gsc || (irc->fd >= 0)) |
|
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
529 | irc_cmd_quit(irc, "quit", NULL, NULL); |
|
78aeb8fa1113
[gaim-migrate @ 16745]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
530 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
531 | if (gc->inpa) |
| 15884 | 532 | purple_input_remove(gc->inpa); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
533 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
534 | g_free(irc->inbuf); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
535 | if (irc->gsc) { |
| 15884 | 536 | purple_ssl_close(irc->gsc); |
|
14222
71d8761db708
[gaim-migrate @ 16808]
Mark Doliner <markdoliner@pidgin.im>
parents:
14173
diff
changeset
|
537 | } else if (irc->fd >= 0) { |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
538 | close(irc->fd); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
539 | } |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
540 | if (irc->timer) |
| 15884 | 541 | purple_timeout_remove(irc->timer); |
|
31565
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
542 | if (irc->who_channel_timer) |
|
1138b2c998ec
propagate from branch 'im.pidgin.pidgin' (head e131c2da768d5bd01e4bcb33b488a43ffd378208)
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31451
diff
changeset
|
543 | purple_timeout_remove(irc->who_channel_timer); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
544 | g_hash_table_destroy(irc->cmds); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
545 | g_hash_table_destroy(irc->msgs); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
546 | g_hash_table_destroy(irc->buddies); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
547 | if (irc->motd) |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
548 | g_string_free(irc->motd, TRUE); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
549 | g_free(irc->server); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
550 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
551 | if (irc->writeh) |
| 15884 | 552 | purple_input_remove(irc->writeh); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
553 | |
| 15884 | 554 | purple_circ_buffer_destroy(irc->outbuf); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
555 | |
|
16167
8536102557ba
Make non-standard mode characters support connection-specific instead of
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
556 | 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
|
557 | 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
|
558 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
559 | g_free(irc); |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
560 | } |
|
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
561 | |
| 15884 | 562 | 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
|
563 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
564 | struct irc_conn *irc = gc->proto_data; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
565 | char *plain; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
566 | const char *args[2]; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
567 | |
|
24574
4ee71b4f335f
Strip multiple leading mode characters from incoming nicknames.
Marcos García Ochoa <magao@bigfoot.com>
parents:
23906
diff
changeset
|
568 | args[0] = irc_nick_skip_mode(irc, who); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
569 | |
|
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
|
570 | purple_markup_html_to_xhtml(what, NULL, &plain); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
571 | args[1] = plain; |
| 9442 | 572 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
573 | irc_cmd_privmsg(irc, "msg", NULL, args); |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
574 | g_free(plain); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
575 | return 1; |
|
2289
0af7cf95a25d
[gaim-migrate @ 2299]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2273
diff
changeset
|
576 | } |
| 2086 | 577 | |
| 15884 | 578 | static void irc_get_info(PurpleConnection *gc, const char *who) |
| 2086 | 579 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
580 | struct irc_conn *irc = gc->proto_data; |
|
10618
6613664e683c
[gaim-migrate @ 12083]
Daniel Atallah <datallah@pidgin.im>
parents:
10555
diff
changeset
|
581 | const char *args[2]; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
582 | args[0] = who; |
| 10624 | 583 | args[1] = NULL; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
584 | irc_cmd_whois(irc, "whois", NULL, args); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
585 | } |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
586 | |
| 15884 | 587 | static void irc_set_status(PurpleAccount *account, PurpleStatus *status) |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
588 | { |
| 15884 | 589 | PurpleConnection *gc = purple_account_get_connection(account); |
|
13438
f57f4ecc3302
[gaim-migrate @ 15812]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
590 | struct irc_conn *irc; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
591 | const char *args[1]; |
| 15884 | 592 | const char *status_id = purple_status_get_id(status); |
| 2086 | 593 | |
|
13438
f57f4ecc3302
[gaim-migrate @ 15812]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
594 | g_return_if_fail(gc != NULL); |
|
f57f4ecc3302
[gaim-migrate @ 15812]
Richard Laager <rlaager@pidgin.im>
parents:
13297
diff
changeset
|
595 | irc = gc->proto_data; |
| 10646 | 596 | |
| 15884 | 597 | if (!purple_status_is_active(status)) |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
598 | return; |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
599 | |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
600 | args[0] = NULL; |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10494
diff
changeset
|
601 | |
|
11718
90804d019837
[gaim-migrate @ 14009]
Mark Doliner <markdoliner@pidgin.im>
parents:
11522
diff
changeset
|
602 | if (!strcmp(status_id, "away")) { |
| 15884 | 603 | args[0] = purple_status_get_attr_string(status, "message"); |
|
12001
512c45efaccb
[gaim-migrate @ 14294]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
604 | if ((args[0] == NULL) || (*args[0] == '\0')) |
|
512c45efaccb
[gaim-migrate @ 14294]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
605 | args[0] = _("Away"); |
| 10646 | 606 | irc_cmd_away(irc, "away", NULL, args); |
|
12210
d7e2c9f73e16
[gaim-migrate @ 14512]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
607 | } else if (!strcmp(status_id, "available")) { |
|
d7e2c9f73e16
[gaim-migrate @ 14512]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12143
diff
changeset
|
608 | irc_cmd_away(irc, "back", NULL, args); |
| 10646 | 609 | } |
| 4916 | 610 | } |
| 611 | ||
| 15884 | 612 | static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| 3029 | 613 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
614 | struct irc_conn *irc = (struct irc_conn *)gc->proto_data; |
|
28118
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
615 | struct irc_buddy *ib; |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
616 | 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
|
617 | |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
618 | 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
|
619 | if (ib != NULL) { |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
620 | ib->ref++; |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
621 | 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
|
622 | ib->online ? "available" : "offline", NULL); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
623 | } else { |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
624 | 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
|
625 | ib->name = g_strdup(bname); |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
626 | ib->ref = 1; |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
627 | 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
|
628 | } |
| 9238 | 629 | |
|
9553
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
630 | /* 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
|
631 | * 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
|
632 | * someone's online asap */ |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
633 | if (irc->timer) |
|
146d83b7512b
[gaim-migrate @ 10386]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9475
diff
changeset
|
634 | irc_ison_one(irc, ib); |
| 3029 | 635 | } |
| 3622 | 636 | |
| 15884 | 637 | 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
|
638 | { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
639 | struct irc_conn *irc = (struct irc_conn *)gc->proto_data; |
|
28118
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
640 | struct irc_buddy *ib; |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
641 | |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
642 | 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
|
643 | if (ib && --ib->ref == 0) { |
|
ba26e203a9ca
irc: Handle a buddy appearing in multiple groups properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
644 | 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
|
645 | } |
| 3616 | 646 | } |
|
4514
40e3588a280f
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4509
diff
changeset
|
647 | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
648 | static void read_input(struct irc_conn *irc, int len) |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
649 | { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
650 | char *cur, *end; |
| 6369 | 651 | |
|
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
|
652 | irc->account->gc->last_received = time(NULL); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
653 | irc->inbufused += len; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
654 | irc->inbuf[irc->inbufused] = '\0'; |
| 3616 | 655 | |
| 8156 | 656 | cur = irc->inbuf; |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
657 | |
| 12752 | 658 | /* This is a hack to work around the fact that marv gets messages |
| 659 | * with null bytes in them while using some weird irc server at work | |
| 660 | */ | |
| 661 | while ((cur < (irc->inbuf + irc->inbufused)) && !*cur) | |
| 662 | cur++; | |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
663 | |
| 8156 | 664 | while (cur < irc->inbuf + irc->inbufused && |
| 665 | ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { | |
| 666 | int step = (*end == '\r' ? 2 : 1); | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
667 | *end = '\0'; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
668 | irc_parse_msg(irc, cur); |
| 8156 | 669 | cur = end + step; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
670 | } |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
671 | if (cur != irc->inbuf + irc->inbufused) { /* leftover */ |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
672 | irc->inbufused -= (cur - irc->inbuf); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
673 | memmove(irc->inbuf, cur, irc->inbufused); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
674 | } else { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
675 | irc->inbufused = 0; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
676 | } |
| 3616 | 677 | } |
| 678 | ||
| 15884 | 679 | static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, |
| 680 | PurpleInputCondition cond) | |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
681 | { |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
682 | |
| 15884 | 683 | PurpleConnection *gc = data; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
684 | struct irc_conn *irc = gc->proto_data; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
685 | int len; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
686 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
687 | if(!g_list_find(purple_connections_get_all(), gc)) { |
| 15884 | 688 | purple_ssl_close(gsc); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
689 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
690 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
691 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
692 | if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
693 | irc->inbuflen += IRC_INITIAL_BUFSIZE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
694 | irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
695 | } |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
696 | |
| 15884 | 697 | 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
|
698 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
699 | if (len < 0 && errno == EAGAIN) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
700 | /* Try again later */ |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
701 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
702 | } 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
|
703 | 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
|
704 | g_strerror(errno)); |
| 21279 | 705 | purple_connection_error_reason (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
706 | 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
|
707 | g_free(tmp); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
708 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
709 | } else if (len == 0) { |
| 21279 | 710 | purple_connection_error_reason (gc, |
| 711 | 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
|
712 | _("Server closed the connection")); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
713 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
714 | } |
|
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 | read_input(irc, len); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
717 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
718 | |
| 15884 | 719 | 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
|
720 | { |
| 15884 | 721 | PurpleConnection *gc = data; |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
722 | struct irc_conn *irc = gc->proto_data; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
723 | int len; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
724 | |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
725 | if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
726 | irc->inbuflen += IRC_INITIAL_BUFSIZE; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
727 | irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
728 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
729 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
730 | 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
|
731 | if (len < 0 && errno == EAGAIN) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
732 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12752
diff
changeset
|
733 | } 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
|
734 | 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
|
735 | g_strerror(errno)); |
| 21279 | 736 | purple_connection_error_reason (gc, |
|
27627
244455b1897f
Similar connection error message changes for IRC. These are hopefully
Mark Doliner <markdoliner@pidgin.im>
parents:
27184
diff
changeset
|
737 | 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
|
738 | g_free(tmp); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
739 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
740 | } else if (len == 0) { |
| 21279 | 741 | purple_connection_error_reason (gc, |
| 742 | 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
|
743 | _("Server closed the connection")); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
744 | return; |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
745 | } |
|
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 | read_input(irc, len); |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
748 | } |
|
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
749 | |
| 15884 | 750 | static void irc_chat_join (PurpleConnection *gc, GHashTable *data) |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
751 | { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
752 | struct irc_conn *irc = gc->proto_data; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
753 | const char *args[2]; |
| 3616 | 754 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
755 | args[0] = g_hash_table_lookup(data, "channel"); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
756 | args[1] = g_hash_table_lookup(data, "password"); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
757 | irc_cmd_join(irc, "join", NULL, args); |
| 3622 | 758 | } |
| 759 | ||
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
760 | static char *irc_get_chat_name(GHashTable *data) { |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
761 | return g_strdup(g_hash_table_lookup(data, "channel")); |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
762 | } |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9754
diff
changeset
|
763 | |
|
17077
87eae71a31a5
Don't allow IRC username to contain spaces. Fixes #443.
Daniel Atallah <datallah@pidgin.im>
parents:
16746
diff
changeset
|
764 | static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) |
| 3751 | 765 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
766 | struct irc_conn *irc = gc->proto_data; |
| 15884 | 767 | PurpleConversation *convo = purple_find_chat(gc, id); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
768 | const char *args[2]; |
| 3751 | 769 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
770 | if (!convo) { |
| 15884 | 771 | 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
|
772 | return; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
773 | } |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
774 | args[0] = name; |
| 15884 | 775 | args[1] = purple_conversation_get_name(convo); |
| 776 | irc_cmd_invite(irc, "invite", purple_conversation_get_name(convo), args); | |
| 3707 | 777 | } |
| 778 | ||
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
779 | |
| 15884 | 780 | static void irc_chat_leave (PurpleConnection *gc, int id) |
| 3707 | 781 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
782 | struct irc_conn *irc = gc->proto_data; |
| 15884 | 783 | PurpleConversation *convo = purple_find_chat(gc, id); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
784 | const char *args[2]; |
| 5298 | 785 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
786 | if (!convo) |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
787 | return; |
| 3735 | 788 | |
| 15884 | 789 | args[0] = purple_conversation_get_name(convo); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
790 | args[1] = NULL; |
| 15884 | 791 | 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
|
792 | serv_got_chat_left(gc, id); |
| 3735 | 793 | } |
| 794 | ||
| 15884 | 795 | static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) |
| 3735 | 796 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
797 | struct irc_conn *irc = gc->proto_data; |
| 15884 | 798 | PurpleConversation *convo = purple_find_chat(gc, id); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
799 | const char *args[2]; |
| 8163 | 800 | char *tmp; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
801 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
802 | if (!convo) { |
| 15884 | 803 | 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
|
804 | return -EINVAL; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
805 | } |
| 9130 | 806 | #if 0 |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
807 | if (*what == '/') { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
808 | return irc_parse_cmd(irc, convo->name, what + 1); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
809 | } |
| 9130 | 810 | #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
|
811 | purple_markup_html_to_xhtml(what, NULL, &tmp); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
812 | args[0] = convo->name; |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12210
diff
changeset
|
813 | args[1] = tmp; |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
814 | |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
815 | irc_cmd_privmsg(irc, "msg", NULL, args); |
| 8163 | 816 | |
|
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
|
817 | serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), flags, what, time(NULL)); |
| 8163 | 818 | g_free(tmp); |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
819 | return 0; |
| 3707 | 820 | } |
| 821 | ||
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
822 | static guint irc_nick_hash(const char *nick) |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
823 | { |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
824 | char *lc; |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
825 | guint bucket; |
|
6270
e3cb3b0c6c82
[gaim-migrate @ 6767]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
826 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
827 | lc = g_utf8_strdown(nick, -1); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
828 | bucket = g_str_hash(lc); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
829 | g_free(lc); |
|
6270
e3cb3b0c6c82
[gaim-migrate @ 6767]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
830 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
831 | return bucket; |
| 3029 | 832 | } |
| 833 | ||
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
834 | 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
|
835 | { |
| 15884 | 836 | return (purple_utf8_strcasecmp(nick1, nick2) == 0); |
|
2619
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
837 | } |
|
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 | static void irc_buddy_free(struct irc_buddy *ib) |
|
2619
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
840 | { |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
841 | g_free(ib->name); |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
842 | g_free(ib); |
|
2619
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
843 | } |
|
5d8a8feb4ad1
[gaim-migrate @ 2632]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2617
diff
changeset
|
844 | |
| 15884 | 845 | static void irc_chat_set_topic(PurpleConnection *gc, int id, const char *topic) |
| 9154 | 846 | { |
| 847 | char *buf; | |
| 848 | const char *name = NULL; | |
| 849 | struct irc_conn *irc; | |
| 850 | ||
| 851 | irc = gc->proto_data; | |
| 15884 | 852 | name = purple_conversation_get_name(purple_find_chat(gc, id)); |
| 9154 | 853 | |
| 854 | if (name == NULL) | |
| 855 | return; | |
| 856 | ||
| 857 | buf = irc_format(irc, "vt:", "TOPIC", name, topic); | |
| 858 | irc_send(irc, buf); | |
| 859 | g_free(buf); | |
| 860 | } | |
| 861 | ||
| 15884 | 862 | static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) |
| 8114 | 863 | { |
| 864 | struct irc_conn *irc; | |
| 865 | GList *fields = NULL; | |
| 15884 | 866 | PurpleRoomlistField *f; |
| 8352 | 867 | char *buf; |
| 8114 | 868 | |
| 869 | irc = gc->proto_data; | |
| 870 | ||
| 871 | if (irc->roomlist) | |
| 15884 | 872 | purple_roomlist_unref(irc->roomlist); |
| 8114 | 873 | |
| 15884 | 874 | irc->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); |
| 8114 | 875 | |
| 15884 | 876 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); |
| 8114 | 877 | fields = g_list_append(fields, f); |
| 878 | ||
| 15884 | 879 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); |
| 8114 | 880 | fields = g_list_append(fields, f); |
| 881 | ||
| 15884 | 882 | f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); |
| 8114 | 883 | fields = g_list_append(fields, f); |
| 884 | ||
| 15884 | 885 | purple_roomlist_set_fields(irc->roomlist, fields); |
| 8114 | 886 | |
| 8352 | 887 | buf = irc_format(irc, "v", "LIST"); |
| 888 | irc_send(irc, buf); | |
| 889 | g_free(buf); | |
| 8114 | 890 | |
| 891 | return irc->roomlist; | |
| 892 | } | |
| 893 | ||
| 15884 | 894 | static void irc_roomlist_cancel(PurpleRoomlist *list) |
| 8114 | 895 | { |
| 15884 | 896 | PurpleConnection *gc = purple_account_get_connection(list->account); |
| 8114 | 897 | struct irc_conn *irc; |
| 898 | ||
| 899 | if (gc == NULL) | |
| 900 | return; | |
| 901 | ||
| 902 | irc = gc->proto_data; | |
| 903 | ||
| 15884 | 904 | purple_roomlist_set_in_progress(list, FALSE); |
| 8114 | 905 | |
| 906 | if (irc->roomlist == list) { | |
| 907 | irc->roomlist = NULL; | |
| 15884 | 908 | purple_roomlist_unref(list); |
| 8114 | 909 | } |
| 910 | } | |
| 911 | ||
| 15884 | 912 | static void irc_keepalive(PurpleConnection *gc) |
|
14544
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
913 | { |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
914 | struct irc_conn *irc = gc->proto_data; |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
915 | if ((time(NULL) - irc->recv_time) > PING_TIMEOUT) |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
916 | irc_cmd_ping(irc, NULL, NULL, NULL); |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
917 | } |
|
847944da3ca0
[gaim-migrate @ 17201]
Daniel Atallah <datallah@pidgin.im>
parents:
14534
diff
changeset
|
918 | |
| 15884 | 919 | static PurplePluginProtocolInfo prpl_info = |
| 2086 | 920 | { |
|
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 */ |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
987 | sizeof(PurplePluginProtocolInfo), /* struct_size */ |
| 23708 | 988 | 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
|
989 | 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
|
990 | 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
|
991 | 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
|
992 | NULL, /* set_public_alias */ |
|
cca9685df785
Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents:
29812
diff
changeset
|
993 | NULL /* get_public_alias */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
994 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
995 | |
| 15884 | 996 | static gboolean load_plugin (PurplePlugin *plugin) { |
| 14683 | 997 | |
| 15884 | 998 | purple_signal_register(plugin, "irc-sending-text", |
| 999 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
| 1000 | purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), | |
| 1001 | purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
| 1002 | purple_signal_register(plugin, "irc-receiving-text", | |
| 1003 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
| 1004 | purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), | |
| 1005 | purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
| 14683 | 1006 | return TRUE; |
| 1007 | } | |
| 1008 | ||
| 8114 | 1009 | |
| 15884 | 1010 | static PurplePluginInfo info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1011 | { |
| 15884 | 1012 | PURPLE_PLUGIN_MAGIC, |
| 1013 | PURPLE_MAJOR_VERSION, | |
| 1014 | PURPLE_MINOR_VERSION, | |
| 1015 | PURPLE_PLUGIN_PROTOCOL, /**< type */ | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1016 | NULL, /**< ui_requirement */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1017 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1018 | NULL, /**< dependencies */ |
| 15884 | 1019 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1020 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1021 | "prpl-irc", /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1022 | "IRC", /**< name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
1023 | DISPLAY_VERSION, /**< version */ |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1024 | N_("IRC Protocol Plugin"), /** summary */ |
|
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1025 | N_("The IRC Protocol Plugin that Sucks Less"), /** description */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1026 | NULL, /**< author */ |
| 15884 | 1027 | PURPLE_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1028 | |
| 14683 | 1029 | load_plugin, /**< load */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1030 | NULL, /**< unload */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1031 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1032 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1033 | NULL, /**< ui_info */ |
| 8993 | 1034 | &prpl_info, /**< extra_info */ |
| 11763 | 1035 | NULL, /**< prefs_info */ |
|
16746
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1036 | irc_actions, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1037 | |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1038 | /* padding */ |
|
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, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16168
diff
changeset
|
1042 | NULL |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1043 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1044 | |
| 15884 | 1045 | static void _init_plugin(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5150
diff
changeset
|
1046 | { |
| 15884 | 1047 | PurpleAccountUserSplit *split; |
| 1048 | PurpleAccountOption *option; | |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1049 | |
| 15884 | 1050 | split = purple_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1051 | 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
|
1052 | |
| 15884 | 1053 | 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
|
1054 | 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
|
1055 | |
| 15884 | 1056 | 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
|
1057 | 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
|
1058 | |
|
23906
6962e96ddd38
This adds an "auto-detect UTF-8" option to IRC which, when enabled,
Ethan Blanton <elb@pidgin.im>
parents:
23905
diff
changeset
|
1059 | 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
|
1060 | 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
|
1061 | |
| 15884 | 1062 | option = purple_account_option_string_new(_("Username"), "username", ""); |
| 7323 | 1063 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1064 | ||
| 15884 | 1065 | option = purple_account_option_string_new(_("Real name"), "realname", ""); |
| 10002 | 1066 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1067 | ||
| 11763 | 1068 | /* |
| 15884 | 1069 | option = purple_account_option_string_new(_("Quit message"), "quitmsg", IRC_DEFAULT_QUIT); |
| 11763 | 1070 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1071 | */ | |
| 1072 | ||
| 15884 | 1073 | option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); |
|
10365
5b329161c730
[gaim-migrate @ 11583]
Daniel Atallah <datallah@pidgin.im>
parents:
10258
diff
changeset
|
1074 | 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
|
1075 | |
|
6333
551f4a5b3c33
[gaim-migrate @ 6832]
Robert McQueen <robot101@debian.org>
parents:
6321
diff
changeset
|
1076 | _irc_plugin = plugin; |
| 9130 | 1077 | |
| 15884 | 1078 | purple_prefs_remove("/plugins/prpl/irc/quitmsg"); |
| 1079 | purple_prefs_remove("/plugins/prpl/irc"); | |
| 11073 | 1080 | |
| 9130 | 1081 | irc_register_commands(); |
| 2086 | 1082 | } |
| 1083 | ||
| 15884 | 1084 | PURPLE_INIT_PLUGIN(irc, _init_plugin, info); |