#import "ShowcaseController.h"
#import "ITInetSocket.h"
+ITInetSocket *sock;
@implementation ShowcaseController
- (void)awakeFromNib
{
-
- ITInetSocket *sock = [[ITInetSocket alloc] initWithDelegate:self];
+ sock = [[ITInetSocket alloc] initWithDelegate:self];
NSLog(@"rawr?");
- [sock connectToHost:@"66.111.58.80" onPort:4336];
+ [sock connectToHost:@"irc.freenode.net" onPort:6667];
}
-- (void) finishedConnecting:(in ITInetSocket *)sender {
- NSLog(@"Done connectin'");
- NSData *d = [NSData dataWithBytesNoCopy:"M00f!" length:5];
- [sender->writePipe writeData:d];
+- (void) finishedConnecting:(ITInetSocket *)sender {
+
}
+
- (void) errorOccured:(ITInetSocketError)err during:(ITInetSocketState)state onSocket:(in ITInetSocket*)sender {NSLog(@"wtf");[sender retryConnection];}
-- (void) dataReceived:(in ITInetSocket *)sender
+- (void) dataReceived:(ITInetSocket *)sender
{
- ITByteStream *p = sender->readPipe;
- NSData *d = [p readAllData];
- NSLog(@"%@",d);
}
+- (void) newDataAdded:(ITByteStream*)sender {
+ static int firstTime = YES;
+ NSString *ircini = @"USER m0nk3ys . . :Not Telling\r\nNICK ITFTest\r\n", *irc2 = @"JOIN #iThink\r\nPRIVMSG #iThink :w00t\r\nQUIT :!\r\n";
+ NSLog(@"Writing something");
+ NSData *d = [NSData dataWithBytes:[firstTime?ircini:irc2 cString] length:[firstTime?ircini:irc2 length]];
+ [sock->writePipe writeData:d];
+ NSLog(@"Reading something");
+ firstTime = NO;
+}
@end