about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-05-23 23:53:44 +0100
committerJames Booth <boothj5@gmail.com>2016-05-23 23:53:44 +0100
commit6559263b2fed1edc6b004dc3e50697600e450b9b (patch)
tree7b17f7d326ada6abb958e362fd76c8b4abc019f7 /src/xmpp
parent0edd4309257a8372761f44cbd576b027d1b9766c (diff)
downloadprofani-tty-6559263b2fed1edc6b004dc3e50697600e450b9b.tar.gz
Option to bookmark room invites
issue #813
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/bookmark.c18
-rw-r--r--src/xmpp/xmpp.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c
index 0f88a129..8c859a92 100644
--- a/src/xmpp/bookmark.c
+++ b/src/xmpp/bookmark.c
@@ -240,6 +240,24 @@ bookmark_autocomplete_reset(void)
     }
 }
 
+gboolean
+bookmark_exists(const char *const room)
+{
+    GSList *bookmarks = autocomplete_create_list(bookmark_ac);
+    GSList *curr = bookmarks;
+    while (curr) {
+        if (strcmp(curr->data, room) == 0) {
+            g_slist_free_full(bookmarks, g_free);
+            return TRUE;
+        } else {
+            curr = g_slist_next(curr);
+        }
+    }
+    g_slist_free_full(bookmarks, g_free);
+
+    return FALSE;
+}
+
 static int
 _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
 {
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index 65d2cbad..890df2f3 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -184,6 +184,7 @@ gboolean bookmark_join(const char *jid);
 const GList* bookmark_get_list(void);
 char* bookmark_find(const char *const search_str);
 void bookmark_autocomplete_reset(void);
+gboolean bookmark_exists(const char *const room);
 
 void roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups);
 void roster_send_add_to_group(const char *const group, PContact contact);