annotate plugins/timestamp_format.c @ 13020:72300c551dc2

[gaim-migrate @ 15373] More whitespace from the tree. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Mon, 23 Jan 2006 11:41:51 +0000
parents c1317074fce3
children fd57413bc421
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"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
6 #include "version.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
7
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
8 #include "gtkconv.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
9 #include "gtkplugin.h"
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
10
12851
c1317074fce3 [gaim-migrate @ 15201]
Richard Laager <rlaager@wiktel.com>
parents: 12848
diff changeset
11 #include <time.h>
c1317074fce3 [gaim-migrate @ 15201]
Richard Laager <rlaager@wiktel.com>
parents: 12848
diff changeset
12
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
13 static GaimPluginPrefFrame *
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
14 get_plugin_pref_frame(GaimPlugin *plugin)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
15 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
16 GaimPluginPrefFrame *frame;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
17 GaimPluginPref *ppref;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
18
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
19 frame = gaim_plugin_pref_frame_new();
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
20
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
21 ppref = gaim_plugin_pref_new_with_label(_("Timestamp Format Options"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
22 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
23
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
24 ppref = gaim_plugin_pref_new_with_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
25 "/plugins/gtk/timestamp_format/force_24hr",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
26 _("_Force (traditional Gaim) 24-hour time format"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
27 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
28
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
29 ppref = gaim_plugin_pref_new_with_label(_("Show dates in..."));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
30 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
31
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
32 ppref = gaim_plugin_pref_new_with_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
33 "/plugins/gtk/timestamp_format/use_dates/conversation",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
34 _("Co_nversations:"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
35 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE);
12848
d26e3314c650 [gaim-migrate @ 15198]
Richard Laager <rlaager@wiktel.com>
parents: 12737
diff changeset
36 gaim_plugin_pref_add_choice(ppref, "For delayed messages", "automatic");
d26e3314c650 [gaim-migrate @ 15198]
Richard Laager <rlaager@wiktel.com>
parents: 12737
diff changeset
37 gaim_plugin_pref_add_choice(ppref, "For delayed messages and in chats", "chats");
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
38 gaim_plugin_pref_add_choice(ppref, "Always", "always");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
39 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
40
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
41 ppref = gaim_plugin_pref_new_with_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
42 "/plugins/gtk/timestamp_format/use_dates/log",
12848
d26e3314c650 [gaim-migrate @ 15198]
Richard Laager <rlaager@wiktel.com>
parents: 12737
diff changeset
43 _("_Message Logs:"));
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
44 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE);
12848
d26e3314c650 [gaim-migrate @ 15198]
Richard Laager <rlaager@wiktel.com>
parents: 12737
diff changeset
45 gaim_plugin_pref_add_choice(ppref, "For delayed messages", "automatic");
d26e3314c650 [gaim-migrate @ 15198]
Richard Laager <rlaager@wiktel.com>
parents: 12737
diff changeset
46 gaim_plugin_pref_add_choice(ppref, "For delayed messages and in chats", "chats");
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
47 gaim_plugin_pref_add_choice(ppref, "Always", "always");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
48 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
49
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
50 return frame;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
51 }
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 static char *timestamp_cb_common(GaimConversation *conv,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
54 const struct tm *tm,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
55 gboolean force,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
56 const char *dates)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
57 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
58 char buf[64];
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
59
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
60 g_return_val_if_fail(conv != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
61 g_return_val_if_fail(tm != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
62 g_return_val_if_fail(dates != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
63
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
64 if (!strcmp(dates, "always") ||
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
65 (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT &&
12848
d26e3314c650 [gaim-migrate @ 15198]
Richard Laager <rlaager@wiktel.com>
parents: 12737
diff changeset
66 !strcmp(dates, "chats")) ||
12851
c1317074fce3 [gaim-migrate @ 15201]
Richard Laager <rlaager@wiktel.com>
parents: 12848
diff changeset
67 (time(NULL) > (mktime((struct tm *)tm) + 20*60)))
12737
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
68 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
69 if (force)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
70 strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
71 else
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
72 strftime(buf, sizeof(buf), "%x %X", tm);
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 return g_strdup(buf);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
75 }
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 if (force)
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 strftime(buf, sizeof(buf), "%H:%M:%S", tm);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
80 return g_strdup(buf);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
81 }
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 return NULL;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
84 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
85
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
86 static char *conversation_timestamp_cb(GaimConversation *conv,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
87 const struct tm *tm, gpointer data)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
88 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
89 gboolean force = gaim_prefs_get_bool(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
90 "/plugins/gtk/timestamp_format/force_24hr");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
91 const char *dates = gaim_prefs_get_string(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
92 "/plugins/gtk/timestamp_format/use_dates/conversation");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
93 return timestamp_cb_common(conv, tm, force, dates);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
94 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
95
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
96 static char *log_timestamp_cb(GaimLog *log,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
97 const struct tm *tm, gpointer data)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
98 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
99 gboolean force = gaim_prefs_get_bool(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
100 "/plugins/gtk/timestamp_format/force_24hr");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
101 const char *dates = gaim_prefs_get_string(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
102 "/plugins/gtk/timestamp_format/use_dates/log");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
103
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
104 if (log->type == GAIM_LOG_SYSTEM)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
105 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
106 if (force)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
107 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
108 char buf[64];
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
109 strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
110 return g_strdup(buf);
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 else
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
113 return NULL;
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 return timestamp_cb_common(log->conv, tm, force, dates);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
117 }
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 static gboolean
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
120 plugin_load(GaimPlugin *plugin)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
121 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
122 gaim_signal_connect(gaim_gtk_conversations_get_handle(), "conversation-timestamp",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
123 plugin, GAIM_CALLBACK(conversation_timestamp_cb), NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
124 gaim_signal_connect(gaim_log_get_handle(), "log-timestamp",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
125 plugin, GAIM_CALLBACK(log_timestamp_cb), NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
126 return TRUE;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
127 }
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 static gboolean
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
130 plugin_unload(GaimPlugin *plugin)
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 return TRUE;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
133 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
134
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
135 static GaimPluginUiInfo prefs_info = {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
136 get_plugin_pref_frame,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
137 0, /* page num (Reserved) */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
138 NULL /* frame (Reserved) */
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
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
141 static GaimPluginInfo info =
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
142 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
143 GAIM_PLUGIN_MAGIC,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
144 GAIM_MAJOR_VERSION,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
145 GAIM_MINOR_VERSION,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
146 GAIM_PLUGIN_STANDARD, /**< type */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
147 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
148 0, /**< flags */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
149 NULL, /**< dependencies */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
150 GAIM_PRIORITY_DEFAULT, /**< priority */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
151
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
152 NULL, /**< id */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
153 N_("Message Timestamp Formats"), /**< name */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
154 VERSION, /**< version */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
155 /** summary */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
156 N_("Customizes the message timestamp formats."),
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
157 /** description */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
158 N_("This plugin allows the user to customize "
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
159 "conversation and logging message timestamp "
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
160 "formats."),
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
161 "Richard Laager <rlaager@users.sf.net>", /**< author */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
162 GAIM_WEBSITE, /**< homepage */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
163
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
164 plugin_load, /**< load */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
165 plugin_unload, /**< unload */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
166 NULL, /**< destroy */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
167
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
168 NULL, /**< ui_info */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
169 NULL, /**< extra_info */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
170 &prefs_info, /**< prefs_info */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
171 NULL /**< actions */
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
172 };
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 static void
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
175 init_plugin(GaimPlugin *plugin)
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_none("/plugins/gtk");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
178 gaim_prefs_add_none("/plugins/gtk/timestamp_format");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
179
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
180 gaim_prefs_add_bool("/plugins/gtk/timestamp_format/force_24hr", TRUE);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
181
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
182 gaim_prefs_add_none("/plugins/gtk/timestamp_format/use_dates");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
183 gaim_prefs_add_string("/plugins/gtk/timestamp_format/use_dates/conversation", "automatic");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
184 gaim_prefs_add_string("/plugins/gtk/timestamp_format/use_dates/log", "automatic");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
185 }
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
186
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
187 GAIM_INIT_PLUGIN(timestamp_format, init_plugin, info)