Skip to content

Commit

Permalink
myNick: Parse and Store
Browse files Browse the repository at this point in the history
  • Loading branch information
guruz committed Apr 18, 2020
1 parent dad6693 commit f8b314d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions quassel-for-ios/quassel-for-ios/QuasselCoreConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

@property (nonatomic, strong) NSMutableArray *neworkIdList;
@property (nonatomic, strong) NSMutableDictionary *networkIdNetworkNameMap;
@property (nonatomic, strong) NSMutableDictionary *networkIdMyNickMap;
@property (nonatomic, strong) NSMutableDictionary *bufferIdBufferInfoMap;
@property (nonatomic, strong) NSMutableDictionary *networkIdBufferIdListMap;
@property (nonatomic, strong) NSMutableDictionary *networkIdServerBufferInfoMap;
Expand Down
9 changes: 9 additions & 0 deletions quassel-for-ios/quassel-for-ios/QuasselCoreConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ @implementation QuasselCoreConnection
@synthesize networkIdBufferIdListMap;
@synthesize neworkIdList;
@synthesize networkIdNetworkNameMap;
@synthesize networkIdMyNickMap;
@synthesize bufferIdMessageListMap;
@synthesize delegate;
@synthesize networkIdServerBufferInfoMap;
Expand Down Expand Up @@ -85,6 +86,7 @@ - (void) reConnect {
bufferIdBufferActivityMap = nil;

networkIdNetworkNameMap = nil;
networkIdMyNickMap = nil;

networkIdUserMapMap = nil;;
networkInitsReceived = 0;
Expand Down Expand Up @@ -214,6 +216,10 @@ - (void) handleReceivedNetworkInit:(NSArray*)networkInit
[networkIdNetworkNameMap setObject:networkName forKey:networkId];
[delegate quasselNetworkNameUpdated:networkId];

NSString *myNick = [[initDict objectForKey:@"myNick"] string];
[networkIdMyNickMap setObject:myNick forKey:networkId];
NSLog(@"myNick %@", myNick); // might be empty when disconnected


NSDictionary *ircUsersAndChannels = [[initDict objectForKey:@"IrcUsersAndChannels"] dict];
NSDictionary *channels = [[ircUsersAndChannels objectForKey:@"channels"] dict];
Expand Down Expand Up @@ -419,6 +425,7 @@ - (void) handleReceivedVariant:(QVariant*)v
//NSLog(@"networkIds = %@", networkIds);
neworkIdList = [[NSMutableArray alloc] initWithCapacity:networkIds.list.count];
networkIdNetworkNameMap = [NSMutableDictionary dictionaryWithCapacity:networkIds.list.count];
networkIdMyNickMap = [NSMutableDictionary dictionaryWithCapacity:networkIds.list.count];
networkIdUserMapMap = [NSMutableDictionary dictionaryWithCapacity:neworkIdList.count];
networkIdChannelMapMap = [NSMutableDictionary dictionaryWithCapacity:neworkIdList.count];
[networkIds.list enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
Expand Down Expand Up @@ -898,6 +905,8 @@ - (void) handleReceivedVariant:(QVariant*)v
[usersForNetwork removeObjectForKey:oldNick];
ircUser.nick = newNick;
[usersForNetwork setValue:ircUser forKey:newNick];

// FIXME If it is our nick, should update networkIdMyNickMap too
} else {
NSLog(@"FIXME unknown __objectRenamed__ %@", class);
}
Expand Down

0 comments on commit f8b314d

Please sign in to comment.