pidgin/plugins/history.c

Sun, 01 Nov 2020 02:42:18 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 01 Nov 2020 02:42:18 -0600
changeset 40574
98384d15c7a0
parent 40360
e21f3bbcc2a5
permissions
-rw-r--r--

Remove the winprefs plugin as it only interacts with the buddy list window which we will soon be removing

Testing Done:
Built locally, which means I didn't test it on windows, but it's just deleting windows stuff so it should be fine.

Reviewed at https://reviews.imfreedom.org/r/190/

3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1 /* Puts last 4k of log in new conversations a la Everybuddy (and then
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2 * stolen by Trillian "Pro") */
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
3
9791
f5c5bda0b96b [gaim-migrate @ 10659]
Gary Kramlich <grim@pidgin.im>
parents: 8993
diff changeset
4 #include "internal.h"
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
5 #include "pidgin.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
6
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 39897
diff changeset
7 #include <purple.h>
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
8
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
9 #include "gtkconv.h"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
10 #include "gtkplugin.h"
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
11 #include "gtkwebview.h"
4202
8b92de3b1c07 [gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents: 4113
diff changeset
12
6371
e92b66ee5518 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6063
diff changeset
13 #define HISTORY_PLUGIN_ID "gtk-history"
3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
15 #define HISTORY_SIZE (4 * 1024)
3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
17 static gboolean _scroll_webview_to_end(gpointer data)
8913
8380459a6da6 [gaim-migrate @ 9683]
Tim Ringenbach <marv@pidgin.im>
parents: 8898
diff changeset
18 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35312
diff changeset
19 PidginWebView *webview = data;
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35312
diff changeset
20 pidgin_webview_scroll_to_end(PIDGIN_WEBVIEW(webview), FALSE);
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
21 g_object_unref(G_OBJECT(webview));
8913
8380459a6da6 [gaim-migrate @ 9683]
Tim Ringenbach <marv@pidgin.im>
parents: 8898
diff changeset
22 return FALSE;
8380459a6da6 [gaim-migrate @ 9683]
Tim Ringenbach <marv@pidgin.im>
parents: 8898
diff changeset
23 }
8380459a6da6 [gaim-migrate @ 9683]
Tim Ringenbach <marv@pidgin.im>
parents: 8898
diff changeset
24
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
25 static void historize(PurpleConversation *c)
3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
26 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
27 PurpleAccount *account = purple_conversation_get_account(c);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
28 const char *name = purple_conversation_get_name(c);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
29 GList *logs = NULL;
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
30 const char *alias = name;
7440
e0d8f6bc36c2 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7433
diff changeset
31 guint flags;
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
32 char *history;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
33 PidginConversation *gtkconv;
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
34 #if 0
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
35 /* FIXME: WebView has no options */
3602
b64dd6cf579a [gaim-migrate @ 3713]
Luke Schierer <lschiere@pidgin.im>
parents: 3598
diff changeset
36 GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS;
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
37 #endif
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
38 char *header;
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
39 #if 0
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
40 /* FIXME: WebView has no protocol setting */
11814
5003711283c0 [gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents: 11605
diff changeset
41 char *protocol;
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
42 #endif
20975
bdcc492d3fbe Another patch from QuLogic. This one makes sure the History plugin properly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20342
diff changeset
43 char *escaped_alias;
38620
b02941b9fa9a Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37245
diff changeset
44 GDateTime *dt;
b02941b9fa9a Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37245
diff changeset
45 gchar *header_date;
8898
85f5615bc27e [gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents: 8749
diff changeset
46
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
47 gtkconv = PIDGIN_CONVERSATION(c);
24816
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 23088
diff changeset
48 g_return_if_fail(gtkconv != NULL);
20342
8d080381b313 Fix #3127.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16749
diff changeset
49
24816
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 23088
diff changeset
50 /* An IM which is the first active conversation. */
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 23088
diff changeset
51 g_return_if_fail(gtkconv->convs != NULL);
34660
68c776e3436e Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 33235
diff changeset
52 if (PURPLE_IS_IM_CONVERSATION(c) && !gtkconv->convs->next)
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
53 {
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
54 GSList *buddies;
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
55 GSList *cur;
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
56
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
57 /* If we're not logging, don't show anything.
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
58 * Otherwise, we might show a very old log. */
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 15884
diff changeset
59 if (!purple_prefs_get_bool("/purple/logging/log_ims"))
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
60 return;
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
61
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
62 /* Find buddies for this conversation. */
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34699
diff changeset
63 buddies = purple_blist_find_buddies(account, name);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
64
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
65 /* If we found at least one buddy, save the first buddy's alias. */
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
66 if (buddies != NULL)
34740
9401f9b1ca68 Used GObject-style casts in plugins.
Ankit Vani <a@nevitus.org>
parents: 34728
diff changeset
67 alias = purple_buddy_get_contact_alias(PURPLE_BUDDY(buddies->data));
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
68
25880
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
69 for (cur = buddies; cur != NULL; cur = cur->next)
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
70 {
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
71 PurpleBlistNode *node = cur->data;
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
72 PurpleBlistNode *prev = purple_blist_node_get_sibling_prev(node);
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
73 PurpleBlistNode *next = purple_blist_node_get_sibling_next(node);
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
74 if ((node != NULL) && ((prev != NULL) || (next != NULL)))
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
75 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
76 PurpleBlistNode *node2;
24956
05aa5ba1eab4 updated the pidgin plugins for the blist struct hiding
Gary Kramlich <grim@reaperworld.com>
parents: 23088
diff changeset
77 PurpleBlistNode *parent = purple_blist_node_get_parent(node);
05aa5ba1eab4 updated the pidgin plugins for the blist struct hiding
Gary Kramlich <grim@reaperworld.com>
parents: 23088
diff changeset
78 PurpleBlistNode *child = purple_blist_node_get_first_child(parent);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
79
34740
9401f9b1ca68 Used GObject-style casts in plugins.
Ankit Vani <a@nevitus.org>
parents: 34728
diff changeset
80 alias = purple_buddy_get_contact_alias(PURPLE_BUDDY(node));
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
81
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
82 /* We've found a buddy that matches this conversation. It's part of a
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
83 * PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
84 * in the contact and get all the logs. */
24956
05aa5ba1eab4 updated the pidgin plugins for the blist struct hiding
Gary Kramlich <grim@reaperworld.com>
parents: 23088
diff changeset
85 for (node2 = child ; node2 != NULL ; node2 = purple_blist_node_get_sibling_next(node2))
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
86 {
25880
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
87 logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM,
34740
9401f9b1ca68 Used GObject-style casts in plugins.
Ankit Vani <a@nevitus.org>
parents: 34728
diff changeset
88 purple_buddy_get_name(PURPLE_BUDDY(node2)),
9401f9b1ca68 Used GObject-style casts in plugins.
Ankit Vani <a@nevitus.org>
parents: 34728
diff changeset
89 purple_buddy_get_account(PURPLE_BUDDY(node2))),
25880
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
90 logs);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
91 }
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
92 break;
25880
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
93 }
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
94 }
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
95 g_slist_free(buddies);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
96
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
97 if (logs == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
98 logs = purple_log_get_logs(PURPLE_LOG_IM, name, account);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
99 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
100 logs = g_list_sort(logs, purple_log_compare);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
101 }
34660
68c776e3436e Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 33235
diff changeset
102 else if (PURPLE_IS_CHAT_CONVERSATION(c))
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
103 {
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
104 /* If we're not logging, don't show anything.
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
105 * Otherwise, we might show a very old log. */
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 15884
diff changeset
106 if (!purple_prefs_get_bool("/purple/logging/log_chats"))
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
107 return;
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
108
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
109 logs = purple_log_get_logs(PURPLE_LOG_CHAT, name, account);
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
110 }
7440
e0d8f6bc36c2 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7433
diff changeset
111
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
112 if (logs == NULL)
3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
113 return;
8898
85f5615bc27e [gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents: 8749
diff changeset
114
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
115 history = purple_log_read((PurpleLog*)logs->data, &flags);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
116 gtkconv = PIDGIN_CONVERSATION(c);
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
117 #if 0
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
118 /* FIXME: WebView has no options */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
119 if (flags & PURPLE_LOG_READ_NO_NEWLINE)
3602
b64dd6cf579a [gaim-migrate @ 3713]
Luke Schierer <lschiere@pidgin.im>
parents: 3598
diff changeset
120 options |= GTK_IMHTML_NO_NEWLINE;
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
121 #endif
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
122
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
123 #if 0
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
124 /* FIXME: WebView has no protocol setting */
11814
5003711283c0 [gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents: 11605
diff changeset
125 protocol = g_strdup(gtk_imhtml_get_protocol_name(GTK_IMHTML(gtkconv->imhtml)));
5003711283c0 [gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents: 11605
diff changeset
126 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
25880
05694862fe8b Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents: 24990
diff changeset
127 purple_account_get_protocol_name(((PurpleLog*)logs->data)->account));
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
128 #endif
11814
5003711283c0 [gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents: 11605
diff changeset
129
33235
dbf53ee374bc Fix compile error for now.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
130 #if 0
dbf53ee374bc Fix compile error for now.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
131 /* TODO WebKit: Do this properly... */
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35312
diff changeset
132 if (!pidgin_webview_is_empty(PIDGIN_WEBVIEW(gtkconv->webview)))
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35312
diff changeset
133 pidgin_webview_append_html(PIDGIN_WEBVIEW(gtkconv->webview), "<BR>");
33235
dbf53ee374bc Fix compile error for now.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
134 #endif
13338
a643484b9f9c [gaim-migrate @ 15707]
Richard Laager <rlaager@pidgin.im>
parents: 13333
diff changeset
135
20975
bdcc492d3fbe Another patch from QuLogic. This one makes sure the History plugin properly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20342
diff changeset
136 escaped_alias = g_markup_escape_text(alias, -1);
23062
9b984c0fda98 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: 21106
diff changeset
137
38620
b02941b9fa9a Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37245
diff changeset
138 dt = g_date_time_to_local(((PurpleLog *)logs->data)->time);
b02941b9fa9a Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37245
diff changeset
139 header_date = g_date_time_format(dt, "%c");
b02941b9fa9a Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37245
diff changeset
140 g_date_time_unref(dt);
23062
9b984c0fda98 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: 21106
diff changeset
141
9b984c0fda98 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: 21106
diff changeset
142 header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), escaped_alias, header_date);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35312
diff changeset
143 pidgin_webview_append_html(PIDGIN_WEBVIEW(gtkconv->webview), header);
38620
b02941b9fa9a Change purple_log_new to use GDateTime.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37245
diff changeset
144 g_free(header_date);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
145 g_free(header);
20975
bdcc492d3fbe Another patch from QuLogic. This one makes sure the History plugin properly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20342
diff changeset
146 g_free(escaped_alias);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
147
13338
a643484b9f9c [gaim-migrate @ 15707]
Richard Laager <rlaager@pidgin.im>
parents: 13333
diff changeset
148 g_strchomp(history);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35312
diff changeset
149 pidgin_webview_append_html(PIDGIN_WEBVIEW(gtkconv->webview), history);
7433
76909f0112c5 [gaim-migrate @ 8038]
Sean Egan <seanegan@pidgin.im>
parents: 7261
diff changeset
150 g_free(history);
8898
85f5615bc27e [gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents: 8749
diff changeset
151
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35312
diff changeset
152 pidgin_webview_append_html(PIDGIN_WEBVIEW(gtkconv->webview), "<hr>");
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
153
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
154 #if 0
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
155 /* FIXME: WebView has no protocol setting */
11814
5003711283c0 [gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents: 11605
diff changeset
156 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol);
5003711283c0 [gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents: 11605
diff changeset
157 g_free(protocol);
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
158 #endif
11814
5003711283c0 [gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents: 11605
diff changeset
159
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
160 g_object_ref(G_OBJECT(gtkconv->webview));
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25880
diff changeset
161 g_idle_add(_scroll_webview_to_end, gtkconv->webview);
11051
837b4b6ef10d [gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 10764
diff changeset
162
39897
16b440d4ab36 Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39562
diff changeset
163 g_list_free_full(logs, (GDestroyNotify)purple_log_free);
3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
164 }
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
165
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
166 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
167 history_prefs_check(PurplePlugin *plugin)
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
168 {
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 15884
diff changeset
169 if (!purple_prefs_get_bool("/purple/logging/log_ims") &&
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 15884
diff changeset
170 !purple_prefs_get_bool("/purple/logging/log_chats"))
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
171 {
39562
40dca5c3593a Update plugins that were referring to menus with ->'s to use the unicode arrows as well
Gary Kramlich <grim@reaperworld.com>
parents: 38620
diff changeset
172 /* Translators: Please maintain the use of ⇦ or ⇨ to represent the menu hierarchy */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
173 purple_notify_warning(plugin, NULL, _("History Plugin Requires Logging"),
39562
40dca5c3593a Update plugins that were referring to menus with ->'s to use the unicode arrows as well
Gary Kramlich <grim@reaperworld.com>
parents: 38620
diff changeset
174 _("Logging can be enabled from Tools ⇨ Preferences ⇨ Logging.\n\n"
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
175 "Enabling logs for instant messages and/or chats will activate "
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33235
diff changeset
176 "history for the same conversation type(s)."), NULL);
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
177 }
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
178 }
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
179
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
180 static void history_prefs_cb(const char *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12632
diff changeset
181 gconstpointer val, gpointer data)
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
182 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
183 history_prefs_check((PurplePlugin *)data);
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
184 }
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
185
36757
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
186 static PidginPluginInfo *
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
187 plugin_query(GError **error)
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
188 {
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
189 const gchar * const authors[] = {
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
190 "Sean Egan <seanegan@gmail.com>",
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
191 NULL
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
192 };
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
193
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
194 return pidgin_plugin_info_new(
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
195 "id", HISTORY_PLUGIN_ID,
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
196 "name", N_("History"),
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
197 "version", DISPLAY_VERSION,
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
198 "category", N_("User interface"),
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
199 "summary", N_("Shows recently logged conversations in new "
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
200 "conversations."),
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
201 "description", N_("When a new conversation is opened this plugin will "
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
202 "insert the last conversation into the current "
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
203 "conversation."),
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
204 "authors", authors,
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
205 "website", PURPLE_WEBSITE,
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
206 "abi-version", PURPLE_ABI_VERSION,
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
207 NULL
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
208 );
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
209 }
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
210
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
211 static gboolean
36757
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
212 plugin_load(PurplePlugin *plugin, GError **error)
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
213 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
214 purple_signal_connect(purple_conversations_get_handle(),
6485
3c7ba18e32f1 [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
215 "conversation-created",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
216 plugin, PURPLE_CALLBACK(historize), NULL);
20342
8d080381b313 Fix #3127.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16749
diff changeset
217 /* XXX: Do we want to listen to pidgin's "conversation-displayed" signal? */
3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 15884
diff changeset
219 purple_prefs_connect_callback(plugin, "/purple/logging/log_ims",
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
220 history_prefs_cb, plugin);
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 15884
diff changeset
221 purple_prefs_connect_callback(plugin, "/purple/logging/log_chats",
11217
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
222 history_prefs_cb, plugin);
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
223
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
224 history_prefs_check(plugin);
771bd94e6eec [gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents: 11051
diff changeset
225
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
226 return TRUE;
3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
227 }
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228
36757
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
229 static gboolean
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
230 plugin_unload(PurplePlugin *plugin, GError **error)
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
231 {
36757
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
232 return TRUE;
3598
03d03049ecd6 [gaim-migrate @ 3700]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
233 }
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5114
diff changeset
234
36757
2e04586cf6e8 Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
235 PURPLE_PLUGIN_INIT(history, plugin_query, plugin_load, plugin_unload);

mercurial