summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87ae463)
raw | patch | inline | side by side (parent: 87ae463)
author | daleharvey <daleharvey@users.sourceforge.net> | |
Sun, 25 Jun 2006 12:57:59 +0000 (12:57 +0000) | ||
committer | daleharvey <daleharvey@users.sourceforge.net> | |
Sun, 25 Jun 2006 12:57:59 +0000 (12:57 +0000) |
src/make.exclude | patch | blob | history | |
src/pedro/work/filerec.cpp | [new file with mode: 0644] | patch | blob |
src/pedro/work/filesend.cpp | [new file with mode: 0644] | patch | blob |
src/pedro/work/groupchat.cpp | [new file with mode: 0644] | patch | blob |
src/pedro/work/inklayout.svg | [new file with mode: 0644] | patch | blob |
src/pedro/work/test.cpp | [new file with mode: 0644] | patch | blob |
diff --git a/src/make.exclude b/src/make.exclude
index f7e5a456223efdd49da166f52871e83c414f3b9e..4c9afd7f8480a3111d4cddf2946cac5f3df91650 100644 (file)
--- a/src/make.exclude
+++ b/src/make.exclude
xml/quote-test.cpp
xml/repr-action-test.cpp
io/streamtest.cpp
-
+pedro/work
###############################################
# Bob:
diff --git a/src/pedro/work/filerec.cpp b/src/pedro/work/filerec.cpp
--- /dev/null
@@ -0,0 +1,130 @@
+
+
+#include <stdio.h>
+
+#include "pedroxmpp.h"
+
+//########################################################################
+//# T E S T
+//########################################################################
+
+
+class TestListener : public Pedro::XmppEventListener
+{
+public:
+ TestListener()
+ {
+ incoming = false;
+ }
+
+ 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;
+ }
+ case Pedro::XmppEvent::EVENT_FILE_RECEIVE:
+ {
+ printf("FILE RECEIVE\n");
+ from = evt.getFrom();
+ streamId = evt.getStreamId();
+ iqId = evt.getIqId();
+ fileName = evt.getFileName();
+ fileHash = evt.getFileHash();
+ fileSize = evt.getFileSize();
+ incoming = true;
+ break;
+ }
+
+ }
+ }
+
+ Pedro::DOMString from;
+ Pedro::DOMString streamId;
+ Pedro::DOMString iqId;
+ Pedro::DOMString fileName;
+ Pedro::DOMString fileHash;
+ long fileSize;
+ bool incoming;
+};
+
+
+bool doTest()
+{
+ printf("############ RECEIVING FILE\n");
+
+ Pedro::XmppClient client;
+ TestListener listener;
+ client.addXmppEventListener(listener);
+
+ //Host, port, user, pass, resource
+ if (!client.connect("jabber.org.uk", 443, "ishmal", "PASSWORD", "filerec"))
+ {
+ printf("Connect failed\n");
+ return false;
+ }
+
+ while (true)
+ {
+ printf("####Waiting for file\n");
+ if (listener.incoming)
+ break;
+ client.pause(2000);
+ }
+
+ printf("#####GOT A FILE\n");
+/*
+TODO: Just Commented out to compile
+ if (!client.fileReceive(listener.from,
+ listener.iqId,
+ listener.streamId,
+ listener.fileName,
+ "text.sav",
+ listener.fileHash))
+ {
+ return false;
+ }
+*/
+ client.pause(1000000);
+
+ client.disconnect();
+
+ return true;
+}
+
+int main(int argc, char **argv)
+{
+ if (!doTest())
+ return 1;
+ return 0;
+}
+
diff --git a/src/pedro/work/filesend.cpp b/src/pedro/work/filesend.cpp
--- /dev/null
@@ -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;
+}
+
diff --git a/src/pedro/work/groupchat.cpp b/src/pedro/work/groupchat.cpp
--- /dev/null
@@ -0,0 +1,225 @@
+
+
+#include <stdio.h>
+#include <string.h>
+
+#include "pedroxmpp.h"
+
+//########################################################################
+//# T E S T
+//########################################################################
+
+using namespace Pedro;
+
+
+class Listener : public Pedro::XmppEventListener
+{
+public:
+ Listener(){}
+
+ virtual ~Listener(){}
+
+ 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_MESSAGE:
+ {
+ printf("<%s> %s\n", evt.getFrom().c_str(), evt.getData().c_str());
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_PRESENCE:
+ {
+ printf("PRESENCE\n");
+ printf("from : %s\n", evt.getFrom().c_str());
+ //printf("presence : %s\n", evt.getPresence().c_str());
+ // TODO: Just Commented out to compile
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_MUC_MESSAGE:
+ {
+ printf("<%s> %s\n", evt.getFrom().c_str(), evt.getData().c_str());
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_MUC_JOIN:
+ {
+ printf("MUC JOIN\n");
+ printf("group: %s\n", evt.getGroup().c_str());
+ printf("from : %s\n", evt.getFrom().c_str());
+ //printf("presence: %s\n", evt.getPresence().c_str());
+ // TODO: Just Commented out to compile
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_MUC_LEAVE:
+ {
+ printf("MUC LEAVE\n");
+ printf("group: %s\n", evt.getGroup().c_str());
+ printf("from : %s\n", evt.getFrom().c_str());
+ //printf("presence: %s\n", evt.getPresence().c_str());
+ // TODO: Just Commented out to compile
+ 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: %s\n", evt.getPresence().c_str());
+ // TODO: Just Commented out to compile
+ break;
+ }
+
+ }
+ }
+};
+
+
+class CommandLineGroupChat
+{
+public:
+ CommandLineGroupChat(const DOMString &hostArg,
+ int portArg,
+ const DOMString &userArg,
+ const DOMString &passArg,
+ const DOMString &resourceArg,
+ const DOMString &groupJidArg,
+ const DOMString &nickArg)
+ {
+ host = hostArg;
+ port = portArg;
+ user = userArg;
+ pass = passArg;
+ resource = resourceArg;
+ groupJid = groupJidArg;
+ nick = nickArg;
+ }
+ ~CommandLineGroupChat()
+ {
+ client.disconnect();
+ }
+
+ virtual bool run();
+ virtual bool processCommandLine();
+
+private:
+
+ DOMString host;
+ int port;
+ DOMString user;
+ DOMString pass;
+ DOMString resource;
+ DOMString groupJid;
+ DOMString nick;
+
+ XmppClient client;
+
+};
+
+
+bool CommandLineGroupChat::run()
+{
+ Listener listener;
+ client.addXmppEventListener(listener);
+
+ //Host, port, user, pass, resource
+ if (!client.connect(host, port, user, pass, resource))
+ {
+ return false;
+ }
+
+ //Group jabber id, nick, pass
+ if (!client.groupChatJoin(groupJid, nick, ""))
+ {
+ printf("failed join\n");
+ return false;
+ }
+
+ //Allow receive buffer to clear out
+ client.pause(10000);
+
+ while (true)
+ {
+ if (!processCommandLine())
+ break;
+ }
+
+ //Group jabber id, nick
+ client.groupChatLeave(groupJid, nick);
+
+
+ client.disconnect();
+
+ return true;
+}
+
+
+bool CommandLineGroupChat::processCommandLine()
+{
+ char buf[512];
+ printf("send>:");
+ fgets(buf, 511, stdin);
+
+ if (buf[0]=='/')
+ {
+ if (strncmp(buf, "/q", 2)==0)
+ return false;
+ else
+ {
+ printf("Unknown command\n");
+ return true;
+ }
+ }
+
+ else
+ {
+ DOMString msg = buf;
+ if (msg.size() > 0 )
+ {
+ if (!client.groupChatMessage(groupJid, buf))
+ {
+ printf("failed message send\n");
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+
+int main(int argc, char **argv)
+{
+ if (argc!=8)
+ {
+ printf("usage: %s host port user pass resource groupid nick\n", argv[0]);
+ return 1;
+ }
+ int port = atoi(argv[2]);
+ CommandLineGroupChat groupChat(argv[1], port, argv[3], argv[4],
+ argv[5], argv[6], argv[7]);
+ if (!groupChat.run())
+ return 1;
+ return 0;
+}
+
diff --git a/src/pedro/work/inklayout.svg b/src/pedro/work/inklayout.svg
--- /dev/null
@@ -0,0 +1,378 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<!-- Created with Inkscape (http://www.inkscape.org/) -->\r
+<svg\r
+ xmlns:dc="http://purl.org/dc/elements/1.1/"\r
+ xmlns:cc="http://web.resource.org/cc/"\r
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
+ xmlns:svg="http://www.w3.org/2000/svg"\r
+ xmlns="http://www.w3.org/2000/svg"\r
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\r
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
+ width="841.88977pt"\r
+ height="595.27557pt"\r
+ id="svg2"\r
+ sodipodi:version="0.32"\r
+ inkscape:version="0.42+devel"\r
+ version="1.0"\r
+ sodipodi:docbase="/home/rjamison/pedro"\r
+ sodipodi:docname="inklayout.svg">\r
+ <defs\r
+ id="defs4">\r
+ <marker\r
+ inkscape:stockid="Arrow1Mend"\r
+ orient="auto"\r
+ refY="0.0"\r
+ refX="0.0"\r
+ id="Arrow1Mend"\r
+ style="overflow:visible;">\r
+ <path\r
+ id="path4241"\r
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "\r
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"\r
+ transform="scale(0.4) rotate(180)" />\r
+ </marker>\r
+ <marker\r
+ inkscape:stockid="Arrow1Mstart"\r
+ orient="auto"\r
+ refY="0.0"\r
+ refX="0.0"\r
+ id="Arrow1Mstart"\r
+ style="overflow:visible">\r
+ <path\r
+ id="path4244"\r
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "\r
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"\r
+ transform="scale(0.4)" />\r
+ </marker>\r
+ <marker\r
+ inkscape:stockid="TriangleInL"\r
+ orient="auto"\r
+ refY="0.0"\r
+ refX="0.0"\r
+ id="TriangleInL"\r
+ style="overflow:visible">\r
+ <path\r
+ id="path4158"\r
+ d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "\r
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"\r
+ transform="scale(-0.8)" />\r
+ </marker>\r
+ <marker\r
+ inkscape:stockid="Arrow2Lstart"\r
+ orient="auto"\r
+ refY="0.0"\r
+ refX="0.0"\r
+ id="Arrow2Lstart"\r
+ style="overflow:visible">\r
+ <path\r
+ id="path4232"\r
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"\r
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "\r
+ transform="scale(1.1) translate(-5,0)" />\r
+ </marker>\r
+ <marker\r
+ inkscape:stockid="Arrow1Lstart"\r
+ orient="auto"\r
+ refY="0.0"\r
+ refX="0.0"\r
+ id="Arrow1Lstart"\r
+ style="overflow:visible">\r
+ <path\r
+ id="path4250"\r
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "\r
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"\r
+ transform="scale(0.8)" />\r
+ </marker>\r
+ </defs>\r
+ <sodipodi:namedview\r
+ id="base"\r
+ pagecolor="#ffffff"\r
+ bordercolor="#666666"\r
+ borderopacity="1.0"\r
+ inkscape:pageopacity="0.0"\r
+ inkscape:pageshadow="2"\r
+ inkscape:zoom="0.98994949"\r
+ inkscape:cx="544.45061"\r
+ inkscape:cy="385.08312"\r
+ inkscape:document-units="px"\r
+ inkscape:current-layer="layer1"\r
+ fill="#000000"\r
+ inkscape:window-width="899"\r
+ inkscape:window-height="951"\r
+ inkscape:window-x="284"\r
+ inkscape:window-y="59" />\r
+ <metadata\r
+ id="metadata7">\r
+ <rdf:RDF>\r
+ <cc:Work\r
+ rdf:about="">\r
+ <dc:format>image/svg+xml</dc:format>\r
+ <dc:type\r
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\r
+ </cc:Work>\r
+ </rdf:RDF>\r
+ </metadata>\r
+ <g\r
+ inkscape:label="Layer 1"\r
+ inkscape:groupmode="layer"\r
+ id="layer1">\r
+ <rect\r
+ y="20.094482"\r
+ x="424.57144"\r
+ height="37.142857"\r
+ width="240"\r
+ id="rect3148"\r
+ style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.20000005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />\r
+ <rect\r
+ style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.20000005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"\r
+ id="rect2273"\r
+ width="240"\r
+ height="37.142857"\r
+ x="418.57144"\r
+ y="14.094482" />\r
+ <rect\r
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"\r
+ id="rect1358"\r
+ width="83.244057"\r
+ height="35.076485"\r
+ x="191.22281"\r
+ y="182.43959" />\r
+ <text\r
+ xml:space="preserve"\r
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ x="199.27339"\r
+ y="203.54922"\r
+ id="text2233"\r
+ sodipodi:linespacing="125%"><tspan\r
+ sodipodi:role="line"\r
+ id="tspan2235"\r
+ x="199.27339"\r
+ y="203.54922">Private chat</tspan></text>\r
+ <rect\r
+ y="278.15387"\r
+ x="282.6514"\r
+ height="35.076485"\r
+ width="83.244057"\r
+ id="rect2237"\r
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />\r
+ <text\r
+ id="text2239"\r
+ y="331.4064"\r
+ x="252.13055"\r
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ xml:space="preserve"><tspan\r
+ y="331.4064"\r
+ x="252.13055"\r
+ id="tspan2241"\r
+ sodipodi:role="line">Gui Client Main Window</tspan></text>\r
+ <rect\r
+ y="182.43959"\r
+ x="289.22281"\r
+ height="35.076485"\r
+ width="83.244057"\r
+ id="rect2243"\r
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />\r
+ <text\r
+ id="text2245"\r
+ y="204.97781"\r
+ x="302.9877"\r
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ xml:space="preserve"\r
+ sodipodi:linespacing="125%"><tspan\r
+ y="204.97781"\r
+ x="302.9877"\r
+ id="tspan2247"\r
+ sodipodi:role="line">Group chat</tspan></text>\r
+ <rect\r
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.62177706;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"\r
+ id="rect2249"\r
+ width="96.722092"\r
+ height="35.076485"\r
+ x="391.2695"\r
+ y="182.43959" />\r
+ <text\r
+ xml:space="preserve"\r
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ x="419.9877"\r
+ y="173.54926"\r
+ id="text2251"><tspan\r
+ sodipodi:role="line"\r
+ id="tspan2253"\r
+ x="419.9877"\r
+ y="173.54926">Dialog</tspan></text>\r
+ <path\r
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"\r
+ d="M 249.87329,217.80449 L 307.24497,277.86545"\r
+ id="path2255"\r
+ inkscape:connector-type="polyline"\r
+ inkscape:connection-start="#rect1358"\r
+ inkscape:connection-end="#rect2237" />\r
+ <path\r
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"\r
+ d="M 329.62092,217.80449 L 325.49734,277.86545"\r
+ id="path2257"\r
+ inkscape:connector-type="polyline"\r
+ inkscape:connection-start="#rect2243"\r
+ inkscape:connection-end="#rect2237" />\r
+ <path\r
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"\r
+ d="M 418.11835,217.82696 L 345.75854,277.86545"\r
+ id="path2259"\r
+ inkscape:connector-type="polyline"\r
+ inkscape:connection-start="#rect2249"\r
+ inkscape:connection-end="#rect2237" />\r
+ <text\r
+ xml:space="preserve"\r
+ style="font-size:24px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ x="428.57141"\r
+ y="39.808769"\r
+ id="text2261"\r
+ sodipodi:linespacing="100%"><tspan\r
+ sodipodi:role="line"\r
+ id="tspan2263"\r
+ x="428.57141"\r
+ y="39.808769">Inkboard Layout</tspan></text>\r
+ <rect\r
+ y="182.02116"\r
+ x="582.86676"\r
+ height="35.076485"\r
+ width="83.244057"\r
+ id="rect3150"\r
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />\r
+ <text\r
+ id="text3152"\r
+ y="173.84511"\r
+ x="603.06018"\r
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ xml:space="preserve"><tspan\r
+ y="173.84511"\r
+ x="603.06018"\r
+ id="tspan3154"\r
+ sodipodi:role="line">Session</tspan></text>\r
+ <rect\r
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"\r
+ id="rect3156"\r
+ width="83.244057"\r
+ height="35.076485"\r
+ x="674.29535"\r
+ y="277.73547" />\r
+ <text\r
+ xml:space="preserve"\r
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ x="664.48877"\r
+ y="330.98801"\r
+ id="text3158"><tspan\r
+ sodipodi:role="line"\r
+ id="tspan3160"\r
+ x="664.48877"\r
+ y="330.98801">Session Manager</tspan></text>\r
+ <rect\r
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"\r
+ id="rect3162"\r
+ width="83.244057"\r
+ height="35.076485"\r
+ x="680.86676"\r
+ y="182.02116" />\r
+ <text\r
+ xml:space="preserve"\r
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ x="701.06018"\r
+ y="173.84511"\r
+ id="text3164"><tspan\r
+ sodipodi:role="line"\r
+ id="tspan3166"\r
+ x="701.06018"\r
+ y="173.84511">Session</tspan></text>\r
+ <rect\r
+ y="182.02116"\r
+ x="782.86676"\r
+ height="35.076485"\r
+ width="83.244057"\r
+ id="rect3168"\r
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />\r
+ <text\r
+ id="text3170"\r
+ y="173.84511"\r
+ x="803.06018"\r
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ xml:space="preserve"><tspan\r
+ y="173.84511"\r
+ x="803.06018"\r
+ id="tspan3172"\r
+ sodipodi:role="line">Session</tspan></text>\r
+ <path\r
+ inkscape:connection-end="#rect2237"\r
+ inkscape:connection-start="#rect1358"\r
+ inkscape:connector-type="polyline"\r
+ id="path3174"\r
+ d="M 249.87329,217.80449 L 307.24497,277.86545"\r
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />\r
+ <text\r
+ id="text3180"\r
+ y="195.69208"\r
+ x="407.84482"\r
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ xml:space="preserve"\r
+ sodipodi:linespacing="125%"><tspan\r
+ y="195.69208"\r
+ x="407.84482"\r
+ id="tspan3182"\r
+ sodipodi:role="line">Private chat</tspan></text>\r
+ <text\r
+ xml:space="preserve"\r
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ x="393.70197"\r
+ y="208.54922"\r
+ id="text3184"\r
+ sodipodi:linespacing="125%"><tspan\r
+ sodipodi:role="line"\r
+ id="tspan3186"\r
+ x="393.70197"\r
+ y="208.54922">w/ group member</tspan></text>\r
+ <text\r
+ id="text3188"\r
+ y="174.26353"\r
+ x="311.41626"\r
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ xml:space="preserve"><tspan\r
+ y="174.26353"\r
+ x="311.41626"\r
+ id="tspan3190"\r
+ sodipodi:role="line">Dialog</tspan></text>\r
+ <text\r
+ xml:space="preserve"\r
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"\r
+ x="213.41626"\r
+ y="174.26353"\r
+ id="text3192"><tspan\r
+ sodipodi:role="line"\r
+ id="tspan3194"\r
+ x="213.41626"\r
+ y="174.26353">Dialog</tspan></text>\r
+ <path\r
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"\r
+ d="M 804.26751,217.38606 L 736.13865,277.44706"\r
+ id="path3196"\r
+ inkscape:connector-type="polyline"\r
+ inkscape:connection-start="#rect3168"\r
+ inkscape:connection-end="#rect3156" />\r
+ <path\r
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"\r
+ d="M 721.26487,217.38606 L 717.14129,277.44706"\r
+ id="path3198"\r
+ inkscape:connector-type="polyline"\r
+ inkscape:connection-start="#rect3162"\r
+ inkscape:connection-end="#rect3156" />\r
+ <path\r
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"\r
+ d="M 641.51724,217.38606 L 698.88893,277.44706"\r
+ id="path3200"\r
+ inkscape:connector-type="polyline"\r
+ inkscape:connection-start="#rect3150"\r
+ inkscape:connection-end="#rect3156" />\r
+ <path\r
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:6.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"\r
+ d="M 452.54834,260.23141 C 615.1829,260.23141 616.19305,260.23141 616.19305,260.23141"\r
+ id="path3202" />\r
+ </g>\r
+</svg>\r
diff --git a/src/pedro/work/test.cpp b/src/pedro/work/test.cpp
--- /dev/null
+++ b/src/pedro/work/test.cpp
@@ -0,0 +1,183 @@
+
+
+#include <stdio.h>
+
+#include "pedroxmpp.h"
+#include "pedroconfig.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_MESSAGE:
+ {
+ printf("MESSAGE\n");
+ printf("from : %s\n", evt.getFrom().c_str());
+ printf("msg : %s\n", evt.getData().c_str());
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_PRESENCE:
+ {
+ printf("PRESENCE\n");
+ printf("from : %s\n", evt.getFrom().c_str());
+ printf("presence : %d\n", evt.getPresence());
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_MUC_MESSAGE:
+ {
+ printf("MUC GROUP MESSAGE\n");
+ printf("group: %s\n", evt.getGroup().c_str());
+ printf("from : %s\n", evt.getFrom().c_str());
+ printf("msg : %s\n", evt.getData().c_str());
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_MUC_JOIN:
+ {
+ printf("MUC JOIN\n");
+ printf("group: %s\n", evt.getGroup().c_str());
+ printf("from : %s\n", evt.getFrom().c_str());
+ printf("presence: %d\n", evt.getPresence());
+ break;
+ }
+ case Pedro::XmppEvent::EVENT_MUC_LEAVE:
+ {
+ printf("MUC LEAVE\n");
+ printf("group: %s\n", evt.getGroup().c_str());
+ printf("from : %s\n", evt.getFrom().c_str());
+ printf("presence: %d\n", evt.getPresence());
+ 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("############ TESTING\n");
+
+ char *groupJid = "inkscape@conference.gristle.org";
+
+ Pedro::XmppClient client;
+ TestListener listener;
+ client.addXmppEventListener(listener);
+
+ //Host, port, user, pass, resource
+ if (!client.connect("jabber.org.uk", 443, "ishmal", "PASSWORD", "myclient"))
+ {
+ printf("Connect failed\n");
+ return false;
+ }
+
+ //Group jabber id, nick, pass
+ client.groupChatJoin(groupJid, "mynick", "");
+
+ client.pause(8000);
+
+ //Group jabber id, nick, msg
+ //client.groupChatMessage(groupJid, "hello, world");
+
+ client.pause(3000);
+
+ //client.groupChatGetUserList(groupJid);
+
+ client.pause(3000);
+
+ //client.groupChatPrivateMessage("inkscape2@conference.gristle.org",
+ // "ishmal", "hello, world");
+ client.message("ishmal@jabber.org.uk/https", "hey, bob");
+
+ client.pause(60000);
+
+ //Group jabber id, nick
+ client.groupChatLeave(groupJid, "mynick");
+
+ client.pause(1000000);
+
+ client.disconnect();
+
+ return true;
+}
+
+
+bool configTest()
+{
+ printf("#################################\n");
+ printf("## C o n f i g t e s t\n");
+ printf("#################################\n");
+
+ Pedro::XmppConfig config;
+
+ if (!config.readFile("pedro.ini"))
+ {
+ printf("could not read config file\n");
+ return false;
+ }
+
+ Pedro::DOMString str = config.toXmlBuffer();
+
+ printf("#################################\n");
+ printf("%s\n", str.c_str());
+
+ if (!config.writeFile("pedro2.ini"))
+ {
+ printf("could not write config file\n");
+ return false;
+ }
+
+
+ return true;
+
+};
+
+
+
+int main(int argc, char **argv)
+{
+ if (!configTest())
+ return 1;
+ return 0;
+}
+