2 * Displays messages on a new line, below the nick
3 * Copyright (C) 2004 Stu Tomlinson <stu@nosnilmot.com>
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.
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.
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
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
23 #include <conversation.h>
31 addnewline_msg_cb(PurpleAccount
*account
, char *sender
, char **message
,
32 PurpleConversation
*conv
, int *flags
, void *data
)
34 if (((purple_conversation_get_type(conv
) == PURPLE_CONV_TYPE_IM
) &&
35 !purple_prefs_get_bool("/plugins/core/newline/im")) ||
36 ((purple_conversation_get_type(conv
) == PURPLE_CONV_TYPE_CHAT
) &&
37 !purple_prefs_get_bool("/plugins/core/newline/chat")))
40 if (g_ascii_strncasecmp(*message
, "/me ", strlen("/me "))) {
41 char *tmp
= g_strdup_printf("<br/>%s", *message
);
49 static PurplePluginPrefFrame
*
50 get_plugin_pref_frame(PurplePlugin
*plugin
) {
51 PurplePluginPrefFrame
*frame
;
52 PurplePluginPref
*ppref
;
54 frame
= purple_plugin_pref_frame_new();
56 ppref
= purple_plugin_pref_new_with_name_and_label(
57 "/plugins/core/newline/im", _("Add new line in IMs"));
58 purple_plugin_pref_frame_add(frame
, ppref
);
60 ppref
= purple_plugin_pref_new_with_name_and_label(
61 "/plugins/core/newline/chat", _("Add new line in Chats"));
62 purple_plugin_pref_frame_add(frame
, ppref
);
69 plugin_load(PurplePlugin
*plugin
)
71 void *conversation
= purple_conversations_get_handle();
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
);
81 static PurplePluginUiInfo prefs_info
= {
82 get_plugin_pref_frame
,
83 0, /* page_num (Reserved) */
84 NULL
, /* frame (Reserved) */
92 static PurplePluginInfo info
=
94 PURPLE_PLUGIN_MAGIC
, /**< magic */
95 PURPLE_MAJOR_VERSION
, /**< major version */
96 PURPLE_MINOR_VERSION
, /**< minor version */
97 PURPLE_PLUGIN_STANDARD
, /**< type */
98 NULL
, /**< ui_requirement */
100 NULL
, /**< dependencies */
101 PURPLE_PRIORITY_DEFAULT
, /**< priority */
103 "core-plugin_pack-newline", /**< id */
104 N_("New Line"), /**< name */
105 DISPLAY_VERSION
, /**< version */
106 N_("Prepends a newline to displayed message."), /**< summary */
107 N_("Prepends a newline to messages so that the "
108 "rest of the message appears below the "
109 "username in the conversation window."), /**< description */
110 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */
111 PURPLE_WEBSITE
, /**< homepage */
113 plugin_load
, /**< load */
115 NULL
, /**< destroy */
117 NULL
, /**< ui_info */
118 NULL
, /**< extra_info */
119 &prefs_info
, /**< prefs_info */
120 NULL
, /**< actions */
130 init_plugin(PurplePlugin
*plugin
) {
131 purple_prefs_add_none("/plugins/core/newline");
132 purple_prefs_add_bool("/plugins/core/newline/im", TRUE
);
133 purple_prefs_add_bool("/plugins/core/newline/chat", TRUE
);
136 PURPLE_INIT_PLUGIN(newline
, init_plugin
, info
)