summaryrefslogtreecommitdiffstats
path: root/src/pedro/work/filesend.cpp
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2006-05-15 15:06:21 +0000
committerishmal <ishmal@users.sourceforge.net>2006-05-15 15:06:21 +0000
commit8325c242bbc39df39b5b2260d3e2aac289d8a930 (patch)
tree9a910be0c78883d9beec6cece07f7f800e0713ae /src/pedro/work/filesend.cpp
parentfix potential (though currently impossible) crash when spatial mode is used w... (diff)
downloadinkscape-8325c242bbc39df39b5b2260d3e2aac289d8a930.tar.gz
inkscape-8325c242bbc39df39b5b2260d3e2aac289d8a930.zip
Move from the jabber_whiteboard directory to its own, so that it can be updated in parallel.
(bzr r846)
Diffstat (limited to 'src/pedro/work/filesend.cpp')
-rw-r--r--src/pedro/work/filesend.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/pedro/work/filesend.cpp b/src/pedro/work/filesend.cpp
new file mode 100644
index 000000000..7a114abe2
--- /dev/null
+++ b/src/pedro/work/filesend.cpp
@@ -0,0 +1,95 @@
+
+
+#include <stdio.h>
+
+#include "pedroxmpp.h"
+
+//########################################################################
+//# T E S T
+//########################################################################
+
+
+class TestListener : public Pedro::XmppEventListener
+{
+public:
+ TestListener(){}
+
+ virtual ~TestListener(){}
+
+ virtual void processXmppEvent(const Pedro::XmppEvent &evt)
+ {
+ int typ = evt.getType();
+ switch (typ)
+ {
+ case Pedro::XmppEvent::EVENT_STATUS:
+ {
+ printf("STATUS: %s\n", evt.getData().c_str());
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_ERROR:
+ {
+ printf("ERROR: %s\n", evt.getData().c_str());
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_CONNECTED:
+ {
+ printf("CONNECTED\n");
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_DISCONNECTED:
+ {
+ printf("DISCONNECTED\n");
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_MUC_PRESENCE:
+ {
+ printf("MUC PRESENCE\n");
+ printf("group : %s\n", evt.getGroup().c_str());
+ printf("from : %s\n", evt.getFrom().c_str());
+ printf("presence: %d\n", evt.getPresence());
+ break;
+ }
+
+ }
+ }
+};
+
+
+bool doTest()
+{
+ printf("############ SENDING FILE\n");
+
+ Pedro::XmppClient client;
+ TestListener listener;
+ client.addXmppEventListener(listener);
+
+ //Host, port, user, pass, resource
+ if (!client.connect("jabber.org.uk", 443, "ishmal", "PASSWORD", "filesend"))
+ {
+ printf("Connect failed\n");
+ return false;
+ }
+
+
+ if (!client.fileSend("ishmal@jabber.org.uk/filerec",
+ "server.pem" , "server.pem",
+ "a short story by edgar allen poe"))
+ {
+ return false;
+ }
+
+ printf("OK\n");
+ client.pause(1000000);
+
+ client.disconnect();
+
+ return true;
+}
+
+int main(int argc, char **argv)
+{
+ if (!doTest())
+ return 1;
+ return 0;
+}
+