ObjIRC  Diff

Differences From Artifact [aa5e5ea8ab]:

To Artifact [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];