| 99 | | // if ( ! [object isLocalUser]) |
|---|
| 100 | | if ( [[sender representedObject] isKindOfClass:NSClassFromString(@"JVChatRoomMember")] ) |
|---|
| 101 | | { |
|---|
| 102 | | [self requestAvatarFromUser: [(JVChatRoomMember *)[sender representedObject] user]]; |
|---|
| 103 | | } |
|---|
| 104 | | else if ( [[sender representedObject] isKindOfClass:NSClassFromString(@"MVChatUser")] ) |
|---|
| 105 | | { |
|---|
| 106 | | [self requestAvatarFromUser: (MVChatUser *)[sender representedObject]]; |
|---|
| 107 | | } |
|---|
| 108 | | else if ( [[sender representedObject] isMemberOfClass:NSClassFromString(@"JVDirectChatPanel")] ) |
|---|
| 109 | | { |
|---|
| 110 | | [self requestAvatarFromUser: (MVChatUser *)[[sender representedObject] user]]; |
|---|
| 111 | | } |
|---|
| 112 | | else if ( [[sender representedObject] isMemberOfClass:NSClassFromString(@"JVChatRoomPanel")] ) |
|---|
| 113 | | { |
|---|
| 114 | | //NSLog([_throttledRequests className]); |
|---|
| 115 | | //[_throttledRequests unionSet:[(MVChatRoom *)[[sender representedObject] target] memberUsers]]; |
|---|
| 116 | | //NSTimer *timer = |
|---|
| 117 | | //[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(requestAvatarThrottled:) userInfo:nil repeats:YES]; |
|---|
| 118 | | |
|---|
| 119 | | /*NSEnumerator *enumerator = [[(MVChatRoom *)[[sender representedObject] target] memberUsers] objectEnumerator]; |
|---|
| 120 | | MVChatUser *chatUser = nil; |
|---|
| 121 | | |
|---|
| 122 | | while( ( chatUser = [enumerator nextObject] ) ) { |
|---|
| 123 | | [self requestAvatarFromUser:chatUser]; |
|---|
| 124 | | }*/ |
|---|
| 125 | | } |
|---|
| 126 | | else |
|---|
| 127 | | { |
|---|
| 128 | | NSLog([[[[sender representedObject] target] class ]description]); |
|---|
| 129 | | } |
|---|
| 130 | | // } |
|---|
| 131 | | // else |
|---|
| 132 | | // { localuser actions } |
|---|
| 133 | | } |
|---|
| 134 | | |
|---|
| 135 | | /*- (void) requestAvatarThrottled:(NSTimer *)timer |
|---|
| 136 | | { |
|---|
| 137 | | MVChatUser *chatUser = (MVChatUser *)[_throttledRequests anyObject]; |
|---|
| 138 | | [self requestAvatarFromUser:chatUser]; |
|---|
| 139 | | [_throttledRequests removeObject:chatUser]; |
|---|
| 140 | | if ([_throttledRequests count] == 0) |
|---|
| 141 | | { |
|---|
| 142 | | [timer invalidate]; |
|---|
| 143 | | } |
|---|
| 144 | | }*/ |
|---|
| 145 | | |
|---|
| | 103 | if ( [[sender representedObject] isKindOfClass:NSClassFromString(@"JVChatRoomMember")] ) |
|---|
| | 104 | { |
|---|
| | 105 | [self requestAvatarFromUser: [(JVChatRoomMember *)[sender representedObject] user]]; |
|---|
| | 106 | } |
|---|
| | 107 | else if ( [[sender representedObject] isKindOfClass:NSClassFromString(@"MVChatUser")] ) |
|---|
| | 108 | { |
|---|
| | 109 | [self requestAvatarFromUser: (MVChatUser *)[sender representedObject]]; |
|---|
| | 110 | } |
|---|
| | 111 | else if ( [[sender representedObject] isMemberOfClass:NSClassFromString(@"JVDirectChatPanel")] ) |
|---|
| | 112 | { |
|---|
| | 113 | [self requestAvatarFromUser: (MVChatUser *)[[sender representedObject] user]]; |
|---|
| | 114 | } |
|---|
| | 115 | else if ( [[sender representedObject] isMemberOfClass:NSClassFromString(@"JVChatRoomPanel")] ) |
|---|
| | 116 | { |
|---|
| | 117 | //TODO: ctcp flood handling by the application |
|---|
| | 118 | |
|---|
| | 119 | //TODO: enable later |
|---|
| | 120 | /*NSEnumerator *enumerator = [[(MVChatRoom *)[[sender representedObject] target] memberUsers] objectEnumerator]; |
|---|
| | 121 | MVChatUser *chatUser = nil; |
|---|
| | 122 | |
|---|
| | 123 | while( ( chatUser = [enumerator nextObject] ) ) { |
|---|
| | 124 | [self requestAvatarFromUser:chatUser]; |
|---|
| | 125 | }*/ |
|---|
| | 126 | } |
|---|
| | 127 | else |
|---|
| | 128 | { |
|---|
| | 129 | //TODO: Remove this when done testing |
|---|
| | 130 | NSLog(@"AVATAR: unknown sender for requestAvatarMenuItem: @%", [[[[sender representedObject] target] class ]description]); |
|---|
| | 131 | } |
|---|
| | 132 | } |
|---|
| | 133 | |
|---|
| | 134 | //TODO: is this functionality really required? |
|---|
| 166 | | //NSLog(@"Avatar Support: -- %@ (class), user: %@/%@: %@ (class)", [[[message sender] class] description], [[(JVChatRoomMember *)[message sender] user] serverAddress], [[(JVChatRoomMember *)[message sender] user] nickname], [[[[message sender] user] class] description]); |
|---|
| 167 | | |
|---|
| 168 | | //TODO: check for buddies, unless this works for them too (doesnt, *.quakenet.org bug) |
|---|
| 169 | | if ([[[(JVChatRoomMember *)[message sender] user] attributes] objectForKey:@"MVChatUserPictureAttribute"] == nil) |
|---|
| 170 | | { |
|---|
| 171 | | //NSLog(@"Avatar Support: -- nil: %@", [[[[(JVChatRoomMember *)[message sender] user] attributes] objectForKey:@"MVChatUserPictureAttribute"] description]); |
|---|
| 172 | | [self addAvatarToUser:[(JVChatRoomMember *)[message sender] user]]; |
|---|
| 173 | | } |
|---|
| 174 | | else |
|---|
| 175 | | { |
|---|
| 176 | | //NSLog(@"Avatar Support: -- nicht nil: %@", [[[[(JVChatRoomMember *)[message sender] user] attributes] objectForKey:@"MVChatUserPictureAttribute"] description]); |
|---|
| 177 | | //TODO: remove this |
|---|
| 178 | | [[JVNotificationController defaultController] performNotification:@"JVPluginNotification" withContextInfo:[NSDictionary dictionaryWithObjectsAndKeys:[[[(JVChatRoomMember *)[message sender] user] attributes] objectForKey:@"MVChatUserPictureAttribute"],@"image",@"Avatar Support",@"title",[NSString stringWithFormat:@"%@ already has an Avatar.", [[(JVChatRoomMember *)[message sender] user] nickname]],@"description",nil]]; |
|---|
| 179 | | } |
|---|
| | 155 | _writingUser = [(JVChatRoomMember *)[message sender] user]; |
|---|
| 183 | | //TODO: this is for direct chats, see comment #1 above |
|---|
| 184 | | //NSLog(@"Avatar Support: -- %@/%@: %@ (class)", [(MVChatUser *)[message sender] serverAddress], [(MVChatUser *)[message sender] nickname], [[[message sender] class] description]); |
|---|
| 185 | | |
|---|
| 186 | | //TODO: check for buddies, unless this works for them too (doesnt) |
|---|
| 187 | | if ([[(MVChatUser *)[message sender] attributes] objectForKey:@"MVChatUserPictureAttribute"] == nil) |
|---|
| 188 | | { |
|---|
| 189 | | //NSLog(@"Avatar Support: -- nil: %@", [[[(MVChatUser *)[message sender] attributes] objectForKey:@"MVChatUserPictureAttribute"] description]); |
|---|
| 190 | | [self addAvatarToUser:(MVChatUser *)[message sender]]; |
|---|
| 191 | | } |
|---|
| 192 | | else |
|---|
| 193 | | { |
|---|
| 194 | | //NSLog(@"Avatar Support: --nicht nil: %@", [[[(MVChatUser *)[message sender] attributes] objectForKey:@"MVChatUserPictureAttribute"] description]); |
|---|
| 195 | | //TODO: remove this |
|---|
| 196 | | [[JVNotificationController defaultController] performNotification:@"JVPluginNotification" withContextInfo:[NSDictionary dictionaryWithObjectsAndKeys:[[(MVChatUser *)[message sender] attributes] objectForKey:@"MVChatUserPictureAttribute"],@"image",@"Avatar Support",@"title",[NSString stringWithFormat:@"%@ already has an Avatar.", [(MVChatUser *)[message sender] nickname]],@"description",nil]]; |
|---|
| 197 | | } |
|---|
| | 159 | _writingUser = (MVChatUser *)[message sender]; |
|---|
| | 160 | } |
|---|
| | 161 | |
|---|
| | 162 | //NSLog(@"Avatar Support: -- %@ (class), user: %@/%@: %@ (class)", [[[message sender] class] description], [_writingUser serverAddress], [_writingUser nickname], [[[[message sender] user] class] description]); |
|---|
| | 163 | |
|---|
| | 164 | //TODO: check for buddies, unless this works for them too (doesnt, *.quakenet.org bug) |
|---|
| | 165 | if ([[_writingUser attributes] objectForKey:@"MVChatUserPictureAttribute"] == nil) |
|---|
| | 166 | { |
|---|
| | 167 | //NSLog(@"Avatar Support: -- nil: %@", [[[_writingUser attributes] objectForKey:@"MVChatUserPictureAttribute"] description]); |
|---|
| | 168 | [self addAvatarToUser:_writingUser]; |
|---|
| | 169 | } |
|---|
| | 170 | else |
|---|
| | 171 | { |
|---|
| | 172 | //NSLog(@"Avatar Support: -- nicht nil: %@", [[[_writingUser attributes] objectForKey:@"MVChatUserPictureAttribute"] description]); |
|---|
| | 173 | //TODO: remove this |
|---|
| | 174 | [[JVNotificationController defaultController] performNotification:@"JVPluginNotification" withContextInfo: |
|---|
| | 175 | [NSDictionary dictionaryWithObjectsAndKeys:[[_writingUser attributes] objectForKey: |
|---|
| | 176 | @"MVChatUserPictureAttribute"], @"image", |
|---|
| | 177 | @"Avatar Support", @"title", |
|---|
| | 178 | [NSString stringWithFormat:@"%@ already has an Avatar.", [_writingUser nickname]],@"description", |
|---|
| | 179 | nil]]; |
|---|
| 250 | | [[JVNotificationController defaultController] performNotification:@"JVPluginNotification" withContextInfo:[NSDictionary dictionaryWithObjectsAndKeys:[[chatUser attributes] objectForKey:@"MVChatUserPictureAttribute"],@"image",@"Avatar Support",@"title",[NSString stringWithFormat:@"Received Avatar from user %@.", [chatUser nickname]],@"description",nil]]; |
|---|
| | 225 | [[JVNotificationController defaultController] performNotification:@"JVPluginNotification" withContextInfo: |
|---|
| | 226 | [NSDictionary dictionaryWithObjectsAndKeys:[[chatUser attributes] objectForKey: |
|---|
| | 227 | @"MVChatUserPictureAttribute"], @"image", |
|---|
| | 228 | @"Avatar Support", @"title", |
|---|
| | 229 | [NSString stringWithFormat:@"Received Avatar from user %@.", [chatUser nickname]], @"description", |
|---|
| | 230 | nil]]; |
|---|
| 308 | | [[JVNotificationController defaultController] performNotification:@"JVPluginNotification" withContextInfo:[NSDictionary dictionaryWithObjectsAndKeys:[[chatUser attributes] objectForKey:@"MVChatUserPictureAttribute"],@"image",@"Avatar Support",@"title",[NSString stringWithFormat:@"Avatar added for user %@.", [chatUser nickname]],@"description",nil]]; |
|---|
| | 288 | [[JVNotificationController defaultController] performNotification:@"JVPluginNotification" withContextInfo: |
|---|
| | 289 | [NSDictionary dictionaryWithObjectsAndKeys:[[chatUser attributes] objectForKey: |
|---|
| | 290 | @"MVChatUserPictureAttribute"], @"image", |
|---|
| | 291 | @"Avatar Support", @"title", |
|---|
| | 292 | [NSString stringWithFormat:@"Avatar added for user %@.", [chatUser nickname]], @"description", |
|---|
| | 293 | nil]]; |
|---|