about summary refs log tree commit diff stats
path: root/src/plugins/plugins.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-03-26 15:50:16 +0000
committerJames Booth <boothj5@gmail.com>2016-03-26 15:50:16 +0000
commitd0397f3da5ca659d86590e8730e6765609ef56ca (patch)
tree9ee2be97b1cd9c059f3024d46131fa118a251218 /src/plugins/plugins.c
parentce9b0836a0cdbf81b8fdc47f163b8a165d331101 (diff)
downloadprofani-tty-d0397f3da5ca659d86590e8730e6765609ef56ca.tar.gz
Added stanza send hooks for plugins
Diffstat (limited to 'src/plugins/plugins.c')
-rw-r--r--src/plugins/plugins.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c
index 75fc01d6..9ec3f5c7 100644
--- a/src/plugins/plugins.c
+++ b/src/plugins/plugins.c
@@ -409,6 +409,69 @@ plugins_post_priv_message_send(const char * const jid, const char * const messag
     jid_destroy(jidp);
 }
 
+char*
+plugins_on_message_stanza_send(const char *const text)
+{
+    char *new_stanza = NULL;
+    char *curr_stanza = strdup(text);
+
+    GSList *curr = plugins;
+    while (curr) {
+        ProfPlugin *plugin = curr->data;
+        new_stanza = plugin->on_message_stanza_send(plugin, curr_stanza);
+        if (new_stanza) {
+            free(curr_stanza);
+            curr_stanza = strdup(new_stanza);
+            free(new_stanza);
+        }
+        curr = g_slist_next(curr);
+    }
+
+    return curr_stanza;
+}
+
+char*
+plugins_on_presence_stanza_send(const char *const text)
+{
+    char *new_stanza = NULL;
+    char *curr_stanza = strdup(text);
+
+    GSList *curr = plugins;
+    while (curr) {
+        ProfPlugin *plugin = curr->data;
+        new_stanza = plugin->on_presence_stanza_send(plugin, curr_stanza);
+        if (new_stanza) {
+            free(curr_stanza);
+            curr_stanza = strdup(new_stanza);
+            free(new_stanza);
+        }
+        curr = g_slist_next(curr);
+    }
+
+    return curr_stanza;
+}
+
+char*
+plugins_on_iq_stanza_send(const char *const text)
+{
+    char *new_stanza = NULL;
+    char *curr_stanza = strdup(text);
+
+    GSList *curr = plugins;
+    while (curr) {
+        ProfPlugin *plugin = curr->data;
+        new_stanza = plugin->on_iq_stanza_send(plugin, curr_stanza);
+        if (new_stanza) {
+            free(curr_stanza);
+            curr_stanza = strdup(new_stanza);
+            free(new_stanza);
+        }
+        curr = g_slist_next(curr);
+    }
+
+    return curr_stanza;
+}
+
 void
 plugins_shutdown(void)
 {