annotate plugins/timestamp_format.c @ 12738:4152c8f14a02

[gaim-migrate @ 15083] LSchiere prefers Gaim not crash. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 05 Jan 2006 20:40:07 +0000
parents a1e241dd50b6
children d26e3314c650
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
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
11 static GaimPluginPrefFrame *
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
12 get_plugin_pref_frame(GaimPlugin *plugin)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
13 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
14 GaimPluginPrefFrame *frame;
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
15 GaimPluginPref *ppref;
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 frame = gaim_plugin_pref_frame_new();
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 ppref = gaim_plugin_pref_new_with_label(_("Timestamp Format Options"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
20 gaim_plugin_pref_frame_add(frame, ppref);
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_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
23 "/plugins/gtk/timestamp_format/force_24hr",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
24 _("_Force (traditional Gaim) 24-hour time format"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
25 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
26
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
27 ppref = gaim_plugin_pref_new_with_label(_("Show dates in..."));
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_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
31 "/plugins/gtk/timestamp_format/use_dates/conversation",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
32 _("Co_nversations:"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
33 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
34 gaim_plugin_pref_add_choice(ppref, "For Delayed Messages", "automatic");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
35 gaim_plugin_pref_add_choice(ppref, "In Chats", "chats");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
36 gaim_plugin_pref_add_choice(ppref, "Always", "always");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
37 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
38
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
39 ppref = gaim_plugin_pref_new_with_name_and_label(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
40 "/plugins/gtk/timestamp_format/use_dates/log",
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
41 _("_Logs:"));
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
42 gaim_plugin_pref_set_type(ppref, GAIM_PLUGIN_PREF_CHOICE);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
43 gaim_plugin_pref_add_choice(ppref, "For Delayed Messages", "automatic");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
44 gaim_plugin_pref_add_choice(ppref, "In Chats", "chats");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
45 gaim_plugin_pref_add_choice(ppref, "Always", "always");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
46 gaim_plugin_pref_frame_add(frame, ppref);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
47
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
48 return frame;
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
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
51 static char *timestamp_cb_common(GaimConversation *conv,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
52 const struct tm *tm,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
53 gboolean force,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
54 const char *dates)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
55 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
56 char buf[64];
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 g_return_val_if_fail(conv != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
59 g_return_val_if_fail(tm != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
60 g_return_val_if_fail(dates != NULL, NULL);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
61
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
62 if (!strcmp(dates, "always") ||
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
63 (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT &&
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
64 !strcmp(dates, "chats")))
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
65 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
66 if (force)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
67 strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
68 else
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
69 strftime(buf, sizeof(buf), "%x %X", tm);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
70
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
71 return g_strdup(buf);
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)
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 strftime(buf, sizeof(buf), "%H:%M:%S", tm);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
77 return g_strdup(buf);
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 return NULL;
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 static char *conversation_timestamp_cb(GaimConversation *conv,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
84 const struct tm *tm, gpointer data)
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 gboolean force = gaim_prefs_get_bool(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
87 "/plugins/gtk/timestamp_format/force_24hr");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
88 const char *dates = gaim_prefs_get_string(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
89 "/plugins/gtk/timestamp_format/use_dates/conversation");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
90 return timestamp_cb_common(conv, tm, force, dates);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
91 }
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 static char *log_timestamp_cb(GaimLog *log,
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
94 const struct tm *tm, gpointer data)
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 gboolean force = gaim_prefs_get_bool(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
97 "/plugins/gtk/timestamp_format/force_24hr");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
98 const char *dates = gaim_prefs_get_string(
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
99 "/plugins/gtk/timestamp_format/use_dates/log");
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
100
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
101 if (log->type == GAIM_LOG_SYSTEM)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
102 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
103 if (force)
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
104 {
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
105 char buf[64];
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
106 strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
107 return g_strdup(buf);
a1e241dd50b6 [gaim-migrate @ 15082]
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
108 }
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)