From: David Woodhouse Date: Thu, 22 Mar 2018 23:43:28 +0000 (+0000) Subject: Add get_cb_alias X-Git-Tag: v0.9~48 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9347ce7bfd59d97f6399f9b7ab1fab07390d5df8;p=pidgin-chime.git Add get_cb_alias --- diff --git a/chat.c b/chat.c index 888b29c..5941830 100644 --- a/chat.c +++ b/chat.c @@ -825,3 +825,13 @@ GList *chime_purple_chat_menu(PurpleChat *pchat) return items; } + +char *chime_purple_get_cb_alias(PurpleConnection *conn, int id, const gchar *who) +{ + ChimeContact *contact = chime_connection_contact_by_email(PURPLE_CHIME_CXN(conn), who); + + if (contact) + return g_strdup(chime_contact_get_display_name(contact)); + else + return NULL; +} diff --git a/chime.c b/chime.c index cdc13a6..fff0f3b 100644 --- a/chime.c +++ b/chime.c @@ -320,7 +320,12 @@ static GList *chime_purple_blist_node_menu(PurpleBlistNode *node) } } +#ifdef PURPLE_BLIST_NODE_IS_VISIBLE /* This was added at the same time */ +#define PRPL_HAS_GET_CB_ALIAS +#endif + static PurplePluginProtocolInfo chime_prpl_info = { + .struct_size = sizeof(PurplePluginProtocolInfo), .options = OPT_PROTO_NO_PASSWORD, .list_icon = chime_purple_list_icon, .login = chime_purple_login, @@ -343,6 +348,9 @@ static PurplePluginProtocolInfo chime_prpl_info = { .send_typing = chime_send_typing, .set_idle = chime_purple_set_idle, .blist_node_menu = chime_purple_blist_node_menu, +#ifdef PRPL_HAS_GET_CB_ALIAS + .get_cb_alias = chime_purple_get_cb_alias, +#endif }; static void chime_purple_show_about_plugin(PurplePluginAction *action) diff --git a/chime.h b/chime.h index aa29745..e6a4bcc 100644 --- a/chime.h +++ b/chime.h @@ -97,6 +97,7 @@ void on_chime_new_group_conv(ChimeConnection *cxn, ChimeConversation *conv, Purp void chime_purple_chat_invite(PurpleConnection *conn, int id, const char *message, const char *who); struct chime_chat *do_join_chat(PurpleConnection *conn, ChimeConnection *cxn, ChimeObject *obj, JsonNode *first_msg, ChimeMeeting *meeting); GList *chime_purple_chat_menu(PurpleChat *chat); +char *chime_purple_get_cb_alias(PurpleConnection *conn, int id, const gchar *who); /* conversations.c */ void on_chime_new_conversation(ChimeConnection *cxn, ChimeConversation *conv, PurpleConnection *conn);