Sun, 17 Oct 2004 23:55:49 +0000
[gaim-migrate @ 11141]
Two things:
a. Added Enter as a gtk_binding to GtkIMHtml. This fixes everything.
Input methods now work. The "Enter sends" and "Ctrl-Enter sends" preferences
were removed and defaulted to yes and no respectively, BUT, in a very super-cool
turn of events, you can now add your own bindings to .gtkrc to make WHATEVER
YOU WANT send. Awesome. Someone should use g_signal_accumulator_true_handled
or something to make profiles and away messages able to insert newlines.
b. Removed "Use multi-colored screennames in chats," defaulted to yes, and
wrote a nifty algorithm to automatically adjust the colors to accomodate the
background (see http://gaim.sf.net/sean/porn-chat.png). People should play
around and tweak it a bit. The algorithm takes into consideration the
luminosity of the current background and the base hue to use for the screenname
in generating the new colors. Note that it does this while maintaining the hues.
Someone should optimize this so it skips over the floating point arithmatic when
the background color is white.
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
1 | /* |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
2 | * Gaim - iChat-like timestamps |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
3 | * |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
4 | * Copyright (C) 2002-2003, Sean Egan |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
5 | * Copyright (C) 2003, Chris J. Friesen <Darth_Sebulba04@yahoo.com> |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
6 | * |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
7 | * This program is free software; you can redistribute it and/or modify |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
8 | * it under the terms of the GNU General Public License as published by |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
9 | * the Free Software Foundation; either version 2 of the License, or |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
10 | * (at your option) any later version. |
| 4220 | 11 | * |
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
15 | * GNU General Public License for more details. |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
16 | * |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
17 | * You should have received a copy of the GNU General Public License |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
18 | * along with this program; if not, write to the Free Software |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
20 | * |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
21 | */ |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
22 | |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
23 | |
| 3598 | 24 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
25 | #include "internal.h" |
|
4202
8b92de3b1c07
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4201
diff
changeset
|
26 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
27 | #include "conversation.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
28 | #include "debug.h" |
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
29 | #include "prefs.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
30 | #include "signals.h" |
| 9943 | 31 | #include "version.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
32 | |
| 3598 | 33 | #include "gtkimhtml.h" |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
34 | #include "gtkplugin.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
35 | #include "gtkutils.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
36 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
37 | #define TIMESTAMP_PLUGIN_ID "gtk-timestamp" |
| 3598 | 38 | |
|
6050
7410ba1809ad
[gaim-migrate @ 6500]
Mark Doliner <markdoliner@pidgin.im>
parents:
5920
diff
changeset
|
39 | /* Set the default to 5 minutes. */ |
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
40 | static int interval = 5 * 60 * 1000; |
| 3598 | 41 | |
| 9191 | 42 | static GSList *timestamp_timeouts = NULL; |
| 3598 | 43 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
44 | static gboolean do_timestamp (gpointer data) |
| 3598 | 45 | { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
46 | GaimConversation *c = (GaimConversation *)data; |
| 3598 | 47 | char *buf; |
| 48 | char mdate[6]; | |
| 9191 | 49 | int is_conversation_active; |
| 3598 | 50 | time_t tim = time(NULL); |
| 9191 | 51 | |
|
4376
88f8faf7cb61
[gaim-migrate @ 4642]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
52 | if (!g_list_find(gaim_get_conversations(), c)) |
| 3598 | 53 | return FALSE; |
| 54 | ||
| 9191 | 55 | /* is_conversation_active is true if an im has been displayed since the last timestamp */ |
| 56 | is_conversation_active = GPOINTER_TO_INT(gaim_conversation_get_data(c, "timestamp-conv-active")); | |
| 57 | ||
| 58 | if (is_conversation_active){ | |
| 59 | gaim_conversation_set_data(c, "timestamp-conv-active", GINT_TO_POINTER(FALSE)); | |
| 60 | strftime(mdate, sizeof(mdate), "%H:%M", localtime(&tim)); | |
| 61 | buf = g_strdup_printf(" %s", mdate); | |
| 62 | gaim_conversation_write(c, NULL, buf, GAIM_MESSAGE_NO_LOG, tim); | |
| 63 | g_free(buf); | |
| 64 | } | |
| 65 | else | |
| 66 | gaim_conversation_set_data(c, "timestamp-enabled", GINT_TO_POINTER(FALSE)); | |
| 67 | ||
| 3598 | 68 | return TRUE; |
| 69 | } | |
| 70 | ||
| 9191 | 71 | |
| 72 | static gboolean | |
| 73 | timestamp_displaying_conv_msg(GaimAccount *account, GaimConversation *conv, | |
|
9863
323e4fe28791
[gaim-migrate @ 10742]
Mark Doliner <markdoliner@pidgin.im>
parents:
9191
diff
changeset
|
74 | char **buffer, void *data) |
| 9191 | 75 | { |
| 76 | int is_timestamp_enabled; | |
| 77 | ||
| 78 | if (!g_list_find(gaim_get_conversations(), conv)) | |
| 79 | return FALSE; | |
| 80 | ||
| 81 | /* set to true, since there has been an im since the last timestamp */ | |
| 82 | gaim_conversation_set_data(conv, "timestamp-conv-active", GINT_TO_POINTER(TRUE)); | |
| 83 | ||
| 84 | is_timestamp_enabled = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "timestamp-enabled")); | |
| 85 | ||
| 86 | if (!is_timestamp_enabled){ | |
| 87 | gaim_conversation_set_data(conv, "timestamp-enabled", GINT_TO_POINTER(TRUE)); | |
| 88 | do_timestamp((gpointer)conv); | |
| 89 | } | |
| 90 | ||
| 91 | return FALSE; | |
| 92 | } | |
| 93 | ||
| 94 | static gboolean | |
| 95 | timestamp_receiving_msg(GaimAccount *account, char **sender, char **buffer, | |
|
10104
081392879815
[gaim-migrate @ 11131]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9943
diff
changeset
|
96 | GaimConversation *conv, int *flags, void *data) |
| 9191 | 97 | { |
|
10104
081392879815
[gaim-migrate @ 11131]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9943
diff
changeset
|
98 | g_return_val_if_fail(conv != NULL, FALSE); |
|
081392879815
[gaim-migrate @ 11131]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9943
diff
changeset
|
99 | |
|
081392879815
[gaim-migrate @ 11131]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9943
diff
changeset
|
100 | return timestamp_displaying_conv_msg(account, conv, buffer, data); |
| 9191 | 101 | } |
| 102 | ||
| 103 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
104 | static void timestamp_new_convo(GaimConversation *conv) |
| 3598 | 105 | { |
| 9191 | 106 | if (!g_list_find(gaim_get_conversations(), conv)) |
| 107 | return; | |
| 108 | ||
| 109 | /* | |
| 110 | This if statement stops conversations that have already been initialized for timestamps | |
| 111 | from being reinitialized. This prevents every active conversation from immediately being spammed | |
| 112 | with a new timestamp when the user modifies the timer interval. | |
| 113 | */ | |
| 114 | if (!gaim_conversation_get_data(conv, "timestamp-initialized")){ | |
| 115 | gaim_conversation_set_data(conv, "timestamp-initialized", GINT_TO_POINTER(TRUE)); | |
| 116 | gaim_conversation_set_data(conv, "timestamp-enabled", GINT_TO_POINTER(TRUE)); | |
| 117 | gaim_conversation_set_data(conv, "timestamp-conv-active", GINT_TO_POINTER(TRUE)); | |
| 118 | do_timestamp(conv); | |
| 119 | } | |
| 4168 | 120 | |
| 3727 | 121 | timestamp_timeouts = g_slist_append(timestamp_timeouts, |
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
122 | GINT_TO_POINTER(g_timeout_add(interval, do_timestamp, conv))); |
| 9191 | 123 | } |
| 3598 | 124 | |
| 9191 | 125 | |
| 126 | static void destroy_timer_list() | |
| 127 | { | |
| 128 | GSList *to; | |
| 129 | ||
| 130 | for (to = timestamp_timeouts; to != NULL; to = to->next) | |
| 131 | g_source_remove(GPOINTER_TO_INT(to->data)); | |
| 132 | ||
| 133 | g_slist_free(timestamp_timeouts); | |
| 134 | ||
| 135 | timestamp_timeouts = NULL; | |
| 3598 | 136 | } |
| 4220 | 137 | |
| 9191 | 138 | static void init_timer_list() |
| 139 | { | |
| 140 | GList *cnvs; | |
| 141 | GaimConversation *c; | |
| 142 | ||
| 143 | if (timestamp_timeouts != NULL) | |
| 144 | destroy_timer_list(); | |
| 145 | ||
| 146 | for (cnvs = gaim_get_conversations(); cnvs != NULL; cnvs = cnvs->next) { | |
| 147 | c = cnvs->data; | |
| 148 | timestamp_new_convo(c); | |
| 149 | } | |
| 150 | } | |
| 151 | ||
| 152 | ||
| 153 | ||
| 4220 | 154 | static void set_timestamp(GtkWidget *button, GtkWidget *spinner) { |
| 155 | int tm; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
156 | |
| 4220 | 157 | tm = 0; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
158 | |
| 4220 | 159 | tm = CLAMP(gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner)), 1, G_MAXINT); |
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
160 | gaim_debug(GAIM_DEBUG_MISC, "timestamp", "setting time to %d mins\n", tm); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
161 | |
| 4220 | 162 | tm = tm * 60 * 1000; |
| 163 | ||
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
164 | interval = tm; |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
165 | gaim_prefs_set_int("/plugins/gtk/timestamp/interval", interval); |
| 9191 | 166 | |
| 167 | destroy_timer_list(); | |
| 168 | init_timer_list(); | |
| 4220 | 169 | } |
| 170 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
171 | static GtkWidget * |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
172 | get_config_frame(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
173 | { |
| 4220 | 174 | GtkWidget *ret; |
| 175 | GtkWidget *frame, *label; | |
| 176 | GtkWidget *vbox, *hbox; | |
| 177 | GtkAdjustment *adj; | |
| 178 | GtkWidget *spinner, *button; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
179 | |
| 4220 | 180 | ret = gtk_vbox_new(FALSE, 18); |
| 181 | gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
| 182 | ||
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
183 | frame = gaim_gtk_make_frame(ret, _("iChat Timestamp")); |
| 4220 | 184 | vbox = gtk_vbox_new(FALSE, 5); |
| 185 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 186 | ||
| 187 | hbox = gtk_hbox_new(FALSE, 5); | |
| 188 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
| 189 | ||
| 4586 | 190 | label = gtk_label_new(_("Delay")); |
| 4220 | 191 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
192 | |
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
193 | adj = (GtkAdjustment *)gtk_adjustment_new(interval/(60*1000), 1, G_MAXINT, 1, 0, 0); |
| 4220 | 194 | spinner = gtk_spin_button_new(adj, 0, 0); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
195 | gtk_box_pack_start(GTK_BOX(hbox), spinner, TRUE, TRUE, 0); |
| 4220 | 196 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
197 | label = gtk_label_new(_("minutes.")); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
198 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
| 4220 | 199 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
200 | hbox = gtk_hbox_new(TRUE, 5); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
201 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); |
| 4220 | 202 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
203 | button = gtk_button_new_with_mnemonic(_("_Apply")); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
204 | gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
205 | g_signal_connect(G_OBJECT(button), "clicked", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
206 | G_CALLBACK(set_timestamp), spinner); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
207 | |
| 4220 | 208 | gtk_widget_show_all(ret); |
| 209 | return ret; | |
| 210 | } | |
| 211 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
212 | static gboolean |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
213 | plugin_load(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
214 | { |
| 9191 | 215 | void *conv_handle = gaim_conversations_get_handle(); |
| 216 | ||
| 217 | init_timer_list(); | |
| 3598 | 218 | |
| 9191 | 219 | gaim_signal_connect(conv_handle, "conversation-created", |
| 220 | plugin, GAIM_CALLBACK(timestamp_new_convo), NULL); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
221 | |
|
9863
323e4fe28791
[gaim-migrate @ 10742]
Mark Doliner <markdoliner@pidgin.im>
parents:
9191
diff
changeset
|
222 | /* record IM display events for each conversation */ |
| 9191 | 223 | gaim_signal_connect(conv_handle, "receiving-im-msg", |
| 224 | plugin, GAIM_CALLBACK(timestamp_receiving_msg), NULL); | |
| 225 | gaim_signal_connect(conv_handle, "displaying-im-msg", | |
| 226 | plugin, GAIM_CALLBACK(timestamp_displaying_conv_msg), NULL); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
227 | |
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
228 | interval = gaim_prefs_get_int("/plugins/gtk/timestamp/interval"); |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
229 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
230 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
231 | } |
| 3598 | 232 | |
| 9191 | 233 | |
| 234 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
235 | static gboolean |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
236 | plugin_unload(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
237 | { |
| 9191 | 238 | void *conv_handle = gaim_conversations_get_handle(); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
239 | |
| 9191 | 240 | gaim_signal_disconnect(conv_handle, "conversation-created", |
| 241 | plugin, GAIM_CALLBACK(timestamp_new_convo)); | |
| 242 | gaim_signal_disconnect(conv_handle, "receiving-im-msg", | |
| 243 | plugin, GAIM_CALLBACK(timestamp_receiving_msg)); | |
| 244 | gaim_signal_disconnect(conv_handle, "displaying-im-msg", | |
| 245 | plugin, GAIM_CALLBACK(timestamp_displaying_conv_msg)); | |
| 246 | ||
| 247 | destroy_timer_list(); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
248 | return TRUE; |
| 3598 | 249 | } |
| 250 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
251 | static GaimGtkPluginUiInfo ui_info = |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
252 | { |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
253 | get_config_frame |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
254 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
255 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
256 | static GaimPluginInfo info = |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
257 | { |
| 9943 | 258 | GAIM_PLUGIN_MAGIC, |
| 259 | GAIM_MAJOR_VERSION, | |
| 260 | GAIM_MINOR_VERSION, | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
261 | GAIM_PLUGIN_STANDARD, /**< type */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
262 | GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
263 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
264 | NULL, /**< dependencies */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
265 | GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
266 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
267 | TIMESTAMP_PLUGIN_ID, /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
268 | N_("Timestamp"), /**< name */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
269 | VERSION, /**< version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
270 | /** summary */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
271 | N_("Adds iChat-style timestamps to conversations every N minutes."), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
272 | /** description */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
273 | N_("Adds iChat-style timestamps to conversations every N minutes."), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
274 | "Sean Egan <bj91704@binghamton.edu>", /**< author */ |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
275 | GAIM_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
276 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
277 | plugin_load, /**< load */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
278 | plugin_unload, /**< unload */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
279 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
280 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
281 | &ui_info, /**< ui_info */ |
| 8993 | 282 | NULL, /**< extra_info */ |
| 283 | NULL, | |
| 284 | NULL | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
285 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
286 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
287 | static void |
|
5920
963bfdefee02
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5873
diff
changeset
|
288 | init_plugin(GaimPlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4586
diff
changeset
|
289 | { |
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
290 | gaim_prefs_add_none("/plugins/gtk/timestamp"); |
|
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
291 | gaim_prefs_add_int("/plugins/gtk/timestamp/interval", interval); |
| 3598 | 292 | } |
| 293 | ||
|
7237
da128ba7a4de
[gaim-migrate @ 7812]
Mark Doliner <markdoliner@pidgin.im>
parents:
6982
diff
changeset
|
294 | GAIM_INIT_PLUGIN(interval, init_plugin, info) |