about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-09-28 22:09:20 +0100
committerJames Booth <boothj5@gmail.com>2014-09-28 22:09:20 +0100
commitd25d6b450201ee58f41e55d57da093eafa25e20c (patch)
tree0ec326336d9d1e6972034a01a86d7100dd9ed848 /src/xmpp
parent41b49cb5d6507636070c4d65f0e3f006c1ac9952 (diff)
downloadprofani-tty-d25d6b450201ee58f41e55d57da093eafa25e20c.tar.gz
Tidied muc module
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/bookmark.c10
-rw-r--r--src/xmpp/iq.c4
-rw-r--r--src/xmpp/message.c4
-rw-r--r--src/xmpp/presence.c24
-rw-r--r--src/xmpp/stanza.c10
5 files changed, 26 insertions, 26 deletions
diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c
index 395bf102..b5d495a6 100644
--- a/src/xmpp/bookmark.c
+++ b/src/xmpp/bookmark.c
@@ -178,15 +178,15 @@ _bookmark_join(const char *jid)
         char *account_name = jabber_get_account_name();
         ProfAccount *account = accounts_get_account(account_name);
         Bookmark *item = found->data;
-        if (!muc_room_is_active(item->jid)) {
+        if (!muc_active(item->jid)) {
             char *nick = item->nick;
             if (nick == NULL) {
                 nick = account->muc_nick;
             }
             presence_join_room(item->jid, nick, item->password);
-            muc_join_room(item->jid, nick, item->password, FALSE);
+            muc_join(item->jid, nick, item->password, FALSE);
             account_free(account);
-        } else if (muc_get_roster_received(item->jid)) {
+        } else if (muc_roster_complete(item->jid)) {
             ui_room_join(item->jid, TRUE);
         }
         return TRUE;
@@ -343,9 +343,9 @@ _bookmark_handle_result(xmpp_conn_t * const conn,
 
                 log_debug("Autojoin %s with nick=%s", jid, name);
                 room_jid = jid_create_from_bare_and_resource(jid, name);
-                if (!muc_room_is_active(room_jid->barejid)) {
+                if (!muc_active(room_jid->barejid)) {
                     presence_join_room(jid, name, password);
-                    muc_join_room(jid, name, password, TRUE);
+                    muc_join(jid, name, password, TRUE);
                 }
                 jid_destroy(room_jid);
                 account_free(account);
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 4a354a23..34722ee2 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -495,8 +495,8 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
     PContact contact;
     Jid *jidp = jid_create(jid);
-    if (muc_room_is_active(jidp->barejid)) {
-        contact = muc_get_participant(jidp->barejid, jidp->resourcepart);
+    if (muc_active(jidp->barejid)) {
+        contact = muc_roster_item(jidp->barejid, jidp->resourcepart);
     } else {
         contact = roster_get_contact(jidp->barejid);
     }
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 0e80f9b5..f3940067 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -392,7 +392,7 @@ _groupchat_handler(xmpp_conn_t * const conn,
     }
 
     // room not active in profanity
-    if (!muc_room_is_active(jid->barejid)) {
+    if (!muc_active(jid->barejid)) {
         log_error("Message received for inactive chat room: %s", jid->str);
         jid_destroy(jid);
         return 1;
@@ -444,7 +444,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
         return 1;
 
     // private message from chat room use full jid (room/nick)
-    } else if (muc_room_is_active(jid->barejid)) {
+    } else if (muc_active(jid->barejid)) {
         // determine if the notifications happened whilst offline
         GTimeVal tv_stamp;
         gboolean delayed = stanza_get_delay(stanza, &tv_stamp);
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index f63b3349..a3cd2173 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -242,12 +242,12 @@ _presence_update(const resource_presence_t presence_type, const char * const msg
 static void
 _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence)
 {
-    GList *rooms_p = muc_get_active_room_list();
+    GList *rooms_p = muc_rooms();
     GList *rooms = rooms_p;
 
     while (rooms != NULL) {
         const char *room = rooms->data;
-        const char *nick = muc_get_room_nick(room);
+        const char *nick = muc_nick(room);
 
         if (nick != NULL) {
             char *full_room_jid = create_fulljid(room, nick);
@@ -331,7 +331,7 @@ _presence_leave_chat_room(const char * const room_jid)
     log_debug("Sending room leave presence to: %s", room_jid);
     xmpp_ctx_t *ctx = connection_get_ctx();
     xmpp_conn_t *conn = connection_get_conn();
-    char *nick = muc_get_room_nick(room_jid);
+    char *nick = muc_nick(room_jid);
 
     if (nick != NULL) {
         xmpp_stanza_t *presence = stanza_create_room_leave_presence(ctx, room_jid,
@@ -702,7 +702,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
             // leave room if not self nick change
             if (new_nick != NULL) {
-                muc_set_room_pending_nick_change(from_room, new_nick);
+                muc_nick_change_start(from_room, new_nick);
             } else {
                 handle_leave_room(from_room);
             }
@@ -711,11 +711,11 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
         } else {
 
             // handle self nick change
-            if (muc_is_room_pending_nick_change(from_room)) {
+            if (muc_nick_change_pending(from_room)) {
                 handle_room_nick_change(from_room, from_nick);
 
             // handle roster complete
-            } else if (!muc_get_roster_received(from_room)) {
+            } else if (!muc_roster_complete(from_room)) {
                 handle_room_roster_complete(from_room);
 
                 // room configuration required
@@ -752,7 +752,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
             if (stanza_is_room_nick_change(stanza)) {
                 char *new_nick = stanza_get_new_nick(stanza);
                 if (new_nick != NULL) {
-                    muc_set_roster_pending_nick_change(from_room, new_nick, from_nick);
+                    muc_roster_nick_change_start(from_room, new_nick, from_nick);
                     free(new_nick);
                 }
             } else {
@@ -766,17 +766,17 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
             }
 
             char *show_str = stanza_get_show(stanza, "online");
-            if (!muc_get_roster_received(from_room)) {
-                muc_add_to_roster(from_room, from_nick, show_str, status_str);
+            if (!muc_roster_complete(from_room)) {
+                muc_roster_add(from_room, from_nick, show_str, status_str);
             } else {
-                char *old_nick = muc_complete_roster_nick_change(from_room, from_nick);
+                char *old_nick = muc_roster_nick_change_complete(from_room, from_nick);
 
                 if (old_nick != NULL) {
-                    muc_add_to_roster(from_room, from_nick, show_str, status_str);
+                    muc_roster_add(from_room, from_nick, show_str, status_str);
                     handle_room_member_nick_change(from_room, old_nick, from_nick);
                     free(old_nick);
                 } else {
-                    if (!muc_nick_in_roster(from_room, from_nick)) {
+                    if (!muc_roster_contains_nick(from_room, from_nick)) {
                         handle_room_member_online(from_room, from_nick, show_str, status_str);
                     } else {
                         handle_room_member_presence(from_room, from_nick, show_str, status_str);
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 045fea59..ff31bc65 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -851,19 +851,19 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza,
         char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
         if (from) {
             Jid *from_jid = jid_create(from);
-            if (muc_room_is_active(from_jid->barejid)) {
-                char *nick = muc_get_room_nick(from_jid->barejid);
+            if (muc_active(from_jid->barejid)) {
+                char *nick = muc_nick(from_jid->barejid);
                 if (g_strcmp0(from_jid->resourcepart, nick) == 0) {
                     return TRUE;
                 }
             }
 
             // check if a new nickname maps to a pending nick change for this user
-            if (muc_is_room_pending_nick_change(from_jid->barejid)) {
+            if (muc_nick_change_pending(from_jid->barejid)) {
                 char *new_nick = from_jid->resourcepart;
                 if (new_nick) {
-                    char *nick = muc_get_room_nick(from_jid->barejid);
-                    char *old_nick = muc_get_old_nick(from_jid->barejid, new_nick);
+                    char *nick = muc_nick(from_jid->barejid);
+                    char *old_nick = muc_old_nick(from_jid->barejid, new_nick);
                     if (g_strcmp0(old_nick, nick) == 0) {
                         return TRUE;
                     }