[Pkg-privacy-commits] [pidgin-otr] 123/255: * otr-plugin.c: Made wrapper for process_conv_create callbacks * gtk-dialog.c: Added checks for if you have disabled OTR for a buddy. Also getting rid of another type punned warning with mingw gcc.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:51:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch experimental
in repository pidgin-otr.
commit b5a6a3dcd2fdd29191791b3bb83f39ea4071b68a
Author: Rob Smits <rdfsmits at cs.uwaterloo.ca>
Date: Wed Jun 27 16:46:07 2012 -0400
* otr-plugin.c: Made wrapper for process_conv_create callbacks
* gtk-dialog.c: Added checks for if you have disabled OTR for a buddy.
Also getting rid of another type punned warning with mingw gcc.
---
gtk-dialog.c | 22 +++++++++++++++++-----
otr-plugin.c | 10 ++++++++--
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/gtk-dialog.c b/gtk-dialog.c
index b51f094..28349b3 100644
--- a/gtk-dialog.c
+++ b/gtk-dialog.c
@@ -2319,7 +2319,8 @@ static void otr_add_buddy_instances_top_menu(PidginConversation *gtkconv,
GtkWidget *menu_image;
GtkWidget * tooltip_menu;
gchar *tooltip_text;
- otrl_instag_t * instance;
+ gpointer gp_instance;
+ otrl_instag_t * selected_instance;
gboolean selection_exists = 0;
ConnContext * context = instances->data;
TrustLevel level = TRUST_NOT_PRIVATE;
@@ -2332,13 +2333,14 @@ static void otr_add_buddy_instances_top_menu(PidginConversation *gtkconv,
conv = otrg_plugin_context_to_conv(context, 0);
selection_exists = g_hash_table_lookup_extended(conv->data,
- "otr-ui_selected_ctx", NULL, (gpointer*)&instance);
+ "otr-ui_selected_ctx", NULL, &gp_instance);
/* Find the selected or default instance */
if (selection_exists) {
+ selected_instance = gp_instance;
context = otrl_context_find(otrg_plugin_userstate,
context->username, context->accountname, context->protocol,
- *instance, 0, NULL, NULL, NULL);
+ *selected_instance, 0, NULL, NULL, NULL);
} else {
context = otrl_context_find(otrg_plugin_userstate,
context->username, context->accountname, context->protocol,
@@ -2393,7 +2395,8 @@ static void otr_add_buddy_instances_top_menu(PidginConversation *gtkconv,
g_free(text);
- if (!selection_exists || *instance != curr_context->their_instance) {
+ if (!selection_exists ||
+ *selected_instance != curr_context->their_instance) {
GtkWidget *select_ctx = gtk_menu_item_new_with_label(_("Select"));
GtkWidget *menusep = gtk_separator_menu_item_new();
@@ -2407,7 +2410,7 @@ static void otr_add_buddy_instances_top_menu(PidginConversation *gtkconv,
select_ctx);
gtk_widget_show(select_ctx);
} else if (selection_exists &&
- *instance == curr_context->their_instance) {
+ *selected_instance == curr_context->their_instance) {
GtkWidget *selected_ctx =
gtk_menu_item_new_with_label(_("Selected"));
GtkWidget *menusep = gtk_separator_menu_item_new();
@@ -2880,6 +2883,11 @@ static void otrg_gtk_dialog_new_purple_conv(PurpleConversation *conv)
name = purple_conversation_get_name(conv);
otrg_ui_get_prefs(&prefs, account, name);
+ /* OTR is disabled for this buddy */
+ if (prefs.policy == OTRL_POLICY_NEVER) {
+ return;
+ }
+
bbox = gtkconv->toolbar;
context = otrg_plugin_conv_to_selected_context(conv, 0);
@@ -3135,6 +3143,10 @@ static gboolean check_incoming_instance_change(PurpleAccount *account,
last_received_instance = g_hash_table_lookup(conv->data,
"otr-last_received_ctx");
+ if (!last_received_instance) {
+ return; /* OTR disabled for this buddy */
+ }
+
if (*last_received_instance == OTRL_INSTAG_MASTER ||
*last_received_instance >= OTRL_MIN_VALID_INSTAG) {
have_received = TRUE;
diff --git a/otr-plugin.c b/otr-plugin.c
index 524110a..9e80570 100644
--- a/otr-plugin.c
+++ b/otr-plugin.c
@@ -890,6 +890,12 @@ static void process_conv_create(PurpleConversation *conv)
otrg_dialog_new_conv(conv);
}
+/* Wrapper around process_conv_create for callback purposes */
+static void process_conv_create_cb(PurpleConversation *conv, void *data)
+{
+ process_conv_create(conv);
+}
+
static void process_conv_updated(PurpleConversation *conv,
PurpleConvUpdateType type, void *data)
{
@@ -1272,7 +1278,7 @@ static gboolean otr_plugin_load(PurplePlugin *handle)
purple_signal_connect(conv_handle, "conversation-updated",
otrg_plugin_handle, PURPLE_CALLBACK(process_conv_updated), NULL);
purple_signal_connect(conv_handle, "conversation-created",
- otrg_plugin_handle, PURPLE_CALLBACK(process_conv_create), NULL);
+ otrg_plugin_handle, PURPLE_CALLBACK(process_conv_create_cb), NULL);
purple_signal_connect(conv_handle, "deleting-conversation",
otrg_plugin_handle, PURPLE_CALLBACK(process_conv_destroyed), NULL);
purple_signal_connect(conn_handle, "signed-on", otrg_plugin_handle,
@@ -1312,7 +1318,7 @@ static gboolean otr_plugin_unload(PurplePlugin *handle)
purple_signal_disconnect(conv_handle, "conversation-updated",
otrg_plugin_handle, PURPLE_CALLBACK(process_conv_updated));
purple_signal_disconnect(conv_handle, "conversation-created",
- otrg_plugin_handle, PURPLE_CALLBACK(process_conv_create));
+ otrg_plugin_handle, PURPLE_CALLBACK(process_conv_create_cb));
purple_signal_disconnect(conv_handle, "deleting-conversation",
otrg_plugin_handle, PURPLE_CALLBACK(process_conv_destroyed));
purple_signal_disconnect(conn_handle, "signed-on", otrg_plugin_handle,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/pidgin-otr.git
More information about the Pkg-privacy-commits
mailing list