#include <session.hh>
Inheritance diagram for jabberoo::Session:
Public Types | |
enum | AuthType { atPlaintextAuth, atDigestAuth, atAutoAuth, at0kAuth } |
The authorization type. More... | |
enum | ConnectionState { csNotConnected, csCreateUser, csAuthReq, csAwaitingAuth, csConnected } |
The connection state. More... | |
Public Member Functions | |
Session () | |
Construct a Session. | |
virtual | ~Session () |
Deconstruct a Session. | |
Session & | operator>> (const char *buffer) |
Read from the Session. | |
Session & | operator<< (const Packet &p) |
Send a Packet. | |
Session & | operator<< (const char *buffer) |
Send text. | |
void | connect (const std::string &server, AuthType atype, const std::string &username, const std::string &resource, const std::string &password, bool createuser=false, bool should_auth=true) |
Log into a server and authenticate. | |
bool | disconnect () |
Disconnect from the server. | |
ConnectionState | getConnState () |
Get the ConnectionState. | |
virtual void | push (const char *data, int datasz) |
Push raw XML to the session. | |
void | registerIQ (const std::string &id, ElementCallbackFunc f) |
Register an iq callback. | |
judo::XPath::Query * | registerXPath (const std::string &query, ElementCallbackFunc f, bool incoming=true) |
Register a judo::XPath callback The callback will be called with any packets that match the given judo::XPath query. | |
void | unregisterXPath (judo::XPath::Query *id, bool incoming=true) |
Unregister a judo::XPath callback. | |
void | queryNamespace (const std::string &nspace, ElementCallbackFunc f, const std::string &to="") |
Query a namespace on a specific JabberID. | |
const Roster & | roster () const |
Get the Roster. | |
Roster & | roster () |
Get the Roster. | |
const DiscoDB & | discoDB () const |
Get the DiscoDB. | |
DiscoDB & | discoDB () |
Get the DiscoDB. | |
const PresenceDB & | presenceDB () const |
Get the PresenceDB. | |
PresenceDB & | presenceDB () |
Get the PresenceDB. | |
AuthType | getAuthType () const |
Get the AuthType which was used. | |
const std::string & | getUserName () const |
Get the username which was used. | |
std::string | getNextID () |
Get the next available id Using this function ensures that ids are not repeated in the same Session. | |
std::string | getDigest () |
Get the digest hash. | |
Public Attributes | |
SigC::Signal2< void, int, const std::string &, SigC::Marshal< void > > | evtXMLParserError |
This event is emitted when there is an error parsing the XML received. | |
SigC::Signal1< void, const char *, SigC::Marshal< void > > | evtTransmitXML |
This event is emitted when XML is transmitted. | |
SigC::Signal1< void, const char *, SigC::Marshal< void > > | evtRecvXML |
This event is emitted when XML is received. | |
SigC::Signal1< void, const Packet &, SigC::Marshal< void > > | evtTransmitPacket |
This event is emitted when a Packet is transmitted. | |
SigC::Signal1< void, const judo::Element &, SigC::Marshal< void > > | evtConnected |
This event is emitted when the connection to the server has been established. | |
SigC::Signal0< void, SigC::Marshal< void > > | evtDisconnected |
This event is emitted when the connection to the server has been discontinued. | |
SigC::Signal1< void, const Message &, SigC::Marshal< void > > | evtMessage |
This event is emitted when a Message is received. | |
SigC::Signal1< void, const judo::Element &, SigC::Marshal< void > > | evtIQ |
This event is emitted when an IQ judo::element is received. | |
SigC::Signal1< void, const Presence &, SigC::Marshal< void > > | evtMyPresence |
This event is emitted when a Presence judo::element which appears to be from the server is received. | |
SigC::Signal2< void, const Presence &, Presence::Type, SigC::Marshal< void > > | evtPresence |
This event is emitted when a Presence judo::element is received. | |
SigC::Signal1< void, const Presence &, SigC::Marshal< void > > | evtPresenceRequest |
This event is emitted when a Presence subscription request is received. | |
SigC::Signal1< void, const judo::Element &, SigC::Marshal< void > > | evtUnknownPacket |
This event is emitted when an unknown XML judo::element is received. | |
SigC::Signal2< void, int, const char *, SigC::Marshal< void > > | evtAuthError |
This event is emitted when an authorization error occurs. | |
SigC::Signal0< void, SigC::Marshal< void > > | evtOnRoster |
This event is emitted when a roster is received. | |
SigC::Signal3< void, std::string &, std::string &, std::string &, SigC::Marshal< void > > | evtOnVersion |
This event is emitted when a client version is requested. | |
SigC::Signal1< void, std::string &, SigC::Marshal< void > > | evtOnLast |
This event is emitted when idle time is requested. | |
SigC::Signal2< void, std::string &, std::string &, SigC::Marshal< void > > | evtOnTime |
This event is emitted when the client machine's local time is requested. | |
Protected Member Functions | |
virtual void | onDocumentStart (judo::Element *t) |
Event point for XML document start event. | |
virtual void | onElement (judo::Element *t) |
Event point for immediate children of XML document root. | |
virtual void | onCDATA (judo::CDATA *c) |
Event point for immediate CDATA of an XML document root. | |
virtual void | onDocumentEnd () |
Event point for XML document end event. |
This class provides common operations needed for raw communication between the client and the server.
Definition at line 53 of file session.hh.
|
The authorization type.
Definition at line 62 of file session.hh. |
|
The connection state.
Definition at line 73 of file session.hh. Referenced by getConnState(). |
|
Construct a Session. This constructs a Session.
Definition at line 42 of file jabberoo-session.cpp. |
|
Deconstruct a Session. This frees memory the Session was using. Definition at line 52 of file jabberoo-session.cpp. References csNotConnected, and disconnect(). |
|
Log into a server and authenticate. If should_auth is set to false, you will have to use roster().fetch() manually to get Jabberoo to download the roster. The assumption is that if you don't want standard authentication, you probably don't want the standard roster either. Yes, that's one heck of an assumption, but in practice it seems to match up.
Definition at line 104 of file jabberoo-session.cpp. References csAuthReq, csConnected, csCreateUser, csNotConnected, evtConnected, and judo::ElementStream::reset(). |
|
Get the DiscoDB.
Definition at line 180 of file jabberoo-session.cpp. |
|
Get the DiscoDB.
Definition at line 175 of file jabberoo-session.cpp. |
|
Disconnect from the server.
Definition at line 146 of file jabberoo-session.cpp. References csNotConnected. Referenced by push(), and ~Session(). |
|
Get the AuthType which was used.
Definition at line 195 of file jabberoo-session.cpp. |
|
Get the ConnectionState.
Definition at line 143 of file session.hh. References ConnectionState. |
|
Get the digest hash.
Definition at line 215 of file jabberoo-session.cpp. |
|
Get the next available id Using this function ensures that ids are not repeated in the same Session.
Definition at line 208 of file jabberoo-session.cpp. Referenced by jabberoo::DiscoDB::cache(), and queryNamespace(). |
|
Get the username which was used.
Definition at line 200 of file jabberoo-session.cpp. |
|
Event point for immediate CDATA of an XML document root. Override this method to get notified when CDATA is encountered immediately below the root document. This is a fairly rare condition within most Jabber processing, but is required for those rare cases. If you don't override this method, the CDATA is automatically cleaned up for you.
Reimplemented from judo::ElementStreamEventListener. Definition at line 459 of file jabberoo-session.cpp. |
|
Event point for XML document end event. Override this method to get notified when the XML document is ending Implements judo::ElementStreamEventListener. Definition at line 467 of file jabberoo-session.cpp. References jabberoo::PresenceDB::clear(), csNotConnected, evtDisconnected, and jabberoo::Roster::reset(). |
|
Event point for XML document start event. Override this method to get notified when the XML document is starting
Implements judo::ElementStreamEventListener. Definition at line 419 of file jabberoo-session.cpp. References evtConnected, and judo::Element::getAttrib(). |
|
Event point for immediate children of XML document root. Override this method to get notified when a complete child Element has been parsed.
Implements judo::ElementStreamEventListener. Definition at line 433 of file jabberoo-session.cpp. References evtUnknownPacket, and judo::Node::getName(). |
|
Send text. Sends raw text through the session. Usually, this should be well-formed XML. Definition at line 111 of file session.hh. References evtTransmitXML. |
|
Send a Packet. Sends a Packet through the session. Definition at line 76 of file jabberoo-session.cpp. References evtMyPresence, evtTransmitPacket, evtTransmitXML, jabberoo::Packet::getBaseElement(), jabberoo::Packet::getFrom(), judo::Node::getName(), jabberoo::Packet::getTo(), and jabberoo::Packet::toString(). |
|
Read from the Session. Reads data from the session into a const char* buffer. Definition at line 101 of file session.hh. References push(). |
|
Get the PresenceDB.
Definition at line 190 of file jabberoo-session.cpp. |
|
Get the PresenceDB.
Definition at line 185 of file jabberoo-session.cpp. |
|
Push raw XML to the session. The socket connector should call this function to push raw XML through to Jabberoo.
Reimplemented from judo::ElementStream. Definition at line 224 of file jabberoo-session.cpp. References csNotConnected, disconnect(), evtRecvXML, and evtXMLParserError. Referenced by operator>>(). |
|
Query a namespace on a specific JabberID. The callback will be called once a response to the namespace query is received.
Definition at line 282 of file jabberoo-session.cpp. References judo::Element::addElement(), getNextID(), judo::Element::putAttrib(), and judo::Element::toString(). Referenced by jabberoo::Roster::deleteUser(). |
|
Register an iq callback. The callback will be called once an iq message with the given id is received.
Definition at line 241 of file jabberoo-session.cpp. Referenced by jabberoo::DiscoDB::cache(). |
|
Register a judo::XPath callback The callback will be called with any packets that match the given judo::XPath query.
Definition at line 246 of file jabberoo-session.cpp. |
|
Get the Roster.
Definition at line 170 of file jabberoo-session.cpp. |
|
Get the Roster.
Definition at line 165 of file jabberoo-session.cpp. |
|
Unregister a judo::XPath callback.
Definition at line 264 of file jabberoo-session.cpp. |
|
This event is emitted when an authorization error occurs.
Definition at line 340 of file session.hh. |
|
This event is emitted when the connection to the server has been established.
Definition at line 288 of file session.hh. Referenced by connect(), and onDocumentStart(). |
|
This event is emitted when the connection to the server has been discontinued. This will be emitted whether the connection was due to error or not.
Definition at line 294 of file session.hh. Referenced by onDocumentEnd(). |
|
This event is emitted when an IQ judo::element is received.
Definition at line 307 of file session.hh. |
|
This event is emitted when a Message is received.
Definition at line 301 of file session.hh. |
|
This event is emitted when a Presence judo::element which appears to be from the server is received. This probably is an error, such as specifying some invalid type.
Definition at line 314 of file session.hh. Referenced by operator<<(). |
|
This event is emitted when idle time is requested.
Definition at line 361 of file session.hh. |
|
This event is emitted when a roster is received. Note that this could be simply a roster push or the complete roster. The only reason you'd attach to this is if you want notification of *all* roster changes, whether or not you need to refresh the roster. It probably makes more sense to use jabberoo::Roster::evtRefresh
Definition at line 349 of file session.hh. |
|
This event is emitted when the client machine's local time is requested.
Definition at line 368 of file session.hh. |
|
This event is emitted when a client version is requested.
Definition at line 356 of file session.hh. |
|
This event is emitted when a Presence judo::element is received.
Definition at line 321 of file session.hh. |
|
This event is emitted when a Presence subscription request is received.
Definition at line 327 of file session.hh. |
|
This event is emitted when XML is received.
Definition at line 276 of file session.hh. Referenced by push(). |
|
This event is emitted when a Packet is transmitted.
Definition at line 281 of file session.hh. Referenced by operator<<(). |
|
This event is emitted when XML is transmitted. This should be hooked up to a function in the socket connector which sends the character data.
Definition at line 271 of file session.hh. Referenced by operator<<(). |
|
This event is emitted when an unknown XML judo::element is received.
Definition at line 334 of file session.hh. Referenced by onElement(). |
|
This event is emitted when there is an error parsing the XML received. Jabberoo catches libjudo's ParserError exception, disconnects the session, and then triggers this event.
Definition at line 265 of file session.hh. Referenced by push(). |