ADDED Doxyfile Index: Doxyfile ================================================================== --- /dev/null +++ Doxyfile @@ -0,0 +1,7 @@ +PROJECT_NAME = "ObjXMPP" +OUTPUT_DIRECTORY = docs/ +INPUT = src +FILE_PATTERNS = *.h *.m +HTML_OUTPUT = . +GENERATE_LATEX = NO +HIDE_UNDOC_CLASSES = YES Index: src/XMPPConnection.h ================================================================== --- src/XMPPConnection.h +++ src/XMPPConnection.h @@ -13,20 +13,47 @@ didReceivePresence: (XMPPPresence*)pres; - (void)connection: (XMPPConnection*)conn didReceiveMessage: (XMPPMessage*)msg; @end +/** + * \brief A class that abstracts a connection to an XMPP service + */ @interface XMPPConnection: OFObject { OFTCPSocket *sock; OFXMLParser *parser; OFXMLElementBuilder *elementBuilder; + + /** + * The username (local part of the JID) to connect with + */ OFString *username; + + /** + * The password to connect with + */ OFString *password; + + /** + * The server to connect to + */ OFString *server; + + /** + * The resource to connect with + */ OFString *resource; + + /** + * The port to connect to + */ short port; + + /** + * Whether to use TLS + */ BOOL useTLS; id delegate; OFMutableArray *mechanisms; } @@ -36,9 +63,22 @@ @property (copy) OFString *resource; @property (assign) short port; @property (assign) BOOL useTLS; @property (retain) id delegate; +/** + * Connects to the XMPP service + */ - (void)connect; + +/** + * Starts a loop handling incomming data + */ - (void)handleConnection; + +/** + * Sends a OFXMLElement (usually a XMPPStanza) + * + * \param elem The element to send + */ - (void)sendStanza: (OFXMLElement*)elem; @end Index: src/XMPPStanza.h ================================================================== --- src/XMPPStanza.h +++ src/XMPPStanza.h @@ -1,86 +1,333 @@ #import +/** + * \brief A class describing a XMPP Stanza + */ @interface XMPPStanza: OFXMLElement { + /** + * The value of the stanza's from attribute + */ OFString *from; + + /** + * The value of the stanza's to attribute + */ OFString *to; + + /** + * The value of the stanza's type attribute + */ OFString *type; + + /** + * The value of the stanza's id attribute + */ OFString *ID; } @property (copy) OFString *from; @property (copy) OFString *to; @property (copy) OFString *type; @property (copy) OFString *ID; -+ stanzaWithName: (OFString*)name; -+ stanzaWithName: (OFString*)name - type: (OFString*)type_; -+ stanzaWithName: (OFString*)name - ID: (OFString*)ID_; -+ stanzaWithName: (OFString*)name - type: (OFString*)type_ - ID: (OFString*)ID_; +/** + * Creates a new XMPPStanza with a certain name + * + * \param name The stanza's name (one of iq, message or presence) + * \return A new autoreleased XMPPStanza + */ ++ stanzaWithName: (OFString*)name; + +/** + * Creates a new XMPPStanza with a certain name and type + * + * \param name The stanza's name (one of iq, message or presence) + * \param type The value for the stanza's type attribute + * \return A new autoreleased XMPPStanza + */ ++ stanzaWithName: (OFString*)name + type: (OFString*)type; + +/** + * Creates a new XMPPStanza with a certain name and id + * + * \param name The stanza's name (one of iq, message or presence) + * \param ID The value for the stanza's id attribute + * \return A new autoreleased XMPPStanza + */ ++ stanzaWithName: (OFString*)name + ID: (OFString*)ID; + +/** + * Creates a new XMPPStanza with a certain name, type and id + * + * \param name The stanza's name (one of iq, message or presence) + * \param type The value for the stanza's type attribute + * \param ID The value for the stanza's id attribute + * \return A new autoreleased XMPPStanza + */ ++ stanzaWithName: (OFString*)name + type: (OFString*)type + ID: (OFString*)ID; + +/** + * Creates a new XMPPStanza from a OFXMLElement + * + * \param elem The element to base the XMPPStanza on + * \return A new autoreleased XMPPStanza + */ + stanzaWithElement: (OFXMLElement*)elem; +/** + * Initializes an already allocated XMPPStanza with a certain name + * + * \param name The stanza's name (one of iq, message or presence) + * \return A initialized XMPPStanza + */ - initWithName: (OFString*)name; + +/** + * Initializes an already allocated XMPPStanza with a certain name and type + * + * \param name The stanza's name (one of iq, message or presence) + * \param type The value for the stanza's type attribute + * \return A initialized XMPPStanza + */ - initWithName: (OFString*)name - type: (OFString*)type_; + type: (OFString*)type; + +/** + * Initializes an already allocated XMPPStanza with a certain name and id + * + * \param name The stanza's name (one of iq, message or presence) + * \param ID The value for the stanza's id attribute + * \return A initialized XMPPStanza + */ - initWithName: (OFString*)name - ID: (OFString*)ID_; + ID: (OFString*)ID; + +/** + * Initializes an already allocated XMPPStanza with a certain name, type and id + * + * \param name The stanza's name (one of iq, message or presence) + * \param type The value for the stanza's type attribute + * \param ID The value for the stanza's id attribute + * \return A initialized XMPPStanza + */ - initWithName: (OFString*)name - type: (OFString*)type_ - ID: (OFString*)ID_; + type: (OFString*)type + ID: (OFString*)ID; + +/** + * Initializes an already allocated XMPPStanza based on a OFXMLElement + * + * \param elem The element to base the XMPPStanza on + * \return A initialized XMPPStanza + */ - initWithElement: (OFXMLElement*)elem; @end +/** + * \brief A class describing a IQ stanza + */ @interface XMPPIQ: XMPPStanza { } -+ IQWithType: (OFString*)type_ - ID: (OFString*)ID_; +/** + * Creates a new XMPPIQ with a certain type and id + * + * \param type The value for the stanza's type attribute + * \param ID The value for the stanza's id attribute + * \return A new autoreleased XMPPIQ + */ ++ IQWithType: (OFString*)type + ID: (OFString*)ID; -- initWithType: (OFString*)type_ - ID: (OFString*)ID_; +/** + * Initializes an already allocated XMPPIQ with a certain type and id + * + * \param type The value for the stanza's type attribute + * \param ID The value for the stanza's id attribute + * \return A initialized XMPPIQ + */ +- initWithType: (OFString*)type + ID: (OFString*)ID; @end +/** + * \brief A class describing a message stanza + */ @interface XMPPMessage: XMPPStanza { } +/** + * Creates a new XMPPMessage + * + * \return A new autoreleased XMPPMessage + */ + message; -+ messageWithID: (OFString*)ID_; -+ messageWithType: (OFString*)type_; -+ messageWithType: (OFString*)type_ - ID: (OFString*)ID_; + +/** + * Creates a new XMPPMessage with a certain id + * + * \param ID The value for the stanza's id attribute + * \return A new autoreleased XMPPMessage + */ ++ messageWithID: (OFString*)ID; + +/** + * Creates a new XMPPMessage with a certain type + * + * \param type The value for the stanza's type attribute + * \return A new autoreleased XMPPMessage + */ ++ messageWithType: (OFString*)type; + +/** + * Creates a new XMPPMessage with a certain type and id + * + * \param type The value for the stanza's type attribute + * \param ID The value for the stanza's id attribute + * \return A new autoreleased XMPPMessage + */ ++ messageWithType: (OFString*)type + ID: (OFString*)ID; +/** + * Initializes an already allocated XMPPMessage + * + * \return A initialized XMPPMessage + */ - init; -- initWithID: (OFString*)ID_; -- initWithType: (OFString*)type_; -- initWithType: (OFString*)type_ - ID: (OFString*)ID_; + +/** + * Initializes an already allocated XMPPMessage with a certain id + * + * \param ID The value for the stanza's id attribute + * \return A initialized XMPPMessage + */ +- initWithID: (OFString*)ID; + +/** + * Initializes an already allocated XMPPMessage with a certain type + * + * \param type The value for the stanza's type attribute + * \return A initialized XMPPMessage + */ +- initWithType: (OFString*)type; + +/** + * Initializes an already allocated XMPPMessage with a certain type and id + * + * \param type The value for the stanza's type attribute + * \param ID The value for the stanza's id attribute + * \return A initialized XMPPMessage + */ +- initWithType: (OFString*)type + ID: (OFString*)ID; +/** + * Adds a body element to the XMPPMessage + * + * \param body The text content of the body element + */ - (void)addBody: (OFString*)body; @end +/** + * \brief A class describing a presence stanza + */ @interface XMPPPresence: XMPPStanza { } +/** + * Creates a new XMPPPresence + * + * \return A new autoreleased XMPPPresence + */ + presence; -+ presenceWithID: (OFString*)ID_; -+ presenceWithType: (OFString*)type_; -+ presenceWithType: (OFString*)type_ - ID: (OFString*)ID_; + +/** + * Creates a new XMPPPresence with a certain id + * + * \param ID The value for the stanza's id attribute + * \return A new autoreleased XMPPPresence + */ ++ presenceWithID: (OFString*)ID; + +/** + * Creates a new XMPPPresence with a certain type + * + * \param type The value for the stanza's type attribute + * \return A new autoreleased XMPPPresence + */ ++ presenceWithType: (OFString*)type; + +/** + * Creates a new XMPPPresence with a certain type and id + * + * \param type The value for the stanza's type attribute + * \param ID The value for the stanza's id attribute + * \return A new autoreleased XMPPPresence + */ ++ presenceWithType: (OFString*)type + ID: (OFString*)ID; +/** + * Initializes an already allocated XMPPPresence + * + * \return A initialized XMPPPresence + */ - init; -- initWithID: (OFString*)ID_; -- initWithType: (OFString*)type_; -- initWithType: (OFString*)type_ - ID: (OFString*)ID_; + +/** + * Initializes an already allocated XMPPPresence with a certain id + * + * \param ID The value for the stanza's id attribute + * \return A initialized XMPPPresence + */ +- initWithID: (OFString*)ID; + +/** + * Initializes an already allocated XMPPPresence with a certain type + * + * \param type The value for the stanza's type attribute + * \return A initialized XMPPPresence + */ +- initWithType: (OFString*)type; + +/** + * Initializes an already allocated XMPPPresence with a certain type and id + * + * \param type The value for the stanza's type attribute + * \param ID The value for the stanza's id attribute + * \return A initialized XMPPPresence + */ +- initWithType: (OFString*)type + ID: (OFString*)ID; +/** + * Adds a show element to the presence stanza + * + * \param show The text content of the show element + */ - (void)addShow: (OFString*)show; + +/** + * Adds a status element to the presence stanza + * + * \param status The text content of the status element + */ - (void)addStatus: (OFString*)status; + +/** + * Adds a priority element to the presence stanza + * + * \param priority The text content of the priority element + */ - (void)addPriority: (int8_t)priority; @end