Validate usage of /room config command, added UI messages

This commit is contained in:
James Booth
2014-09-03 22:56:33 +01:00
parent 64521eb135
commit b50b786dcc
7 changed files with 87 additions and 16 deletions

View File

@@ -49,6 +49,7 @@ typedef struct _muc_room_t {
char *password;
char *subject;
char *autocomplete_prefix;
gboolean pending_config;
GList *pending_broadcasts;
gboolean autojoin;
gboolean pending_nick_change;
@@ -162,6 +163,7 @@ muc_join_room(const char * const room, const char * const nick,
}
new_room->subject = NULL;
new_room->pending_broadcasts = NULL;
new_room->pending_config = FALSE;
new_room->roster = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
(GDestroyNotify)p_contact_free);
new_room->nick_ac = autocomplete_new();
@@ -185,6 +187,39 @@ muc_leave_room(const char * const room)
}
}
gboolean
muc_requires_config(const char * const room)
{
if (rooms == NULL) {
return FALSE;
}
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room == NULL) {
return FALSE;
}
return chat_room->pending_config;
}
void
muc_set_requires_config(const char * const room, gboolean val)
{
if (rooms == NULL) {
return;
}
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room == NULL) {
return;
}
chat_room->pending_config = val;
return;
}
/*
* Returns TRUE if the user is currently in the room
*/