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 | |
| 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')
| -rw-r--r-- | src/make.exclude | 2 | ||||
| -rw-r--r-- | src/pedro/work/filerec.cpp | 130 | ||||
| -rw-r--r-- | src/pedro/work/filesend.cpp | 95 | ||||
| -rw-r--r-- | src/pedro/work/groupchat.cpp | 225 | ||||
| -rw-r--r-- | src/pedro/work/inklayout.svg | 378 | ||||
| -rw-r--r-- | src/pedro/work/test.cpp | 183 |
6 files changed, 1012 insertions, 1 deletions
diff --git a/src/make.exclude b/src/make.exclude index f7e5a4562..4c9afd7f8 100644 --- a/src/make.exclude +++ b/src/make.exclude @@ -46,7 +46,7 @@ winmain.cpp 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 new file mode 100644 index 000000000..01d9b6bd8 --- /dev/null +++ b/src/pedro/work/filerec.cpp @@ -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 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; +} + diff --git a/src/pedro/work/groupchat.cpp b/src/pedro/work/groupchat.cpp new file mode 100644 index 000000000..6c2e186d9 --- /dev/null +++ b/src/pedro/work/groupchat.cpp @@ -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 new file mode 100644 index 000000000..5f28a129b --- /dev/null +++ b/src/pedro/work/inklayout.svg @@ -0,0 +1,378 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="841.88977pt"
+ height="595.27557pt"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.42+devel"
+ version="1.0"
+ sodipodi:docbase="/home/rjamison/pedro"
+ sodipodi:docname="inklayout.svg">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Mend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mend"
+ style="overflow:visible;">
+ <path
+ id="path4241"
+ 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 "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.4) rotate(180)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mstart"
+ style="overflow:visible">
+ <path
+ id="path4244"
+ 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 "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.4)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="TriangleInL"
+ style="overflow:visible">
+ <path
+ id="path4158"
+ d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lstart"
+ style="overflow:visible">
+ <path
+ id="path4232"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
+ 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 "
+ transform="scale(1.1) translate(-5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path4250"
+ 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 "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="544.45061"
+ inkscape:cy="385.08312"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ fill="#000000"
+ inkscape:window-width="899"
+ inkscape:window-height="951"
+ inkscape:window-x="284"
+ inkscape:window-y="59" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ y="20.094482"
+ x="424.57144"
+ height="37.142857"
+ width="240"
+ id="rect3148"
+ style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.20000005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.20000005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2273"
+ width="240"
+ height="37.142857"
+ x="418.57144"
+ y="14.094482" />
+ <rect
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1358"
+ width="83.244057"
+ height="35.076485"
+ x="191.22281"
+ y="182.43959" />
+ <text
+ xml:space="preserve"
+ 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"
+ x="199.27339"
+ y="203.54922"
+ id="text2233"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan2235"
+ x="199.27339"
+ y="203.54922">Private chat</tspan></text>
+ <rect
+ y="278.15387"
+ x="282.6514"
+ height="35.076485"
+ width="83.244057"
+ id="rect2237"
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <text
+ id="text2239"
+ y="331.4064"
+ x="252.13055"
+ 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"
+ xml:space="preserve"><tspan
+ y="331.4064"
+ x="252.13055"
+ id="tspan2241"
+ sodipodi:role="line">Gui Client Main Window</tspan></text>
+ <rect
+ y="182.43959"
+ x="289.22281"
+ height="35.076485"
+ width="83.244057"
+ id="rect2243"
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <text
+ id="text2245"
+ y="204.97781"
+ x="302.9877"
+ 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"
+ xml:space="preserve"
+ sodipodi:linespacing="125%"><tspan
+ y="204.97781"
+ x="302.9877"
+ id="tspan2247"
+ sodipodi:role="line">Group chat</tspan></text>
+ <rect
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.62177706;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2249"
+ width="96.722092"
+ height="35.076485"
+ x="391.2695"
+ y="182.43959" />
+ <text
+ xml:space="preserve"
+ 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"
+ x="419.9877"
+ y="173.54926"
+ id="text2251"><tspan
+ sodipodi:role="line"
+ id="tspan2253"
+ x="419.9877"
+ y="173.54926">Dialog</tspan></text>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 249.87329,217.80449 L 307.24497,277.86545"
+ id="path2255"
+ inkscape:connector-type="polyline"
+ inkscape:connection-start="#rect1358"
+ inkscape:connection-end="#rect2237" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 329.62092,217.80449 L 325.49734,277.86545"
+ id="path2257"
+ inkscape:connector-type="polyline"
+ inkscape:connection-start="#rect2243"
+ inkscape:connection-end="#rect2237" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 418.11835,217.82696 L 345.75854,277.86545"
+ id="path2259"
+ inkscape:connector-type="polyline"
+ inkscape:connection-start="#rect2249"
+ inkscape:connection-end="#rect2237" />
+ <text
+ xml:space="preserve"
+ 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"
+ x="428.57141"
+ y="39.808769"
+ id="text2261"
+ sodipodi:linespacing="100%"><tspan
+ sodipodi:role="line"
+ id="tspan2263"
+ x="428.57141"
+ y="39.808769">Inkboard Layout</tspan></text>
+ <rect
+ y="182.02116"
+ x="582.86676"
+ height="35.076485"
+ width="83.244057"
+ id="rect3150"
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <text
+ id="text3152"
+ y="173.84511"
+ x="603.06018"
+ 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"
+ xml:space="preserve"><tspan
+ y="173.84511"
+ x="603.06018"
+ id="tspan3154"
+ sodipodi:role="line">Session</tspan></text>
+ <rect
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3156"
+ width="83.244057"
+ height="35.076485"
+ x="674.29535"
+ y="277.73547" />
+ <text
+ xml:space="preserve"
+ 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"
+ x="664.48877"
+ y="330.98801"
+ id="text3158"><tspan
+ sodipodi:role="line"
+ id="tspan3160"
+ x="664.48877"
+ y="330.98801">Session Manager</tspan></text>
+ <rect
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3162"
+ width="83.244057"
+ height="35.076485"
+ x="680.86676"
+ y="182.02116" />
+ <text
+ xml:space="preserve"
+ 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"
+ x="701.06018"
+ y="173.84511"
+ id="text3164"><tspan
+ sodipodi:role="line"
+ id="tspan3166"
+ x="701.06018"
+ y="173.84511">Session</tspan></text>
+ <rect
+ y="182.02116"
+ x="782.86676"
+ height="35.076485"
+ width="83.244057"
+ id="rect3168"
+ style="fill:none;fill-opacity:0.75;stroke:#000000;stroke-width:0.57683086;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <text
+ id="text3170"
+ y="173.84511"
+ x="803.06018"
+ 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"
+ xml:space="preserve"><tspan
+ y="173.84511"
+ x="803.06018"
+ id="tspan3172"
+ sodipodi:role="line">Session</tspan></text>
+ <path
+ inkscape:connection-end="#rect2237"
+ inkscape:connection-start="#rect1358"
+ inkscape:connector-type="polyline"
+ id="path3174"
+ d="M 249.87329,217.80449 L 307.24497,277.86545"
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <text
+ id="text3180"
+ y="195.69208"
+ x="407.84482"
+ 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"
+ xml:space="preserve"
+ sodipodi:linespacing="125%"><tspan
+ y="195.69208"
+ x="407.84482"
+ id="tspan3182"
+ sodipodi:role="line">Private chat</tspan></text>
+ <text
+ xml:space="preserve"
+ 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"
+ x="393.70197"
+ y="208.54922"
+ id="text3184"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3186"
+ x="393.70197"
+ y="208.54922">w/ group member</tspan></text>
+ <text
+ id="text3188"
+ y="174.26353"
+ x="311.41626"
+ 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"
+ xml:space="preserve"><tspan
+ y="174.26353"
+ x="311.41626"
+ id="tspan3190"
+ sodipodi:role="line">Dialog</tspan></text>
+ <text
+ xml:space="preserve"
+ 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"
+ x="213.41626"
+ y="174.26353"
+ id="text3192"><tspan
+ sodipodi:role="line"
+ id="tspan3194"
+ x="213.41626"
+ y="174.26353">Dialog</tspan></text>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 804.26751,217.38606 L 736.13865,277.44706"
+ id="path3196"
+ inkscape:connector-type="polyline"
+ inkscape:connection-start="#rect3168"
+ inkscape:connection-end="#rect3156" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 721.26487,217.38606 L 717.14129,277.44706"
+ id="path3198"
+ inkscape:connector-type="polyline"
+ inkscape:connection-start="#rect3162"
+ inkscape:connection-end="#rect3156" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 641.51724,217.38606 L 698.88893,277.44706"
+ id="path3200"
+ inkscape:connector-type="polyline"
+ inkscape:connection-start="#rect3150"
+ inkscape:connection-end="#rect3156" />
+ <path
+ 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)"
+ d="M 452.54834,260.23141 C 615.1829,260.23141 616.19305,260.23141 616.19305,260.23141"
+ id="path3202" />
+ </g>
+</svg>
diff --git a/src/pedro/work/test.cpp b/src/pedro/work/test.cpp new file mode 100644 index 000000000..f822ceca9 --- /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; +} + |
