diff options
| author | daleharvey <daleharvey@users.sourceforge.net> | 2006-06-25 12:57:59 +0000 |
|---|---|---|
| committer | daleharvey <daleharvey@users.sourceforge.net> | 2006-06-25 12:57:59 +0000 |
| commit | 8052c8d78980445977922543a32864bd1d8c69fc (patch) | |
| tree | ba3df86d94ccb9ad3a1f4bc650e8f089e5d445bb /src/pedro/work/filesend.cpp | |
| parent | added inkboard-session.cpp to make.exclude (diff) | |
| download | inkscape-8052c8d78980445977922543a32864bd1d8c69fc.tar.gz inkscape-8052c8d78980445977922543a32864bd1d8c69fc.zip | |
restored pedro/work and added it to make.exclude
(bzr r1286)
Diffstat (limited to 'src/pedro/work/filesend.cpp')
| -rw-r--r-- | src/pedro/work/filesend.cpp | 95 |
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; +} + |
