Sun, 09 Nov 2008 20:55:10 +0000
Added menu items to buddy list context menu to start voice and video sessions
After discussing the matter with Maiku, we decided to have two choises.
"Audio call" which will show up if audio sessions is possible with a buddy and
the other item is either "Audio/Video" or "Video" depending on if the buddy
supports both at the same time or not
| 12737 | 1 | #include "internal.h" |
| 2 | ||
| 3 | #include "debug.h" | |
| 4 | #include "log.h" | |
| 5 | #include "plugin.h" | |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
6 | #include "util.h" |
| 12737 | 7 | #include "version.h" |
| 8 | ||
| 9 | #include "gtkconv.h" | |
| 10 | #include "gtkplugin.h" | |
| 11 | ||
|
12851
96079cc66acf
[gaim-migrate @ 15201]
Richard Laager <rlaager@pidgin.im>
parents:
12848
diff
changeset
|
12 | #include <time.h> |
|
96079cc66acf
[gaim-migrate @ 15201]
Richard Laager <rlaager@pidgin.im>
parents:
12848
diff
changeset
|
13 | |
| 15884 | 14 | static PurplePluginPrefFrame * |
| 15 | get_plugin_pref_frame(PurplePlugin *plugin) | |
| 12737 | 16 | { |
| 15884 | 17 | PurplePluginPrefFrame *frame; |
| 18 | PurplePluginPref *ppref; | |
|
16073
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15939
diff
changeset
|
19 | char *tmp; |
| 12737 | 20 | |
| 15884 | 21 | frame = purple_plugin_pref_frame_new(); |
| 12737 | 22 | |
| 15884 | 23 | ppref = purple_plugin_pref_new_with_label(_("Timestamp Format Options")); |
| 24 | purple_plugin_pref_frame_add(frame, ppref); | |
| 12737 | 25 | |
|
16976
3a4c6c96e2cf
Traditional Pidgin doesn't make any sense. It was only ever the case for
Richard Laager <rlaager@pidgin.im>
parents:
16865
diff
changeset
|
26 | tmp = g_strdup_printf(_("_Force 24-hour time format")); |
| 15884 | 27 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 12737 | 28 | "/plugins/gtk/timestamp_format/force_24hr", |
|
16073
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15939
diff
changeset
|
29 | tmp); |
| 15884 | 30 | purple_plugin_pref_frame_add(frame, ppref); |
|
16073
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15939
diff
changeset
|
31 | g_free(tmp); |
| 12737 | 32 | |
| 15884 | 33 | ppref = purple_plugin_pref_new_with_label(_("Show dates in...")); |
| 34 | purple_plugin_pref_frame_add(frame, ppref); | |
| 12737 | 35 | |
| 15884 | 36 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 12737 | 37 | "/plugins/gtk/timestamp_format/use_dates/conversation", |
| 38 | _("Co_nversations:")); | |
| 15884 | 39 | purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); |
| 40 | purple_plugin_pref_add_choice(ppref, _("For delayed messages"), "automatic"); | |
| 41 | purple_plugin_pref_add_choice(ppref, _("For delayed messages and in chats"), "chats"); | |
| 42 | purple_plugin_pref_add_choice(ppref, _("Always"), "always"); | |
| 43 | purple_plugin_pref_frame_add(frame, ppref); | |
| 12737 | 44 | |
| 15884 | 45 | ppref = purple_plugin_pref_new_with_name_and_label( |
| 12737 | 46 | "/plugins/gtk/timestamp_format/use_dates/log", |
|
12848
a6cc4c3c950f
[gaim-migrate @ 15198]
Richard Laager <rlaager@pidgin.im>
parents:
12737
diff
changeset
|
47 | _("_Message Logs:")); |
| 15884 | 48 | purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); |
| 49 | purple_plugin_pref_add_choice(ppref, _("For delayed messages"), "automatic"); | |
| 50 | purple_plugin_pref_add_choice(ppref, _("For delayed messages and in chats"), "chats"); | |
| 51 | purple_plugin_pref_add_choice(ppref, _("Always"), "always"); | |
| 52 | purple_plugin_pref_frame_add(frame, ppref); | |
| 12737 | 53 | |
| 54 | return frame; | |
| 55 | } | |
| 56 | ||
| 15884 | 57 | static char *timestamp_cb_common(PurpleConversation *conv, |
|
14049
c15c41423e19
[gaim-migrate @ 16559]
Richard Laager <rlaager@pidgin.im>
parents:
13115
diff
changeset
|
58 | time_t t, |
|
15575
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
59 | gboolean show_date, |
| 12737 | 60 | gboolean force, |
| 16865 | 61 | const char *dates, |
| 62 | gboolean parens) | |
| 12737 | 63 | { |
| 64 | g_return_val_if_fail(dates != NULL, NULL); | |
| 65 | ||
|
15575
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
66 | if (show_date || |
|
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
67 | !strcmp(dates, "always") || |
| 15884 | 68 | (conv != NULL && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && !strcmp(dates, "chats"))) |
| 12737 | 69 | { |
|
15575
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
70 | struct tm *tm = localtime(&t); |
| 12737 | 71 | if (force) |
| 16865 | 72 | return g_strdup_printf("%s%s%s", parens ? "(" : "", purple_utf8_strftime("%Y-%m-%d %H:%M:%S", tm), parens ? ")" : ""); |
| 12737 | 73 | else |
| 16865 | 74 | return g_strdup_printf("%s%s%s", parens ? "(" : "", purple_date_format_long(tm), parens ? ")" : ""); |
| 12737 | 75 | } |
| 76 | ||
| 77 | if (force) | |
|
15575
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
78 | { |
|
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
79 | struct tm *tm = localtime(&t); |
| 16865 | 80 | return g_strdup_printf("%s%s%s", parens ? "(" : "", purple_utf8_strftime("%H:%M:%S", tm), parens ? ")" : ""); |
|
15575
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
81 | } |
| 12737 | 82 | |
| 83 | return NULL; | |
| 84 | } | |
| 85 | ||
| 15884 | 86 | static char *conversation_timestamp_cb(PurpleConversation *conv, |
|
15575
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
87 | time_t t, gboolean show_date, gpointer data) |
| 12737 | 88 | { |
| 15884 | 89 | gboolean force = purple_prefs_get_bool( |
| 12737 | 90 | "/plugins/gtk/timestamp_format/force_24hr"); |
| 15884 | 91 | const char *dates = purple_prefs_get_string( |
| 12737 | 92 | "/plugins/gtk/timestamp_format/use_dates/conversation"); |
|
13054
6d323387986e
[gaim-migrate @ 15416]
Richard Laager <rlaager@pidgin.im>
parents:
12851
diff
changeset
|
93 | |
|
6d323387986e
[gaim-migrate @ 15416]
Richard Laager <rlaager@pidgin.im>
parents:
12851
diff
changeset
|
94 | g_return_val_if_fail(conv != NULL, NULL); |
|
6d323387986e
[gaim-migrate @ 15416]
Richard Laager <rlaager@pidgin.im>
parents:
12851
diff
changeset
|
95 | |
| 16865 | 96 | return timestamp_cb_common(conv, t, show_date, force, dates, TRUE); |
| 12737 | 97 | } |
| 98 | ||
| 15884 | 99 | static char *log_timestamp_cb(PurpleLog *log, time_t t, gboolean show_date, gpointer data) |
| 12737 | 100 | { |
| 15884 | 101 | gboolean force = purple_prefs_get_bool( |
| 12737 | 102 | "/plugins/gtk/timestamp_format/force_24hr"); |
| 15884 | 103 | const char *dates = purple_prefs_get_string( |
| 12737 | 104 | "/plugins/gtk/timestamp_format/use_dates/log"); |
| 105 | ||
|
13054
6d323387986e
[gaim-migrate @ 15416]
Richard Laager <rlaager@pidgin.im>
parents:
12851
diff
changeset
|
106 | g_return_val_if_fail(log != NULL, NULL); |
|
6d323387986e
[gaim-migrate @ 15416]
Richard Laager <rlaager@pidgin.im>
parents:
12851
diff
changeset
|
107 | |
| 16865 | 108 | return timestamp_cb_common(log->conv, t, show_date, force, dates, FALSE); |
| 12737 | 109 | } |
| 110 | ||
| 111 | static gboolean | |
| 15884 | 112 | plugin_load(PurplePlugin *plugin) |
| 12737 | 113 | { |
| 15884 | 114 | purple_signal_connect(pidgin_conversations_get_handle(), "conversation-timestamp", |
| 115 | plugin, PURPLE_CALLBACK(conversation_timestamp_cb), NULL); | |
| 116 | purple_signal_connect(purple_log_get_handle(), "log-timestamp", | |
| 117 | plugin, PURPLE_CALLBACK(log_timestamp_cb), NULL); | |
| 12737 | 118 | return TRUE; |
| 119 | } | |
| 120 | ||
| 121 | static gboolean | |
| 15884 | 122 | plugin_unload(PurplePlugin *plugin) |
| 12737 | 123 | { |
| 124 | return TRUE; | |
| 125 | } | |
| 126 | ||
| 15884 | 127 | static PurplePluginUiInfo prefs_info = { |
| 12737 | 128 | get_plugin_pref_frame, |
| 129 | 0, /* page num (Reserved) */ | |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
130 | NULL,/* frame (Reserved) */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
131 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
132 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
133 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
134 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
135 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
136 | NULL |
| 12737 | 137 | }; |
| 138 | ||
| 15884 | 139 | static PurplePluginInfo info = |
| 12737 | 140 | { |
| 15884 | 141 | PURPLE_PLUGIN_MAGIC, |
| 142 | PURPLE_MAJOR_VERSION, | |
| 143 | PURPLE_MINOR_VERSION, | |
|
15939
efc69ea48720
The Message Timestamp Formats plugin lacked an ID before.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
144 | PURPLE_PLUGIN_STANDARD, /**< type */ |
|
15575
bd1e13b63e4b
In Pidgin, display a full date on the timestamp of the first message to
Richard Laager <rlaager@pidgin.im>
parents:
15562
diff
changeset
|
145 | PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ |
| 12737 | 146 | 0, /**< flags */ |
| 147 | NULL, /**< dependencies */ | |
|
15939
efc69ea48720
The Message Timestamp Formats plugin lacked an ID before.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
148 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 12737 | 149 | |
|
15939
efc69ea48720
The Message Timestamp Formats plugin lacked an ID before.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
150 | "core-timestamp_format", /**< id */ |
| 12737 | 151 | N_("Message Timestamp Formats"), /**< name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16976
diff
changeset
|
152 | DISPLAY_VERSION, /**< version */ |
| 12737 | 153 | /** summary */ |
| 154 | N_("Customizes the message timestamp formats."), | |
| 155 | /** description */ | |
| 156 | N_("This plugin allows the user to customize " | |
| 157 | "conversation and logging message timestamp " | |
| 158 | "formats."), | |
|
15629
a2261cb315e2
Switching to my pidgin.im e-mail address, which I think fits nicely and seems professional.
Richard Laager <rlaager@pidgin.im>
parents:
15626
diff
changeset
|
159 | "Richard Laager <rlaager@pidgin.im>", /**< author */ |
|
15939
efc69ea48720
The Message Timestamp Formats plugin lacked an ID before.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
160 | PURPLE_WEBSITE, /**< homepage */ |
| 12737 | 161 | |
| 162 | plugin_load, /**< load */ | |
| 163 | plugin_unload, /**< unload */ | |
| 164 | NULL, /**< destroy */ | |
| 165 | ||
| 166 | NULL, /**< ui_info */ | |
| 167 | NULL, /**< extra_info */ | |
| 168 | &prefs_info, /**< prefs_info */ | |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
169 | NULL, /**< actions */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
170 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
171 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
172 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
173 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
174 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16073
diff
changeset
|
175 | NULL |
| 12737 | 176 | }; |
| 177 | ||
| 178 | static void | |
| 15884 | 179 | init_plugin(PurplePlugin *plugin) |
| 12737 | 180 | { |
| 15884 | 181 | purple_prefs_add_none("/plugins/gtk"); |
| 182 | purple_prefs_add_none("/plugins/gtk/timestamp_format"); | |
| 12737 | 183 | |
| 15884 | 184 | purple_prefs_add_bool("/plugins/gtk/timestamp_format/force_24hr", TRUE); |
| 12737 | 185 | |
| 15884 | 186 | purple_prefs_add_none("/plugins/gtk/timestamp_format/use_dates"); |
| 187 | purple_prefs_add_string("/plugins/gtk/timestamp_format/use_dates/conversation", "automatic"); | |
| 188 | purple_prefs_add_string("/plugins/gtk/timestamp_format/use_dates/log", "automatic"); | |
| 12737 | 189 | } |
| 190 | ||
| 15884 | 191 | PURPLE_INIT_PLUGIN(timestamp_format, init_plugin, info) |