X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/c9e0098808889b595086f244439485d1787f65ee..14a301f7aa7b244c4831006cfc4cfa42185517a4:/ShowcaseController.m diff --git a/ShowcaseController.m b/ShowcaseController.m index c1eef3c..5a775c7 100755 --- a/ShowcaseController.m +++ b/ShowcaseController.m @@ -9,27 +9,32 @@ #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