15168
|
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, "displaying-im-msg",
|
|
49 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
|
|
50 gaim_signal_connect(conversation, "displaying-chat-msg",
|
|
51 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
|
|
52 gaim_signal_connect(conversation, "receiving-im-msg",
|
|
53 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
|
|
54 gaim_signal_connect(conversation, "receiving-chat-msg",
|
|
55 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
|
|
56
|
|
57 return TRUE;
|
|
58 }
|
|
59
|
|
60 static GaimPluginInfo info =
|
|
61 {
|
|
62 GAIM_PLUGIN_MAGIC, /**< magic */
|
|
63 GAIM_MAJOR_VERSION, /**< major version */
|
|
64 GAIM_MINOR_VERSION, /**< minor version */
|
|
65 GAIM_PLUGIN_STANDARD, /**< type */
|
|
66 NULL, /**< ui_requirement */
|
|
67 0, /**< flags */
|
|
68 NULL, /**< dependencies */
|
|
69 GAIM_PRIORITY_DEFAULT, /**< priority */
|
|
70
|
|
71 "core-plugin_pack-newline", /**< id */
|
|
72 N_("New Line"), /**< name */
|
|
73 VERSION, /**< version */
|
|
74 N_("Prepends a newline to displayed message."), /** summary */
|
|
75 N_("Prepends a newline to messages so that the "
|
|
76 "test of the message appears below the "
|
|
77 "screen name in the conversation window."), /** description */
|
|
78 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */
|
|
79 GAIM_WEBSITE, /**< homepage */
|
|
80
|
|
81 plugin_load, /**< load */
|
|
82 NULL, /**< unload */
|
|
83 NULL, /**< destroy */
|
|
84
|
|
85 NULL, /**< ui_info */
|
|
86 NULL, /**< extra_info */
|
|
87 NULL, /**< prefs_info */
|
|
88 NULL /**< actions */
|
|
89 };
|
|
90
|
|
91 static void
|
|
92 init_plugin(GaimPlugin *plugin) {
|
|
93 }
|
|
94
|
|
95 GAIM_INIT_PLUGIN(lastseen, init_plugin, info)
|