Mercurial > pidgin.yaz
changeset 21690:33285f8f68ba
merge of '125f56f31252d721a347d2d2e379956433c1d8b5'
and 'c1a40e1accb59a7d8fa230b529bf457014ed99af'
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 29 Nov 2007 23:21:14 +0000 |
parents | 882ac6616de9 (current diff) 3f87c3265740 (diff) |
children | 3ed9b027479d |
files | |
diffstat | 1 files changed, 40 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/plugins/newline.c Thu Nov 29 23:18:51 2007 +0000 +++ b/libpurple/plugins/newline.c Thu Nov 29 23:21:14 2007 +0000 @@ -31,6 +31,12 @@ 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 @@ 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 @@ 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 @@ NULL, /**< ui_info */ NULL, /**< extra_info */ - NULL, /**< prefs_info */ + &prefs_info, /**< prefs_info */ NULL, /**< actions */ /* padding */ @@ -92,6 +128,9 @@ 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)