Wed, 21 Sep 2011 06:45:26 +0000
Apply conversation theme when opening the GTK conversation. All the
parsing stuff was moved out of the theme code and into the conversation
code.
Someone (not me!) needs to check the code I commented out and see if
we really need that stuff (and then port it to WebKit/styling).
We also need to determine where to place Template.html and the rest
of our (not-yet-written) default theme.
| 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" |
|
32517
cab76b54eb8b
Fix history plugin compile.
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 | |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
25 | static gboolean _scroll_webview_to_end(gpointer data) |
| 8913 | 26 | { |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
27 | GtkWebView *webview = data; |
|
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
28 | gtk_webview_scroll_to_end(GTK_WEBVIEW(webview), FALSE); |
|
cab76b54eb8b
Fix history plugin compile.
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; |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
43 | #if 0 |
|
cab76b54eb8b
Fix history plugin compile.
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; |
|
32517
cab76b54eb8b
Fix history plugin compile.
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; |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
48 | #if 0 |
|
cab76b54eb8b
Fix history plugin compile.
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; |
|
32517
cab76b54eb8b
Fix history plugin compile.
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); |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
126 | #if 0 |
|
cab76b54eb8b
Fix history plugin compile.
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; |
|
32517
cab76b54eb8b
Fix history plugin compile.
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 | |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
132 | #if 0 |
|
cab76b54eb8b
Fix history plugin compile.
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)); |
|
32517
cab76b54eb8b
Fix history plugin compile.
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 | |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
139 | if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview))) |
|
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
140 | gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<BR>"); |
|
13338
a643484b9f9c
[gaim-migrate @ 15707]
Richard Laager <rlaager@pidgin.im>
parents:
13333
diff
changeset
|
141 | |
|
20975
bdcc492d3fbe
Another patch from QuLogic. This one makes sure the History plugin properly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20342
diff
changeset
|
142 | 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
|
143 | |
|
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
|
144 | 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
|
145 | 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
|
146 | 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
|
147 | 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
|
148 | |
|
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 | header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), escaped_alias, header_date); |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
150 | gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), header); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
151 | 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
|
152 | g_free(escaped_alias); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
153 | |
|
13338
a643484b9f9c
[gaim-migrate @ 15707]
Richard Laager <rlaager@pidgin.im>
parents:
13333
diff
changeset
|
154 | g_strchomp(history); |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
155 | gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), history); |
| 7433 | 156 | g_free(history); |
|
8898
85f5615bc27e
[gaim-migrate @ 9667]
Mark Doliner <markdoliner@pidgin.im>
parents:
8749
diff
changeset
|
157 | |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
158 | gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "<hr>"); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
159 | |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
160 | #if 0 |
|
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
161 | /* FIXME: WebView has no protocol setting */ |
|
11814
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
162 | gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol); |
|
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
163 | g_free(protocol); |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
164 | #endif |
|
11814
5003711283c0
[gaim-migrate @ 14105]
Richard Laager <rlaager@pidgin.im>
parents:
11605
diff
changeset
|
165 | |
|
32517
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
166 | g_object_ref(G_OBJECT(gtkconv->webview)); |
|
cab76b54eb8b
Fix history plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25880
diff
changeset
|
167 | g_idle_add(_scroll_webview_to_end, gtkconv->webview); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
168 | |
| 15884 | 169 | g_list_foreach(logs, (GFunc)purple_log_free, NULL); |
|
11051
837b4b6ef10d
[gaim-migrate @ 12989]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
10764
diff
changeset
|
170 | g_list_free(logs); |
| 3598 | 171 | } |
| 172 | ||
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
173 | static void |
| 15884 | 174 | history_prefs_check(PurplePlugin *plugin) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
175 | { |
|
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
|
176 | 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
|
177 | !purple_prefs_get_bool("/purple/logging/log_chats")) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
178 | { |
| 15884 | 179 | purple_notify_warning(plugin, NULL, _("History Plugin Requires Logging"), |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
180 | _("Logging can be enabled from Tools -> Preferences -> Logging.\n\n" |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
181 | "Enabling logs for instant messages and/or chats will activate " |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
182 | "history for the same conversation type(s).")); |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
183 | } |
|
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 | |
| 15884 | 186 | static void history_prefs_cb(const char *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12632
diff
changeset
|
187 | gconstpointer val, gpointer data) |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
188 | { |
| 15884 | 189 | history_prefs_check((PurplePlugin *)data); |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
190 | } |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
191 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
192 | static gboolean |
| 15884 | 193 | plugin_load(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
194 | { |
| 15884 | 195 | purple_signal_connect(purple_conversations_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
196 | "conversation-created", |
| 15884 | 197 | plugin, PURPLE_CALLBACK(historize), NULL); |
| 20342 | 198 | /* XXX: Do we want to listen to pidgin's "conversation-displayed" signal? */ |
| 3598 | 199 | |
|
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
|
200 | purple_prefs_connect_callback(plugin, "/purple/logging/log_ims", |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
201 | 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
|
202 | purple_prefs_connect_callback(plugin, "/purple/logging/log_chats", |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
203 | history_prefs_cb, plugin); |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
204 | |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
205 | history_prefs_check(plugin); |
|
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
206 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
207 | return TRUE; |
| 3598 | 208 | } |
| 209 | ||
| 15884 | 210 | static PurplePluginInfo info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
211 | { |
| 15884 | 212 | PURPLE_PLUGIN_MAGIC, |
| 213 | PURPLE_MAJOR_VERSION, | |
| 214 | PURPLE_MINOR_VERSION, | |
| 215 | PURPLE_PLUGIN_STANDARD, | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
216 | PIDGIN_PLUGIN_TYPE, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
217 | 0, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
218 | NULL, |
| 15884 | 219 | PURPLE_PRIORITY_DEFAULT, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
220 | HISTORY_PLUGIN_ID, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
221 | 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
|
222 | DISPLAY_VERSION, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
223 | N_("Shows recently logged conversations in new conversations."), |
|
11217
771bd94e6eec
[gaim-migrate @ 13349]
Richard Laager <rlaager@pidgin.im>
parents:
11051
diff
changeset
|
224 | 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
|
225 | "the last conversation into the current conversation."), |
|
12406
89863d2d9b8d
[gaim-migrate @ 14713]
Richard Laager <rlaager@pidgin.im>
parents:
11814
diff
changeset
|
226 | "Sean Egan <seanegan@gmail.com>", |
| 15884 | 227 | PURPLE_WEBSITE, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
228 | plugin_load, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
229 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
230 | NULL, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
231 | NULL, |
| 8993 | 232 | NULL, |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11217
diff
changeset
|
233 | 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
|
234 | 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
|
235 | |
|
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
|
236 | /* 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
|
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 | 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
|
239 | NULL, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
240 | NULL |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
241 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
242 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
243 | static void |
| 15884 | 244 | init_plugin(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
245 | { |
| 3598 | 246 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5114
diff
changeset
|
247 | |
| 15884 | 248 | PURPLE_INIT_PLUGIN(history, init_plugin, info) |