annotate libgaim/plugins/newline.c @ 15177:5a7648191611

[gaim-migrate @ 17964] Minor cleanup. No functionality change. Someone at work asked me if I just sit around and audit code all day. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 11 Dec 2006 22:03:18 +0000
parents 630b794db0c8
children 1a54e98534ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15168
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Displays messages on a new line, below the nick
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) 2004 Stu Tomlinson <stu@nosnilmot.com>
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * modify it under the terms of the GNU General Public License
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * as published by the Free Software Foundation; either version 2
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * of the License, or (at your option) any later version.
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * GNU General Public License for more details.
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 #include "internal.h"
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 #include <string.h>
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <conversation.h>
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include <debug.h>
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include <plugin.h>
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #include <signals.h>
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include <util.h>
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #include <version.h>
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 static gboolean
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 addnewline_msg_cb(GaimAccount *account, char *sender, char **message,
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 GaimConversation *conv, int *flags, void *data)
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 {
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 if (g_ascii_strncasecmp(*message, "/me ", strlen("/me "))) {
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 char *tmp = g_strdup_printf("\n%s", *message);
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 g_free(*message);
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 *message = tmp;
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 }
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 return FALSE;
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 }
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 static gboolean
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 plugin_load(GaimPlugin *plugin)
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 {
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 void *conversation = gaim_conversations_get_handle();
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 gaim_signal_connect(conversation, "displaying-im-msg",
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 gaim_signal_connect(conversation, "displaying-chat-msg",
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 gaim_signal_connect(conversation, "receiving-im-msg",
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 gaim_signal_connect(conversation, "receiving-chat-msg",
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL);
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 return TRUE;
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 }
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 static GaimPluginInfo info =
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 {
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 GAIM_PLUGIN_MAGIC, /**< magic */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 GAIM_MAJOR_VERSION, /**< major version */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 GAIM_MINOR_VERSION, /**< minor version */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 GAIM_PLUGIN_STANDARD, /**< type */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 NULL, /**< ui_requirement */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 0, /**< flags */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 NULL, /**< dependencies */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 GAIM_PRIORITY_DEFAULT, /**< priority */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 "core-plugin_pack-newline", /**< id */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 N_("New Line"), /**< name */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 VERSION, /**< version */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 N_("Prepends a newline to displayed message."), /** summary */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 N_("Prepends a newline to messages so that the "
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 "test of the message appears below the "
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 "screen name in the conversation window."), /** description */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 GAIM_WEBSITE, /**< homepage */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 plugin_load, /**< load */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 NULL, /**< unload */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 NULL, /**< destroy */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 NULL, /**< ui_info */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 NULL, /**< extra_info */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 NULL, /**< prefs_info */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 NULL /**< actions */
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 };
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 static void
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 init_plugin(GaimPlugin *plugin) {
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 }
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94
630b794db0c8 [gaim-migrate @ 17954]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 GAIM_INIT_PLUGIN(lastseen, init_plugin, info)