summaryrefslogtreecommitdiffstats
path: root/gatchat
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-12-02 17:27:58 -0600
committerDenis Kenzior <denkenz@gmail.com>2009-12-02 19:10:08 -0600
commit1d98c226b529b8b8b53513cf805b6b5cbb8586ad (patch)
tree3f8e2d6ff47f867b4993abeb22bad958f1f9a746 /gatchat
parentb787745b009e500dcd94cd718021b0fea4cdfa11 (diff)
downloadofono-1d98c226b529b8b8b53513cf805b6b5cbb8586ad.tar.bz2
Add g_at_chat_unregister_all function
Diffstat (limited to 'gatchat')
-rw-r--r--gatchat/gatchat.c28
-rw-r--r--gatchat/gatchat.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 54e64340..d0907665 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -1346,6 +1346,34 @@ gboolean g_at_chat_unregister(GAtChat *chat, guint id)
return TRUE;
}
+gboolean g_at_chat_unregister_all(GAtChat *chat)
+{
+ GHashTableIter iter;
+ struct at_notify *notify;
+ char *prefix;
+ gpointer key, value;
+ GSList *l;
+
+ if (chat == NULL || chat->notify_list == NULL)
+ return FALSE;
+
+ g_hash_table_iter_init(&iter, chat->notify_list);
+
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ prefix = key;
+ notify = value;
+
+ for (l = notify->nodes; l; l = l->next)
+ at_notify_node_destroy(l->data);
+
+ g_slist_free(notify->nodes);
+ notify->nodes= NULL;
+ g_hash_table_iter_remove(&iter);
+ }
+
+ return TRUE;
+}
+
gboolean g_at_chat_set_wakeup_command(GAtChat *chat, const char *cmd,
unsigned int timeout, unsigned int msec)
{
diff --git a/gatchat/gatchat.h b/gatchat/gatchat.h
index 8fffda6a..c74ef15f 100644
--- a/gatchat/gatchat.h
+++ b/gatchat/gatchat.h
@@ -125,6 +125,7 @@ guint g_at_chat_register(GAtChat *chat, const char *prefix,
gpointer user_data, GDestroyNotify notify);
gboolean g_at_chat_unregister(GAtChat *chat, guint id);
+gboolean g_at_chat_unregister_all(GAtChat *chat);
gboolean g_at_chat_set_wakeup_command(GAtChat *chat, const char *cmd,
guint timeout, guint msec);