Sat, 21 Sep 2013 11:54:03 +0200
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
| 3598 | 1 | /* Puts last 4k of log in new conversations a la Everybuddy (and then |
| 2 | * stolen by Trillian "Pro") */ | |
| 3 | ||
| 9791 | 4 | #include "internal.h" |
| 15577 | 5 | #include "pidgin.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
6 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
7 | #include "conversation.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
8 | #include "debug.h" |
| 7433 | 9 | #include "log.h" |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
10 | #include "notify.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
11 | #include "prefs.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
12 | #include "signals.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
13 | #include "util.h" |
| 9943 | 14 | #include "version.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
15 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
16 | #include "gtkconv.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
17 | #include "gtkimhtml.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
18 | #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
|
19 | #include "gtkwebview.h" |
|
4202
8b92de3b1c07
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4113
diff
changeset
|
20 | |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6063
diff
changeset
|
21 | #define HISTORY_PLUGIN_ID "gtk-history" |
| 3598 | 22 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
23 | #define HISTORY_SIZE (4 * 1024) |
| 3598 | 24 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
25 | static gboolean _scroll_webview_to_end(gpointer data) |
| 8913 | 26 | { |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
27 | GtkWebView *webview = data; |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
28 | gtk_webview_scroll_to_end(GTK_WEBVIEW(webview), FALSE); |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
29 | g_object_unref(G_OBJECT(webview)); |
| 8913 | 30 | return FALSE; |
| 31 | } | |
| 32 | ||
| 15884 | 33 | static void historize(PurpleConversation *c) |
| 3598 | 34 | { |
| 15884 | 35 | PurpleAccount *account = purple_conversation_get_account(c); |
| 36 | const char *name = purple_conversation_get_name(c); | |
| 37 | PurpleConversationType convtype; | |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
38 | GList *logs = NULL; |
|
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
39 | const char *alias = name; |
| 7440 | 40 | guint flags; |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
41 | char *history; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
42 | 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
|
43 | #if 0 |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
44 | /* FIXME: WebView has no options */ |
| 3602 | 45 | 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
|
46 | #endif |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
47 | 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
|
48 | #if 0 |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
49 | /* FIXME: WebView has no protocol setting */ |
|
11814
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
50 | 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
|
51 | #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
|
52 | char *escaped_alias; |
|
23088
db14d7541088
Remove a compile warning.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23062
diff
changeset
|
53 | const char *header_date; |
|
8898
85f5615bc27e
[gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents:
8749
diff
changeset
|
54 | |
| 15884 | 55 | convtype = purple_conversation_get_type(c); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
56 | 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
|
57 | g_return_if_fail(gtkconv != NULL); |
| 20342 | 58 | |
|
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
|
59 | /* 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
|
60 | g_return_if_fail(gtkconv->convs != NULL); |
|
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
23088
diff
changeset
|
61 | if (convtype == PURPLE_CONV_TYPE_IM && !gtkconv->convs->next) |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
62 | { |
|
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
63 | GSList *buddies; |
|
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
64 | GSList *cur; |
|
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
65 | |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
66 | /* If we're not logging, don't show anything. |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
67 | * 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
|
68 | if (!purple_prefs_get_bool("/purple/logging/log_ims")) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
69 | return; |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
70 | |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
71 | /* Find buddies for this conversation. */ |
|
25880
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
72 | buddies = purple_find_buddies(account, name); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
73 | |
|
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
74 | /* 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
|
75 | if (buddies != NULL) |
| 15884 | 76 | alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
77 | |
|
25880
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
78 | for (cur = buddies; cur != NULL; cur = cur->next) |
|
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
79 | { |
|
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
80 | PurpleBlistNode *node = cur->data; |
|
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
81 | 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
|
82 | 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
|
83 | if ((node != NULL) && ((prev != NULL) || (next != NULL))) |
|
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
84 | { |
| 15884 | 85 | PurpleBlistNode *node2; |
|
24956
05aa5ba1eab4
updated the pidgin plugins for the blist struct hiding
Gary Kramlich <grim@reaperworld.com>
parents:
23088
diff
changeset
|
86 | 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
|
87 | PurpleBlistNode *child = purple_blist_node_get_first_child(parent); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
88 | |
| 15884 | 89 | alias = purple_buddy_get_contact_alias((PurpleBuddy *)node); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
90 | |
|
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
91 | /* We've found a buddy that matches this conversation. It's part of a |
| 15884 | 92 | * 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
|
93 | * 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
|
94 | 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
|
95 | { |
|
25880
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
96 | logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM, |
| 15884 | 97 | purple_buddy_get_name((PurpleBuddy *)node2), |
| 98 | purple_buddy_get_account((PurpleBuddy *)node2)), | |
|
25880
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
99 | logs); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
100 | } |
|
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
101 | break; |
|
25880
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
102 | } |
|
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
103 | } |
|
05694862fe8b
Fix the indentation in this function
Mark Doliner <markdoliner@pidgin.im>
parents:
24990
diff
changeset
|
104 | g_slist_free(buddies); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
105 | |
|
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
106 | if (logs == NULL) |
| 15884 | 107 | 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
|
108 | else |
| 15884 | 109 | logs = g_list_sort(logs, purple_log_compare); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
110 | } |
| 15884 | 111 | else if (convtype == PURPLE_CONV_TYPE_CHAT) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
112 | { |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
113 | /* If we're not logging, don't show anything. |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
114 | * 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
|
115 | if (!purple_prefs_get_bool("/purple/logging/log_chats")) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
116 | return; |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
117 | |
| 15884 | 118 | logs = purple_log_get_logs(PURPLE_LOG_CHAT, name, account); |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
119 | } |
| 7440 | 120 | |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
121 | if (logs == NULL) |
| 3598 | 122 | return; |
|
8898
85f5615bc27e
[gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents:
8749
diff
changeset
|
123 | |
| 15884 | 124 | 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
|
125 | 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
|
126 | #if 0 |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
127 | /* FIXME: WebView has no options */ |
| 15884 | 128 | if (flags & PURPLE_LOG_READ_NO_NEWLINE) |
| 3602 | 129 | 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
|
130 | #endif |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
131 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
132 | #if 0 |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
133 | /* FIXME: WebView has no protocol setting */ |
|
11814
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
134 | 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
|
135 | 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
|
136 | 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
|
137 | #endif |
|
11814
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
138 | |
|
33235
dbf53ee374bc
Fix compile error for now.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
139 | #if 0 |
|
dbf53ee374bc
Fix compile error for now.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
140 | /* TODO WebKit: Do this properly... */ |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
141 | if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview))) |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
142 | gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<BR>"); |
|
33235
dbf53ee374bc
Fix compile error for now.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
143 | #endif |
|
13338
a643484b9f9c
[gaim-migrate @ 15707]
Richard Laager <rlaager@pidgin.im>
parents:
13333
diff
changeset
|
144 | |
|
20975
bdcc492d3fbe
Another patch from QuLogic. This one makes sure the History plugin properly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20342
diff
changeset
|
145 | 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
|
146 | |
|
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
|
147 | if (((PurpleLog *)logs->data)->tm) |
|
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
|
148 | header_date = purple_date_format_full(((PurpleLog *)logs->data)->tm); |
|
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
|
149 | else |
|
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
|
150 | header_date = purple_date_format_full(localtime(&((PurpleLog *)logs->data)->time)); |
|
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
|
151 | |
|
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
|
152 | header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), escaped_alias, header_date); |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
153 | gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), header); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
154 | 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
|
155 | g_free(escaped_alias); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
156 | |
|
13338
a643484b9f9c
[gaim-migrate @ 15707]
Richard Laager <rlaager@pidgin.im>
parents:
13333
diff
changeset
|
157 | g_strchomp(history); |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
158 | gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), history); |
| 7433 | 159 | g_free(history); |
|
8898
85f5615bc27e
[gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents:
8749
diff
changeset
|
160 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
161 | gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<hr>"); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
162 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
163 | #if 0 |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
164 | /* FIXME: WebView has no protocol setting */ |
|
11814
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
165 | gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol); |
|
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
166 | 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
|
167 | #endif |
|
11814
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
168 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
169 | 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
|
170 | g_idle_add(_scroll_webview_to_end, gtkconv->webview); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
171 | |
| 15884 | 172 | g_list_foreach(logs, (GFunc)purple_log_free, NULL); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
173 | g_list_free(logs); |
| 3598 | 174 | } |
| 175 | ||
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
176 | static void |
| 15884 | 177 | history_prefs_check(PurplePlugin *plugin) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
178 | { |
|
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
|
179 | 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
|
180 | !purple_prefs_get_bool("/purple/logging/log_chats")) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
181 | { |
| 15884 | 182 | purple_notify_warning(plugin, NULL, _("History Plugin Requires Logging"), |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
183 | _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n" |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
184 | "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
|
185 | "history for the same conversation type(s)."), NULL); |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
186 | } |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
187 | } |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
188 | |
| 15884 | 189 | static void history_prefs_cb(const char *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12632
diff
changeset
|
190 | gconstpointer val, gpointer data) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
191 | { |
| 15884 | 192 | history_prefs_check((PurplePlugin *)data); |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
193 | } |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
194 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
195 | static gboolean |
| 15884 | 196 | plugin_load(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
197 | { |
| 15884 | 198 | purple_signal_connect(purple_conversations_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
199 | "conversation-created", |
| 15884 | 200 | plugin, PURPLE_CALLBACK(historize), NULL); |
| 20342 | 201 | /* XXX: Do we want to listen to pidgin's "conversation-displayed" signal? */ |
| 3598 | 202 | |
|
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
|
203 | purple_prefs_connect_callback(plugin, "/purple/logging/log_ims", |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
204 | 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
|
205 | purple_prefs_connect_callback(plugin, "/purple/logging/log_chats", |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
206 | history_prefs_cb, plugin); |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
207 | |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
208 | history_prefs_check(plugin); |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
209 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
210 | return TRUE; |
| 3598 | 211 | } |
| 212 | ||
| 15884 | 213 | static PurplePluginInfo info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
214 | { |
| 15884 | 215 | PURPLE_PLUGIN_MAGIC, |
| 216 | PURPLE_MAJOR_VERSION, | |
| 217 | PURPLE_MINOR_VERSION, | |
| 218 | PURPLE_PLUGIN_STANDARD, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
219 | PIDGIN_PLUGIN_TYPE, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
220 | 0, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
221 | NULL, |
| 15884 | 222 | PURPLE_PRIORITY_DEFAULT, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
223 | HISTORY_PLUGIN_ID, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
224 | N_("History"), |
|
21106
b85fbef13eed
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21076
diff
changeset
|
225 | DISPLAY_VERSION, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
226 | N_("Shows recently logged conversations in new conversations."), |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
227 | N_("When a new conversation is opened this plugin will insert " |
|
12632
91f69473e4c5
[gaim-migrate @ 14968]
Richard Laager <rlaager@pidgin.im>
parents:
12558
diff
changeset
|
228 | "the last conversation into the current conversation."), |
|
12406
89863d2d9b8d
[gaim-migrate @ 14713]
Richard Laager <rlaager@pidgin.im>
parents:
11814
diff
changeset
|
229 | "Sean Egan <seanegan@gmail.com>", |
| 15884 | 230 | PURPLE_WEBSITE, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
231 | plugin_load, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
232 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
233 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
234 | NULL, |
| 8993 | 235 | NULL, |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11217
diff
changeset
|
236 | NULL, |
|
16749
14a3fdc0aed7
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:
16478
diff
changeset
|
237 | NULL, |
|
14a3fdc0aed7
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:
16478
diff
changeset
|
238 | |
|
14a3fdc0aed7
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:
16478
diff
changeset
|
239 | /* padding */ |
|
14a3fdc0aed7
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:
16478
diff
changeset
|
240 | NULL, |
|
14a3fdc0aed7
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:
16478
diff
changeset
|
241 | NULL, |
|
14a3fdc0aed7
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:
16478
diff
changeset
|
242 | NULL, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
243 | NULL |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
244 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
245 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
246 | static void |
| 15884 | 247 | init_plugin(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
248 | { |
| 3598 | 249 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
250 | |
| 15884 | 251 | PURPLE_INIT_PLUGIN(history, init_plugin, info) |