Code

improve streaming
[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-2006 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>
28 #include <map>
30 #include <string>
32 #include "pedrodom.h"
34 namespace Pedro
35 {
37 typedef std::string DOMString;
40 //########################################################################
41 //# X M P P    E V E N T
42 //########################################################################
43 class XmppUser
44 {
45 public:
46     XmppUser()
47         {
48         }
49     XmppUser(const DOMString &jidArg, const DOMString &nickArg)
50         {
51         jid  = jidArg;
52         nick = nickArg;
53         }
54     XmppUser(const DOMString &jidArg,          const DOMString &nickArg,
55              const DOMString &subscriptionArg, const DOMString &groupArg)
56         {
57         jid          = jidArg;
58         nick         = nickArg;
59         subscription = subscriptionArg;
60         group        = groupArg;
61         }
62     XmppUser(const XmppUser &other)
63         {
64         jid          = other.jid;
65         nick         = other.nick;
66         subscription = other.subscription;
67         group        = other.group;
68         show         = other.show;
69         }
70     XmppUser &operator=(const XmppUser &other)
71         {
72         jid          = other.jid;
73         nick         = other.nick;
74         subscription = other.subscription;
75         group        = other.group;
76         show         = other.show;
77         return *this;
78         }
79     virtual ~XmppUser()
80         {}
81     DOMString jid;
82     DOMString nick;
83     DOMString subscription;
84     DOMString group;
85     DOMString show;
86 };
92 /**
93  * Class that emits information from a client
94  */
95 class XmppEvent
96 {
98 public:
100     /**
101      * People might want to refer to these docs to understand
102      * the XMPP terminology used here.
103      * http://www.ietf.org/rfc/rfc3920.txt      -- Xmpp Core
104      * http://www.ietf.org/rfc/rfc3921.txt      -- Messaging and presence
105      * http://www.jabber.org/jeps/jep-0077.html -- In-Band registration
106      * http://www.jabber.org/jeps/jep-0045.html -- Multiuser Chat
107      * http://www.jabber.org/jeps/jep-0047.html -- In-Band byte streams
108      * http://www.jabber.org/jeps/jep-0096.html -- File transfer
109      */
111     /**
112      *  No event type.  Default
113      */
114     static const int EVENT_NONE                 =  0;
116     /**
117      *  Client emits a status message.  Message is in getData().
118      */
119     static const int EVENT_STATUS               =  1;
121     /**
122      *  Client emits an error message.  Message is in getData().
123      */
124     static const int EVENT_ERROR                =  2;
126     /**
127      *  Client has connected to a host.  Host name is in getData().
128      */
129     static const int EVENT_CONNECTED            = 10;
131     /**
132      *  Client has disconnected from a host.  Host name is in getData().
133      */
134     static const int EVENT_DISCONNECTED         = 11;
136     /**
137      *  Client has begun speaking to the server in SSL.  This is usually
138      *  emitted just before EVENT_CONNECTED,  since authorization has not
139      *  yet taken place.
140      */
141     static const int EVENT_SSL_STARTED          = 12;
143     /**
144      *  Client has successfully registered a new account on a server.
145      *  The server is in getFrom(), the user in getTo()
146      */
147     static const int EVENT_REGISTRATION_NEW     = 20;
149     /**
150      *  Client has successfully changed the password of an existing account on a server.
151      *  The server is in getFrom(), the user in getTo()
152      */
153     static const int EVENT_REGISTRATION_CHANGE_PASS  = 21;
155     /**
156      *  Client has successfully cancelled an existing account on a server.
157      *  The server is in getFrom(), the user in getTo()
158      */
159     static const int EVENT_REGISTRATION_CANCEL  = 22;
161     /**
162      *  A <presence> packet has been received.
163      *  getFrom()     returns the full jabber id
164      *  getPresence() returns the available/unavailable boolean
165      *  getShow()     returns the jabber 'show' string: 'show', 'away', 'xa', etc
166      *  getStatus()   returns a status message, sent from a client
167      *  Note: if a presence packet is determined to be MUC, it is
168      *    rather sent as an EVENT_MUC_JOIN, LEAVE, or PRESENCE
169      */
170     static const int EVENT_PRESENCE             = 30;
172     /**
173      *  Client has just received a complete roster.  The collected information
174      *  can be found at client.getRoster(), and is a std::vector of XmppUser
175      *  records.
176      */
177     static const int EVENT_ROSTER               = 31;
179     /**
180      *  Client has just received a message packet.
181      *  getFrom() returns the full jabber id of the sender
182      *  getData() returns the text of the message
183      *  getDom()  returns the DOM treelet for this stanza.  This is provided
184      *                to make message extension easier.
185      *  Note: if a message packet is determined to be MUC, it is
186      *    rather sent as an EVENT_MUC_MESSAGE
187      */
188     static const int EVENT_MESSAGE              = 32;
190     /**
191      *  THIS user has just joined a multi-user chat group.
192      *  getGroup()    returns the group name
193      *  getFrom()     returns the nick of the user in the group
194      *  getPresence() returns the available/unavailable boolean
195      *  getShow()     returns the jabber 'show' string: 'show', 'away', 'xa', etc
196      *  getStatus()   returns a status message, sent from a client
197      */
198     static const int EVENT_MUC_JOIN             = 40;
200     /**
201      *  THIS user has just left a multi-user chat group.
202      *  getGroup()    returns the group name
203      *  getFrom()     returns the nick of the user in the group
204      *  getPresence() returns the available/unavailable boolean
205      *  getShow()     returns the jabber 'show' string: 'show', 'away', 'xa', etc
206      *  getStatus()   returns a status message, sent from a client
207      */
208     static const int EVENT_MUC_LEAVE            = 41;
210     /**
211      *  Presence for another user in a multi-user chat room.
212      *  getGroup()    returns the group name
213      *  getFrom()     returns the nick of the user in the group
214      *  getPresence() returns the available/unavailable boolean
215      *  getShow()     returns the jabber 'show' string: 'show', 'away', 'xa', etc
216      *  getStatus()   returns a status message, sent from a client
217      */
218     static const int EVENT_MUC_PRESENCE         = 42;
220     /**
221      *  Client has just received a message packet from a multi-user chat room
222      *  getGroup() returns the group name
223      *  getFrom()  returns the full jabber id of the sender
224      *  getData()  returns the text of the message
225      *  getDom()   returns the DOM treelet for this stanza.  This is provided
226      *             to make message extension easier.
227      */
228     static const int EVENT_MUC_MESSAGE          = 43;
230     /**
231      *  Client has begun receiving a stream
232      */
233     static const int EVENT_STREAM_RECEIVE_INIT  = 50;
235     /**
236      *  Client receives another stream packet.
237      */
238     static const int EVENT_STREAM_RECEIVE       = 51;
240     /**
241      * Client has received the end of a stream
242      */
243     static const int EVENT_STREAM_RECEIVE_CLOSE = 52;
245     /**
246      * Other client has accepted a file.
247      */
248     static const int EVENT_FILE_ACCEPTED        = 60;
250     /**
251      * This client has just received a file.
252      */
253     static const int EVENT_FILE_RECEIVE         = 61;
255     /**
256      *  Constructs an event with one of the types above.
257      */
258     XmppEvent(int type);
260     /**
261      *  Copy constructor
262      */
263     XmppEvent(const XmppEvent &other);
265     /**
266      *  Assignment
267      */
268     virtual XmppEvent &operator=(const XmppEvent &other);
270     /**
271      *  Destructor
272      */
273     virtual ~XmppEvent();
275     /**
276      *  Assignment
277      */
278     virtual void assign(const XmppEvent &other);
280     /**
281      *  Return the event type.
282      */
283     virtual int getType() const;
286     /**
287      *
288      */
289     virtual DOMString getIqId() const;
292     /**
293      *
294      */
295     virtual void setIqId(const DOMString &val);
297     /**
298      *
299      */
300     virtual DOMString getStreamId() const;
303     /**
304      *
305      */
306     virtual void setStreamId(const DOMString &val);
308     /**
309      *
310      */
311     virtual bool getPresence() const;
314     /**
315      *
316      */
317     virtual void setPresence(bool val);
319     /**
320      *
321      */
322     virtual DOMString getShow() const;
325     /**
326      *
327      */
328     virtual void setShow(const DOMString &val);
330     /**
331      *
332      */
333     virtual DOMString getStatus() const;
335     /**
336      *
337      */
338     virtual void setStatus(const DOMString &val);
340     /**
341      *
342      */
343     virtual DOMString getTo() const;
345     /**
346      *
347      */
348     virtual void setTo(const DOMString &val);
350     /**
351      *
352      */
353     virtual DOMString getFrom() const;
355     /**
356      *
357      */
358     virtual void setFrom(const DOMString &val);
360     /**
361      *
362      */
363     virtual DOMString getGroup() const;
365     /**
366      *
367      */
368     virtual void setGroup(const DOMString &val);
370     /**
371      *
372      */
373     virtual Element *getDOM() const;
376     /**
377      *
378      */
379     virtual void setDOM(const Element *val);
381     /**
382      *
383      */
384     virtual std::vector<XmppUser> getUserList() const;
386     /**
387      *
388      */
389     virtual void setUserList(const std::vector<XmppUser> &userList);
391     /**
392      *
393      */
394     virtual DOMString getFileName() const;
397     /**
398      *
399      */
400     virtual void setFileName(const DOMString &val);
403     /**
404      *
405      */
406     virtual DOMString getFileDesc() const;
409     /**
410      *
411      */
412     virtual void setFileDesc(const DOMString &val);
415     /**
416      *
417      */
418     virtual long getFileSize() const;
421     /**
422      *
423      */
424     virtual void setFileSize(long val);
426     /**
427      *
428      */
429     virtual DOMString getFileHash() const;
431     /**
432      *
433      */
434     virtual void setFileHash(const DOMString &val);
436     /**
437      *
438      */
439     virtual DOMString getData() const;
442     /**
443      *
444      */
445     virtual void setData(const DOMString &val);
447 private:
449     int eventType;
451     DOMString iqId;
453     DOMString streamId;
455     bool      presence;
457     DOMString show;
459     DOMString status;
461     DOMString to;
463     DOMString from;
465     DOMString group;
467     DOMString data;
469     DOMString fileName;
470     DOMString fileDesc;
471     long      fileSize;
472     DOMString fileHash;
474     Element *dom;
476     std::vector<XmppUser>userList;
478 };
485 //########################################################################
486 //# X M P P    E V E N T    L I S T E N E R
487 //########################################################################
489 /**
490  * Class that receives and processes an XmppEvent.  Users should inherit
491  * from this class, and overload processXmppEvent() to perform their event
492  * handling
493  */
494 class XmppEventListener
496 public:
498     /**
499      *  Constructor  
500      */
501     XmppEventListener()
502         {}
504     /**
505      *  Assignment
506      */
507     XmppEventListener(const XmppEventListener &other)
508         {}
511     /**
512      * Destructor
513      */
514     virtual ~XmppEventListener()
515         {}
517     /**
518      *  Overload this method to provide your application-specific
519      *  event handling.  Use event.getType() to decide what to do
520      *  with the event.
521      */
522     virtual void processXmppEvent(const XmppEvent &event)
523         {}
525 };
529 //########################################################################
530 //# X M P P    E V E N T    T A R G E T
531 //########################################################################
533 /**
534  * A base class for classes that emit XmppEvents.
535  *
536  * Note: terminology: 'target' is the common term for this, although it
537  * seems odd that a 'target' is the source of the events.  It is clearer
538  * if you consider that the greater system targets this class with events,
539  * and this class delegates the handling to its listeners.
540  */
541 class XmppEventTarget
543 public:
545     /**
546      * Constructor
547      */
548     XmppEventTarget();
550     /**
551      *  Copy constructor
552      */
553     XmppEventTarget(const XmppEventTarget &other);
555     /**
556      * Destructor
557      */
558     virtual ~XmppEventTarget();
561     //###########################
562     //# M E S S A G E S
563     //###########################
566     /**
567      * Send an error message to all subscribers
568      */
569     void error(char *fmt, ...);
572     /**
573      * Send a status message to all subscribers
574      */
575     void status(char *fmt, ...);
577     //###########################
578     //# LISTENERS
579     //###########################
581     /**
582      *  Subscribe a subclass of XmppEventListener to this target's events.
583      */
584     virtual void addXmppEventListener(const XmppEventListener &listener);
586     /**
587      *  Unsubscribe a subclass of XmppEventListener from this target's events.
588      */
589     virtual void removeXmppEventListener(const XmppEventListener &listener);
591     /**
592      *  Remove all event subscribers
593      */
594     virtual void clearXmppEventListeners();
596     /**
597      *  This sends an event to all registered listeners.
598      */
599     virtual void dispatchXmppEvent(const XmppEvent &event);
601     /**
602      *  By enabling this, you provide an alternate way to get XmppEvents.
603      *  Any event sent to dispatchXmppEvent() is also sent to this queue,
604      *  so that it can be later be picked up by eventQueuePop();
605      *  This can sometimes be good for GUI's which can't always respond
606      *  repidly or asynchronously.
607      */
608     void eventQueueEnable(bool val);
610     /**
611      *  Return true if there is one or more XmppEvents waiting in the event
612      *  queue.  This is used to avoid calling eventQueuePop() when there is
613      *  nothing in the queue.
614      */
615     int eventQueueAvailable();
617     /**
618      *  Return the next XmppEvent in the queue.  Users should check that
619      *  eventQueueAvailable() is greater than 0 before calling this.  If
620      *  people forget to do this, an event of type XmppEvent::EVENT_NONE
621      *  is generated and returned.
622      */
623     XmppEvent eventQueuePop();
626 private:
628     std::vector<XmppEventListener *> listeners;
630     std::vector<XmppEvent> eventQueue;
631     bool eventQueueEnabled;
633     static const int targetWriteBufLen = 2048;
635     char targetWriteBuf[targetWriteBufLen];
636 };
642 //########################################################################
643 //# X M P P    C L I E N T
644 //########################################################################
646 //forward declarations
647 class TcpSocket;
648 class XmppChat;
649 class XmppGroupChat;
650 class XmppStream;
653 /**
654  *  This is the actual XMPP (Jabber) client.
655  */
656 class XmppClient : public XmppEventTarget
659 public:
661     //###########################
662     //# CONSTRUCTORS
663     //###########################
665     /**
666      * Constructor
667      */
668     XmppClient();
670     /**
671      *  Copy constructor
672      */
673     XmppClient(const XmppClient &other);
675     /**
676      *  Assignment
677      */
678     void assign(const XmppClient &other);
680     /**
681      * Destructor
682      */
683     virtual ~XmppClient();
686     //###########################
687     //# UTILITY
688     //###########################
690     /**
691      *  Pause execution of the app for a given number of
692      *  milliseconds.  Use this rarely, only when really needed.
693      */
694     virtual bool pause(unsigned long millis);
696     /**
697      *  Process a string so that it can safely be
698      *  placed in XML as PCDATA
699      */
700     DOMString toXml(const DOMString &str);
702     //###########################
703     //# CONNECTION
704     //###########################
706     /**
707      *
708      */
709     virtual bool connect();
711     /**
712      *
713      */
714     virtual bool connect(DOMString host, int port,
715                          DOMString userName,
716                          DOMString password,
717                          DOMString resource);
719     /**
720      *
721      */
722     virtual bool disconnect();
725     /**
726      *
727      */
728     virtual bool write(char *fmt, ...);
730     //#######################
731     //# V A R I A B L E S
732     //#######################
734     /**
735      *
736      */
737     virtual bool isConnected()
738         { return connected; }
740     /**
741      *
742      */
743     virtual DOMString getHost()
744         { return host; }
746     /**
747      *
748      */
749     virtual void setHost(const DOMString &val)
750         { host = val; }
752     /**
753      *
754      */
755     virtual DOMString getRealm()
756         { return realm; }
758     /**
759      *
760      */
761     virtual void setRealm(const DOMString &val)
762         { realm = val; }
764     /**
765      *
766      */
767     virtual int getPort()
768         { return port; }
770     /**
771      *
772      */
773     virtual void setPort(int val)
774         { port = val; }
776     /**
777      *
778      */
779     virtual DOMString getUsername();
781     /**
782      *
783      */
784     virtual void setUsername(const DOMString &val);
786     /**
787      *
788      */
789     virtual DOMString getPassword()
790         { return password; }
792     /**
793      *
794      */
795     virtual void setPassword(const DOMString &val)
796         { password = val; }
798     /**
799      *
800      */
801     virtual DOMString getResource()
802         { return resource; }
804     /**
805      *
806      */
807     virtual void setResource(const DOMString &val)
808         { resource = val; }
810     /**
811      *
812      */
813     virtual void setJid(const DOMString &val)
814         { jid = val; }
816     /**
817      *
818      */
819     virtual DOMString getJid()
820         { return jid; }
824     /**
825      *
826      */
827     virtual int getMsgId()
828         { return msgId++; }
832     //#######################
833     //# P R O C E S S I N G
834     //#######################
837     /**
838      *
839      */
840     bool processMessage(Element *root);
842     /**
843      *
844      */
845     bool processPresence(Element *root);
847     /**
848      *
849      */
850     bool processIq(Element *root);
852     /**
853      *
854      */
855     virtual bool receiveAndProcess();
857     /**
858      *
859      */
860     virtual bool receiveAndProcessLoop();
862     //#######################
863     //# ROSTER
864     //#######################
866     /**
867      *
868      */
869     bool rosterAdd(const DOMString &rosterGroup,
870                    const DOMString &otherJid,
871                    const DOMString &name);
873     /**
874      *
875      */
876     bool rosterDelete(const DOMString &otherJid);
878     /**
879      *
880      */
881     std::vector<XmppUser> getRoster();
883     /**
884      *
885      */
886     virtual void rosterShow(const DOMString &jid, const DOMString &show);
888     //#######################
889     //# REGISTRATION
890     //#######################
892     /**
893      *  Set whether the client should to in-band registration
894      *  before authentication.  Causes inBandRegistrationNew() to be called
895      *  synchronously, before async is started.
896      */
897     virtual void setDoRegister(bool val)
898         { doRegister = val; }
900     /**
901      * Change the password of an existing account with a server
902      */
903     bool inBandRegistrationChangePassword(const DOMString &newPassword);
905     /**
906      * Cancel an existing account with a server
907      */
908     bool inBandRegistrationCancel();
911     //#######################
912     //# CHAT (individual)
913     //#######################
915     /**
916      *
917      */
918     virtual bool message(const DOMString &user, const DOMString &subj,
919                          const DOMString &text);
921     /**
922      *
923      */
924     virtual bool message(const DOMString &user, const DOMString &text);
926     /**
927      *
928      */
929     virtual bool presence(const DOMString &presence);
931     //#######################
932     //# GROUP CHAT
933     //#######################
935     /**
936      *
937      */
938     virtual bool groupChatCreate(const DOMString &groupJid);
940     /**
941      *
942      */
943     virtual void groupChatDelete(const DOMString &groupJid);
945     /**
946      *
947      */
948     bool groupChatExists(const DOMString &groupJid);
950     /**
951      *
952      */
953     virtual void groupChatsClear();
955     /**
956      *
957      */
958     virtual void groupChatUserAdd(const DOMString &groupJid,
959                                   const DOMString &nick,
960                                   const DOMString &jid);
961     /**
962      *
963      */
964     virtual void groupChatUserShow(const DOMString &groupJid,
965                                    const DOMString &nick,
966                                    const DOMString &show);
968     /**
969      *
970      */
971     virtual void groupChatUserDelete(const DOMString &groupJid,
972                                      const DOMString &nick);
974     /**
975      *
976      */
977     virtual std::vector<XmppUser>
978              groupChatGetUserList(const DOMString &groupJid);
980     /**
981      *
982      */
983     virtual bool groupChatJoin(const DOMString &groupJid,
984                                const DOMString &nick,
985                                const DOMString &pass);
987     /**
988      *
989      */
990     virtual bool groupChatLeave(const DOMString &groupJid,
991                                 const DOMString &nick);
993     /**
994      *
995      */
996     virtual bool groupChatMessage(const DOMString &groupJid,
997                                   const DOMString &msg);
999     /**
1000      *
1001      */
1002     virtual bool groupChatPrivateMessage(const DOMString &groupJid,
1003                                          const DOMString &toNick,
1004                                          const DOMString &msg);
1006     /**
1007      *
1008      */
1009     virtual bool groupChatPresence(const DOMString &groupJid,
1010                                    const DOMString &nick,
1011                                    const DOMString &presence);
1014     //#######################
1015     //# STREAMS
1016     //#######################
1018     typedef enum
1019         {
1020         STREAM_AVAILABLE,
1021         STREAM_OPENING,
1022         STREAM_OPEN,
1023         STREAM_CLOSING,
1024         STREAM_CLOSED,
1025         STREAM_ERROR
1026         } StreamStates;
1028     /**
1029      *
1030      */
1031     virtual bool outputStreamOpen(const DOMString &jid,
1032                                  const DOMString &streamId);
1034     /**
1035      *
1036      */
1037     virtual bool outputStreamWrite(const DOMString &streamId,
1038                const std::vector<unsigned char> &buf);
1040     /**
1041      *
1042      */
1043     virtual bool outputStreamClose(const DOMString &streamId);
1045     /**
1046      *
1047      */
1048     virtual bool inputStreamOpen(const DOMString &jid,
1049                                 const DOMString &streamId,
1050                                 const DOMString &iqId);
1052     /**
1053      *
1054      */
1055     virtual bool inputStreamClose(const DOMString &streamId);
1058     //#######################
1059     //# FILE   TRANSFERS
1060     //#######################
1062     /**
1063      *
1064      */
1065     virtual bool fileSend(const DOMString &destJid,
1066                           const DOMString &offeredName,
1067                           const DOMString &fileName,
1068                           const DOMString &description);
1070     /**
1071      *
1072      */
1073     virtual bool fileSendBackground(const DOMString &destJid,
1074                                     const DOMString &offeredName,
1075                                     const DOMString &fileName,
1076                                     const DOMString &description);
1078     /**
1079      *
1080      */
1081     virtual bool fileReceive(const DOMString &fromJid,
1082                              const DOMString &iqId,
1083                              const DOMString &streamId,
1084                              const DOMString &fileName,
1085                              long  fileSize,
1086                              const DOMString &fileHash);
1087     /**
1088      *
1089      */
1090     virtual bool fileReceiveBackground(const DOMString &fromJid,
1091                                        const DOMString &iqId,
1092                                        const DOMString &streamId,
1093                                        const DOMString &fileName,
1094                                        long  fileSize,
1095                                        const DOMString &fileHash);
1098 private:
1100     void init();
1102     DOMString host;
1104     /**
1105      * will be same as host, unless username is
1106      * user@realm
1107      */
1108     DOMString realm;
1110     int port;
1112     DOMString username;
1114     DOMString password;
1116     DOMString resource;
1118     DOMString jid;
1120     int msgId;
1122     TcpSocket *sock;
1124     bool connected;
1126     bool createSession();
1128     bool checkConnect();
1130     DOMString readStanza();
1132     bool saslMd5Authenticate();
1134     bool saslPlainAuthenticate();
1136     bool saslAuthenticate();
1138     bool iqAuthenticate(const DOMString &streamId);
1140     /**
1141      * Register a new account with a server.  Not done by user
1142      */
1143     bool inBandRegistrationNew();
1145     bool keepGoing;
1147     bool doRegister;
1149     static const int writeBufLen = 2048;
1151     unsigned char writeBuf[writeBufLen];
1153     std::vector<XmppGroupChat *>groupChats;
1155     //#### Roster
1156     std::vector<XmppUser>roster;
1159     //#### Streams
1160     
1161     bool processInBandByteStreamMessage(Element *root);
1162     
1163     DOMString streamPacket;
1165     std::map<DOMString, XmppStream *> outputStreams;
1167     std::map<DOMString, XmppStream *> inputStreams;
1170     //#### File send
1171     
1172     bool processFileMessage(Element *root);
1174     std::map<DOMString, XmppStream *> fileSends;
1176 };
1181 //########################################################################
1182 //# X M P P    G R O U P    C H A T
1183 //########################################################################
1185 /**
1186  *
1187  */
1188 class XmppGroupChat
1190 public:
1192     /**
1193      *
1194      */
1195     XmppGroupChat(const DOMString &groupJid);
1197     /**
1198      *
1199      */
1200     XmppGroupChat(const XmppGroupChat &other);
1202     /**
1203      *
1204      */
1205     virtual ~XmppGroupChat();
1207     /**
1208      *
1209      */
1210     virtual DOMString getGroupJid();
1212     /**
1213      *
1214      */
1215     virtual void userAdd(const DOMString &nick,
1216                          const DOMString &jid);
1217     /**
1218      *
1219      */
1220     virtual void userShow(const DOMString &nick,
1221                           const DOMString &show);
1223     /**
1224      *
1225      */
1226     virtual void userDelete(const DOMString &nick);
1228     /**
1229      *
1230      */
1231     virtual std::vector<XmppUser> getUserList() const;
1234 private:
1236     DOMString groupJid;
1238     std::vector<XmppUser>userList;
1240 };
1251 } //namespace Pedro
1253 #endif /* __XMPP_H__ */
1255 //########################################################################
1256 //# E N D    O F     F I L E
1257 //########################################################################