Mercurial > pidgin
annotate plugins/codeinline.c @ 13914:3ae8a3935406
[gaim-migrate @ 16414]
First stab at trying to fix the MSN http connect method. It still
doesn't work, and I'm not sure why, but it gets a lot farther in
the signon process now.
For those unfamiliar with the issue, the MSN http connect method
stopped working after all the non-blocking I/O changes. The http
connect method is apparently used by lots of people behind silly
firewalls and stuff, and therefore we really shouldn't release
Gaim 2.0.0 without it working, because people will complain.
The two main problems were
1. The outgoing message queue was removed in favor of buffering all
data to one large buffer. This sounds good in theory... but apparently
each message sent to and from the server has a "SessionID" in the
HTTP header. Every message we send should use the same SessionID as
the last packet we received from the server. So basically you can't
put two messages into the outgoing buffer at the same time because
you don't have the correct SessionID to use for the second message.
You have to wait until you get the reply from the server.
2. There were some strange buffer problems with using the wrong
variable when trying to combine the header+body into one buffer
before sending the message.
I also fixed a small memleak or two, added some comments, and
tried to clean up the code a little.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 03 Jul 2006 20:39:04 +0000 |
parents | f09c6e8df82c |
children | 8bda65b88e49 |
rev | line source |
---|---|
12055 | 1 /* |
2 * gaim | |
3 * | |
4 * Gaim is the legal property of its developers, whose names are too numerous | |
5 * to list here. Please refer to the COPYRIGHT file distributed with this | |
6 * source distribution. | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 | |
23 #include "internal.h" | |
24 #include "plugin.h" | |
25 #include "notify.h" | |
26 #include "util.h" | |
27 #include "version.h" | |
28 #include "gtkutils.h" | |
29 #include "gtkimhtml.h" | |
30 | |
31 GaimPlugin *plugin_handle = NULL; | |
32 | |
13233
f09c6e8df82c
[gaim-migrate @ 15598]
Richard Laager <rlaager@wiktel.com>
parents:
12055
diff
changeset
|
33 static gboolean outgoing_msg_cb(GaimAccount *account, const char *who, char **message, |
f09c6e8df82c
[gaim-migrate @ 15598]
Richard Laager <rlaager@wiktel.com>
parents:
12055
diff
changeset
|
34 GaimConversation *conv, GaimMessageFlags flags, gpointer null) |
12055 | 35 { |
36 char *m; | |
37 char **ms = g_strsplit(*message, "<u>", -1); | |
38 m = g_strjoinv("<font face=\"monospace\" color=\"#00b025\">", ms); | |
39 g_strfreev(ms); | |
40 | |
41 ms = g_strsplit(m, "</u>", -1); | |
42 g_free(m); | |
43 m = g_strjoinv("</font>", ms); | |
44 g_free(*message); | |
45 *message = m; | |
46 return FALSE; | |
47 } | |
48 | |
49 static gboolean | |
50 plugin_load(GaimPlugin *plugin) | |
51 { | |
52 void *handle = gaim_conversations_get_handle(); | |
53 plugin_handle = plugin; | |
54 gaim_signal_connect(handle, "writing-im-msg", plugin, | |
55 GAIM_CALLBACK(outgoing_msg_cb), NULL); | |
56 | |
57 return TRUE; | |
58 } | |
59 | |
60 | |
61 static GaimPluginInfo info = | |
62 { | |
63 GAIM_PLUGIN_MAGIC, | |
64 GAIM_MAJOR_VERSION, | |
65 GAIM_MINOR_VERSION, | |
66 GAIM_PLUGIN_STANDARD, | |
67 NULL, | |
68 0, | |
69 NULL, | |
70 GAIM_PRIORITY_DEFAULT, | |
71 "codeinline", | |
72 "Code Inline", | |
73 "1.0", | |
74 "Formats text as code", | |
75 "Changes the formatting of any outgoing text such that " | |
76 "anything underlined will be received green and monospace.", | |
77 "Sean Egan <seanegan@gmail.com>", | |
78 "http://gaim.sourceforge.net", | |
79 plugin_load, | |
80 NULL, | |
81 NULL, | |
82 NULL, | |
83 NULL, | |
84 NULL, | |
85 NULL | |
86 }; | |
87 | |
88 static void | |
89 init_plugin(GaimPlugin *plugin) | |
90 { | |
91 } | |
92 | |
93 GAIM_INIT_PLUGIN(urlcatcher, init_plugin, info) |