Bug in PublicMessageRequest validation

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

Posts: 205
Joined: 09 Nov 2010, 00:48

Bug in PublicMessageRequest validation

Postby mmilen » 26 Oct 2011, 14:17

line 57 in GenericMessageRequest.m
-(void)validatePublicMessage:(SmartFoxiPhoneClient *)sfs errors:(NSMutableArray *)errors {
if(_message == nil || [_message length] == 0) {
[errors addObject:@"Public message is empty!"];

if (_room != nil && ![sfs.mySelf isJoinedInRoom:_room]) {
[errors addObject:[NSString stringWithFormat:@"You are not joined in the target Room: %@", _room]];

in some circumstances

Code: Select all

[sfs.mySelf isJoinedInRoom:_room]
shows the client not joined, while the server has it right and ROOM isJoined property is also correct, every other message will go out just fine. Replacing this check with

Code: Select all

[_room isJoined]
fixes the problem and it is much faster, as it checks single boolean value vs going through isJoinedInRoom , which involves search in array.[/code]
User avatar
Site Admin
Posts: 19933
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 01 Nov 2011, 19:54

Thanks for reporting
...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 1 guest