Mercurial > pidgin
annotate console/plugins/gnthistory.c @ 15328:f19b9b39d71a
[gaim-migrate @ 18119]
sf patch #1629012, from betalb
Use hardcoded invisible char only if the default is *
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 13 Jan 2007 18:46:55 +0000 |
parents | c7651586e27b |
children |
rev | line source |
---|---|
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 /** |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 * @file gnthistory.c Show log from previous conversation |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 * |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 * Copyright (C) 2006 Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 * |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 * (at your option) any later version. |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 * |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 * GNU General Public License for more details. |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 * |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 */ |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 /* Ripped from gtk/plugins/history.c */ |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 #include "internal.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 #include "conversation.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 #include "debug.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 #include "log.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 #include "notify.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 #include "prefs.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 #include "signals.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #include "util.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 #include "version.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 #include "gntplugin.h" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 #define HISTORY_PLUGIN_ID "gnt-history" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 #define HISTORY_SIZE (4 * 1024) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 static void historize(GaimConversation *c) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 GaimAccount *account = gaim_conversation_get_account(c); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 const char *name = gaim_conversation_get_name(c); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 GaimConversationType convtype; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 GList *logs = NULL; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 const char *alias = name; |
14787
584da235633e
[gaim-migrate @ 17551]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14783
diff
changeset
|
47 GaimLogReadFlags flags; |
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 char *history; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 char *header; |
14234
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14223
diff
changeset
|
50 GaimMessageFlags mflag; |
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 convtype = gaim_conversation_get_type(c); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 if (convtype == GAIM_CONV_TYPE_IM) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 GSList *buddies; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 GSList *cur; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 /* If we're not logging, don't show anything. |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 * Otherwise, we might show a very old log. */ |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 if (!gaim_prefs_get_bool("/core/logging/log_ims")) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 return; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 /* Find buddies for this conversation. */ |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 buddies = gaim_find_buddies(account, name); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 /* If we found at least one buddy, save the first buddy's alias. */ |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 if (buddies != NULL) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 alias = gaim_buddy_get_contact_alias((GaimBuddy *)buddies->data); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 for (cur = buddies; cur != NULL; cur = cur->next) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 GaimBlistNode *node = cur->data; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 GaimBlistNode *node2; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 alias = gaim_buddy_get_contact_alias((GaimBuddy *)node); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 /* We've found a buddy that matches this conversation. It's part of a |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 * GaimContact with more than one GaimBuddy. Loop through the GaimBuddies |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 * in the contact and get all the logs. */ |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 for (node2 = node->parent->child ; node2 != NULL ; node2 = node2->next) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 logs = g_list_concat( |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 gaim_log_get_logs(GAIM_LOG_IM, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 gaim_buddy_get_name((GaimBuddy *)node2), |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 gaim_buddy_get_account((GaimBuddy *)node2)), |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 logs); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 break; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 g_slist_free(buddies); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 if (logs == NULL) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 logs = gaim_log_get_logs(GAIM_LOG_IM, name, account); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 else |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 logs = g_list_sort(logs, gaim_log_compare); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 else if (convtype == GAIM_CONV_TYPE_CHAT) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 /* If we're not logging, don't show anything. |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 * Otherwise, we might show a very old log. */ |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 if (!gaim_prefs_get_bool("/core/logging/log_chats")) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 return; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 logs = gaim_log_get_logs(GAIM_LOG_CHAT, name, account); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 if (logs == NULL) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 return; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 |
14234
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14223
diff
changeset
|
113 mflag = GAIM_MESSAGE_NO_LOG | GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_DELAYED; |
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 history = gaim_log_read((GaimLog*)logs->data, &flags); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), alias, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 gaim_date_format_full(localtime(&((GaimLog *)logs->data)->time))); |
14234
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14223
diff
changeset
|
118 gaim_conversation_write(c, "", header, mflag, time(NULL)); |
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 g_free(header); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 |
14787
584da235633e
[gaim-migrate @ 17551]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14783
diff
changeset
|
121 if (flags & GAIM_LOG_READ_NO_NEWLINE) |
584da235633e
[gaim-migrate @ 17551]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14783
diff
changeset
|
122 gaim_str_strip_char(history, '\n'); |
14234
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14223
diff
changeset
|
123 gaim_conversation_write(c, "", history, mflag, time(NULL)); |
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 g_free(history); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 |
14234
04bdbbefbd1d
[gaim-migrate @ 16916]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14223
diff
changeset
|
126 gaim_conversation_write(c, "", "<hr>", mflag, time(NULL)); |
14223
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 g_list_foreach(logs, (GFunc)gaim_log_free, NULL); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 g_list_free(logs); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 static void |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 history_prefs_check(GaimPlugin *plugin) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 if (!gaim_prefs_get_bool("/core/logging/log_ims") && |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 !gaim_prefs_get_bool("/core/logging/log_chats")) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 gaim_notify_warning(plugin, NULL, _("History Plugin Requires Logging"), |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 "Enabling logs for instant messages and/or chats will activate " |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 "history for the same conversation type(s).")); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 static void history_prefs_cb(const char *name, GaimPrefType type, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 gconstpointer val, gpointer data) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 history_prefs_check((GaimPlugin *)data); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 static gboolean |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 plugin_load(GaimPlugin *plugin) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 gaim_signal_connect(gaim_conversations_get_handle(), |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 "conversation-created", |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 plugin, GAIM_CALLBACK(historize), NULL); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 gaim_prefs_connect_callback(plugin, "/core/logging/log_ims", |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 history_prefs_cb, plugin); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 gaim_prefs_connect_callback(plugin, "/core/logging/log_chats", |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 history_prefs_cb, plugin); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 history_prefs_check(plugin); |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 return TRUE; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 static GaimPluginInfo info = |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 GAIM_PLUGIN_MAGIC, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 GAIM_MAJOR_VERSION, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 GAIM_MINOR_VERSION, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 GAIM_PLUGIN_STANDARD, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 NULL, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 0, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 NULL, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 GAIM_PRIORITY_DEFAULT, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 HISTORY_PLUGIN_ID, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 N_("GntHistory"), |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 VERSION, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 N_("Shows recently logged conversations in new conversations."), |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 N_("When a new conversation is opened this plugin will insert " |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 "the last conversation into the current conversation."), |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 "Sean Egan <seanegan@gmail.com>\n" |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 "Sadrul H Chowdhury <sadrul@users.sourceforge.net>", |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 GAIM_WEBSITE, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 plugin_load, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 NULL, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 NULL, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 NULL, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 NULL, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 NULL, |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 NULL |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 }; |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 static void |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 init_plugin(GaimPlugin *plugin) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 { |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 } |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 GAIM_INIT_PLUGIN(gnthistory, init_plugin, info) |
7c560c01b8f9
[gaim-migrate @ 16904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 |