im.pidgin.pidgin: c1a40e1accb59a7d8fa230b529bf457014ed99af
nosnilmot at pidgin.im
nosnilmot at pidgin.im
Thu Nov 29 14:10:44 EST 2007
-----------------------------------------------------------------
Revision: c1a40e1accb59a7d8fa230b529bf457014ed99af
Ancestor: 680ead8ac23fbdc99bd7178248a4cdf0bec54307
Author: nosnilmot at pidgin.im
Date: 2007-11-29T19:04:44
Branch: im.pidgin.pidgin
Modified files:
libpurple/plugins/newline.c
ChangeLog:
Add preferences to the newline plugin to allow enabling separately for IMs
and Chats.
Fixes: 9b03ab350711290846t424e302fh1eb5e3fe6d7c3872 at mail.gmail.com
-------------- next part --------------
============================================================
--- libpurple/plugins/newline.c c391a78885b93eae159ef9324b24e397234cccfc
+++ libpurple/plugins/newline.c ba291c6c584a00d63449cf62116b2a6895205c90
@@ -31,6 +31,12 @@ addnewline_msg_cb(PurpleAccount *account
addnewline_msg_cb(PurpleAccount *account, char *sender, char **message,
PurpleConversation *conv, int *flags, void *data)
{
+ if (((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) &&
+ !purple_prefs_get_bool("/plugins/core/newline/im")) ||
+ ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) &&
+ !purple_prefs_get_bool("/plugins/core/newline/chat")))
+ return FALSE;
+
if (g_ascii_strncasecmp(*message, "/me ", strlen("/me "))) {
char *tmp = g_strdup_printf("<br/>%s", *message);
g_free(*message);
@@ -40,6 +46,25 @@ addnewline_msg_cb(PurpleAccount *account
return FALSE;
}
+static PurplePluginPrefFrame *
+get_plugin_pref_frame(PurplePlugin *plugin) {
+ PurplePluginPrefFrame *frame;
+ PurplePluginPref *ppref;
+
+ frame = purple_plugin_pref_frame_new();
+
+ ppref = purple_plugin_pref_new_with_name_and_label(
+ "/plugins/core/newline/im", _("Add new line in IMs"));
+ purple_plugin_pref_frame_add(frame, ppref);
+
+ ppref = purple_plugin_pref_new_with_name_and_label(
+ "/plugins/core/newline/chat", _("Add new line in Chats"));
+ purple_plugin_pref_frame_add(frame, ppref);
+
+ return frame;
+}
+
+
static gboolean
plugin_load(PurplePlugin *plugin)
{
@@ -53,6 +78,17 @@ plugin_load(PurplePlugin *plugin)
return TRUE;
}
+static PurplePluginUiInfo prefs_info = {
+ get_plugin_pref_frame,
+ 0, /* page_num (Reserved) */
+ NULL, /* frame (Reserved) */
+ /* Padding */
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
static PurplePluginInfo info =
{
PURPLE_PLUGIN_MAGIC, /**< magic */
@@ -80,7 +116,7 @@ static PurplePluginInfo info =
NULL, /**< ui_info */
NULL, /**< extra_info */
- NULL, /**< prefs_info */
+ &prefs_info, /**< prefs_info */
NULL, /**< actions */
/* padding */
@@ -92,6 +128,9 @@ init_plugin(PurplePlugin *plugin) {
static void
init_plugin(PurplePlugin *plugin) {
+ purple_prefs_add_none("/plugins/core/newline");
+ purple_prefs_add_bool("/plugins/core/newline/im", TRUE);
+ purple_prefs_add_bool("/plugins/core/newline/chat", TRUE);
}
PURPLE_INIT_PLUGIN(lastseen, init_plugin, info)
More information about the Commits
mailing list