From: David Woodhouse Date: Tue, 26 Nov 2019 16:09:42 +0000 (+0000) Subject: Fix 'Join with audio' on already-open meeting, ending audio closes chat X-Git-Tag: v1.4~33 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=abde31f405e7d0b29c4bc3bc7904b7242df848c8;p=pidgin-chime.git Fix 'Join with audio' on already-open meeting, ending audio closes chat --- diff --git a/prpl/chat.c b/prpl/chat.c index e20cc95..e5320db 100644 --- a/prpl/chat.c +++ b/prpl/chat.c @@ -329,6 +329,8 @@ static void call_media_changed(PurpleMedia *media, PurpleMediaState state, const chat->media_connected = FALSE; chime_call_set_silent(chat->call, TRUE); } + if (chat->conv) + purple_conversation_destroy(chat->conv); } } @@ -1151,7 +1153,7 @@ void chime_purple_chat_invite(PurpleConnection *conn, int id, const char *messag chime_connection_autocomplete_contact_async(pc->cxn, who, NULL, autocomplete_mad_cb, mad); } -static void show_participants (PurpleBuddy *buddy, gpointer _chat) +static void show_participants(PurpleBuddy *buddy, gpointer _chat) { struct chime_chat *chat = _chat; if (chat->call) { @@ -1162,6 +1164,12 @@ static void show_participants (PurpleBuddy *buddy, gpointer _chat) } } +void chime_purple_chat_join_audio(struct chime_chat *chat) +{ + if (chat->call) + chime_call_set_silent(chat->call, FALSE); +} + static void join_audio(PurpleBuddy *buddy, gpointer _chat) { struct chime_chat *chat = _chat; diff --git a/prpl/chime.h b/prpl/chime.h index 602f47d..72a9155 100644 --- a/prpl/chime.h +++ b/prpl/chime.h @@ -103,6 +103,7 @@ char *chime_purple_cb_real_name(PurpleConnection *conn, int id, const char *who) void on_chime_new_group_conv(ChimeConnection *cxn, ChimeConversation *conv, PurpleConnection *conn); 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); +void chime_purple_chat_join_audio(struct chime_chat *chat); GList *chime_purple_chat_menu(PurpleChat *chat); char *chime_purple_get_cb_alias(PurpleConnection *conn, int id, const gchar *who); diff --git a/prpl/meeting.c b/prpl/meeting.c index ad19a93..7d5639b 100644 --- a/prpl/meeting.c +++ b/prpl/meeting.c @@ -311,8 +311,23 @@ static void do_join_joinable(PurpleConnection *conn, GList *row, gboolean muted) gchar *name = g_list_nth_data(row, 1); purple_debug(PURPLE_DEBUG_INFO, "chime", "Join meeting %s\n", name); ChimeMeeting *mtg = chime_connection_meeting_by_name(cxn, name); - if (mtg) + + if (mtg) { + if (!muted) { + /* If asked for audio and the meeting is already open, just start audio */ + struct purple_chime *pc = purple_connection_get_protocol_data(conn); + ChimeRoom *room = chime_meeting_get_chat_room(mtg); + + if (room) { + struct chime_chat *chat = g_hash_table_lookup(pc->chats_by_room, room); + if (chat) { + chime_purple_chat_join_audio(chat); + return; + } + } + } chime_connection_join_meeting_async(cxn, mtg, muted, NULL, join_mtg_done, conn); + } } static void join_joinable_audio(PurpleConnection *conn, GList *row, gpointer _unused)