diff options
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/muc.c | 20 | ||||
-rw-r--r-- | src/xmpp/muc.h | 7 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/xmpp/muc.c b/src/xmpp/muc.c index 62a589d7..89e707a1 100644 --- a/src/xmpp/muc.c +++ b/src/xmpp/muc.c @@ -64,6 +64,7 @@ typedef struct _muc_room_t { GHashTable *nick_changes; gboolean roster_received; muc_member_type_t member_type; + muc_anonymity_type_t anonymity_type; } ChatRoom; GHashTable *rooms = NULL; @@ -223,6 +224,7 @@ muc_join(const char *const room, const char *const nick, const char *const passw new_room->pending_nick_change = FALSE; new_room->autojoin = autojoin; new_room->member_type = MUC_MEMBER_TYPE_UNKNOWN; + new_room->anonymity_type = MUC_ANONYMITY_TYPE_UNKNOWN; g_hash_table_insert(rooms, strdup(room), new_room); } @@ -264,6 +266,13 @@ muc_set_features(const char *const room, GSList *features) } else { chat_room->member_type = MUC_MEMBER_TYPE_PUBLIC; } + if (g_slist_find_custom(features, "muc_nonanonymous", (GCompareFunc)g_strcmp0)) { + chat_room->anonymity_type = MUC_ANONYMITY_TYPE_NONANONYMOUS; + } else if (g_slist_find_custom(features, "muc_semianonymous", (GCompareFunc)g_strcmp0)) { + chat_room->anonymity_type = MUC_ANONYMITY_TYPE_SEMIANONYMOUS; + } else { + chat_room->anonymity_type = MUC_ANONYMITY_TYPE_UNKNOWN; + } } } @@ -835,6 +844,17 @@ muc_member_type(const char *const room) } } +muc_anonymity_type_t +muc_anonymity_type(const char *const room) +{ + ChatRoom *chat_room = g_hash_table_lookup(rooms, room); + if (chat_room) { + return chat_room->anonymity_type; + } else { + return MUC_ANONYMITY_TYPE_UNKNOWN; + } +} + static void _free_room(ChatRoom *room) diff --git a/src/xmpp/muc.h b/src/xmpp/muc.h index e0b035f2..4b49a954 100644 --- a/src/xmpp/muc.h +++ b/src/xmpp/muc.h @@ -63,6 +63,12 @@ typedef enum { MUC_MEMBER_TYPE_MEMBERS_ONLY } muc_member_type_t; +typedef enum { + MUC_ANONYMITY_TYPE_UNKNOWN, + MUC_ANONYMITY_TYPE_NONANONYMOUS, + MUC_ANONYMITY_TYPE_SEMIANONYMOUS +} muc_anonymity_type_t; + typedef struct _muc_occupant_t { char *nick; gchar *nick_collate_key; @@ -150,5 +156,6 @@ char* muc_role_str(const char *const room); char* muc_affiliation_str(const char *const room); muc_member_type_t muc_member_type(const char *const room); +muc_anonymity_type_t muc_anonymity_type(const char *const room); #endif |