annotate plugins/history.c @ 11605:f36471a3c258

[gaim-migrate @ 13876] History plugin should no longer speak unless spoken to, or something like that. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 04 Oct 2005 02:01:07 +0000
parents 17142948653e
children fa17fc619f17
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /* Puts last 4k of log in new conversations a la Everybuddy (and then
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * stolen by Trillian "Pro") */
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
4 #include "internal.h"
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8993
diff changeset
5 #include "gtkgaim.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
6
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
7 #include "conversation.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
8 #include "debug.h"
7433
6fdc55dd636a [gaim-migrate @ 8038]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
9 #include "log.h"
11217
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
10 #include "notify.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
11 #include "prefs.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
12 #include "signals.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
13 #include "util.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
14 #include "version.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
15
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
16 #include "gtkconv.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
17 #include "gtkimhtml.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
18 #include "gtkplugin.h"
4202
59751fe608c5 [gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents: 4113
diff changeset
19
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6063
diff changeset
20 #define HISTORY_PLUGIN_ID "gtk-history"
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
22 #define HISTORY_SIZE (4 * 1024)
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23
8913
d729311f6352 [gaim-migrate @ 9683]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
24 static gboolean _scroll_imhtml_to_end(gpointer data)
d729311f6352 [gaim-migrate @ 9683]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
25 {
d729311f6352 [gaim-migrate @ 9683]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
26 GtkIMHtml *imhtml = data;
d729311f6352 [gaim-migrate @ 9683]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
27 gtk_imhtml_scroll_to_end(GTK_IMHTML(imhtml));
d729311f6352 [gaim-migrate @ 9683]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
28 g_object_unref(G_OBJECT(imhtml));
d729311f6352 [gaim-migrate @ 9683]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
29 return FALSE;
d729311f6352 [gaim-migrate @ 9683]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
30 }
d729311f6352 [gaim-migrate @ 9683]
Luke Schierer <lschiere@pidgin.im>
parents: 8898
diff changeset
31
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
32 static void historize(GaimConversation *c)
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 {
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
34 GaimAccount *account = gaim_conversation_get_account(c);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
35 const char *name = gaim_conversation_get_name(c);
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8749
diff changeset
36 GaimConversationType convtype;
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
37 GList *logs = NULL;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
38 const char *alias = name;
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7433
diff changeset
39 guint flags;
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
40 char *history;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
41 GaimGtkConversation *gtkconv;
3602
a9cf9903bd74 [gaim-migrate @ 3713]
Luke Schierer <lschiere@pidgin.im>
parents: 3598
diff changeset
42 GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS;
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
43 time_t tm;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
44 char day[64];
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
45 char *header;
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8749
diff changeset
46
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8749
diff changeset
47 convtype = gaim_conversation_get_type(c);
11605
f36471a3c258 [gaim-migrate @ 13876]
Tim Ringenbach <marv@pidgin.im>
parents: 11338
diff changeset
48 gtkconv = GAIM_GTK_CONVERSATION(c);
f36471a3c258 [gaim-migrate @ 13876]
Tim Ringenbach <marv@pidgin.im>
parents: 11338
diff changeset
49 if (convtype == GAIM_CONV_TYPE_IM && g_list_length(gtkconv->convs) < 2)
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
50 {
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
51 GSList *buddies;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
52 GSList *cur;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
53
11217
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
54 /* If we're not logging, don't show anything.
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
55 * Otherwise, we might show a very old log. */
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
56 if (!gaim_prefs_get_bool("/core/logging/log_ims"))
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
57 return;
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
58
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
59 /* Find buddies for this conversation. */
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
60 buddies = gaim_find_buddies(account, name);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
61
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
62 /* If we found at least one buddy, save the first buddy's alias. */
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
63 if (buddies != NULL)
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
64 alias = gaim_buddy_get_contact_alias((GaimBuddy *)buddies->data);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
65
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
66 for (cur = buddies; cur != NULL; cur = cur->next)
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
67 {
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
68 GaimBlistNode *node = cur->data;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
69 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL)))
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
70 {
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
71 GaimBlistNode *node2;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
72
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
73 alias = gaim_buddy_get_contact_alias((GaimBuddy *)node);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
74
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
75 /* We've found a buddy that matches this conversation. It's part of a
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
76 * GaimContact with more than one GaimBuddy. Loop through the GaimBuddies
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
77 * in the contact and get all the logs. */
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
78 for (node2 = node->parent->child ; node2 != NULL ; node2 = node2->next)
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
79 {
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
80 logs = g_list_concat(
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
81 gaim_log_get_logs(GAIM_LOG_IM,
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
82 gaim_buddy_get_name((GaimBuddy *)node2),
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
83 gaim_buddy_get_account((GaimBuddy *)node2)),
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
84 logs);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
85 }
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
86 break;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
87 }
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
88 }
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
89 g_slist_free(buddies);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
90
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
91 if (logs == NULL)
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
92 logs = gaim_log_get_logs(GAIM_LOG_IM, name, account);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
93 else
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
94 logs = g_list_sort(logs, gaim_log_compare);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
95 }
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11318
diff changeset
96 else if (convtype == GAIM_CONV_TYPE_CHAT)
11217
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
97 {
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
98 /* If we're not logging, don't show anything.
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
99 * Otherwise, we might show a very old log. */
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
100 if (!gaim_prefs_get_bool("/core/logging/log_chats"))
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
101 return;
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
102
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
103 logs = gaim_log_get_logs(GAIM_LOG_CHAT, name, account);
11217
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
104 }
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7433
diff changeset
105
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
106 if (logs == NULL)
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 return;
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8749
diff changeset
108
7433
6fdc55dd636a [gaim-migrate @ 8038]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
109 history = gaim_log_read((GaimLog*)logs->data, &flags);
6fdc55dd636a [gaim-migrate @ 8038]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
110 gtkconv = GAIM_GTK_CONVERSATION(c);
6fdc55dd636a [gaim-migrate @ 8038]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
111 if (flags & GAIM_LOG_READ_NO_NEWLINE)
3602
a9cf9903bd74 [gaim-migrate @ 3713]
Luke Schierer <lschiere@pidgin.im>
parents: 3598
diff changeset
112 options |= GTK_IMHTML_NO_NEWLINE;
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
113
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
114 tm = ((GaimLog *)logs->data)->time;
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
115 gaim_strftime(day, sizeof(day), "%c", localtime(&tm));
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
116 header = g_strdup_printf("<b>Conversation with %s on %s:</b><br>", alias, day);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
117 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), header, options);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
118 g_free(header);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
119
7433
6fdc55dd636a [gaim-migrate @ 8038]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
120 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), history, options);
6fdc55dd636a [gaim-migrate @ 8038]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
121 g_free(history);
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8749
diff changeset
122
11051
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
123 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<hr>", options);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
124
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
125 g_object_ref(G_OBJECT(gtkconv->imhtml));
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
126 g_idle_add(_scroll_imhtml_to_end, gtkconv->imhtml);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
127
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
128 g_list_foreach(logs, (GFunc)gaim_log_free, NULL);
5290afac047c [gaim-migrate @ 12989]
Richard Laager <rlaager@wiktel.com>
parents: 10764
diff changeset
129 g_list_free(logs);
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 }
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131
11217
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
132 static void
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
133 history_prefs_check(GaimPlugin *plugin)
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
134 {
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
135 if (!gaim_prefs_get_bool("/core/logging/log_ims") &&
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
136 !gaim_prefs_get_bool("/core/logging/log_chats"))
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
137 {
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
138 gaim_notify_warning(plugin, NULL, _("History Plugin Requires Logging"),
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
139 _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n"
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
140 "Enabling logs for instant messages and/or chats will activate "
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
141 "history for the same conversation type(s)."));
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
142 }
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
143 }
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
144
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
145 static void history_prefs_cb(const char *name, GaimPrefType type, gpointer val, gpointer data)
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
146 {
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
147 history_prefs_check((GaimPlugin *)data);
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
148 }
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
149
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
150 static gboolean
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
151 plugin_load(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
152 {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
153 gaim_signal_connect(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
154 "conversation-created",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
155 plugin, GAIM_CALLBACK(historize), NULL);
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156
11217
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
157 gaim_prefs_connect_callback(plugin, "/core/logging/log_ims",
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
158 history_prefs_cb, plugin);
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
159 gaim_prefs_connect_callback(plugin, "/core/logging/log_chats",
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
160 history_prefs_cb, plugin);
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
161
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
162 history_prefs_check(plugin);
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
163
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
164 return TRUE;
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 }
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
167 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
168 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
169 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
170 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9791
diff changeset
171 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
172 GAIM_PLUGIN_STANDARD,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
173 GAIM_GTK_PLUGIN_TYPE,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
174 0,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
175 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
176 GAIM_PRIORITY_DEFAULT,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
177 HISTORY_PLUGIN_ID,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
178 N_("History"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
179 VERSION,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
180 N_("Shows recently logged conversations in new conversations."),
11217
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
181 N_("When a new conversation is opened this plugin will insert "
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
182 "the last conversation into the current conversation.\n\n"
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
183 "The history plugin requires logging be enabled. Logging can "
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
184 "be enabled from Tools -> Preferences -> Logging. Enabling logs "
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
185 "for instant messages and/or chats will activate history for "
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
186 "the same conversation type(s)."
f854402837ba [gaim-migrate @ 13349]
Richard Laager <rlaager@wiktel.com>
parents: 11051
diff changeset
187 ),
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
188 "Sean Egan <bj91704@binghamton.edu>",
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6063
diff changeset
189 GAIM_WEBSITE,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
190 plugin_load,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
191 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
192 NULL,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
193 NULL,
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8913
diff changeset
194 NULL,
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11217
diff changeset
195 NULL,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
196 NULL
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
197 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
198
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
199 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5873
diff changeset
200 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
201 {
3598
c6f92ece3097 [gaim-migrate @ 3700]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
203
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5920
diff changeset
204 GAIM_INIT_PLUGIN(history, init_plugin, info)