Don't implement IRCConnectionDelegate on OFObject.
FossilOrigin-Name: c99e07382f3d50e498f16baf600180109fac6f844aa79b3ce0fa7068e32f7a2a
This commit is contained in:
parent
97b6edeb00
commit
0ed61817fa
2 changed files with 71 additions and 131 deletions
|
@ -25,11 +25,7 @@
|
||||||
@class IRCConnection;
|
@class IRCConnection;
|
||||||
@class IRCUser;
|
@class IRCUser;
|
||||||
|
|
||||||
#ifndef IRC_CONNECTION_M
|
|
||||||
@protocol IRCConnectionDelegate <OFObject>
|
@protocol IRCConnectionDelegate <OFObject>
|
||||||
#else
|
|
||||||
@protocol IRCConnectionDelegate
|
|
||||||
#endif
|
|
||||||
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
|
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
|
||||||
@optional
|
@optional
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -188,6 +188,7 @@
|
||||||
|
|
||||||
- (void)sendLine: (OFString*)line
|
- (void)sendLine: (OFString*)line
|
||||||
{
|
{
|
||||||
|
if ([_delegate respondsToSelector: @selector(connection:didSendLine:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didSendLine: line];
|
didSendLine: line];
|
||||||
|
|
||||||
|
@ -254,6 +255,8 @@
|
||||||
OFArray *components;
|
OFArray *components;
|
||||||
OFString *action = nil;
|
OFString *action = nil;
|
||||||
|
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connection:didReceiveLine:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didReceiveLine: line];
|
didReceiveLine: line];
|
||||||
|
|
||||||
|
@ -274,7 +277,10 @@
|
||||||
|
|
||||||
/* Connected */
|
/* Connected */
|
||||||
if ([action isEqual: @"001"] && [components count] >= 4) {
|
if ([action isEqual: @"001"] && [components count] >= 4) {
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connectionWasEstablished:)])
|
||||||
[_delegate connectionWasEstablished: self];
|
[_delegate connectionWasEstablished: self];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +304,8 @@
|
||||||
|
|
||||||
[channel addObject: [user nickname]];
|
[channel addObject: [user nickname]];
|
||||||
|
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connection:didSeeUser:joinChannel:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didSeeUser: user
|
didSeeUser: user
|
||||||
joinChannel: where];
|
joinChannel: where];
|
||||||
|
@ -341,6 +349,8 @@
|
||||||
[channel addObject: user];
|
[channel addObject: user];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connection:didReceiveNamesForChannel:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didReceiveNamesForChannel: where];
|
didReceiveNamesForChannel: where];
|
||||||
|
|
||||||
|
@ -367,6 +377,8 @@
|
||||||
|
|
||||||
[channel removeObject: [user nickname]];
|
[channel removeObject: [user nickname]];
|
||||||
|
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connection:didSeeUser:leaveChannel:reason:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didSeeUser: user
|
didSeeUser: user
|
||||||
leaveChannel: where
|
leaveChannel: where
|
||||||
|
@ -397,6 +409,8 @@
|
||||||
|
|
||||||
[channel removeObject: [user nickname]];
|
[channel removeObject: [user nickname]];
|
||||||
|
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connection:didSeeUser:kickUser:channel:reason:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didSeeUser: user
|
didSeeUser: user
|
||||||
kickUser: whom
|
kickUser: whom
|
||||||
|
@ -427,6 +441,8 @@
|
||||||
while ((channel = [enumerator nextObject]) != nil)
|
while ((channel = [enumerator nextObject]) != nil)
|
||||||
[channel removeObject: [user nickname]];
|
[channel removeObject: [user nickname]];
|
||||||
|
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connection:didSeeUserQuit:reason:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didSeeUserQuit: user
|
didSeeUserQuit: user
|
||||||
reason: reason];
|
reason: reason];
|
||||||
|
@ -461,6 +477,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connection:didSeeUser:changeNicknameTo:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didSeeUser: user
|
didSeeUser: user
|
||||||
changeNicknameTo: nickname];
|
changeNicknameTo: nickname];
|
||||||
|
@ -483,15 +501,20 @@
|
||||||
of_range(pos + 2, [line length] - pos - 2)];
|
of_range(pos + 2, [line length] - pos - 2)];
|
||||||
user = [IRCUser IRCUserWithString: from];
|
user = [IRCUser IRCUserWithString: from];
|
||||||
|
|
||||||
if (![to isEqual: _nickname])
|
if (![to isEqual: _nickname]) {
|
||||||
|
if ([_delegate respondsToSelector: @selector(connection:
|
||||||
|
didReceiveMessage:channel:user:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didReceiveMessage: msg
|
didReceiveMessage: msg
|
||||||
channel: to
|
channel: to
|
||||||
user: user];
|
user: user];
|
||||||
else
|
} else {
|
||||||
|
if ([_delegate respondsToSelector: @selector(connection:
|
||||||
|
didReceivePrivateMessage:user:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didReceivePrivateMessage: msg
|
didReceivePrivateMessage: msg
|
||||||
user: user];
|
user: user];
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -517,15 +540,20 @@
|
||||||
|
|
||||||
user = [IRCUser IRCUserWithString: from];
|
user = [IRCUser IRCUserWithString: from];
|
||||||
|
|
||||||
if (![to isEqual: _nickname])
|
if (![to isEqual: _nickname]) {
|
||||||
|
if ([_delegate respondsToSelector: @selector(connection:
|
||||||
|
didReceiveNotice:channel:user:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didReceiveNotice: notice
|
didReceiveNotice: notice
|
||||||
channel: to
|
channel: to
|
||||||
user: user];
|
user: user];
|
||||||
else
|
} else {
|
||||||
|
if ([_delegate respondsToSelector:
|
||||||
|
@selector(connection:didReceiveNotice:user:)])
|
||||||
[_delegate connection: self
|
[_delegate connection: self
|
||||||
didReceiveNotice: notice
|
didReceiveNotice: notice
|
||||||
user: user];
|
user: user];
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -586,87 +614,3 @@
|
||||||
return [[[_channels objectForKey: channel] copy] autorelease];
|
return [[[_channels objectForKey: channel] copy] autorelease];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation OFObject (IRCConnectionDelegate)
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didReceiveLine: (OFString*)line
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didSendLine: (OFString*)line
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connectionWasEstablished: (IRCConnection*)connection
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didSeeUser: (IRCUser*)user
|
|
||||||
joinChannel: (OFString*)channel
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didSeeUser: (IRCUser*)user
|
|
||||||
leaveChannel: (OFString*)channel
|
|
||||||
reason: (OFString*)reason
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didSeeUser: (IRCUser*)user
|
|
||||||
changeNicknameTo: (OFString*)nickname
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didSeeUser: (IRCUser*)user
|
|
||||||
kickUser: (OFString*)kickedUser
|
|
||||||
channel: (OFString*)channel
|
|
||||||
reason: (OFString*)reason
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didSeeUserQuit: (IRCUser*)user
|
|
||||||
reason: (OFString*)reason
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didReceiveMessage: (OFString*)msg
|
|
||||||
channel: (OFString*)channel
|
|
||||||
user: (IRCUser*)user
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didReceivePrivateMessage: (OFString*)msg
|
|
||||||
user: (IRCUser*)user
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didReceiveNotice: (OFString*)notice
|
|
||||||
channel: (OFString*)channel
|
|
||||||
user: (IRCUser*)user
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didReceiveNotice: (OFString*)notice
|
|
||||||
user: (IRCUser*)user
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
|
||||||
didReceiveNamesForChannel: (OFString*)channel
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connectionWasClosed: (IRCConnection*)connection
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue