ObjXMPP  Check-in [31846fcc3b]

Overview
Comment:Add -[parseBuffer:withSize:] to XMPPConnection.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 31846fcc3baa08e8cb41db0e6073171fb615834114e8904ab2fa08f1702148da
User & Date: js on 2011-04-01 02:23:18
Other Links: manifest | tags
Context
2011-04-01
02:26
Add -[socket] to XMPPConnection. check-in: 9e5a047eec user: js tags: trunk
02:23
Add -[parseBuffer:withSize:] to XMPPConnection. check-in: 31846fcc3b user: js tags: trunk
01:14
Add convenience header and method. check-in: 6c757fb3c0 user: js tags: trunk
Changes

Modified src/XMPPConnection.h from [ae3d7030e1] to [30a48b2ec0].

86
87
88
89
90
91
92



93
94
95
96
97
98
99
100
101
102
103
104












105
106
107
108
109
110
111
@property (copy) OFString *username, *password, *server, *resource;
@property (copy, readonly) XMPPJID *JID;
@property (assign) uint16_t port;
@property (retain) id <XMPPConnectionDelegate> delegate;
@property (readonly, retain) XMPPRoster *roster;
#endif




+ connection;

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

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













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








>
>
>












>
>
>
>
>
>
>
>
>
>
>
>







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@property (copy) OFString *username, *password, *server, *resource;
@property (copy, readonly) XMPPJID *JID;
@property (assign) uint16_t port;
@property (retain) id <XMPPConnectionDelegate> delegate;
@property (readonly, retain) XMPPRoster *roster;
#endif

/**
 * \return A new autoreleased XMPPConnection
 */
+ connection;

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

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

/**
 * Parses the specified buffer.
 *
 * This is useful for handling multiple connections at once.
 *
 * \param buf The buffer to parse
 * \param size The size of the buffer. If size is 0, it is assumed that the
 *	       connection was closed.
 */
- (void)parseBuffer: (const char*)buf
	   withSize: (size_t)size;

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

Modified src/XMPPConnection.m from [9566d5c99c] to [82b4f2ceb5].

224
225
226
227
228
229
230











231
232
233
234
235
236
237
		    @selector(connectionWasClosed:)])
			[delegate connectionWasClosed: self];

		[parser parseBuffer: buf
			   withSize: len];
	}
}












- (void)sendStanza: (OFXMLElement*)elem
{
	of_log(@"Out: %@", elem);
	[sock writeString: [elem XMLString]];
}








>
>
>
>
>
>
>
>
>
>
>







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
		    @selector(connectionWasClosed:)])
			[delegate connectionWasClosed: self];

		[parser parseBuffer: buf
			   withSize: len];
	}
}

- (void)parseBuffer: (const char*)buf
	   withSize: (size_t)size
{
	if (size < 1 && [delegate respondsToSelector:
	    @selector(connectionWasClosed:)])
		[delegate connectionWasClosed: self];

	[parser parseBuffer: buf
		   withSize: size];
}

- (void)sendStanza: (OFXMLElement*)elem
{
	of_log(@"Out: %@", elem);
	[sock writeString: [elem XMLString]];
}