Changes in / [20:30]


Ignore:
Location:
/trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • /trunk/Languages/English.lproj/MVConnections.nib/classes.nib

    r20 r30  
    3030                editRemoveRoom = NSButton;  
    3131                editRooms = NSTableView;  
     32                editServerPassword = NSTextField;  
    3233                joinRoom = NSPanel;  
    3334                messageUser = NSPanel;  
     
    3839                nicknameAuth = NSPanel;  
    3940                openConnection = NSPanel;  
    40                 panel = NSPanel;  
    4141                roomPassword = NSTextField;  
    4242                roomToJoin = NSComboBox;  
    4343                userToMessage = NSTextField;  
    4444            };  
    45             SUPERCLASS = NSObject;  
     45            SUPERCLASS = NSWindowController;  
    4646        },  
    4747        {CLASS = MVTableView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; },  
  • /trunk/Languages/English.lproj/MVConnections.nib/info.nib

    r20 r30  
    66    <string>454 93 381 300 0 0 1280 1002 </string> 
    77    <key>IBFramework Version</key> 
    8     <string>283.0</string> 
     8    <string>291.0</string> 
    99    <key>IBGroupedObjects</key> 
    1010    <dict> 
     
    2929            <string>543</string> 
    3030        </array> 
     31        <key>6</key> 
     32        <array> 
     33            <string>540</string> 
     34            <string>543</string> 
     35        </array> 
    3136    </dict> 
    3237    <key>IBLastGroupID</key> 
    33     <string>6</string> 
     38    <string>7</string> 
    3439    <key>IBLockedObjects</key> 
    3540    <array> 
     
    3742    </array> 
    3843    <key>IBSystem Version</key> 
    39     <string>6F21</string> 
     44    <string>6I32</string> 
    4045</dict> 
    4146</plist> 
  • /trunk/MVBuddyListController.h

    r20 r30  
    99@interface MVBuddyListController : NSWindowController { 
    1010@private 
    11     IBOutlet NSWindow *window; 
    1211    IBOutlet NSTableView *buddies; 
    1312    IBOutlet NSTextField *myName; 
  • /trunk/MVBuddyListController.m

    r20 r30  
    9393    [self _saveBuddyList]; 
    9494 
    95     [window close]; 
    96     window = nil; 
     95    [[self window] close]; 
    9796 
    9897    [_me autorelease]; 
     
    149148    static BOOL loaded = NO; 
    150149    if( ! loaded ) loaded = [NSBundle loadNibNamed:@"MVBuddyList" owner:self]; 
    151     NSLog( @"showBuddyList %d", loaded ); 
    152     [window makeKeyAndOrderFront:nil]; 
     150    [[self window] makeKeyAndOrderFront:nil]; 
    153151} 
    154152 
     
    190188    [editStatusButton setFrame:NSZeroRect]; 
    191189    [myStatus setObjectValue:_statusMessage]; 
    192     [window makeFirstResponder:myStatus]; 
     190    [[self window] makeFirstResponder:myStatus]; 
    193191} 
    194192@end 
  • /trunk/MVChatConnection.h

    r20 r30  
    33#import <IOKit/IOKitLib.h> 
    44#import <IOKit/IOTypes.h> 
     5 
     6#define MVURLEncodeString(t) ((NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)(t), NULL, CFSTR(",;:/?@&$="), kCFStringEncodingUTF8)) 
     7#define MVURLDecodeString(t) ((NSString *)CFURLCreateStringByReplacingPercentEscapes(NULL, (CFStringRef)(t), NULL)) 
    58 
    69typedef enum { 
     
    6467@interface MVChatConnection : NSObject { 
    6568@private 
    66     NSString *_nickname, *_password, *_server; 
     69    NSString *_nickname, *_npassword, *_password, *_server; 
    6770    unsigned short _port; 
    6871    MVChatConnectionStatus _status; 
     
    8790- (void) setNickname:(NSString *) nickname; 
    8891- (NSString *) nickname; 
     92 
     93- (void) setNicknamePassword:(NSString *) password; 
     94- (NSString *) nicknamePassword; 
    8995 
    9096- (void) setPassword:(NSString *) password; 
  • /trunk/MVChatConnection.m

    r20 r30  
    133133            break; 
    134134        case FE_BADUSERPASS: 
    135             NSRunCriticalAlertPanel( NSLocalizedString( @"Your Chat password is invalid", chat invalid password dialog title ), NSLocalizedString( @"The password you specified is invalid and a connection could not be made without a proper password. Make sure you have access to the server.", chat invalid password dialog message ), nil, nil, nil ); 
     135            NSRunCriticalAlertPanel( NSLocalizedString( @"Your Chat password is invalid", chat invalid password dialog title ), NSLocalizedString( @"The password you specified is invalid or a connection could not be made without a proper password. Make sure you have access to the server.", chat invalid password dialog message ), nil, nil, nil ); 
    136136            break; 
    137137        case FE_BADUSER: 
     
    192192void MVChatNeedPassword( void *c, void *cs, char *password, const int size ) { 
    193193    MVChatConnection *self = cs; 
    194     const char *pass = [[self password] UTF8String]; 
     194    const char *pass = [[self nicknamePassword] UTF8String]; 
    195195    if( ! pass ) { 
    196196        [[NSNotificationCenter defaultCenter] postNotificationName:MVChatConnectionNeedPasswordNotification object:self userInfo:nil]; 
     
    405405    NSCParameterAssert( room != NULL ); 
    406406    NSCParameterAssert( who != NULL ); 
    407     if( previousmember ) firetalk_im_get_info( c, who ); 
     407    firetalk_im_get_info( c, who, 0 ); 
    408408    [[MVChatWindowController chatWindowForRoom:[NSString stringWithUTF8String:room] withConnection:self ifExists:YES] addMemberToChat:[NSString stringWithUTF8String:who] asPreviousMember:(BOOL) previousmember]; 
    409409    [[NSNotificationCenter defaultCenter] postNotificationName:MVChatConnectionUserJoinedRoomNotification object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithUTF8String:room], @"room", [NSString stringWithUTF8String:who], @"who", [NSNumber numberWithBool:previousmember], @"previousMember", nil]]; 
     
    594594    if( ! [[url scheme] isEqualToString:@"irc"] ) return nil; 
    595595    self = [self initWithServer:[url host] port:[[url port] unsignedShortValue] user:[url user]]; 
    596     [self setPassword:[url password]]; 
     596    [self setNicknamePassword:[url password]]; 
    597597    return self; 
    598598} 
     
    645645    if( [self isConnected] ) [self disconnect]; 
    646646    [self _willConnect]; 
     647    firetalk_set_password( _chatConnection, NULL, [_password UTF8String] ); 
    647648    firetalk_signon( _chatConnection, [_server UTF8String], _port, [_nickname UTF8String] ); 
    648649} 
     
    656657 
    657658    [self _willConnect]; 
     659    firetalk_set_password( _chatConnection, NULL, [_password UTF8String] ); 
    658660    firetalk_signon( _chatConnection, [server UTF8String], port, [nickname UTF8String] ); 
    659661} 
     
    671673    NSString *url = nil; 
    672674    if( ! _server ) return nil; 
    673     if( _nickname && _port ) url = [NSString stringWithFormat:@"irc://%@@%@:%hu", _nickname, _server, _port]; 
    674     else if( _nickname && ! _port ) url = [NSString stringWithFormat:@"irc://%@@%@", _nickname, _server]; 
    675     else url = [NSString stringWithFormat:@"irc://%@", _server]; 
     675    if( _nickname && _port ) url = [NSString stringWithFormat:@"irc://%@@%@:%hu", MVURLEncodeString( _nickname ), MVURLEncodeString( _server ), _port]; 
     676    else if( _nickname && ! _port ) url = [NSString stringWithFormat:@"irc://%@@%@", MVURLEncodeString( _nickname ), MVURLEncodeString( _server )]; 
     677    else url = [NSString stringWithFormat:@"irc://%@", MVURLEncodeString( _server )]; 
    676678    return [[[NSURL URLWithString:url] retain] autorelease]; 
    677679} 
     
    693695#pragma mark - 
    694696 
     697- (void) setNicknamePassword:(NSString *) password { 
     698    if( [self isConnected] && [password length] && ! [password isEqualToString:_npassword] ) { 
     699        firetalk_set_password( _chatConnection, NULL, [password UTF8String] ); 
     700    } 
     701    [_npassword autorelease]; 
     702    if( [password length] ) _npassword = [password copy]; 
     703    else _npassword = nil; 
     704} 
     705 
     706- (NSString *) nicknamePassword { 
     707    return [[_npassword copy] autorelease]; 
     708} 
     709 
     710#pragma mark - 
     711 
    695712- (void) setPassword:(NSString *) password { 
    696     if( [self isConnected] && [password length] && ! [password isEqualToString:_password] ) { 
    697         firetalk_set_password( _chatConnection, [_password UTF8String], [password UTF8String] ); 
     713    if( ! [self isConnected] && [password length] && ! [password isEqualToString:_password] ) { 
     714        firetalk_set_password( _chatConnection, NULL, [password UTF8String] ); 
    698715    } 
    699716    [_password autorelease]; 
     
    838855- (void) fetchInformationForUser:(NSString *) user { 
    839856    NSParameterAssert( user != nil ); 
    840     if( [self isConnected] ) firetalk_im_get_info( _chatConnection, [user UTF8String] ); 
     857    if( [self isConnected] ) firetalk_im_get_info( _chatConnection, [user UTF8String], 1 ); 
    841858} 
    842859 
  • /trunk/MVChatWindowController.m

    r20 r30  
    636636#pragma mark - 
    637637 
    638 - (void) changeTopic:(NSData *) topic by:(NSString *) author { 
     638- (void) changeTopic:(NSData *) topic by:(NSString *) author { /* ~CRASH! */ 
    639639    NSData *tData = nil; 
    640640    NSParameterAssert( topic != nil ); 
     
    815815    NSParameterAssert( user != nil ); 
    816816 
    817     if( ! _lastDateMessage || [_lastDateMessage timeIntervalSinceNow] < -300 ) { 
     817    if( ! _lastDateMessage || [_lastDateMessage timeIntervalSinceNow] < -300. ) { 
    818818        [_lastDateMessage autorelease]; 
    819819        _lastDateMessage = [[NSDate date] retain]; 
     
    826826 
    827827    if( user ) { 
    828         if( action ) [displayText replaceCharactersInRange:NSMakeRange([[displayText textStorage] length], 0) withString:@"\xA5"]; 
    829         [displayText replaceCharactersInRange:NSMakeRange([[displayText textStorage] length], 0) withString:user]; 
    830         if( ! action ) [displayText replaceCharactersInRange:NSMakeRange([[displayText textStorage] length], 0) withString:@":"]; 
     828        if( action ) [displayText replaceCharactersInRange:NSMakeRange( [[displayText textStorage] length], 0 ) withString:@"\xA5"]; 
     829        [displayText replaceCharactersInRange:NSMakeRange( [[displayText textStorage] length], 0 ) withString:user]; 
     830        if( ! action ) [displayText replaceCharactersInRange:NSMakeRange( [[displayText textStorage] length], 0 ) withString:@":"]; 
    831831        length = [[displayText textStorage] length] - begin; 
    832832        if( ( [[msgString string] rangeOfString:@"'"].location && action ) || ! action ) { 
  • /trunk/MVConnectionsController.h

    r20 r30  
    1010@interface MVConnectionsController : NSWindowController { 
    1111@private 
    12     IBOutlet NSPanel *panel; 
    1312    IBOutlet NSTableView *connections; 
    1413    IBOutlet NSWindow *editConnection; 
     
    3332    IBOutlet NSTextField *editNickname; 
    3433    IBOutlet NSTextField *editPassword; 
     34    IBOutlet NSTextField *editServerPassword; 
    3535    IBOutlet NSTextField *editAddress; 
    3636    IBOutlet NSTextField *editPort; 
  • /trunk/MVConnectionsController.m

    r20 r30  
    6060    [self _saveBookmarkList]; 
    6161 
    62     [panel close]; 
    63     panel = nil; 
     62    [[self window] close]; 
    6463 
    6564    [editConnection autorelease]; 
     
    9796    [newNickname setObjectValue:NSUserName()]; 
    9897 
    99     [panel setFloatingPanel:NO]; 
     98    [(NSPanel *)[self window] setFloatingPanel:NO]; 
    10099 
    101100    theColumn = [connections tableColumnWithIdentifier:@"auto"]; 
     
    115114    [toolbar setAllowsUserCustomization:YES]; 
    116115    [toolbar setAutosavesConfiguration:YES]; 
    117     [panel setToolbar:toolbar]; 
     116    [[self window] setToolbar:toolbar]; 
    118117} 
    119118 
     
    121120 
    122121- (IBAction) showConnectionManager:(id) sender { 
    123     [panel orderFront:nil]; 
     122    [[self window] orderFront:nil]; 
    124123} 
    125124 
     
    135134 
    136135    if( ! [[newNickname stringValue] length] ) { 
    137         [panel makeFirstResponder:newNickname]; 
     136        [[self window] makeFirstResponder:newNickname]; 
    138137        NSRunCriticalAlertPanel( NSLocalizedString( @"Nickname is blank", chat invalid nickname dialog title ), NSLocalizedString( @"The nickname you specified is invalid because it was left blank.", chat nickname blank dialog message ), nil, nil, nil ); 
    139138        return; 
     
    141140 
    142141    if( ! [[newAddress stringValue] length] ) { 
    143         [panel makeFirstResponder:newAddress]; 
     142        [[self window] makeFirstResponder:newAddress]; 
    144143        NSRunCriticalAlertPanel( NSLocalizedString( @"Chat Server is blank", chat invalid nickname dialog title ), NSLocalizedString( @"The chat server you specified is invalid because it was left blank.", chat server blank dialog message ), nil, nil, nil ); 
    145144        return; 
     
    147146 
    148147    if( [newPort intValue] < 0 || [newPort intValue] > 65535 ) { 
    149         [panel makeFirstResponder:newPort]; 
     148        [[self window] makeFirstResponder:newPort]; 
    150149        NSRunCriticalAlertPanel( NSLocalizedString( @"Chat Server Port is invalid", chat invalid nickname dialog title ), NSLocalizedString( @"The chat server port you specified is invalid because it can't be negative or greater than 65535.", chat server port invalid dialog message ), nil, nil, nil ); 
    151150        return; 
     
    166165                } 
    167166                [connections selectRow:[_bookmarks indexOfObject:data] byExtendingSelection:NO]; 
    168                 [panel makeFirstResponder:newNickname]; 
     167                [[self window] makeFirstResponder:newNickname]; 
    169168                return; 
    170169            } 
     
    179178    [self addConnection:connection keepBookmark:(BOOL)[newRemember state]]; 
    180179 
    181     [panel makeKeyAndOrderFront:nil]; 
     180    [[self window] makeKeyAndOrderFront:nil]; 
    182181 
    183182    if( _target && _targetRoom ) [connection joinChatForRoom:_target]; 
     
    237236        [connection setServerPort:[editPort intValue]]; 
    238237        [connection setNickname:[editNickname stringValue]]; 
    239         [connection setPassword:[editPassword stringValue]]; 
     238        [connection setNicknamePassword:[editPassword stringValue]]; 
    240239 
    241240        if( ! [[info objectForKey:@"temporary"] boolValue] ) { 
     241            [[MVKeyChain defaultKeyChain] setInternetPassword:[editServerPassword stringValue] forServer:[editAddress stringValue] securityDomain:[editAddress stringValue] account:nil path:nil port:[connection serverPort] protocol:MVKeyChainProtocolIRC authenticationType:MVKeyChainAuthenticationTypeDefault]; 
    242242            [[MVKeyChain defaultKeyChain] setInternetPassword:[editPassword stringValue] forServer:[editAddress stringValue] securityDomain:[editAddress stringValue] account:[editNickname stringValue] path:nil port:0 protocol:MVKeyChainProtocolIRC authenticationType:MVKeyChainAuthenticationTypeDefault]; 
    243243        } 
     
    271271 
    272272    if( [sender tag] ) { 
    273         [_passConnection setPassword:[authPassword stringValue]]; 
     273        [_passConnection setNicknamePassword:[authPassword stringValue]]; 
    274274     
    275275        if( [authKeychain state] == NSOnState ) { 
     
    327327                else if( target && ! isRoom ) [MVChatWindowController chatWindowWithUser:target withConnection:connection ifExists:NO]; 
    328328                [connections selectRow:[_bookmarks indexOfObject:data] byExtendingSelection:NO]; 
    329                 [panel makeKeyAndOrderFront:nil]; 
     329                [[self window] makeKeyAndOrderFront:nil]; 
    330330                handled = YES; 
    331331                break; 
     
    346346            [self addConnection:connection keepBookmark:NO]; 
    347347 
    348             [panel makeKeyAndOrderFront:nil]; 
     348            [[self window] makeKeyAndOrderFront:nil]; 
    349349 
    350350            if( target && isRoom ) [connection joinChatForRoom:target]; 
     
    686686        connection = [[[MVChatConnection alloc] initWithURL:[NSURL URLWithString:[info objectForKey:@"url"]]] autorelease]; 
    687687 
    688         [connection setPassword:[[MVKeyChain defaultKeyChain] internetPasswordForServer:[connection server] securityDomain:[connection server] account:[connection nickname] path:nil port:0 protocol:MVKeyChainProtocolIRC authenticationType:MVKeyChainAuthenticationTypeDefault]]; 
     688        [connection setPassword:[[MVKeyChain defaultKeyChain] internetPasswordForServer:[connection server] securityDomain:[connection server] account:nil path:nil port:[connection serverPort] protocol:MVKeyChainProtocolIRC authenticationType:MVKeyChainAuthenticationTypeDefault]]; 
     689        [connection setNicknamePassword:[[MVKeyChain defaultKeyChain] internetPasswordForServer:[connection server] securityDomain:[connection server] account:[connection nickname] path:nil port:0 protocol:MVKeyChainProtocolIRC authenticationType:MVKeyChainAuthenticationTypeDefault]]; 
    689690 
    690691        if( [[info objectForKey:@"automatic"] boolValue] ) { 
     
    709710    [connections noteNumberOfRowsChanged]; 
    710711 
    711     if( autoConnect ) [panel makeKeyAndOrderFront:nil]; 
     712    if( autoConnect ) [[self window] makeKeyAndOrderFront:nil]; 
    712713    else [openConnection makeKeyAndOrderFront:nil]; 
    713714} 
    714715 
    715716- (void) _validateToolbar { 
    716     NSEnumerator *enumerator = [[[panel toolbar] visibleItems] objectEnumerator]; 
     717    NSEnumerator *enumerator = [[[[self window] toolbar] visibleItems] objectEnumerator]; 
    717718    id item = nil; 
    718719    BOOL noneSelected = YES, connected = NO; 
     
    819820- (void) _messageUser:(id) sender { 
    820821    if( [connections selectedRow] == -1 ) return; 
    821     [[NSApplication sharedApplication] beginSheet:messageUser modalForWindow:panel modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; 
     822    [[NSApplication sharedApplication] beginSheet:messageUser modalForWindow:[self window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; 
    822823} 
    823824 
     
    826827    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _refreshRooms: ) name:MVChatConnectionGotRoomInfoNotification object:[[_bookmarks objectAtIndex:[connections selectedRow]] objectForKey:@"connection"]]; 
    827828    [(MVChatConnection *)[[_bookmarks objectAtIndex:[connections selectedRow]] objectForKey:@"connection"] fetchRoomList]; 
    828     [[NSApplication sharedApplication] beginSheet:joinRoom modalForWindow:panel modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; 
     829    [[NSApplication sharedApplication] beginSheet:joinRoom modalForWindow:[self window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; 
    829830} 
    830831 
     
    845846    [editNickname setObjectValue:[connection nickname]]; 
    846847    [editPassword setObjectValue:[[MVKeyChain defaultKeyChain] internetPasswordForServer:[connection server] securityDomain:[connection server] account:[connection nickname] path:nil port:0 protocol:MVKeyChainProtocolIRC authenticationType:MVKeyChainAuthenticationTypeDefault]]; 
     848    [editServerPassword setObjectValue:[[MVKeyChain defaultKeyChain] internetPasswordForServer:[connection server] securityDomain:[connection server] account:nil path:nil port:[connection serverPort] protocol:MVKeyChainProtocolIRC authenticationType:MVKeyChainAuthenticationTypeDefault]]; 
    847849 
    848850    [_editingRooms autorelease]; 
  • /trunk/MVFileTransferController.h

    r20 r30  
    2828@interface MVFileTransferController : NSWindowController { 
    2929@private 
    30     IBOutlet NSPanel *panel; 
    3130    IBOutlet NSProgressIndicator *progressBar; 
    3231    IBOutlet NSTextField *transferStatus; 
  • /trunk/MVFileTransferController.m

    r20 r30  
    9090    extern MVFileTransferController *sharedInstance; 
    9191 
    92     [panel close]; 
    93     panel = nil; 
     92    [[self window] close]; 
    9493 
    9594    [_transferStorage autorelease]; 
     
    110109    id prototypeCell = nil; 
    111110 
    112     [panel setFloatingPanel:NO]; 
     111    [(NSPanel *)[self window] setFloatingPanel:NO]; 
    113112 
    114113    [currentFiles setVerticalMotionCanBeginDrag:NO]; 
     
    131130    [toolbar setAllowsUserCustomization:YES]; 
    132131    [toolbar setAutosavesConfiguration:YES]; 
    133     [panel setToolbar:toolbar]; 
     132    [[self window] setToolbar:toolbar]; 
    134133 
    135134    [progressBar setMinValue:0.]; 
     
    143142    static BOOL loaded = NO; 
    144143    if( ! loaded ) loaded = [NSBundle loadNibNamed:@"MVFileTransfer" owner:self]; 
    145     [panel orderFront:nil]; 
     144    [[self window] orderFront:nil]; 
    146145} 
    147146 
     
    340339    BOOL noneSelected = YES; 
    341340 
    342     enumerator = [[[panel toolbar] visibleItems] objectEnumerator]; 
     341    enumerator = [[[[self window] toolbar] visibleItems] objectEnumerator]; 
    343342    if( [currentFiles selectedRow] != -1 ) noneSelected = NO; 
    344343    while( ( item = [enumerator nextObject] ) ) { 
  • /trunk/NSAttributedStringAdditions.m

    r20 r30  
    128128@implementation NSMutableAttributedString (NSMutableAttributedStringImageAdditions) 
    129129- (void) preformImageSubstitutionWithDictionary:(NSDictionary *) dict { 
    130     NSDictionary *attributes = nil; 
     130//  NSDictionary *attributes = nil; 
    131131    NSString *string = [self string], *str = nil; 
    132132    NSEnumerator *keyEnumerator = [dict keyEnumerator]; 
  • /trunk/Other Code/firetalk (cvs)/dummy.c

    r20 r30  
    149149} 
    150150 
    151 enum firetalk_error dummy_get_info(client_t c, const char * const nickname) { 
     151enum firetalk_error dummy_get_info(client_t c, const char * const nickname, const int priority) { 
    152152    return FE_SUCCESS; 
    153153} 
  • /trunk/Other Code/firetalk (cvs)/dummy.h

    r20 r30  
    4141enum firetalk_error dummy_get_roomlist(client_t c, const char * const search); 
    4242enum firetalk_error dummy_stop_roomlist(client_t c); 
    43 enum firetalk_error dummy_get_info(client_t c, const char * const nickname); 
     43enum firetalk_error dummy_get_info(client_t c, const char * const nickname, const int priority); 
    4444enum firetalk_error dummy_set_info(client_t c, const char * const info); 
    4545enum firetalk_error dummy_set_nickname(client_t c, const char * const nickname); 
  • /trunk/Other Code/firetalk (cvs)/firetalk-int.h

    r20 r30  
    174174    enum firetalk_error (*get_roomlist)(client_t, const char * const); 
    175175    enum firetalk_error (*stop_roomlist)(client_t); 
    176     enum firetalk_error (*get_info)(client_t, const char * const); 
     176    enum firetalk_error (*get_info)(client_t, const char * const, const int); 
    177177    enum firetalk_error (*set_info)(client_t, const char * const); 
    178178    enum firetalk_error (*set_away)(client_t, const char * const); 
  • /trunk/Other Code/firetalk (cvs)/firetalk.c

    r20 r30  
    24162416} 
    24172417 
    2418 enum firetalk_error firetalk_im_get_info(firetalk_t conn, const char * const nickname) { 
    2419 #ifdef DEBUG 
    2420     if (firetalk_check_handle(conn) != FE_SUCCESS) 
    2421         return FE_BADHANDLE; 
    2422 #endif 
    2423  
    2424     return protocol_functions[conn->protocol].get_info(conn->handle,nickname); 
     2418enum firetalk_error firetalk_im_get_info(firetalk_t conn, const char * const nickname, const int priority) { 
     2419#ifdef DEBUG 
     2420    if (firetalk_check_handle(conn) != FE_SUCCESS) 
     2421        return FE_BADHANDLE; 
     2422#endif 
     2423 
     2424    return protocol_functions[conn->protocol].get_info(conn->handle,nickname,priority); 
    24252425} 
    24262426 
  • /trunk/Other Code/firetalk (cvs)/firetalk.h

    r20 r30  
    212212enum firetalk_error firetalk_im_list_buddies(firetalk_t conn); 
    213213enum firetalk_error firetalk_im_evil(firetalk_t c, const char * const who); 
    214 enum firetalk_error firetalk_im_get_info(firetalk_t conn, const char * const nickname); 
     214enum firetalk_error firetalk_im_get_info(firetalk_t conn, const char * const nickname, const int priority); 
    215215enum firetalk_error firetalk_im_get_roomlist(firetalk_t conn, const char * const search); 
    216216enum firetalk_error firetalk_im_stop_roomlist(firetalk_t conn); 
  • /trunk/Other Code/firetalk (cvs)/irc.c

    r20 r30  
    630630            i--; 
    631631        } 
    632         j = irc_send_printf(c,1,"%s",outstring); 
     632        j = irc_send_printf(c,0,"%s",outstring); 
    633633        if (j != FE_SUCCESS) /* TODO: Fix this */ 
    634634            return j; 
     
    659659        if( c->password ) free( c->password ); 
    660660        c->password = safe_strdup( newpass ); 
    661         return irc_send_printf(c,1,"PRIVMSG NickServ :IDENTIFY %s",c->password); 
     661        if( c->nickname ) { 
     662            return irc_send_printf(c,1,"PRIVMSG NickServ :IDENTIFY %s",c->password); 
     663        } else return FE_SUCCESS; 
    662664    } 
    663665    return FE_BADUSERPASS; 
     
    693695 
    694696enum firetalk_error irc_signon(client_t c, const char * const nickname) { 
     697    char hostname[256]; 
     698 
     699    if ( safe_strlen( c->password ) ) if (irc_send_printf(c,1,"PASS %s",c->password) != FE_SUCCESS) 
     700        return FE_PACKET; 
     701 
    695702    if (irc_send_printf(c,1,"NICK %s",nickname) != FE_SUCCESS) 
    696703        return FE_PACKET; 
    697704 
    698     if (irc_send_printf(c,1,"USER %s %s %s :%s",nickname,nickname,nickname,nickname) != FE_SUCCESS) 
     705    if( gethostname( hostname, 256 ) ) 
     706        safe_strncpy( hostname, "localhost", 10 ); 
     707 
     708    if (irc_send_printf(c,1,"USER %s %s %s :%s",nickname,hostname,hostname,nickname) != FE_SUCCESS) 
    699709        return FE_PACKET; 
    700710 
     
    753763                if (irc_compare_nicks(c->nickname,irc_get_nickname(args[0])) == 0) { 
    754764                    firetalk_callback_chat_joined(c,args[2]); 
    755                     if (c->identified == 1) { 
     765/*                  if (c->identified == 1) { 
    756766                        if (irc_send_printf(c,0,"PRIVMSG ChanServ :OP %s %s",args[2],c->nickname) != FE_SUCCESS) { 
    757767                            irc_internal_disconnect(c,FE_PACKET); 
    758768                            return FE_PACKET; 
    759769                        } 
    760                     } 
    761                 } else 
     770                    }*/ 
     771                } else { 
    762772                    firetalk_callback_chat_user_joined(c,args[2],irc_get_nickname(args[0]),0); 
     773                } 
    763774            } else if (strcmp(args[1],"PART") == 0) { 
    764775                if (irc_compare_nicks(c->nickname,irc_get_nickname(args[0])) == 0) 
     
    853864                        /* we're recognized */ 
    854865                        c->identified = 1; 
    855                         if (irc_send_printf(c,0,"PRIVMSG ChanServ :OP ALL") != FE_SUCCESS) { 
     866/*                      if (irc_send_printf(c,0,"PRIVMSG ChanServ :OP ALL") != FE_SUCCESS) { 
    856867                            irc_internal_disconnect(c,FE_PACKET); 
    857868                            return FE_PACKET; 
    858                         } 
     869                        }*/ 
    859870                    } 
    860871                } 
     
    10391050                                if (irc_compare_nicks(args[tempint2-1],c->nickname) == FE_SUCCESS) { 
    10401051                                    firetalk_callback_chat_deopped(c,args[2],irc_get_nickname(args[0])); 
    1041                                     if (c->identified == 1) { 
    1042                                         /* this is us, and we're identified, so we can request a reop */ 
     1052/*                                  if (c->identified == 1) { 
     1053                                        // this is us, and we're identified, so we can request a reop 
    10431054                                        if (irc_send_printf(c,0,"PRIVMSG ChanServ :OP %s %s",args[2],c->nickname) != FE_SUCCESS) { 
    10441055                                            irc_internal_disconnect(c,FE_PACKET); 
    10451056                                            return FE_PACKET; 
    10461057                                        } 
    1047                                     } 
     1058                                    }*/ 
    10481059                                } 
    10491060                            } 
     
    10581069                                if (irc_compare_nicks(args[tempint2-1],c->nickname) == FE_SUCCESS) { 
    10591070                                    firetalk_callback_chat_devoiced(c,args[2],irc_get_nickname(args[0])); 
    1060                                     if (c->identified == 1) { 
    1061                                         /* this is us, and we're identified, so we can request a revoice */ 
     1071/*                                  if (c->identified == 1) { 
     1072                                        // this is us, and we're identified, so we can request a revoice 
    10621073                                        if (irc_send_printf(c,0,"PRIVMSG ChanServ :VOICE %s %s",args[2],c->nickname) != FE_SUCCESS) { 
    10631074                                            irc_internal_disconnect(c,FE_PACKET); 
    10641075                                            return FE_PACKET; 
    10651076                                        } 
    1066                                     } 
     1077                                    }*/ 
    10671078                                } 
    10681079                            } 
     
    11621173 
    11631174enum firetalk_error irc_got_data_connecting(client_t c, unsigned char * buffer, unsigned short * bufferpos) { 
    1164     char **args; 
     1175    char **args = NULL; 
    11651176 
    11661177    args = irc_recv_parse(c,buffer,bufferpos); 
     
    11931204        } else { 
    11941205            switch (atoi(args[1])) { 
    1195                 case 376: 
    1196                 case 422: 
     1206                case 376: // RPL_ENDOFMOTD 
     1207                case 422: // ERR_NOMOTD 
     1208                    // reset the password to clear the server password 
     1209                    if (c->password) { 
     1210                        free(c->password); 
     1211                        c->password = NULL; 
     1212                    } 
    11971213                    firetalk_callback_doinit(c,c->nickname); 
    11981214                    firetalk_callback_connected(c); 
    11991215                    break; 
    1200                 case 431: 
    1201                 case 432: 
    1202                 case 436: 
    1203                 case 461: 
     1216                case 431: // ERR_NONICKNAMEGIVEN 
     1217                case 432: // ERR_ERRONEUSNICKNAME 
     1218                case 436: // ERR_NICKCOLLISION 
     1219                case 461: // ERR_NEEDMOREPARAMS 
    12041220                    irc_send_printf(c,1,"QUIT :Invalid nickname"); 
    12051221                    firetalk_callback_connectfailed(c,FE_BADUSER,"Invalid nickname"); 
    12061222                    return FE_BADUSER; 
    1207                 case 433: 
    1208                     irc_send_printf(c,1,"QUIT :Invalid nickname"); 
     1223                case 433: // ERR_NICKNAMEINUSE 
     1224                    irc_send_printf(c,1,"QUIT :Nickname in use"); 
    12091225                    firetalk_callback_connectfailed(c,FE_BADUSER,"Nickname in use"); 
    12101226                    return FE_BADUSER; 
    1211                 case 465: 
    1212                     irc_send_printf(c,1,"QUIT :banned"); 
     1227                case 464: // ERR_PASSWDMISMATCH 
     1228                    irc_send_printf(c,1,"QUIT :Invalid connection password"); 
     1229                    firetalk_callback_connectfailed(c,FE_BADUSER,"Invalid server password"); 
     1230                    return FE_BADUSERPASS; 
     1231                case 465: // ERR_YOUREBANNEDCREEP 
     1232                    irc_send_printf(c,1,"QUIT :Banned"); 
    12131233                    firetalk_callback_connectfailed(c,FE_BLOCKED,"You are banned"); 
    12141234                    return FE_BLOCKED; 
     
    13681388} 
    13691389 
    1370 enum firetalk_error irc_get_info(client_t c, const char * const nickname) { 
     1390enum firetalk_error irc_get_info(client_t c, const char * const nickname, const int priority) { 
    13711391    struct s_irc_whois *whoistemp; 
    13721392 
     
    13781398    c->whois_head->info = NULL; 
    13791399    c->whois_head->next = whoistemp; 
    1380     return irc_send_printf(c,0,"WHOIS %s",nickname); 
     1400    return irc_send_printf(c,priority,"WHOIS %s",nickname); 
    13811401} 
    13821402 
     
    14101430            if (i > 0) 
    14111431                obuf[i-1] = '\0'; 
    1412             if (irc_send_printf(conn,1,"ISON %s",obuf) != 0) { 
     1432            if (irc_send_printf(conn,0,"ISON %s",obuf) != 0) { 
    14131433                irc_internal_disconnect(conn,FE_PACKET); 
    14141434                return FE_PACKET; 
     
    14261446    if (i > 0) { 
    14271447        obuf[i-1] = '\0'; 
    1428         if (irc_send_printf(conn,1,"ISON %s",obuf) != 0) { 
     1448        if (irc_send_printf(conn,0,"ISON %s",obuf) != 0) { 
    14291449            irc_internal_disconnect(conn,FE_PACKET); 
    14301450            return FE_PACKET; 
     
    14391459enum firetalk_error irc_subcode_send_request(client_t c, const char * const to, const char * const command, const char * const args) { 
    14401460    if (args == NULL) { 
    1441         if (irc_send_printf(c,0,"PRIVMSG %s :\001%s\001",to,command) != 0) { 
     1461        if (irc_send_printf(c,1,"PRIVMSG %s :\001%s\001",to,command) != 0) { 
    14421462            irc_internal_disconnect(c,FE_PACKET); 
    14431463            return FE_PACKET; 
    14441464        } 
    14451465    } else { 
    1446         if (irc_send_printf(c,0,"PRIVMSG %s :\001%s %s\001",to,command,args) != 0) { 
     1466        if (irc_send_printf(c,1,"PRIVMSG %s :\001%s %s\001",to,command,args) != 0) { 
    14471467            irc_internal_disconnect(c,FE_PACKET); 
    14481468            return FE_PACKET; 
     
    14541474enum firetalk_error irc_subcode_send_reply(client_t c, const char * const to, const char * const command, const char * const args) { 
    14551475    if (args == NULL) { 
    1456         if (irc_send_printf(c,0,"NOTICE %s :\001%s\001",to,command) != 0) { 
     1476        if (irc_send_printf(c,1,"NOTICE %s :\001%s\001",to,command) != 0) { 
    14571477            irc_internal_disconnect(c,FE_PACKET); 
    14581478            return FE_PACKET; 
    14591479        } 
    14601480    } else { 
    1461         if (irc_send_printf(c,0,"NOTICE %s :\001%s %s\001",to,command,args) != 0) { 
     1481        if (irc_send_printf(c,1,"NOTICE %s :\001%s %s\001",to,command,args) != 0) { 
    14621482            irc_internal_disconnect(c,FE_PACKET); 
    14631483            return FE_PACKET; 
  • /trunk/Other Code/firetalk (cvs)/irc.h

    r20 r30  
    3838enum firetalk_error irc_get_roomlist(client_t c, const char * const search); 
    3939enum firetalk_error irc_stop_roomlist(client_t c); 
    40 enum firetalk_error irc_get_info(client_t c, const char * const nickname); 
     40enum firetalk_error irc_get_info(client_t c, const char * const nickname, const int priority); 
    4141enum firetalk_error irc_set_info(client_t c, const char * const info); 
    4242enum firetalk_error irc_set_nickname(client_t c, const char * const nickname); 
Note: See TracChangeset for help on using the changeset viewer.