Wed, 13 May 2009 20:29:03 +0000
Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.
| 15230 | 1 | /* |
| 2 | * Displays messages on a new line, below the nick | |
| 3 | * Copyright (C) 2004 Stu Tomlinson <stu@nosnilmot.com> | |
| 4 | * | |
| 5 | * This program is free software; you can redistribute it and/or | |
| 6 | * modify it under the terms of the GNU General Public License | |
| 7 | * as published by the Free Software Foundation; either version 2 | |
| 8 | * of the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This program is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | * GNU General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU General Public License | |
| 16 | * 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:
17729
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. |
| 15230 | 18 | */ |
| 19 | #include "internal.h" | |
| 20 | ||
| 21 | #include <string.h> | |
| 22 | ||
| 23 | #include <conversation.h> | |
| 24 | #include <debug.h> | |
| 25 | #include <plugin.h> | |
| 26 | #include <signals.h> | |
| 27 | #include <util.h> | |
| 28 | #include <version.h> | |
| 29 | ||
| 30 | static gboolean | |
| 15884 | 31 | addnewline_msg_cb(PurpleAccount *account, char *sender, char **message, |
| 32 | PurpleConversation *conv, int *flags, void *data) | |
| 15230 | 33 | { |
|
21800
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
34 | if (((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
35 | !purple_prefs_get_bool("/plugins/core/newline/im")) || |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
36 | ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) && |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
37 | !purple_prefs_get_bool("/plugins/core/newline/chat"))) |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
38 | return FALSE; |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
39 | |
| 15230 | 40 | if (g_ascii_strncasecmp(*message, "/me ", strlen("/me "))) { |
|
17729
d7cee72ec9dc
Use <br/> instead of \n for the newline, sadrul thought this might work
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16745
diff
changeset
|
41 | char *tmp = g_strdup_printf("<br/>%s", *message); |
| 15230 | 42 | g_free(*message); |
| 43 | *message = tmp; | |
| 44 | } | |
| 45 | ||
| 46 | return FALSE; | |
| 47 | } | |
| 48 | ||
|
21800
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
49 | static PurplePluginPrefFrame * |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
50 | get_plugin_pref_frame(PurplePlugin *plugin) { |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
51 | PurplePluginPrefFrame *frame; |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
52 | PurplePluginPref *ppref; |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
53 | |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
54 | frame = purple_plugin_pref_frame_new(); |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
55 | |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
56 | ppref = purple_plugin_pref_new_with_name_and_label( |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
57 | "/plugins/core/newline/im", _("Add new line in IMs")); |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
58 | purple_plugin_pref_frame_add(frame, ppref); |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
59 | |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
60 | ppref = purple_plugin_pref_new_with_name_and_label( |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
61 | "/plugins/core/newline/chat", _("Add new line in Chats")); |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
62 | purple_plugin_pref_frame_add(frame, ppref); |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
63 | |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
64 | return frame; |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
65 | } |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
66 | |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
67 | |
| 15230 | 68 | static gboolean |
| 15884 | 69 | plugin_load(PurplePlugin *plugin) |
| 15230 | 70 | { |
| 15884 | 71 | void *conversation = purple_conversations_get_handle(); |
| 15230 | 72 | |
| 15884 | 73 | purple_signal_connect(conversation, "writing-im-msg", |
| 74 | plugin, PURPLE_CALLBACK(addnewline_msg_cb), NULL); | |
| 75 | purple_signal_connect(conversation, "writing-chat-msg", | |
| 76 | plugin, PURPLE_CALLBACK(addnewline_msg_cb), NULL); | |
| 15230 | 77 | |
| 78 | return TRUE; | |
| 79 | } | |
| 80 | ||
|
21800
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
81 | static PurplePluginUiInfo prefs_info = { |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
82 | get_plugin_pref_frame, |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
83 | 0, /* page_num (Reserved) */ |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
84 | NULL, /* frame (Reserved) */ |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
85 | /* Padding */ |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
86 | NULL, |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
87 | NULL, |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
88 | NULL, |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
89 | NULL |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
90 | }; |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
91 | |
| 15884 | 92 | static PurplePluginInfo info = |
| 15230 | 93 | { |
| 16132 | 94 | PURPLE_PLUGIN_MAGIC, /**< magic */ |
| 95 | PURPLE_MAJOR_VERSION, /**< major version */ | |
| 96 | PURPLE_MINOR_VERSION, /**< minor version */ | |
| 15884 | 97 | PURPLE_PLUGIN_STANDARD, /**< type */ |
| 15230 | 98 | NULL, /**< ui_requirement */ |
| 99 | 0, /**< flags */ | |
| 100 | NULL, /**< dependencies */ | |
| 16132 | 101 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 15230 | 102 | |
| 103 | "core-plugin_pack-newline", /**< id */ | |
| 104 | N_("New Line"), /**< name */ | |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
21800
diff
changeset
|
105 | DISPLAY_VERSION, /**< version */ |
| 16132 | 106 | N_("Prepends a newline to displayed message."), /**< summary */ |
| 15230 | 107 | N_("Prepends a newline to messages so that the " |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15253
diff
changeset
|
108 | "rest of the message appears below the " |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
21800
diff
changeset
|
109 | "username in the conversation window."), /**< description */ |
| 15230 | 110 | "Stu Tomlinson <stu@nosnilmot.com>", /**< author */ |
| 15884 | 111 | PURPLE_WEBSITE, /**< homepage */ |
| 15230 | 112 | |
| 113 | plugin_load, /**< load */ | |
| 114 | NULL, /**< unload */ | |
| 115 | NULL, /**< destroy */ | |
| 116 | ||
| 117 | NULL, /**< ui_info */ | |
| 118 | NULL, /**< extra_info */ | |
|
21800
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
119 | &prefs_info, /**< prefs_info */ |
|
16745
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16132
diff
changeset
|
120 | NULL, /**< actions */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16132
diff
changeset
|
121 | |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16132
diff
changeset
|
122 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16132
diff
changeset
|
123 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16132
diff
changeset
|
124 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16132
diff
changeset
|
125 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16132
diff
changeset
|
126 | NULL |
| 15230 | 127 | }; |
| 128 | ||
| 129 | static void | |
| 15884 | 130 | init_plugin(PurplePlugin *plugin) { |
|
21800
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
131 | purple_prefs_add_none("/plugins/core/newline"); |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
132 | purple_prefs_add_bool("/plugins/core/newline/im", TRUE); |
|
775d93e65c3f
Add preferences to the newline plugin to allow enabling separately for IMs
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20288
diff
changeset
|
133 | purple_prefs_add_bool("/plugins/core/newline/chat", TRUE); |
| 15230 | 134 | } |
| 135 | ||
|
25633
feee0c7e503f
Fix some more mis-identified plugins, like 3b3526a0...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22942
diff
changeset
|
136 | PURPLE_INIT_PLUGIN(newline, init_plugin, info) |