ObjIRC  Check-in [b2ebf6b9e5]

Overview
Comment:Adjust to recent ObjFW changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b2ebf6b9e50512a49a644e6329b96d1facf3075506bf78673d69dc94b161ea2d
User & Date: js on 2011-09-09 14:55:04
Other Links: manifest | tags
Context
2011-09-09
16:18
Add -[description] to IRCChannel. check-in: 0d1dcda269 user: js tags: trunk
14:55
Adjust to recent ObjFW changes. check-in: b2ebf6b9e5 user: js tags: trunk
2011-03-24
19:49
Some cleanup. check-in: 43e5b3c00a user: js tags: trunk
Changes

Modified src/IRCConnection.h from [4c8856ff28] to [7791c3eea9].

67
68
69
70
71
72
73
74
75
76
- (void)disconnect;
- (void)disconnectWithReason: (OFString*)reason;
- (void)joinChannel: (OFString*)channelName;
- (void)leaveChannel: (IRCChannel*)channel;
- (void)leaveChannel: (IRCChannel*)channel
	  withReason: (OFString*)reason;
- (void)sendLine: (OFString*)line;
- (void)sendLineWithFormat: (OFString*)line, ...;
- (void)handleConnection;
@end







|


67
68
69
70
71
72
73
74
75
76
- (void)disconnect;
- (void)disconnectWithReason: (OFString*)reason;
- (void)joinChannel: (OFString*)channelName;
- (void)leaveChannel: (IRCChannel*)channel;
- (void)leaveChannel: (IRCChannel*)channel
	  withReason: (OFString*)reason;
- (void)sendLine: (OFString*)line;
- (void)sendLineWithFormat: (OFConstantString*)line, ...;
- (void)handleConnection;
@end

Modified src/IRCConnection.m from [aa5e5ea8ab] to [4ee7d8dea1].

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];

	sock = [[OFTCPSocket alloc] init];
	[sock connectToHost: server
		     onPort: port];

	[self sendLineWithFormat: @"NICK %@", nickname];
	[self sendLineWithFormat: @"USER %@ * 0 :%@", username, realname];

	[pool release];
}








|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];

	sock = [[OFTCPSocket alloc] init];
	[sock connectToHost: server
		       port: port];

	[self sendLineWithFormat: @"NICK %@", nickname];
	[self sendLineWithFormat: @"USER %@ * 0 :%@", username, realname];

	[pool release];
}

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
	if ([delegate respondsToSelector: @selector(connection:didSendLine:)])
		[delegate connection: self
			 didSendLine: line];

	[sock writeLine: line];
}

- (void)sendLineWithFormat: (OFString*)format, ...
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *line;
	va_list args;

	va_start(args, format);
	line = [[[OFString alloc] initWithFormat: format







|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
	if ([delegate respondsToSelector: @selector(connection:didSendLine:)])
		[delegate connection: self
			 didSendLine: line];

	[sock writeLine: line];
}

- (void)sendLineWithFormat: (OFConstantString*)format, ...
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *line;
	va_list args;

	va_start(args, format);
	line = [[[OFString alloc] initWithFormat: format
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
		if (splitted.count == 3 &&
		    [[splitted objectAtIndex: 1] isEqual: @"JOIN"]) {
			OFString *who = [splitted objectAtIndex: 0];
			OFString *where = [splitted objectAtIndex: 2];
			IRCUser *user;
			IRCChannel *channel;

			who = [who substringFromIndex: 1
					      toIndex: who.length];
			where = [where substringFromIndex: 1
						  toIndex: where.length];

			user = [IRCUser IRCUserWithString: who];

			if ([who hasPrefix:
			    [nickname stringByAppendingString: @"!"]]) {
				channel = [IRCChannel channelWithName: where];
				[channels setObject: channel







|
|
|
|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
		if (splitted.count == 3 &&
		    [[splitted objectAtIndex: 1] isEqual: @"JOIN"]) {
			OFString *who = [splitted objectAtIndex: 0];
			OFString *where = [splitted objectAtIndex: 2];
			IRCUser *user;
			IRCChannel *channel;

			who = [who substringWithRange:
			    of_range(1, who.length - 1)];
			where = [where substringWithRange:
			    of_range(1, where.length - 1)];

			user = [IRCUser IRCUserWithString: who];

			if ([who hasPrefix:
			    [nickname stringByAppendingString: @"!"]]) {
				channel = [IRCChannel channelWithName: where];
				[channels setObject: channel
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
			OFString *to = [splitted objectAtIndex: 2];
			IRCUser *user;
			OFString *msg;
			size_t pos = from.length + 1 +
			    [[splitted objectAtIndex: 1] length] + 1 +
			    to.length;

			from = [from substringFromIndex: 1
						toIndex: from.length];
			msg = [line substringFromIndex: pos + 2
					       toIndex: line.length];

			user = [IRCUser IRCUserWithString: from];

			if (![to isEqual: nickname]) {
				IRCChannel *channel;

				channel = [channels objectForKey: to];







|
|
|
|







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
			OFString *to = [splitted objectAtIndex: 2];
			IRCUser *user;
			OFString *msg;
			size_t pos = from.length + 1 +
			    [[splitted objectAtIndex: 1] length] + 1 +
			    to.length;

			from = [from substringWithRange:
			    of_range(1, from.length - 1)];
			msg = [line substringWithRange:
			    of_range(pos + 2, line.length - pos - 2)];

			user = [IRCUser IRCUserWithString: from];

			if (![to isEqual: nickname]) {
				IRCChannel *channel;

				channel = [channels objectForKey: to];