/pidgin/main: 96593c46d85c: Finch-OTR: display e2ee state in con...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Sat Apr 26 10:56:42 EDT 2014
Changeset: 96593c46d85cd966b10b50fa26504a830e70896f
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-04-26 16:56 +0200
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/96593c46d85c
Description:
Finch-OTR: display e2ee state in conv title
diffstat:
finch/gntconv.c | 26 ++++++++++++++++++++++++--
libpurple/conversation.c | 3 +++
libpurple/e2ee.c | 12 ++++++++++++
3 files changed, 39 insertions(+), 2 deletions(-)
diffs (85 lines):
diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -245,8 +245,18 @@ find_im_with_contact(PurpleAccount *acco
static char *
get_conversation_title(PurpleConversation *conv, PurpleAccount *account)
{
- return g_strdup_printf(_("%s (%s -- %s)"), purple_conversation_get_title(conv),
- purple_account_get_username(account), purple_account_get_protocol_name(account));
+ PurpleE2eeState *e2ee;
+
+ e2ee = purple_conversation_get_e2ee_state(conv);
+
+ return g_strdup_printf(_("%s (%s -- %s)%s%s%s%s"),
+ purple_conversation_get_title(conv),
+ purple_account_get_username(account),
+ purple_account_get_protocol_name(account),
+ e2ee ? " | " : "",
+ e2ee ? purple_e2ee_provider_get_name(purple_e2ee_state_get_provider(e2ee)) : "",
+ e2ee ? ": " : "",
+ e2ee ? purple_e2ee_state_get_name(e2ee) : "");
}
static void
@@ -410,6 +420,18 @@ conv_updated(PurpleConversation *conv, P
if (type == PURPLE_CONVERSATION_UPDATE_FEATURES) {
gg_extended_menu(purple_conversation_get_ui_data(conv));
+ return;
+ }
+ if (type == PURPLE_CONVERSATION_UPDATE_E2EE) {
+ FinchConv *ggconv = FINCH_CONV(conv);
+ gchar *title;
+
+ title = get_conversation_title(conv,
+ purple_conversation_get_account(conv));
+ gnt_screen_rename_widget(ggconv->window, title);
+ g_free(title);
+
+ return;
}
}
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -497,6 +497,9 @@ purple_conversation_set_e2ee_state(Purpl
return;
}
+ if (state == priv->e2ee_state)
+ return;
+
if (state)
purple_e2ee_state_ref(state);
purple_e2ee_state_unref(priv->e2ee_state);
diff --git a/libpurple/e2ee.c b/libpurple/e2ee.c
--- a/libpurple/e2ee.c
+++ b/libpurple/e2ee.c
@@ -168,6 +168,7 @@ purple_e2ee_provider_register(PurpleE2ee
void
purple_e2ee_provider_unregister(PurpleE2eeProvider *provider)
{
+ GList *it;
g_return_if_fail(provider != NULL);
if (main_provider != provider) {
@@ -175,6 +176,17 @@ purple_e2ee_provider_unregister(PurpleE2
return;
}
+ for (it = purple_conversations_get_all(); it; it = g_list_next(it)) {
+ PurpleConversation *conv = it->data;
+ PurpleE2eeState *state;
+
+ state = purple_conversation_get_e2ee_state(conv);
+ if (!state)
+ continue;
+ if (provider == purple_e2ee_state_get_provider(state))
+ purple_conversation_set_e2ee_state(conv, NULL);
+ }
+
main_provider = NULL;
}
More information about the Commits
mailing list