about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-10-06 00:26:03 +0100
committerJames Booth <boothj5@gmail.com>2013-10-06 00:26:03 +0100
commit3dffc1d9ff5b7c334551282499dc06fbb1f8f80e (patch)
tree924173b705046b73294eba63c20d5c68b7c11bc7
parent710c49b6b87e71c1b6c06cd6920f9b94414bdc4f (diff)
downloadprofani-tty-3dffc1d9ff5b7c334551282499dc06fbb1f8f80e.tar.gz
Moved muc error handling to profanity.c
-rw-r--r--src/profanity.c9
-rw-r--r--src/ui/core.c7
2 files changed, 9 insertions, 7 deletions
diff --git a/src/profanity.c b/src/profanity.c
index c2de40a4..4c621ffa 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -188,6 +188,15 @@ void
 prof_handle_error_message(const char *from, const char *err_msg)
 {
     ui_handle_error_message(from, err_msg);
+
+    if (g_strcmp0(err_msg, "conflict") == 0) {
+        // remove the room from muc
+        Jid *room_jid = jid_create(from);
+        if (!muc_get_roster_received(room_jid->barejid)) {
+            muc_leave_room(room_jid->barejid);
+        }
+        jid_destroy(room_jid);
+    }
 }
 
 void
diff --git a/src/ui/core.c b/src/ui/core.c
index be1afd03..2cb133b6 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -414,13 +414,6 @@ ui_handle_error_message(const char * const from, const char * const err_msg)
         } else {
             cons_show_error("Error received from server: %s", err_msg);
         }
-        // remove the room from muc
-        Jid *room_jid = jid_create(from);
-        if (!muc_get_roster_received(room_jid->barejid)) {
-            muc_leave_room(room_jid->barejid);
-        }
-        jid_destroy(room_jid);
-
     } else {
         cons_show_error("Error received from server: %s", err_msg);
     }