]> www.infradead.org Git - pidgin-chime.git/commitdiff
Fix 'Join with audio' on already-open meeting, ending audio closes chat
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 26 Nov 2019 16:09:42 +0000 (16:09 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 26 Nov 2019 16:09:42 +0000 (16:09 +0000)
prpl/chat.c
prpl/chime.h
prpl/meeting.c

index e20cc95273baf2d560469778dee14e55286dda69..e5320dbc6639b5a32f8a1aa90273d0b4e010a533 100644 (file)
@@ -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;
index 602f47d04e55cef265f38000bef023b8ef4dbdca..72a91553207083c7ee7f7a91af1ab02a25a4f3a6 100644 (file)
@@ -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);
 
index ad19a93c080078e8ce7594698331ecb738e4350c..7d5639be3396abe2ed57b3fc03d5fd872604a1c4 100644 (file)
@@ -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)