| Paste number 40558: | initChatWindow |
| Pasted by: | Jasarien |
| 1 year, 8 months ago | |
| #adium-devl | |
| Paste contents: |
| //Get everything needed to start a chat with a buddy. - (void)initChatWindow { //Init the buddy to chat with. XfireBuddyListEntry *entry = [[[_xfire buddyList] onlineEntries] objectAtIndex:[buddyListTableView selectedRow]]; chatListEnum = [[chatList openChats] objectEnumerator]; ChatWindowController *chat; while ((chat = [chatListEnum nextObject])) { if ([[chat chatForBuddy] isEqualTo:entry]) { [[chat windowForChat] makeKeyAndOrderFront:self]; } else { ChatWindowController *tempChat = [[ChatWindowController alloc] initWithBuddy:entry]; tempList = [chatList openChats]; [tempList addObject:tempChat]; [tempChat release]; } } [chatList mergeListWithChatList:tempList]; } |
Annotations for this paste:
| Annotation number 1: | XFController |
| Pasted by: | Jasarien |
| 1 year, 8 months ago | |
| Paste contents: |
| // // XFController.h // Xflame // // Created by James Addyman on 15/01/07. // 2007 Jasarien.Com. // #import <Cocoa/Cocoa.h> #import "Xfire.h" #import "ChatWindowController.h" #import "XFChatList.h" @interface XFController : NSWindowController <XfireDelegate> { //Main Window Outlets IBOutlet NSTableView *buddyListTableView; IBOutlet NSTextField *statusField; IBOutlet NSTextField *nickField; IBOutlet NSTextField *passwordField; IBOutlet NSTextField *usernameField; IBOutlet NSButton *connectButton; IBOutlet NSPanel *addBuddy; IBOutlet NSPanel *loginPanel; IBOutlet NSWindow *mainWindow; //Menu Bar Outlets IBOutlet NSMenuItem *loginItem; IBOutlet NSMenuItem *logoutItem; //Add Buddy Window Outlets IBOutlet NSTextField *buddyField; IBOutlet NSTextField *buddyMessage; //Connection Status BOOL connected; //ChatList object XFChatList *chatList; NSMutableArray *tempList; NSEnumerator *chatListEnum; //Xfire object for interacting with XfireLib Xfire *_xfire; } //Main Window Methods - (IBAction)login:(id)sender; - (IBAction)logout:(id)sender; - (IBAction)showLoginPanel:(id)sender; - (IBAction)hideLoginPanel:(id)sender; - (IBAction)setStatus:(id)sender; - (IBAction)setNickName:(id)sender; - (IBAction)showAddBuddyWindow:(id)sender; - (IBAction)removeBuddy:(id)sender; - (void)initChatWindow; - (void)openChatWindowForBuddy:(XfireBuddyListEntry *)theBuddy; //Add Buddy Window Methods - (IBAction)addBuddy:(id)sender; - (IBAction)cancelAddBuddy:(id)sender; @end |
| Annotation number 2: | XFChatList |
| Pasted by: | Jasarien |
| 1 year, 8 months ago | |
| Paste contents: |
| // // XFChatList.h // Xflame // // Created by Jasarien on 30/04/2007. // Copyright 2007 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> @interface XFChatList : NSObject { NSMutableArray *openChats; } - (NSMutableArray *)openChats; - (void)mergeListWithChatList:(NSMutableArray *)aList; @end ----------------------------------------------------------------------------------------- // // XFChatList.m // Xflame // // Created by Jasarien on 30/04/2007. // Copyright 2007 __MyCompanyName__. All rights reserved. // #import "XFChatList.h" @implementation XFChatList - (id)init { if (self = [super init]) { openChats = [NSMutableArray array]; } return self; } - (void)dealloc { NSLog(@"deallocating XFChatList"); [openChats release]; [super dealloc]; } - (NSMutableArray *)openChats { NSLog(@"oc1"); return openChats; } - (void)mergeListWithChatList:(NSMutableArray *)aList { openChats = aList; } @end |
| Annotation number 3: | do, while loop |
| Pasted by: | Jasarien |
| 1 year, 8 months ago | |
| Paste contents: |
| NSLog(@"Before loop"); do { NSLog(@"Starting while loop."); if ([[chat chatForBuddy] isEqualTo:entry]) { NSLog(@"Bringing existing chat forward for buddy: ", [entry displayName]); [[chat windowForChat] makeKeyAndOrderFront:self]; } else { NSLog(@"Creating new chat for buddy: ", [entry displayName]); ChatWindowController *tempChat = [[ChatWindowController alloc] initWithBuddy:entry]; [tempList addObjectsFromArray:[chatList openChats]]; [tempList addObject:tempChat]; [tempChat release]; } } while (chat = [chatListEnum nextObject]); NSLog(@"After Loop"); |