comparison libpurple/plugins/newline.c @ 15374:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children 32c366eeeb99
comparison
equal deleted inserted replaced
15373:f79e0f4df793 15374:5fe8042783c1
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
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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
31 addnewline_msg_cb(GaimAccount *account, char *sender, char **message,
32 GaimConversation *conv, int *flags, void *data)
33 {
34 if (g_ascii_strncasecmp(*message, "/me ", strlen("/me "))) {
35 char *tmp = g_strdup_printf("\n%s", *message);
36 g_free(*message);
37 *message = tmp;
38 }
39
40 return FALSE;
41 }
42
43 static gboolean
44 plugin_load(GaimPlugin *plugin)
45 {
46 void *conversation = gaim_conversations_get_handle();
47
48 gaim_signal_connect(conversation, "writing-im-msg",
49 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
50 gaim_signal_connect(conversation, "writing-chat-msg",
51 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
52
53 return TRUE;
54 }
55
56 static GaimPluginInfo info =
57 {
58 GAIM_PLUGIN_MAGIC, /**< magic */
59 GAIM_MAJOR_VERSION, /**< major version */
60 GAIM_MINOR_VERSION, /**< minor version */
61 GAIM_PLUGIN_STANDARD, /**< type */
62 NULL, /**< ui_requirement */
63 0, /**< flags */
64 NULL, /**< dependencies */
65 GAIM_PRIORITY_DEFAULT, /**< priority */
66
67 "core-plugin_pack-newline", /**< id */
68 N_("New Line"), /**< name */
69 VERSION, /**< version */
70 N_("Prepends a newline to displayed message."), /** summary */
71 N_("Prepends a newline to messages so that the "
72 "rest of the message appears below the "
73 "screen name in the conversation window."), /** description */
74 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */
75 GAIM_WEBSITE, /**< homepage */
76
77 plugin_load, /**< load */
78 NULL, /**< unload */
79 NULL, /**< destroy */
80
81 NULL, /**< ui_info */
82 NULL, /**< extra_info */
83 NULL, /**< prefs_info */
84 NULL /**< actions */
85 };
86
87 static void
88 init_plugin(GaimPlugin *plugin) {
89 }
90
91 GAIM_INIT_PLUGIN(lastseen, init_plugin, info)