Mercurial > pidgin.yaz
comparison plugins/codeinline.c @ 12055:0747647faca1
[gaim-migrate @ 14350]
I wrote this plugin back when I was writing my book. The publisher's
stylesheet had me underline any code terms, and getting into that
habit led me to underline code terms in IM too. So I wrote this plugin
to format underlined stuff as code. Now that I'm using a bunch of different
computers, I find I want to have the plugin elsewhere, so I'm adding it
to CVS
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 12 Nov 2005 20:19:39 +0000 |
parents | |
children | f09c6e8df82c |
comparison
equal
deleted
inserted
replaced
12054:2cb1beb9da51 | 12055:0747647faca1 |
---|---|
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 | |
33 static gboolean outgoing_msg_cb(GaimAccount *account, GaimConversation *conv, char **message) | |
34 { | |
35 char *m; | |
36 char **ms = g_strsplit(*message, "<u>", -1); | |
37 m = g_strjoinv("<font face=\"monospace\" color=\"#00b025\">", ms); | |
38 g_strfreev(ms); | |
39 | |
40 ms = g_strsplit(m, "</u>", -1); | |
41 g_free(m); | |
42 m = g_strjoinv("</font>", ms); | |
43 g_free(*message); | |
44 *message = m; | |
45 return FALSE; | |
46 } | |
47 | |
48 static gboolean | |
49 plugin_load(GaimPlugin *plugin) | |
50 { | |
51 void *handle = gaim_conversations_get_handle(); | |
52 plugin_handle = plugin; | |
53 gaim_signal_connect(handle, "writing-im-msg", plugin, | |
54 GAIM_CALLBACK(outgoing_msg_cb), NULL); | |
55 | |
56 return TRUE; | |
57 } | |
58 | |
59 | |
60 static GaimPluginInfo info = | |
61 { | |
62 GAIM_PLUGIN_MAGIC, | |
63 GAIM_MAJOR_VERSION, | |
64 GAIM_MINOR_VERSION, | |
65 GAIM_PLUGIN_STANDARD, | |
66 NULL, | |
67 0, | |
68 NULL, | |
69 GAIM_PRIORITY_DEFAULT, | |
70 "codeinline", | |
71 "Code Inline", | |
72 "1.0", | |
73 "Formats text as code", | |
74 "Changes the formatting of any outgoing text such that " | |
75 "anything underlined will be received green and monospace.", | |
76 "Sean Egan <seanegan@gmail.com>", | |
77 "http://gaim.sourceforge.net", | |
78 plugin_load, | |
79 NULL, | |
80 NULL, | |
81 NULL, | |
82 NULL, | |
83 NULL, | |
84 NULL | |
85 }; | |
86 | |
87 static void | |
88 init_plugin(GaimPlugin *plugin) | |
89 { | |
90 } | |
91 | |
92 GAIM_INIT_PLUGIN(urlcatcher, init_plugin, info) |