annotate plugins/timestamp_format.c @ 13671:cafb9a4b206f

[gaim-migrate @ 16073] Kevin pointed out that the libgadu files aren't in EXTRA_DIST, which is necessary for building on Windows. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 20 Apr 2006 05:51:37 +0000
parents c73c7dd0721f
children f94309c7c480
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1 #include "internal.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
2
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
3 #include "debug.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
4 #include "log.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
5 #include "plugin.h"
13104
e1e5462b7d81 [gaim-migrate @ 15466]
Richard Laager <rlaager@wiktel.com>
parents: 13089
diff changeset
6 #include "util.h"
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
7 #include "version.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
8
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
9 #include "gtkconv.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
10 #include "gtkplugin.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
11
12851
c1317074fce3 [gaim-migrate @ 15201]
Richard Laager <rlaager@wiktel.com>
parents: 12848
diff changeset
12 #include <time.h>
c1317074fce3 [gaim-migrate @ 15201]
Richard Laager <rlaager@wiktel.com>
parents: 12848
diff changeset
13
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
14 static GaimPluginPrefFrame *
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
15 get_plugin_pref_frame(GaimPlugin *plugin)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
16 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
17 GaimPluginPrefFrame *frame;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
18 GaimPluginPref *ppref;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
19
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
20 frame = gaim_plugin_pref_frame_new();
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
21
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
22 ppref = gaim_plugin_pref_new_with_label(_("Timestamp Format Options"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
23 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
24
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
25 ppref = gaim_plugin_pref_new_with_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
26 "/plugins/gtk/timestamp_format/force_24hr",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
27 _("_Force (traditional Gaim) 24-hour time format"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
28 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
29
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
30 ppref = gaim_plugin_pref_new_with_label(_("Show dates in..."));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
31 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
32
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
33 ppref = gaim_plugin_pref_new_with_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
34 "/plugins/gtk/timestamp_format/use_dates/conversation",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
35 _("Co_nversations:"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
36 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE);
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13054
diff changeset
37 gaim_plugin_pref_add_choice(ppref, _("For delayed messages"), "automatic");
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13054
diff changeset
38 gaim_plugin_pref_add_choice(ppref, _("For delayed messages and in chats"), "chats");
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13054
diff changeset
39 gaim_plugin_pref_add_choice(ppref, _("Always"), "always");
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
40 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
41
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
42 ppref = gaim_plugin_pref_new_with_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
43 "/plugins/gtk/timestamp_format/use_dates/log",
12848
d26e3314c650 [gaim-migrate @ 15198]
Richard Laager <rlaager@wiktel.com>
parents: 12737
diff changeset
44 _("_Message Logs:"));
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
45 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE);
13089
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13054
diff changeset
46 gaim_plugin_pref_add_choice(ppref, _("For delayed messages"), "automatic");
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13054
diff changeset
47 gaim_plugin_pref_add_choice(ppref, _("For delayed messages and in chats"), "chats");
b553326bc468 [gaim-migrate @ 15451]
Mark Doliner <mark@kingant.net>
parents: 13054
diff changeset
48 gaim_plugin_pref_add_choice(ppref, _("Always"), "always");
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
49 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
50
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
51 return frame;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
52 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
53
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
54 static char *timestamp_cb_common(GaimConversation *conv,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
55 const struct tm *tm,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
56 gboolean force,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
57 const char *dates)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
58 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
59 g_return_val_if_fail(conv != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
60 g_return_val_if_fail(tm != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
61 g_return_val_if_fail(dates != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
62
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
63 if (!strcmp(dates, "always") ||
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
64 (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT &&
12848
d26e3314c650 [gaim-migrate @ 15198]
Richard Laager <rlaager@wiktel.com>
parents: 12737
diff changeset
65 !strcmp(dates, "chats")) ||
12851
c1317074fce3 [gaim-migrate @ 15201]
Richard Laager <rlaager@wiktel.com>
parents: 12848
diff changeset
66 (time(NULL) > (mktime((struct tm *)tm) + 20*60)))
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
67 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
68 if (force)
13104
e1e5462b7d81 [gaim-migrate @ 15466]
Richard Laager <rlaager@wiktel.com>
parents: 13089
diff changeset
69 return g_strdup(gaim_utf8_strftime("%Y-%m-%d %H:%M:%S", tm));
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
70 else
13104
e1e5462b7d81 [gaim-migrate @ 15466]
Richard Laager <rlaager@wiktel.com>
parents: 13089
diff changeset
71 return g_strdup(gaim_date_format_long(tm));
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
72 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
73
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
74 if (force)
13114
c73c7dd0721f [gaim-migrate @ 15476]
Richard Laager <rlaager@wiktel.com>
parents: 13104
diff changeset
75 return g_strdup(gaim_utf8_strftime("%H:%M:%S", tm));
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
76
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
77 return NULL;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
78 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
79
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
80 static char *conversation_timestamp_cb(GaimConversation *conv,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
81 const struct tm *tm, gpointer data)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
82 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
83 gboolean force = gaim_prefs_get_bool(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
84 "/plugins/gtk/timestamp_format/force_24hr");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
85 const char *dates = gaim_prefs_get_string(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
86 "/plugins/gtk/timestamp_format/use_dates/conversation");
13054
fd57413bc421 [gaim-migrate @ 15416]
Richard Laager <rlaager@wiktel.com>
parents: 12851
diff changeset
87
fd57413bc421 [gaim-migrate @ 15416]
Richard Laager <rlaager@wiktel.com>
parents: 12851
diff changeset
88 g_return_val_if_fail(conv != NULL, NULL);
fd57413bc421 [gaim-migrate @ 15416]
Richard Laager <rlaager@wiktel.com>
parents: 12851
diff changeset
89 g_return_val_if_fail(tm != NULL, NULL);
fd57413bc421 [gaim-migrate @ 15416]
Richard Laager <rlaager@wiktel.com>
parents: 12851
diff changeset
90
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
91 return timestamp_cb_common(conv, tm, force, dates);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
92 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
93
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
94 static char *log_timestamp_cb(GaimLog *log,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
95 const struct tm *tm, gpointer data)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
96 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
97 gboolean force = gaim_prefs_get_bool(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
98 "/plugins/gtk/timestamp_format/force_24hr");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
99 const char *dates = gaim_prefs_get_string(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
100 "/plugins/gtk/timestamp_format/use_dates/log");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
101
13054
fd57413bc421 [gaim-migrate @ 15416]
Richard Laager <rlaager@wiktel.com>
parents: 12851
diff changeset
102 g_return_val_if_fail(log != NULL, NULL);
fd57413bc421 [gaim-migrate @ 15416]
Richard Laager <rlaager@wiktel.com>
parents: 12851
diff changeset
103 g_return_val_if_fail(tm != NULL, NULL);
fd57413bc421 [gaim-migrate @ 15416]
Richard Laager <rlaager@wiktel.com>
parents: 12851
diff changeset
104
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
105 if (log->type == GAIM_LOG_SYSTEM)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
106 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
107 if (force)
13104
e1e5462b7d81 [gaim-migrate @ 15466]
Richard Laager <rlaager@wiktel.com>
parents: 13089
diff changeset
108 return g_strdup(gaim_utf8_strftime("%Y-%m-%d %H:%M:%S", tm));
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
109 else
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
110 return NULL;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
111 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
112
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
113 return timestamp_cb_common(log->conv, tm, force, dates);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
114 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
115
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
116 static gboolean
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
117 plugin_load(GaimPlugin *plugin)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
118 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
119 gaim_signal_connect(gaim_gtk_conversations_get_handle(), "conversation-timestamp",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
120 plugin, GAIM_CALLBACK(conversation_timestamp_cb), NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
121 gaim_signal_connect(gaim_log_get_handle(), "log-timestamp",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
122 plugin, GAIM_CALLBACK(log_timestamp_cb), NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
123 return TRUE;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
124 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
125
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
126 static gboolean
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
127 plugin_unload(GaimPlugin *plugin)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
128 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
129 return TRUE;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
130 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
131
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
132 static GaimPluginUiInfo prefs_info = {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
133 get_plugin_pref_frame,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
134 0, /* page num (Reserved) */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
135 NULL /* frame (Reserved) */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
136 };
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
137
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
138 static GaimPluginInfo info =
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
139 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
140 GAIM_PLUGIN_MAGIC,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
141 GAIM_MAJOR_VERSION,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
142 GAIM_MINOR_VERSION,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
143 GAIM_PLUGIN_STANDARD, /**< type */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
144 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
145 0, /**< flags */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
146 NULL, /**< dependencies */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
147 GAIM_PRIORITY_DEFAULT, /**< priority */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
148
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
149 NULL, /**< id */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
150 N_("Message Timestamp Formats"), /**< name */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
151 VERSION, /**< version */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
152 /** summary */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
153 N_("Customizes the message timestamp formats."),
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
154 /** description */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
155 N_("This plugin allows the user to customize "
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
156 "conversation and logging message timestamp "
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
157 "formats."),
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
158 "Richard Laager <rlaager@users.sf.net>", /**< author */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
159 GAIM_WEBSITE, /**< homepage */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
160
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
161 plugin_load, /**< load */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
162 plugin_unload, /**< unload */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
163 NULL, /**< destroy */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
164
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
165 NULL, /**< ui_info */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
166 NULL, /**< extra_info */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
167 &prefs_info, /**< prefs_info */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
168 NULL /**< actions */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
169 };
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
170
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
171 static void
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
172 init_plugin(GaimPlugin *plugin)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
173 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
174 gaim_prefs_add_none("/plugins/gtk");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
175 gaim_prefs_add_none("/plugins/gtk/timestamp_format");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
176
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
177 gaim_prefs_add_bool("/plugins/gtk/timestamp_format/force_24hr", TRUE);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
178
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
179 gaim_prefs_add_none("/plugins/gtk/timestamp_format/use_dates");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
180 gaim_prefs_add_string("/plugins/gtk/timestamp_format/use_dates/conversation", "automatic");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
181 gaim_prefs_add_string("/plugins/gtk/timestamp_format/use_dates/log", "automatic");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
182 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
183
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
184 GAIM_INIT_PLUGIN(timestamp_format, init_plugin, info)