ObjXMPP  Diff

Differences From Artifact [3f7778add9]:

To Artifact [9643929b2e]:


1
2
3
4
5


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30

31
32
33
34
35

36
37
38
39
40

41
42
43
44
45

46
47
48
49
50

51
52
53
54
55

56
57
58
59
60

61
62
63
64
65
66
67
68
69
70
71

72
73
74
75
76
77

78
79
80
81
82

83
84
85
86
87

88
89
90
91
92
1
2



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26



27

28



29

30



31

32



33

34



35

36



37

38



39

40
41
42
43
44
45
46
47
48

49
50
51
52
53
54

55
56
57
58
59

60
61
62
63
64

65
66
67
68
69
70


-
-
-
+
+















-
+






-
-
-
+
-

-
-
-
+
-

-
-
-
+
-

-
-
-
+
-

-
-
-
+
-

-
-
-
+
-

-
-
-
+
-









-
+





-
+




-
+




-
+





#import <ObjFW/ObjFW.h>

#import "XMPPJID.h"

@class XMPPConnection;
@class XMPPConnection;
@class XMPPJID;
@class XMPPIQ;
@class XMPPMessage;
@class XMPPPresence;

@protocol XMPPConnectionDelegate
- (void)connectionWasClosed: (XMPPConnection*)conn;
- (void)connection: (XMPPConnection*)conn
      didReceiveIQ: (XMPPIQ*)iq;
-   (void)connection: (XMPPConnection*)conn
  didReceivePresence: (XMPPPresence*)pres;
-  (void)connection: (XMPPConnection*)conn
  didReceiveMessage: (XMPPMessage*)msg;
@end

/**
 * \brief A class that abstracts a connection to an XMPP service
 * \brief A class which abstracts a connection to an XMPP service.
 */
@interface XMPPConnection: OFObject <OFXMLElementBuilderDelegate>
{
	OFTCPSocket *sock;
	OFXMLParser *parser;
	OFXMLElementBuilder *elementBuilder;

	/**
	 * The username to connect with
	/// The username to connect with
	 */
	OFString *username;

	/**
	 * The password to connect with
	/// The password to connect with
	 */
	OFString *password;

	/**
	 * The server to connect to
	/// The server to connect to
	 */
	OFString *server;

	/**
	 * The resource to connect with
	/// The resource to connect with
	 */
	OFString *resource;

	/**
	 * The JID bound to this connection (this is determined by the server)
	/// The JID bound to this connection (this is determined by the server)
	 */
	XMPPJID *JID;

	/**
	 * The port to connect to
	/// The port to connect to
	 */
	short port;

	/**
	 * Whether to use TLS
	/// Whether to use TLS
	 */
	BOOL useTLS;
	id <XMPPConnectionDelegate> delegate;
	OFMutableArray *mechanisms;
}

@property (copy) OFString *username;
@property (copy) OFString *password;
@property (copy) OFString *server;
@property (copy) OFString *resource;
@property (readonly) XMPPJID *JID;
@property (copy, readonly) XMPPJID *JID;
@property (assign) short port;
@property (assign) BOOL useTLS;
@property (retain) id <XMPPConnectionDelegate> delegate;

/**
 * Connects to the XMPP service
 * Connects to the XMPP service.
 */
- (void)connect;

/**
 * Starts a loop handling incomming data
 * Starts a loop handling incomming data.
 */
- (void)handleConnection;

/**
 * Sends a OFXMLElement (usually a XMPPStanza)
 * Sends an OFXMLElement, usually an XMPPStanza.
 *
 * \param elem The element to send
 */
- (void)sendStanza: (OFXMLElement*)elem;
@end