Code

a2fbd87a29df615c6bd53ef6da1536dec4e1a742
[inkscape.git] / src / pedro / pedroxmpp.h
1 #ifndef __XMPP_H__
2 #define __XMPP_H__
3 /*
4  * API for the Pedro mini-XMPP client.
5  *
6  * Authors:
7  *   Bob Jamison
8  *
9  * Copyright (C) 2005 Bob Jamison
10  *
11  *  This library is free software; you can redistribute it and/or
12  *  modify it under the terms of the GNU Lesser General Public
13  *  License as published by the Free Software Foundation; either
14  *  version 2.1 of the License, or (at your option) any later version.
15  *
16  *  This library is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  *  Lesser General Public License for more details.
20  *
21  *  You should have received a copy of the GNU Lesser General Public
22  *  License along with this library; if not, write to the Free Software
23  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24  */
26 #include <stdio.h>
27 #include <vector>
29 #include <string>
31 #include "pedrodom.h"
33 namespace Pedro
34 {
36 typedef std::string DOMString;
39 //########################################################################
40 //# X M P P    E V E N T
41 //########################################################################
42 class XmppUser
43 {
44 public:
45     XmppUser()
46         {
47         }
48     XmppUser(const DOMString &jidArg, const DOMString &nickArg)
49         {
50         jid  = jidArg;
51         nick = nickArg;
52         }
53     XmppUser(const DOMString &jidArg,          const DOMString &nickArg,
54              const DOMString &subscriptionArg, const DOMString &groupArg)
55         {
56         jid          = jidArg;
57         nick         = nickArg;
58         subscription = subscriptionArg;
59         group        = groupArg;
60         }
61     XmppUser(const XmppUser &other)
62         {
63         jid          = other.jid;
64         nick         = other.nick;
65         subscription = other.subscription;
66         group        = other.group;
67         show         = other.show;
68         }
69     XmppUser &operator=(const XmppUser &other)
70         {
71         jid          = other.jid;
72         nick         = other.nick;
73         subscription = other.subscription;
74         group        = other.group;
75         show         = other.show;
76         return *this;
77         }
78     virtual ~XmppUser()
79         {}
80     DOMString jid;
81     DOMString nick;
82     DOMString subscription;
83     DOMString group;
84     DOMString show;
85 };
91 /**
92  * Class that emits information from a client
93  */
94 class XmppEvent
95 {
97 public:
99     /**
100      * People might want to refer to these docs to understand
101      * the XMPP terminology used here.
102      * http://www.ietf.org/rfc/rfc3920.txt      -- Xmpp Core
103      * http://www.ietf.org/rfc/rfc3921.txt      -- Messaging and presence
104      * http://www.jabber.org/jeps/jep-0077.html -- In-Band registration
105      * http://www.jabber.org/jeps/jep-0045.html -- Multiuser Chat
106      * http://www.jabber.org/jeps/jep-0047.html -- In-Band byte streams
107      * http://www.jabber.org/jeps/jep-0096.html -- File transfer
108      */
110     /**
111      *  No event type.  Default
112      */
113     static const int EVENT_NONE                 =  0;
115     /**
116      *  Client emits a status message.  Message is in getData().
117      */
118     static const int EVENT_STATUS               =  1;
120     /**
121      *  Client emits an error message.  Message is in getData().
122      */
123     static const int EVENT_ERROR                =  2;
125     /**
126      *  Client has connected to a host.  Host name is in getData().
127      */
128     static const int EVENT_CONNECTED            = 10;
130     /**
131      *  Client has disconnected from a host.  Host name is in getData().
132      */
133     static const int EVENT_DISCONNECTED         = 11;
135     /**
136      *  Client has begun speaking to the server in SSL.  This is usually
137      *  emitted just before EVENT_CONNECTED,  since authorization has not
138      *  yet taken place.
139      */
140     static const int EVENT_SSL_STARTED          = 12;
142     /**
143      *  Client has successfully registered a new account on a server.
144      *  The server is in getFrom(), the user in getTo()
145      */
146     static const int EVENT_REGISTRATION_NEW     = 20;
148     /**
149      *  Client has successfully changed the password of an existing account on a server.
150      *  The server is in getFrom(), the user in getTo()
151      */
152     static const int EVENT_REGISTRATION_CHANGE_PASS  = 21;
154     /**
155      *  Client has successfully cancelled an existing account on a server.
156      *  The server is in getFrom(), the user in getTo()
157      */
158     static const int EVENT_REGISTRATION_CANCEL  = 22;
160     /**
161      *  A <presence> packet has been received.
162      *  getFrom()     returns the full jabber id
163      *  getPresence() returns the available/unavailable boolean
164      *  getShow()     returns the jabber 'show' string: 'show', 'away', 'xa', etc
165      *  getStatus()   returns a status message, sent from a client
166      *  Note: if a presence packet is determined to be MUC, it is
167      *    rather sent as an EVENT_MUC_JOIN, LEAVE, or PRESENCE
168      */
169     static const int EVENT_PRESENCE             = 30;
171     /**
172      *  Client has just received a complete roster.  The collected information
173      *  can be found at client.getRoster(), and is a std::vector of XmppUser
174      *  records.
175      */
176     static const int EVENT_ROSTER               = 31;
178     /**
179      *  Client has just received a message packet.
180      *  getFrom() returns the full jabber id of the sender
181      *  getData() returns the text of the message
182      *  getDom()  returns the DOM treelet for this stanza.  This is provided
183      *                to make message extension easier.
184      *  Note: if a message packet is determined to be MUC, it is
185      *    rather sent as an EVENT_MUC_MESSAGE
186      */
187     static const int EVENT_MESSAGE              = 32;
189     /**
190      *  THIS user has just joined a multi-user chat group.
191      *  getGroup()    returns the group name
192      *  getFrom()     returns the nick of the user in the group
193      *  getPresence() returns the available/unavailable boolean
194      *  getShow()     returns the jabber 'show' string: 'show', 'away', 'xa', etc
195      *  getStatus()   returns a status message, sent from a client
196      */
197     static const int EVENT_MUC_JOIN             = 40;
199     /**
200      *  THIS user has just left a multi-user chat group.
201      *  getGroup()    returns the group name
202      *  getFrom()     returns the nick of the user in the group
203      *  getPresence() returns the available/unavailable boolean
204      *  getShow()     returns the jabber 'show' string: 'show', 'away', 'xa', etc
205      *  getStatus()   returns a status message, sent from a client
206      */
207     static const int EVENT_MUC_LEAVE            = 41;
209     /**
210      *  Presence for another user in a multi-user chat room.
211      *  getGroup()    returns the group name
212      *  getFrom()     returns the nick of the user in the group
213      *  getPresence() returns the available/unavailable boolean
214      *  getShow()     returns the jabber 'show' string: 'show', 'away', 'xa', etc
215      *  getStatus()   returns a status message, sent from a client
216      */
217     static const int EVENT_MUC_PRESENCE         = 42;
219     /**
220      *  Client has just received a message packet from a multi-user chat room
221      *  getGroup() returns the group name
222      *  getFrom()  returns the full jabber id of the sender
223      *  getData()  returns the text of the message
224      *  getDom()   returns the DOM treelet for this stanza.  This is provided
225      *             to make message extension easier.
226      */
227     static const int EVENT_MUC_MESSAGE          = 43;
229     /**
230      *  Client has begun receiving a stream
231      */
232     static const int EVENT_STREAM_RECEIVE_INIT  = 50;
234     /**
235      *  Client receives another stream packet.
236      */
237     static const int EVENT_STREAM_RECEIVE       = 51;
239     /**
240      * Client has received the end of a stream
241      */
242     static const int EVENT_STREAM_RECEIVE_CLOSE = 52;
244     /**
245      * Other client has accepted a file.
246      */
247     static const int EVENT_FILE_ACCEPTED        = 60;
249     /**
250      * This client has just received a file.
251      */
252     static const int EVENT_FILE_RECEIVE         = 61;
254     /**
255      *  Constructs an event with one of the types above.
256      */
257     XmppEvent(int type);
259     /**
260      *  Copy constructor
261      */
262     XmppEvent(const XmppEvent &other);
264     /**
265      *  Assignment
266      */
267     virtual XmppEvent &operator=(const XmppEvent &other);
269     /**
270      *  Destructor
271      */
272     virtual ~XmppEvent();
274     /**
275      *  Assignment
276      */
277     virtual void assign(const XmppEvent &other);
279     /**
280      *  Return the event type.
281      */
282     virtual int getType() const;
285     /**
286      *
287      */
288     virtual DOMString getIqId() const;
291     /**
292      *
293      */
294     virtual void setIqId(const DOMString &val);
296     /**
297      *
298      */
299     virtual DOMString getStreamId() const;
302     /**
303      *
304      */
305     virtual void setStreamId(const DOMString &val);
307     /**
308      *
309      */
310     virtual bool getPresence() const;
313     /**
314      *
315      */
316     virtual void setPresence(bool val);
318     /**
319      *
320      */
321     virtual DOMString getShow() const;
324     /**
325      *
326      */
327     virtual void setShow(const DOMString &val);
329     /**
330      *
331      */
332     virtual DOMString getStatus() const;
334     /**
335      *
336      */
337     virtual void setStatus(const DOMString &val);
339     /**
340      *
341      */
342     virtual DOMString getTo() const;
344     /**
345      *
346      */
347     virtual void setTo(const DOMString &val);
349     /**
350      *
351      */
352     virtual DOMString getFrom() const;
354     /**
355      *
356      */
357     virtual void setFrom(const DOMString &val);
359     /**
360      *
361      */
362     virtual DOMString getGroup() const;
364     /**
365      *
366      */
367     virtual void setGroup(const DOMString &val);
369     /**
370      *
371      */
372     virtual Element *getDOM() const;
375     /**
376      *
377      */
378     virtual void setDOM(const Element *val);
380     /**
381      *
382      */
383     virtual std::vector<XmppUser> getUserList() const;
385     /**
386      *
387      */
388     virtual void setUserList(const std::vector<XmppUser> &userList);
390     /**
391      *
392      */
393     virtual DOMString getFileName() const;
396     /**
397      *
398      */
399     virtual void setFileName(const DOMString &val);
402     /**
403      *
404      */
405     virtual DOMString getFileDesc() const;
408     /**
409      *
410      */
411     virtual void setFileDesc(const DOMString &val);
414     /**
415      *
416      */
417     virtual long getFileSize() const;
420     /**
421      *
422      */
423     virtual void setFileSize(long val);
425     /**
426      *
427      */
428     virtual DOMString getFileHash() const;
430     /**
431      *
432      */
433     virtual void setFileHash(const DOMString &val);
435     /**
436      *
437      */
438     virtual DOMString getData() const;
441     /**
442      *
443      */
444     virtual void setData(const DOMString &val);
446 private:
448     int eventType;
450     DOMString iqId;
452     DOMString streamId;
454     bool      presence;
456     DOMString show;
458     DOMString status;
460     DOMString to;
462     DOMString from;
464     DOMString group;
466     DOMString data;
468     DOMString fileName;
469     DOMString fileDesc;
470     long      fileSize;
471     DOMString fileHash;
473     Element *dom;
475     std::vector<XmppUser>userList;
477 };
484 //########################################################################
485 //# X M P P    E V E N T    L I S T E N E R
486 //########################################################################
488 /**
489  * Class that receives and processes an XmppEvent.  Users should inherit
490  * from this class, and overload processXmppEvent() to perform their event
491  * handling
492  */
493 class XmppEventListener
495 public:
497     /**
498      *  Constructor  
499      */
500     XmppEventListener()
501         {}
503     /**
504      *  Assignment
505      */
506     XmppEventListener(const XmppEventListener &other)
507         {}
510     /**
511      * Destructor
512      */
513     virtual ~XmppEventListener()
514         {}
516     /**
517      *  Overload this method to provide your application-specific
518      *  event handling.  Use event.getType() to decide what to do
519      *  with the event.
520      */
521     virtual void processXmppEvent(const XmppEvent &event)
522         {}
524 };
528 //########################################################################
529 //# X M P P    E V E N T    T A R G E T
530 //########################################################################
532 /**
533  * A base class for classes that emit XmppEvents.
534  *
535  * Note: terminology: 'target' is the common term for this, although it
536  * seems odd that a 'target' is the source of the events.  It is clearer
537  * if you consider that the greater system targets this class with events,
538  * and this class delegates the handling to its listeners.
539  */
540 class XmppEventTarget
542 public:
544     /**
545      * Constructor
546      */
547     XmppEventTarget();
549     /**
550      *  Copy constructor
551      */
552     XmppEventTarget(const XmppEventTarget &other);
554     /**
555      * Destructor
556      */
557     virtual ~XmppEventTarget();
560     //###########################
561     //# M E S S A G E S
562     //###########################
565     /**
566      * Send an error message to all subscribers
567      */
568     void error(char *fmt, ...);
571     /**
572      * Send a status message to all subscribers
573      */
574     void status(char *fmt, ...);
576     //###########################
577     //# LISTENERS
578     //###########################
580     /**
581      *  Subscribe a subclass of XmppEventListener to this target's events.
582      */
583     virtual void addXmppEventListener(const XmppEventListener &listener);
585     /**
586      *  Unsubscribe a subclass of XmppEventListener from this target's events.
587      */
588     virtual void removeXmppEventListener(const XmppEventListener &listener);
590     /**
591      *  Remove all event subscribers
592      */
593     virtual void clearXmppEventListeners();
595     /**
596      *  This sends an event to all registered listeners.
597      */
598     virtual void dispatchXmppEvent(const XmppEvent &event);
600     /**
601      *  By enabling this, you provide an alternate way to get XmppEvents.
602      *  Any event sent to dispatchXmppEvent() is also sent to this queue,
603      *  so that it can be later be picked up by eventQueuePop();
604      *  This can sometimes be good for GUI's which can't always respond
605      *  repidly or asynchronously.
606      */
607     void eventQueueEnable(bool val);
609     /**
610      *  Return true if there is one or more XmppEvents waiting in the event
611      *  queue.  This is used to avoid calling eventQueuePop() when there is
612      *  nothing in the queue.
613      */
614     int eventQueueAvailable();
616     /**
617      *  Return the next XmppEvent in the queue.  Users should check that
618      *  eventQueueAvailable() is greater than 0 before calling this.  If
619      *  people forget to do this, an event of type XmppEvent::EVENT_NONE
620      *  is generated and returned.
621      */
622     XmppEvent eventQueuePop();
625 private:
627     std::vector<XmppEventListener *> listeners;
629     std::vector<XmppEvent> eventQueue;
630     bool eventQueueEnabled;
632     static const int targetWriteBufLen = 2048;
634     char targetWriteBuf[targetWriteBufLen];
635 };
641 //########################################################################
642 //# X M P P    C L I E N T
643 //########################################################################
645 //forward declarations
646 class TcpSocket;
647 class XmppChat;
648 class XmppGroupChat;
649 class XmppStream;
652 /**
653  *  This is the actual XMPP (Jabber) client.
654  */
655 class XmppClient : public XmppEventTarget
658 public:
660     //###########################
661     //# CONSTRUCTORS
662     //###########################
664     /**
665      * Constructor
666      */
667     XmppClient();
669     /**
670      *  Copy constructor
671      */
672     XmppClient(const XmppClient &other);
674     /**
675      *  Assignment
676      */
677     void assign(const XmppClient &other);
679     /**
680      * Destructor
681      */
682     virtual ~XmppClient();
685     //###########################
686     //# UTILITY
687     //###########################
689     /**
690      *  Pause execution of the app for a given number of
691      *  milliseconds.  Use this rarely, only when really needed.
692      */
693     virtual bool pause(unsigned long millis);
695     /**
696      *  Process a string so that it can safely be
697      *  placed in XML as PCDATA
698      */
699     DOMString toXml(const DOMString &str);
701     //###########################
702     //# CONNECTION
703     //###########################
705     /**
706      *
707      */
708     virtual bool connect();
710     /**
711      *
712      */
713     virtual bool connect(DOMString host, int port,
714                          DOMString userName,
715                          DOMString password,
716                          DOMString resource);
718     /**
719      *
720      */
721     virtual bool disconnect();
724     /**
725      *
726      */
727     virtual bool write(char *fmt, ...);
729     //#######################
730     //# V A R I A B L E S
731     //#######################
733     /**
734      *
735      */
736     virtual bool isConnected()
737         { return connected; }
739     /**
740      *
741      */
742     virtual DOMString getHost()
743         { return host; }
745     /**
746      *
747      */
748     virtual void setHost(const DOMString &val)
749         { host = val; }
751     /**
752      *
753      */
754     virtual DOMString getRealm()
755         { return realm; }
757     /**
758      *
759      */
760     virtual void setRealm(const DOMString &val)
761         { realm = val; }
763     /**
764      *
765      */
766     virtual int getPort()
767         { return port; }
769     /**
770      *
771      */
772     virtual void setPort(int val)
773         { port = val; }
775     /**
776      *
777      */
778     virtual DOMString getUsername();
780     /**
781      *
782      */
783     virtual void setUsername(const DOMString &val);
785     /**
786      *
787      */
788     virtual DOMString getPassword()
789         { return password; }
791     /**
792      *
793      */
794     virtual void setPassword(const DOMString &val)
795         { password = val; }
797     /**
798      *
799      */
800     virtual DOMString getResource()
801         { return resource; }
803     /**
804      *
805      */
806     virtual void setResource(const DOMString &val)
807         { resource = val; }
809     /**
810      *
811      */
812     virtual void setJid(const DOMString &val)
813         { jid = val; }
815     /**
816      *
817      */
818     virtual DOMString getJid()
819         { return jid; }
823     /**
824      *
825      */
826     virtual int getMsgId()
827         { return msgId++; }
831     //#######################
832     //# P R O C E S S I N G
833     //#######################
836     /**
837      *
838      */
839     bool processMessage(Element *root);
841     /**
842      *
843      */
844     bool processPresence(Element *root);
846     /**
847      *
848      */
849     bool processIq(Element *root);
851     /**
852      *
853      */
854     virtual bool receiveAndProcess();
856     /**
857      *
858      */
859     virtual bool receiveAndProcessLoop();
861     //#######################
862     //# ROSTER
863     //#######################
865     /**
866      *
867      */
868     bool rosterAdd(const DOMString &rosterGroup,
869                    const DOMString &otherJid,
870                    const DOMString &name);
872     /**
873      *
874      */
875     bool rosterDelete(const DOMString &otherJid);
877     /**
878      *
879      */
880     std::vector<XmppUser> getRoster();
882     /**
883      *
884      */
885     virtual void rosterShow(const DOMString &jid, const DOMString &show);
887     //#######################
888     //# REGISTRATION
889     //#######################
891     /**
892      *  Set whether the client should to in-band registration
893      *  before authentication.  Causes inBandRegistrationNew() to be called
894      *  synchronously, before async is started.
895      */
896     virtual void setDoRegister(bool val)
897         { doRegister = val; }
899     /**
900      * Change the password of an existing account with a server
901      */
902     bool inBandRegistrationChangePassword(const DOMString &newPassword);
904     /**
905      * Cancel an existing account with a server
906      */
907     bool inBandRegistrationCancel();
910     //#######################
911     //# CHAT (individual)
912     //#######################
914     /**
915      *
916      */
917     virtual bool message(const DOMString &user, const DOMString &subj,
918                          const DOMString &text);
920     /**
921      *
922      */
923     virtual bool message(const DOMString &user, const DOMString &text);
925     /**
926      *
927      */
928     virtual bool presence(const DOMString &presence);
930     //#######################
931     //# GROUP CHAT
932     //#######################
934     /**
935      *
936      */
937     virtual bool groupChatCreate(const DOMString &groupJid);
939     /**
940      *
941      */
942     virtual void groupChatDelete(const DOMString &groupJid);
944     /**
945      *
946      */
947     bool groupChatExists(const DOMString &groupJid);
949     /**
950      *
951      */
952     virtual void groupChatsClear();
954     /**
955      *
956      */
957     virtual void groupChatUserAdd(const DOMString &groupJid,
958                                   const DOMString &nick,
959                                   const DOMString &jid);
960     /**
961      *
962      */
963     virtual void groupChatUserShow(const DOMString &groupJid,
964                                    const DOMString &nick,
965                                    const DOMString &show);
967     /**
968      *
969      */
970     virtual void groupChatUserDelete(const DOMString &groupJid,
971                                      const DOMString &nick);
973     /**
974      *
975      */
976     virtual std::vector<XmppUser>
977              groupChatGetUserList(const DOMString &groupJid);
979     /**
980      *
981      */
982     virtual bool groupChatJoin(const DOMString &groupJid,
983                                const DOMString &nick,
984                                const DOMString &pass);
986     /**
987      *
988      */
989     virtual bool groupChatLeave(const DOMString &groupJid,
990                                 const DOMString &nick);
992     /**
993      *
994      */
995     virtual bool groupChatMessage(const DOMString &groupJid,
996                                   const DOMString &msg);
998     /**
999      *
1000      */
1001     virtual bool groupChatPrivateMessage(const DOMString &groupJid,
1002                                          const DOMString &toNick,
1003                                          const DOMString &msg);
1005     /**
1006      *
1007      */
1008     virtual bool groupChatPresence(const DOMString &groupJid,
1009                                    const DOMString &nick,
1010                                    const DOMString &presence);
1013     //#######################
1014     //# STREAMS
1015     //#######################
1017     typedef enum
1018         {
1019         STREAM_AVAILABLE,
1020         STREAM_OPENING,
1021         STREAM_OPEN,
1022         STREAM_CLOSING,
1023         STREAM_CLOSED,
1024         STREAM_ERROR
1025         } StreamStates;
1027     /**
1028      *
1029      */
1030     virtual int outputStreamOpen(const DOMString &jid,
1031                                  const DOMString &streamId);
1033     /**
1034      *
1035      */
1036     virtual int outputStreamWrite(int streamId,
1037                           const unsigned char *buf, unsigned long len);
1039     /**
1040      *
1041      */
1042     virtual int outputStreamClose(int streamId);
1044     /**
1045      *
1046      */
1047     virtual int inputStreamOpen(const DOMString &jid,
1048                                 const DOMString &streamId,
1049                                 const DOMString &iqId);
1051     /**
1052      *
1053      */
1054     virtual int inputStreamAvailable(int streamId);
1056     /**
1057      *
1058      */
1059     virtual std::vector<unsigned char> inputStreamRead(int streamId);
1061     /**
1062      *
1063      */
1064     virtual bool inputStreamClosing(int streamId);
1066     /**
1067      *
1068      */
1069     virtual int inputStreamClose(int streamId);
1072     //#######################
1073     //# FILE   TRANSFERS
1074     //#######################
1076     /**
1077      *
1078      */
1079     virtual bool fileSend(const DOMString &destJid,
1080                           const DOMString &offeredName,
1081                           const DOMString &fileName,
1082                           const DOMString &description);
1084     /**
1085      *
1086      */
1087     virtual bool fileSendBackground(const DOMString &destJid,
1088                                     const DOMString &offeredName,
1089                                     const DOMString &fileName,
1090                                     const DOMString &description);
1092     /**
1093      *
1094      */
1095     virtual bool fileReceive(const DOMString &fromJid,
1096                              const DOMString &iqId,
1097                              const DOMString &streamId,
1098                              const DOMString &fileName,
1099                              long  fileSize,
1100                              const DOMString &fileHash);
1101     /**
1102      *
1103      */
1104     virtual bool fileReceiveBackground(const DOMString &fromJid,
1105                                        const DOMString &iqId,
1106                                        const DOMString &streamId,
1107                                        const DOMString &fileName,
1108                                        long  fileSize,
1109                                        const DOMString &fileHash);
1112 private:
1114     void init();
1116     DOMString host;
1118     /**
1119      * will be same as host, unless username is
1120      * user@realm
1121      */
1122     DOMString realm;
1124     int port;
1126     DOMString username;
1128     DOMString password;
1130     DOMString resource;
1132     DOMString jid;
1134     int msgId;
1136     TcpSocket *sock;
1138     bool connected;
1140     bool createSession();
1142     bool checkConnect();
1144     DOMString readStanza();
1146     bool saslMd5Authenticate();
1148     bool saslPlainAuthenticate();
1150     bool saslAuthenticate();
1152     bool iqAuthenticate(const DOMString &streamId);
1154     /**
1155      * Register a new account with a server.  Not done by user
1156      */
1157     bool inBandRegistrationNew();
1159     bool keepGoing;
1161     bool doRegister;
1163     static const int writeBufLen = 2048;
1165     unsigned char writeBuf[writeBufLen];
1167     std::vector<XmppGroupChat *>groupChats;
1169     static const int outputStreamCount = 16;
1171     XmppStream *outputStreams[outputStreamCount];
1173     static const int inputStreamCount = 16;
1175     XmppStream *inputStreams[inputStreamCount];
1177     static const int fileSendCount = 16;
1179     XmppStream *fileSends[fileSendCount];
1181     std::vector<XmppUser>roster;
1182 };
1187 //########################################################################
1188 //# X M P P    G R O U P    C H A T
1189 //########################################################################
1191 /**
1192  *
1193  */
1194 class XmppGroupChat
1196 public:
1198     /**
1199      *
1200      */
1201     XmppGroupChat(const DOMString &groupJid);
1203     /**
1204      *
1205      */
1206     XmppGroupChat(const XmppGroupChat &other);
1208     /**
1209      *
1210      */
1211     virtual ~XmppGroupChat();
1213     /**
1214      *
1215      */
1216     virtual DOMString getGroupJid();
1218     /**
1219      *
1220      */
1221     virtual void userAdd(const DOMString &nick,
1222                          const DOMString &jid);
1223     /**
1224      *
1225      */
1226     virtual void userShow(const DOMString &nick,
1227                           const DOMString &show);
1229     /**
1230      *
1231      */
1232     virtual void userDelete(const DOMString &nick);
1234     /**
1235      *
1236      */
1237     virtual std::vector<XmppUser> getUserList() const;
1240 private:
1242     DOMString groupJid;
1244     std::vector<XmppUser>userList;
1246 };
1257 } //namespace Pedro
1259 #endif /* __XMPP_H__ */
1261 //########################################################################
1262 //# E N D    O F     F I L E
1263 //########################################################################