Mercurial > pidgin.yaz
annotate pidgin/plugins/history.c @ 32619:17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
anything yet, and aren't used either.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 17 Sep 2011 05:27:30 +0000 |
parents | 1798b24a4fd5 |
children |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* Puts last 4k of log in new conversations a la Everybuddy (and then |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * stolen by Trillian "Pro") */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 #include "internal.h" |
15514 | 5 #include "pidgin.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 #include "log.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 #include "signals.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 #include "version.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 #include "gtkconv.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 #include "gtkimhtml.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 #include "gtkplugin.h" |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
19 #include "gtkwebview.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 #define HISTORY_PLUGIN_ID "gtk-history" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #define HISTORY_SIZE (4 * 1024) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
25 static gboolean _scroll_webview_to_end(gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 { |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
27 GtkWebView *webview = data; |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
28 gtk_webview_scroll_to_end(GTK_WEBVIEW(webview), FALSE); |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
29 g_object_unref(G_OBJECT(webview)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 |
15823 | 33 static void historize(PurpleConversation *c) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 { |
15823 | 35 PurpleAccount *account = purple_conversation_get_account(c); |
36 const char *name = purple_conversation_get_name(c); | |
37 PurpleConversationType convtype; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 GList *logs = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 const char *alias = name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 guint flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 char *history; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
42 PidginConversation *gtkconv; |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
43 #if 0 |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
44 /* FIXME: WebView has no options */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS; |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
46 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 char *header; |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
48 #if 0 |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
49 /* FIXME: WebView has no protocol setting */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 char *protocol; |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
51 #endif |
20899
3969ac8237e3
Another patch from QuLogic. This one makes sure the History plugin properly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20085
diff
changeset
|
52 char *escaped_alias; |
22927
7c8275692b3b
Remove a compile warning.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22869
diff
changeset
|
53 const char *header_date; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 |
15823 | 55 convtype = purple_conversation_get_type(c); |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
56 gtkconv = PIDGIN_CONVERSATION(c); |
24497
f10aba5592c6
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents:
22927
diff
changeset
|
57 g_return_if_fail(gtkconv != NULL); |
20085 | 58 |
24497
f10aba5592c6
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents:
22927
diff
changeset
|
59 /* An IM which is the first active conversation. */ |
f10aba5592c6
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents:
22927
diff
changeset
|
60 g_return_if_fail(gtkconv->convs != NULL); |
f10aba5592c6
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents:
22927
diff
changeset
|
61 if (convtype == PURPLE_CONV_TYPE_IM && !gtkconv->convs->next) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 GSList *buddies; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 GSList *cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 /* If we're not logging, don't show anything. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 * Otherwise, we might show a very old log. */ |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15823
diff
changeset
|
68 if (!purple_prefs_get_bool("/purple/logging/log_ims")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 /* Find buddies for this conversation. */ |
25407
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
72 buddies = purple_find_buddies(account, name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 /* If we found at least one buddy, save the first buddy's alias. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 if (buddies != NULL) |
15823 | 76 alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
25407
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
78 for (cur = buddies; cur != NULL; cur = cur->next) |
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
79 { |
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
80 PurpleBlistNode *node = cur->data; |
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
81 PurpleBlistNode *prev = purple_blist_node_get_sibling_prev(node); |
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
82 PurpleBlistNode *next = purple_blist_node_get_sibling_next(node); |
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
83 if ((node != NULL) && ((prev != NULL) || (next != NULL))) |
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
84 { |
15823 | 85 PurpleBlistNode *node2; |
25300
ed13551a592a
updated the pidgin plugins for the blist struct hiding
Gary Kramlich <grim@reaperworld.com>
parents:
22927
diff
changeset
|
86 PurpleBlistNode *parent = purple_blist_node_get_parent(node); |
ed13551a592a
updated the pidgin plugins for the blist struct hiding
Gary Kramlich <grim@reaperworld.com>
parents:
22927
diff
changeset
|
87 PurpleBlistNode *child = purple_blist_node_get_first_child(parent); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
15823 | 89 alias = purple_buddy_get_contact_alias((PurpleBuddy *)node); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 /* We've found a buddy that matches this conversation. It's part of a |
15823 | 92 * PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 * in the contact and get all the logs. */ |
25300
ed13551a592a
updated the pidgin plugins for the blist struct hiding
Gary Kramlich <grim@reaperworld.com>
parents:
22927
diff
changeset
|
94 for (node2 = child ; node2 != NULL ; node2 = purple_blist_node_get_sibling_next(node2)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 { |
25407
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
96 logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM, |
15823 | 97 purple_buddy_get_name((PurpleBuddy *)node2), |
98 purple_buddy_get_account((PurpleBuddy *)node2)), | |
25407
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
99 logs); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 break; |
25407
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
102 } |
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
103 } |
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
104 g_slist_free(buddies); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 if (logs == NULL) |
15823 | 107 logs = purple_log_get_logs(PURPLE_LOG_IM, name, account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 else |
15823 | 109 logs = g_list_sort(logs, purple_log_compare); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 } |
15823 | 111 else if (convtype == PURPLE_CONV_TYPE_CHAT) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 /* If we're not logging, don't show anything. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 * Otherwise, we might show a very old log. */ |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15823
diff
changeset
|
115 if (!purple_prefs_get_bool("/purple/logging/log_chats")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 |
15823 | 118 logs = purple_log_get_logs(PURPLE_LOG_CHAT, name, account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 if (logs == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
15823 | 124 history = purple_log_read((PurpleLog*)logs->data, &flags); |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
125 gtkconv = PIDGIN_CONVERSATION(c); |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
126 #if 0 |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
127 /* FIXME: WebView has no options */ |
15823 | 128 if (flags & PURPLE_LOG_READ_NO_NEWLINE) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 options |= GTK_IMHTML_NO_NEWLINE; |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
130 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
132 #if 0 |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
133 /* FIXME: WebView has no protocol setting */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 protocol = g_strdup(gtk_imhtml_get_protocol_name(GTK_IMHTML(gtkconv->imhtml))); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), |
25407
ea325948453c
Fix the indentation in this function
Mark Doliner <mark@kingant.net>
parents:
25334
diff
changeset
|
136 purple_account_get_protocol_name(((PurpleLog*)logs->data)->account)); |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
137 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
139 if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview))) |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
140 gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<BR>"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 |
20899
3969ac8237e3
Another patch from QuLogic. This one makes sure the History plugin properly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20085
diff
changeset
|
142 escaped_alias = g_markup_escape_text(alias, -1); |
22869
cf2ac6f0758a
A patch from poizon. This was intended to fix a bug, but I just fixed that
Mihály Mészáros <poizon@sth.sze.hu>
parents:
21030
diff
changeset
|
143 |
cf2ac6f0758a
A patch from poizon. This was intended to fix a bug, but I just fixed that
Mihály Mészáros <poizon@sth.sze.hu>
parents:
21030
diff
changeset
|
144 if (((PurpleLog *)logs->data)->tm) |
cf2ac6f0758a
A patch from poizon. This was intended to fix a bug, but I just fixed that
Mihály Mészáros <poizon@sth.sze.hu>
parents:
21030
diff
changeset
|
145 header_date = purple_date_format_full(((PurpleLog *)logs->data)->tm); |
cf2ac6f0758a
A patch from poizon. This was intended to fix a bug, but I just fixed that
Mihály Mészáros <poizon@sth.sze.hu>
parents:
21030
diff
changeset
|
146 else |
cf2ac6f0758a
A patch from poizon. This was intended to fix a bug, but I just fixed that
Mihály Mészáros <poizon@sth.sze.hu>
parents:
21030
diff
changeset
|
147 header_date = purple_date_format_full(localtime(&((PurpleLog *)logs->data)->time)); |
cf2ac6f0758a
A patch from poizon. This was intended to fix a bug, but I just fixed that
Mihály Mészáros <poizon@sth.sze.hu>
parents:
21030
diff
changeset
|
148 |
cf2ac6f0758a
A patch from poizon. This was intended to fix a bug, but I just fixed that
Mihály Mészáros <poizon@sth.sze.hu>
parents:
21030
diff
changeset
|
149 header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), escaped_alias, header_date); |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
150 gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), header); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 g_free(header); |
20899
3969ac8237e3
Another patch from QuLogic. This one makes sure the History plugin properly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20085
diff
changeset
|
152 g_free(escaped_alias); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 g_strchomp(history); |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
155 gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), history); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 g_free(history); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
158 gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<hr>"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
160 #if 0 |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
161 /* FIXME: WebView has no protocol setting */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 g_free(protocol); |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
164 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
32598
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
166 g_object_ref(G_OBJECT(gtkconv->webview)); |
1798b24a4fd5
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25407
diff
changeset
|
167 g_idle_add(_scroll_webview_to_end, gtkconv->webview); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 |
15823 | 169 g_list_foreach(logs, (GFunc)purple_log_free, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 g_list_free(logs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 static void |
15823 | 174 history_prefs_check(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 { |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15823
diff
changeset
|
176 if (!purple_prefs_get_bool("/purple/logging/log_ims") && |
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15823
diff
changeset
|
177 !purple_prefs_get_bool("/purple/logging/log_chats")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 { |
15823 | 179 purple_notify_warning(plugin, NULL, _("History Plugin Requires Logging"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 "Enabling logs for instant messages and/or chats will activate " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 "history for the same conversation type(s).")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 |
15823 | 186 static void history_prefs_cb(const char *name, PurplePrefType type, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 gconstpointer val, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 { |
15823 | 189 history_prefs_check((PurplePlugin *)data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 static gboolean |
15823 | 193 plugin_load(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 { |
15823 | 195 purple_signal_connect(purple_conversations_get_handle(), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 "conversation-created", |
15823 | 197 plugin, PURPLE_CALLBACK(historize), NULL); |
20085 | 198 /* XXX: Do we want to listen to pidgin's "conversation-displayed" signal? */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15823
diff
changeset
|
200 purple_prefs_connect_callback(plugin, "/purple/logging/log_ims", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 history_prefs_cb, plugin); |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15823
diff
changeset
|
202 purple_prefs_connect_callback(plugin, "/purple/logging/log_chats", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 history_prefs_cb, plugin); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 history_prefs_check(plugin); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
15823 | 210 static PurplePluginInfo info = |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 { |
15823 | 212 PURPLE_PLUGIN_MAGIC, |
213 PURPLE_MAJOR_VERSION, | |
214 PURPLE_MINOR_VERSION, | |
215 PURPLE_PLUGIN_STANDARD, | |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
216 PIDGIN_PLUGIN_TYPE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 0, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 NULL, |
15823 | 219 PURPLE_PRIORITY_DEFAULT, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 HISTORY_PLUGIN_ID, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 N_("History"), |
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
21000
diff
changeset
|
222 DISPLAY_VERSION, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 N_("Shows recently logged conversations in new conversations."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 N_("When a new conversation is opened this plugin will insert " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 "the last conversation into the current conversation."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 "Sean Egan <seanegan@gmail.com>", |
15823 | 227 PURPLE_WEBSITE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 plugin_load, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 NULL, |
16678
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
234 NULL, |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
235 |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
236 /* padding */ |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
237 NULL, |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
238 NULL, |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
239 NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 NULL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 static void |
15823 | 244 init_plugin(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
15823 | 248 PURPLE_INIT_PLUGIN(history, init_plugin, info) |