go away you include
[ITFoundation.git] / ShowcaseController.m
index 5a775c7..a9aff62 100755 (executable)
@@ -8,33 +8,36 @@
 
 #import "ShowcaseController.h"
 #import "ITInetSocket.h"
+#import <Foundation/NSString.h>
+#import <SystemConfiguration/SystemConfiguration.h>
 
-ITInetSocket *sock;
 
 @implementation ShowcaseController
 - (void)awakeFromNib
 {
-    sock = [[ITInetSocket alloc] initWithDelegate:self];
-    NSLog(@"rawr?");
-    [sock connectToHost:@"irc.freenode.net" onPort:6667];
+    server = [[ITInetServerSocket alloc] initWithDelegate:self];
+    [server setPort:1338];
+    [server setServiceType:@"ittest" useForPort:NO];
+    [server setServiceName:[(NSString*)SCDynamicStoreCopyComputerName(NULL,NULL) autorelease]];
+    [server start];
+    [ITInetSocket startAutoconnectingToService:@"ittest" delegate:self];
 }
 
 - (void) finishedConnecting:(ITInetSocket *)sender {
+    [[sender writePipe] writeBytes:"suck" len:4];
+}
 
+- (void) errorOccured:(ITInetSocketError)err during:(ITInetSocketState)state onSocket:(in ITInetSocket*)sender
+{
 }
 
-- (void) errorOccured:(ITInetSocketError)err during:(ITInetSocketState)state onSocket:(in ITInetSocket*)sender {NSLog(@"wtf");[sender retryConnection];}
-- (void) dataReceived:(ITInetSocket *)sender
+- (void) newDataAdded:(ITByteStream*)sender
 {
+
 }
 
-- (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;
+- (void)newClientJoined:(ITInetSocket*)client
+{
+    [[client writePipe] writeBytes:"suck" len:4];
 }
 @end