From f4aa454397312aeafba775bac78f690ffe98cd8e Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 26 Mar 2016 15:51:43 +0000 Subject: [PATCH] Added stanza send hooks to C and Python exmaples --- tests/python-test.py | 12 +++++++++ tests/test-c-plugin/test-c-plugin.c | 41 +++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/tests/python-test.py b/tests/python-test.py index d65f9a7..7edacb4 100644 --- a/tests/python-test.py +++ b/tests/python-test.py @@ -2,6 +2,7 @@ import prof import threading import time +import sys plugin_win = "Python Test" @@ -417,3 +418,14 @@ def prof_post_priv_message_send(room, nick, message): _create_win() prof.win_show(plugin_win, "fired -> prof_post_priv_message_send: " + room + ", " + nick + ", " + message) +def prof_on_message_stanza_send(stanza): + _create_win() + prof.win_show(plugin_win, "fired -> prof_on_message_stanza_send: " + stanza) + +def prof_on_presence_stanza_send(stanza): + _create_win() + prof.win_show(plugin_win, "fired -> prof_on_presence_stanza_send: " + stanza) + +def prof_on_iq_stanza_send(stanza): + _create_win() + prof.win_show(plugin_win, "fired -> prof_on_iq_stanza_send: " + stanza) diff --git a/tests/test-c-plugin/test-c-plugin.c b/tests/test-c-plugin/test-c-plugin.c index 0e7036b..63e22af 100644 --- a/tests/test-c-plugin/test-c-plugin.c +++ b/tests/test-c-plugin/test-c-plugin.c @@ -685,3 +685,44 @@ prof_post_priv_message_send(const char * const room, const char * const nick, co sprintf(buf, "%s%s, %s, %s", str, room, nick, message); prof_win_show(plugin_win, buf); } + +char* +prof_on_message_stanza_send(const char *const stanza) +{ + create_win(); + + char *str = "fired -> prof_on_message_stanza_send: "; + char buf[strlen(str) + strlen(stanza)]; + sprintf(buf, "%s%s", str, stanza); + prof_win_show(plugin_win, buf); + + return NULL; + // char *new_stanza = strdup("Art thou not Romeo, and a Montague?"); + // return (char *)new_stanza; +} + +char* +prof_on_presence_stanza_send(const char *const stanza) +{ + create_win(); + + char *str = "fired -> prof_on_presence_stanza_send: "; + char buf[strlen(str) + strlen(stanza)]; + sprintf(buf, "%s%s", str, stanza); + prof_win_show(plugin_win, buf); + + return NULL; +} + +char* +prof_on_iq_stanza_send(const char *const stanza) +{ + create_win(); + + char *str = "fired -> prof_on_iq_stanza_send: "; + char buf[strlen(str) + strlen(stanza)]; + sprintf(buf, "%s%s", str, stanza); + prof_win_show(plugin_win, buf); + + return NULL; +}