core/plugins/codeinline.c

changeset 14253
b63ebf84c42b
parent 14097
0c340861ab79
equal deleted inserted replaced
14252:d10dda2777a9 14253:b63ebf84c42b
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
29 GaimPlugin *plugin_handle = NULL;
30
31 static gboolean outgoing_msg_cb(GaimAccount *account, const char *who, char **message,
32 GaimConversation *conv, GaimMessageFlags flags, gpointer null)
33 {
34 char *m;
35 char **ms = g_strsplit(*message, "<u>", -1);
36 m = g_strjoinv("<font face=\"monospace\" color=\"#00b025\">", ms);
37 g_strfreev(ms);
38
39 ms = g_strsplit(m, "</u>", -1);
40 g_free(m);
41 m = g_strjoinv("</font>", ms);
42 g_free(*message);
43 *message = m;
44 return FALSE;
45 }
46
47 static gboolean
48 plugin_load(GaimPlugin *plugin)
49 {
50 void *handle = gaim_conversations_get_handle();
51 plugin_handle = plugin;
52 gaim_signal_connect(handle, "writing-im-msg", plugin,
53 GAIM_CALLBACK(outgoing_msg_cb), NULL);
54
55 return TRUE;
56 }
57
58
59 static GaimPluginInfo info =
60 {
61 GAIM_PLUGIN_MAGIC,
62 GAIM_MAJOR_VERSION,
63 GAIM_MINOR_VERSION,
64 GAIM_PLUGIN_STANDARD,
65 NULL,
66 0,
67 NULL,
68 GAIM_PRIORITY_DEFAULT,
69 "codeinline",
70 "Code Inline",
71 "1.0",
72 "Formats text as code",
73 "Changes the formatting of any outgoing text such that "
74 "anything underlined will be received green and monospace.",
75 "Sean Egan <seanegan@gmail.com>",
76 "http://gaim.sourceforge.net",
77 plugin_load,
78 NULL,
79 NULL,
80 NULL,
81 NULL,
82 NULL,
83 NULL
84 };
85
86 static void
87 init_plugin(GaimPlugin *plugin)
88 {
89 }
90
91 GAIM_INIT_PLUGIN(urlcatcher, init_plugin, info)

mercurial