18#ifndef INCLUDED_GLOOXWRAPPER_H
19#define INCLUDED_GLOOXWRAPPER_H
71#include <gloox/client.h>
72#include <gloox/mucroom.h>
73#include <gloox/registration.h>
74#include <gloox/message.h>
75#include <gloox/jinglecontent.h>
76#include <gloox/jingleiceudp.h>
77#include <gloox/jinglesessionhandler.h>
78#include <gloox/jinglesessionmanager.h>
89#define GLOOXWRAPPER_API __declspec(dllexport)
91#define GLOOXWRAPPER_API
98 class DelayedDelivery;
103 class MUCRoomConfigHandler;
105 class MessageSession;
109 class StanzaExtension;
113 class MUCRoomHandlerWrapper;
114 class SessionHandlerWrapper;
190 return strcmp(
m_Data, str) == 0;
195 return strcmp(
m_Data, str) != 0;
209 static inline std::ostream&
operator<<(std::ostream& stream,
const string&
string)
211 return stream <<
string.c_str();
416 bool connect(
bool block =
true);
417 gloox::ConnectionError recv(
int timeout = -1);
418 const string getID()
const;
419 const string getJID()
const;
420 void send(
const IQ& iq);
422 void setTls(gloox::TLSPolicy tls);
423 void setCompression(
bool compression);
425 void setSASLMechanisms(
int mechanisms);
428 void registerIqHandler(
IqHandler* ih,
int exttype);
431 bool removePresenceExtension(
int type);
435 Client(
const string& server);
436 Client(
const JID& jid,
const string& password,
int port = -1);
439 void setPresence(gloox::Presence::PresenceType pres,
int priority,
const string& status =
"");
450 const string stamp()
const;
459 Disco(gloox::Disco* wrapped);
460 void setVersion(
const string& name,
const string& version,
const string& os =
"");
461 void setIdentity(
const string& category,
const string& type,
const string& name =
"");
472 IQ(
const gloox::IQ& iq) : m_Wrapped(const_cast<gloox::
IQ*>(&iq)), m_Owned(false) { }
474 IQ(gloox::IQ::IqType type,
const JID& to,
const string&
id);
483 return static_cast<const T*
>(findExtension(type));
486 gloox::IQ::IqType subtype()
const;
487 const string id()
const;
488 const gloox::JID& from()
const;
490 gloox::StanzaError error_error()
const;
500 void init(
const char* data,
size_t len);
503 JID(
const gloox::JID& jid) : m_Wrapped(const_cast<gloox::
JID*>(&jid)), m_Owned(false) { }
506 JID(
const string& jid);
507 JID(
const std::string& jid) { init(jid.c_str(), jid.size()); }
510 string username()
const;
511 string resource()
const;
523 Message(gloox::Message* wrapped,
bool owned);
525 gloox::Message::MessageType subtype()
const;
526 const JID& from()
const;
528 string subject(
const string& lang =
"default")
const;
529 string thread()
const;
541 MUCRoom(gloox::MUCRoom* room,
bool owned);
544 const string nick()
const;
545 const string name()
const;
546 const string service()
const;
547 void join(gloox::Presence::PresenceType type = gloox::Presence::Available,
const string& status =
"",
int priority = 0);
548 void leave(
const string& msg =
"");
549 void send(
const string& message);
550 void setNick(
const string& nick);
551 void setPresence(gloox::Presence::PresenceType presence,
const string& msg =
"");
552 void setRequestHistory(
int value, gloox::MUCRoom::HistoryRequestType type);
553 void kick(
const string& nick,
const string& reason);
554 void ban(
const string& nick,
const string& reason);
561 Presence(gloox::Presence::PresenceType presence) : m_Presence(presence) {}
562 gloox::Presence::PresenceType
presence()
const {
return m_Presence; }
574 void fetchRegistrationFields();
586 Tag(
const string& name);
587 Tag(
const string& name,
const string& cdata);
588 Tag(gloox::Tag* wrapped,
bool owned) : m_Wrapped(wrapped), m_Owned(owned) {}
595 static Tag* allocate(gloox::Tag* wrapped,
bool owned);
598 static Tag* allocate(
const string& name);
599 static Tag* allocate(
const string& name,
const string& cdata);
600 static void free(
const Tag* tag);
602 bool addAttribute(
const string& name,
const string& value);
603 string findAttribute(
const string& name)
const;
605 string xmlns()
const;
606 bool setXmlns(
const string& xmlns);
608 void addChild(
Tag* child);
610 string cdata()
const;
611 const Tag* findTag_clone(
const string& expression)
const;
612 ConstTagList findTagList_clone(
const string& expression)
const;
628 Plugin(
const gloox::Jingle::Plugin* wrapped,
bool owned) : m_Wrapped(wrapped), m_Owned(owned) {}
632 const Plugin findPlugin(
int type)
const;
633 const gloox::Jingle::Plugin*
getWrapped()
const {
return m_Wrapped; }
666 Jingle(
const gloox::Jingle::Session::Jingle* wrapped,
bool owned) : m_Wrapped(wrapped), m_Owned(owned) {}
675 Session(gloox::Jingle::Session* wrapped,
bool owned);
678 bool sessionInitiate(
const char* ipStr,
uint16_t port);
699 void registerPlugins();
Definition: glooxwrapper.cpp:311
Definition: glooxwrapper.h:406
Disco * m_DiscoWrapper
Definition: glooxwrapper.h:411
gloox::Client * getWrapped()
Definition: glooxwrapper.h:414
Disco * disco() const
Definition: glooxwrapper.h:433
gloox::Client * m_Wrapped
Definition: glooxwrapper.h:409
ClientImpl * m_Impl
Definition: glooxwrapper.h:410
Definition: glooxwrapper.h:345
virtual bool onTLSConnect(const CertInfo &info)=0
virtual void onConnect()=0
virtual ~ConnectionListener()
Definition: glooxwrapper.h:347
virtual void onDisconnect(gloox::ConnectionError e)=0
Definition: glooxwrapper.h:444
const gloox::DelayedDelivery * m_Wrapped
Definition: glooxwrapper.h:447
NONCOPYABLE(DelayedDelivery)
Definition: glooxwrapper.h:454
gloox::Disco * m_Wrapped
Definition: glooxwrapper.h:457
Definition: glooxwrapper.h:465
bool m_Owned
Definition: glooxwrapper.h:469
gloox::IQ * m_Wrapped
Definition: glooxwrapper.h:468
const gloox::IQ & getWrapped() const
Definition: glooxwrapper.h:471
IQ(const gloox::IQ &iq)
Definition: glooxwrapper.h:472
const T * findExtension(int type) const
Definition: glooxwrapper.h:481
Definition: glooxwrapper.h:354
virtual ~IqHandler()
Definition: glooxwrapper.h:356
virtual bool handleIq(const IQ &iq)=0
virtual void handleIqID(const IQ &iq, int context)=0
Definition: glooxwrapper.h:495
gloox::JID * m_Wrapped
Definition: glooxwrapper.h:498
JID(const std::string &jid)
Definition: glooxwrapper.h:507
bool m_Owned
Definition: glooxwrapper.h:499
const gloox::JID & getWrapped() const
Definition: glooxwrapper.h:502
JID(const gloox::JID &jid)
Definition: glooxwrapper.h:503
See XEP-0176: Jingle ICE-UDP Transport Method.
Definition: glooxwrapper.h:642
Definition: glooxwrapper.h:622
const gloox::Jingle::Plugin * m_Wrapped
Definition: glooxwrapper.h:624
const gloox::Jingle::Plugin * getWrapped() const
Definition: glooxwrapper.h:633
bool m_Owned
Definition: glooxwrapper.h:625
Plugin(const gloox::Jingle::Plugin *wrapped, bool owned)
Definition: glooxwrapper.h:628
Definition: glooxwrapper.h:682
virtual ~SessionHandler()
Definition: glooxwrapper.h:684
virtual void handleSessionAction(gloox::Jingle::Action action, Session &session, const Session::Jingle &jingle)=0
Definition: glooxwrapper.h:661
const gloox::Jingle::Session::Jingle * m_Wrapped
Definition: glooxwrapper.h:663
~Jingle()
Definition: glooxwrapper.h:667
bool m_Owned
Definition: glooxwrapper.h:664
Jingle(const gloox::Jingle::Session::Jingle *wrapped, bool owned)
Definition: glooxwrapper.h:666
Definition: glooxwrapper.h:654
bool m_Owned
Definition: glooxwrapper.h:657
gloox::Jingle::Session * m_Wrapped
Definition: glooxwrapper.h:656
Definition: glooxwrapper.cpp:117
Definition: glooxwrapper.h:369
virtual ~MUCRoomHandler()
Definition: glooxwrapper.h:371
virtual void handleMUCError(MUCRoom &room, gloox::StanzaError error)=0
virtual void handleMUCParticipantPresence(MUCRoom &room, const MUCRoomParticipant participant, const Presence &presence)=0
virtual void handleMUCSubject(MUCRoom &room, const string &nick, const string &subject)=0
virtual void handleMUCMessage(MUCRoom &room, const Message &msg, bool priv)=0
Definition: glooxwrapper.h:534
bool m_Owned
Definition: glooxwrapper.h:539
gloox::MUCRoom * m_Wrapped
Definition: glooxwrapper.h:537
MUCRoomHandlerWrapper * m_HandlerWrapper
Definition: glooxwrapper.h:538
Definition: glooxwrapper.h:362
virtual ~MessageHandler()
Definition: glooxwrapper.h:364
virtual void handleMessage(const Message &msg, MessageSession *session=0)=0
Definition: glooxwrapper.h:515
glooxwrapper::DelayedDelivery * m_DelayedDelivery
Definition: glooxwrapper.h:521
glooxwrapper::JID m_From
Definition: glooxwrapper.h:520
bool m_Owned
Definition: glooxwrapper.h:519
gloox::Message * m_Wrapped
Definition: glooxwrapper.h:518
Definition: glooxwrapper.h:558
gloox::Presence::PresenceType presence() const
Definition: glooxwrapper.h:562
gloox::Presence::PresenceType m_Presence
Definition: glooxwrapper.h:559
Presence(gloox::Presence::PresenceType presence)
Definition: glooxwrapper.h:561
Definition: glooxwrapper.h:379
virtual void handleOOB(const JID &from, const OOB &oob)=0
virtual void handleRegistrationResult(const JID &from, gloox::RegistrationResult regResult)=0
virtual void handleAlreadyRegistered(const JID &from)=0
virtual ~RegistrationHandler()
Definition: glooxwrapper.h:381
virtual void handleRegistrationFields(const JID &from, int fields, string instructions)=0
virtual void handleDataForm(const JID &from, const DataForm &form)=0
Definition: glooxwrapper.h:566
std::list< std::shared_ptr< gloox::RegistrationHandler > > m_RegistrationHandlers
Definition: glooxwrapper.h:570
gloox::Registration * m_Wrapped
Definition: glooxwrapper.h:569
NONCOPYABLE(Registration)
Definition: glooxwrapper.cpp:280
Definition: glooxwrapper.h:691
gloox::Jingle::SessionManager * m_Wrapped
Definition: glooxwrapper.h:693
SessionHandlerWrapper * m_HandlerWrapper
Definition: glooxwrapper.h:694
Definition: glooxwrapper.h:390
virtual StanzaExtension * newInstance(const Tag *tag) const =0
int extensionType() const
Definition: glooxwrapper.h:399
StanzaExtension(int type)
Definition: glooxwrapper.h:392
virtual StanzaExtension * clone() const =0
virtual ~StanzaExtension()
Definition: glooxwrapper.h:393
virtual const string & filterString() const =0
virtual glooxwrapper::Tag * tag() const =0
int m_extensionType
Definition: glooxwrapper.h:401
Definition: glooxwrapper.h:580
gloox::Tag * stealWrapped()
Definition: glooxwrapper.h:594
bool m_Owned
Definition: glooxwrapper.h:584
Tag(gloox::Tag *wrapped, bool owned)
Definition: glooxwrapper.h:588
gloox::Tag * m_Wrapped
Definition: glooxwrapper.h:583
gloox::Tag * getWrapped()
Definition: glooxwrapper.h:593
Definition: glooxwrapper.h:216
list(const list &src)
Definition: glooxwrapper.h:241
void clear()
Definition: glooxwrapper.h:272
list & operator=(const list &src)
Definition: glooxwrapper.h:246
const_iterator end() const
Definition: glooxwrapper.h:237
const T & front() const
Definition: glooxwrapper.h:284
~list()
Definition: glooxwrapper.h:257
node * m_Tail
Definition: glooxwrapper.h:225
const_iterator begin() const
Definition: glooxwrapper.h:236
void push_back(const T &item)
Definition: glooxwrapper.h:262
node * m_Head
Definition: glooxwrapper.h:224
list()
Definition: glooxwrapper.h:239
Definition: glooxwrapper.h:120
bool operator!=(const char *str) const
Definition: glooxwrapper.h:193
size_t m_Size
Definition: glooxwrapper.h:122
bool empty() const
Definition: glooxwrapper.h:183
std::string to_string() const
Gloox strings are UTF encoded, so don't forget to decode it before passing it to the GUI!
Definition: glooxwrapper.h:173
string(const std::string &str)
Definition: glooxwrapper.h:139
char * m_Data
Definition: glooxwrapper.h:123
~string()
Definition: glooxwrapper.h:165
string(const string &str)
Definition: glooxwrapper.h:132
string & operator=(const string &str)
Definition: glooxwrapper.h:153
const char * c_str() const
Definition: glooxwrapper.h:178
string(const char *str)
Definition: glooxwrapper.h:146
bool operator==(const char *str) const
Definition: glooxwrapper.h:188
bool operator<(const string &str) const
Definition: glooxwrapper.h:203
bool operator==(const string &str) const
Definition: glooxwrapper.h:198
string()
Definition: glooxwrapper.h:125
#define GLOOXWRAPPER_API
Definition: glooxwrapper.h:91
bool error(JSContext *cx, uint argc, JS::Value *vp)
Definition: ScriptInterface.cpp:173
list< const Plugin * > PluginList
Definition: glooxwrapper.h:636
Definition: glooxwrapper.cpp:46
static std::ostream & operator<<(std::ostream &stream, const string &string)
Definition: glooxwrapper.h:209
glooxwrapper::list< const Tag * > ConstTagList
Definition: glooxwrapper.h:291
GLOOXWRAPPER_API void * glooxwrapper_alloc(size_t size)
Definition: glooxwrapper.cpp:31
GLOOXWRAPPER_API void glooxwrapper_free(void *p)
Definition: glooxwrapper.cpp:39
glooxwrapper::list< Tag * > TagList
Definition: glooxwrapper.h:290
def xml
Definition: tests.py:138
#define T(string_literal)
Definition: secure_crt.cpp:77
Definition: glooxwrapper.h:294
string server
Definition: glooxwrapper.h:298
int date_to
Definition: glooxwrapper.h:300
string compression
Definition: glooxwrapper.h:304
string issuer
Definition: glooxwrapper.h:297
bool chain
Definition: glooxwrapper.h:296
string protocol
Definition: glooxwrapper.h:301
int status
Definition: glooxwrapper.h:295
int date_from
Definition: glooxwrapper.h:299
string cipher
Definition: glooxwrapper.h:302
string mac
Definition: glooxwrapper.h:303
Definition: glooxwrapper.h:644
string ip
Definition: glooxwrapper.h:645
int port
Definition: glooxwrapper.h:646
Definition: glooxwrapper.h:330
int flags
Definition: glooxwrapper.h:335
string newNick
Definition: glooxwrapper.h:338
JID * actor
Definition: glooxwrapper.h:337
JID * jid
Definition: glooxwrapper.h:334
gloox::MUCRoomAffiliation affiliation
Definition: glooxwrapper.h:332
string reason
Definition: glooxwrapper.h:336
JID * alternate
Definition: glooxwrapper.h:340
JID * nick
Definition: glooxwrapper.h:331
string status
Definition: glooxwrapper.h:339
gloox::MUCRoomRole role
Definition: glooxwrapper.h:333
Definition: glooxwrapper.h:308
string nick
Definition: glooxwrapper.h:310
string zip
Definition: glooxwrapper.h:319
string email
Definition: glooxwrapper.h:315
string url
Definition: glooxwrapper.h:321
string name
Definition: glooxwrapper.h:312
string last
Definition: glooxwrapper.h:314
string password
Definition: glooxwrapper.h:311
string text
Definition: glooxwrapper.h:325
string username
Definition: glooxwrapper.h:309
string phone
Definition: glooxwrapper.h:320
string address
Definition: glooxwrapper.h:316
string date
Definition: glooxwrapper.h:322
string city
Definition: glooxwrapper.h:317
string first
Definition: glooxwrapper.h:313
string state
Definition: glooxwrapper.h:318
string misc
Definition: glooxwrapper.h:324
Definition: glooxwrapper.h:229
const_iterator(const node *n)
Definition: glooxwrapper.h:231
const T & operator*()
Definition: glooxwrapper.h:234
const node * m_Node
Definition: glooxwrapper.h:230
const_iterator & operator++()
Definition: glooxwrapper.h:233
bool operator!=(const const_iterator &it)
Definition: glooxwrapper.h:232
Definition: glooxwrapper.h:219
node(const T &item)
Definition: glooxwrapper.h:220
node * m_Next
Definition: glooxwrapper.h:222
T m_Item
Definition: glooxwrapper.h:221
unsigned short uint16_t
Definition: wposix_types.h:52