Sun, 29 Sep 2019 02:28:31 -0500
Fix some issues found in review
| 12055 | 1 | /* |
| 15884 | 2 | * purple |
| 12055 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 12055 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16786
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 12055 | 21 | */ |
| 22 | ||
| 23 | #include "internal.h" | |
|
39959
e47fcffd061b
migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents:
37482
diff
changeset
|
24 | |
|
e47fcffd061b
migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents:
37482
diff
changeset
|
25 | #include <purple.h> |
| 12055 | 26 | |
| 15884 | 27 | PurplePlugin *plugin_handle = NULL; |
| 12055 | 28 | |
|
36079
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
29 | static char * |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
30 | outgoing_msg_common(const char *message) |
| 12055 | 31 | { |
| 32 | char *m; | |
|
36079
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
33 | char **ms = g_strsplit(message, "<u>", -1); |
| 12055 | 34 | m = g_strjoinv("<font face=\"monospace\" color=\"#00b025\">", ms); |
| 35 | g_strfreev(ms); | |
| 36 | ||
| 37 | ms = g_strsplit(m, "</u>", -1); | |
| 38 | g_free(m); | |
|
36079
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
39 | return g_strjoinv("</font>", ms); |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
40 | } |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
41 | |
|
37482
922720634101
Fix the writing-im-msg callback in codeinline.c
Richard Laager <rlaager@pidgin.im>
parents:
37148
diff
changeset
|
42 | static gboolean outgoing_msg_cb1(PurpleConversation *conv, PurpleMessage *msg, |
|
922720634101
Fix the writing-im-msg callback in codeinline.c
Richard Laager <rlaager@pidgin.im>
parents:
37148
diff
changeset
|
43 | gpointer null) |
|
36079
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
44 | { |
|
37482
922720634101
Fix the writing-im-msg callback in codeinline.c
Richard Laager <rlaager@pidgin.im>
parents:
37148
diff
changeset
|
45 | purple_message_set_contents(msg, |
|
922720634101
Fix the writing-im-msg callback in codeinline.c
Richard Laager <rlaager@pidgin.im>
parents:
37148
diff
changeset
|
46 | outgoing_msg_common(purple_message_get_contents(msg))); |
|
36079
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
47 | return FALSE; |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
48 | } |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
49 | |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
50 | static void |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
51 | outgoing_msg_cb2(PurpleAccount *account, PurpleMessage *msg, |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
52 | PurpleConversation *conv, PurpleMessageFlags flags, gpointer null) |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
53 | { |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
54 | purple_message_set_contents(msg, |
|
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
55 | outgoing_msg_common(purple_message_get_contents(msg))); |
| 12055 | 56 | } |
| 57 | ||
|
36739
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
58 | static PurplePluginInfo * |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
59 | plugin_query(GError **error) |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
60 | { |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
61 | const gchar * const authors[] = { |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
62 | "Sean Egan <seanegan@gmail.com>", |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
63 | NULL |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
64 | }; |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
65 | |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
66 | return purple_plugin_info_new( |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
67 | "id", "codeinline", |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
68 | "name", "Code Inline", |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
69 | "version", "1.0", |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
70 | "category", "Formatting", |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
71 | "summary", "Formats text as code", |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
72 | "description", "Changes the formatting of any outgoing text such " |
| 36742 | 73 | "that anything underlined will be received green and " |
| 74 | "monospace.", | |
|
36739
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
75 | "authors", authors, |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
76 | "website", PURPLE_WEBSITE, |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
77 | "abi-version", PURPLE_ABI_VERSION, |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
78 | NULL |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
79 | ); |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
80 | } |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
81 | |
| 12055 | 82 | static gboolean |
|
36739
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
83 | plugin_load(PurplePlugin *plugin, GError **error) |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13234
diff
changeset
|
84 | { |
| 15884 | 85 | void *handle = purple_conversations_get_handle(); |
| 12055 | 86 | plugin_handle = plugin; |
| 15884 | 87 | purple_signal_connect(handle, "writing-im-msg", plugin, |
|
36079
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
88 | PURPLE_CALLBACK(outgoing_msg_cb1), NULL); |
| 15884 | 89 | purple_signal_connect(handle, "sending-im-msg", plugin, |
|
36079
2e449140fe0b
Switch sending-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
90 | PURPLE_CALLBACK(outgoing_msg_cb2), NULL); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13234
diff
changeset
|
91 | |
| 12055 | 92 | return TRUE; |
| 93 | } | |
| 94 | ||
|
36739
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
95 | static gboolean |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
96 | plugin_unload(PurplePlugin *plugin, GError **error) |
| 12055 | 97 | { |
|
36739
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
98 | return TRUE; |
|
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
99 | } |
| 12055 | 100 | |
|
36739
472bef54ba0a
Started refactoring plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36367
diff
changeset
|
101 | PURPLE_PLUGIN_INIT(codeinline, plugin_query, plugin_load, plugin_unload); |