Adium

Changeset 14798

Show
Ignore:
Timestamp:
01/07/2006 05:12:37 PM (3 years ago)
Author:
evands
Message:

Fixed localizability as well as gender neutrality of the OTR error message when attempting to message in a chat in which the other side has already ended encryption. Fixes #2623

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/AdiumOTREncryption.m

    r14690 r14798  
    383383        message = [NSString stringWithUTF8String:msg]; 
    384384         
    385         if ((localizedMessage = [adiumOTREncryption localizedOTRMessage:message 
    386                                                                                                            withUsername:[listContact formattedUID]])) { 
    387                 message = localizedMessage; 
    388         } 
     385        localizedMessage = [adiumOTREncryption localizedOTRMessage:message 
     386                                                                                                  withUsername:[listContact formattedUID]]; 
    389387 
    390388        [[sharedAdium contentController] displayStatusMessage:localizedMessage 
     
    399397                                          const char *title, const char *primary, const char *secondary) 
    400398{ 
    401         [adiumOTREncryption notifyWithTitle:[NSString stringWithUTF8String:title] 
    402                                                                 primary:[NSString stringWithUTF8String:primary] 
    403                                                           secondary:[NSString stringWithUTF8String:secondary]]; 
     399        AIListContact   *listContact = contactFromInfo(accountname, protocol, username); 
     400        NSString                *formattedUID = [listContact formattedUID]; 
     401 
     402        [adiumOTREncryption notifyWithTitle:[adiumOTREncryption localizedOTRMessage:[NSString stringWithUTF8String:title] 
     403                                                                                                                                   withUsername:formattedUID] 
     404                                                                primary:[adiumOTREncryption localizedOTRMessage:[NSString stringWithUTF8String:primary] 
     405                                                                                                                                   withUsername:formattedUID] 
     406                                                          secondary:[adiumOTREncryption localizedOTRMessage:[NSString stringWithUTF8String:secondary] 
     407                                                                                                                                   withUsername:formattedUID]]; 
    404408} 
    405409 
     
    780784                        AILocalizedString(@"You sent an unencrypted message, but %@ was expecting encryption.", "Message when sending unencrypted messages to a contact expecting encrypted ones. %s will be a name."), 
    781785                        username]; 
     786                 
    782787        } else if ([message rangeOfString:@CLOSED_CONNECTION_MESSAGE].location != NSNotFound) { 
    783788                localizedOTRMessage = [NSString stringWithFormat: 
    784789                        AILocalizedString(@"%@ is no longer using encryption; you should cancel encryption on your side.", "Message when the remote contact cancels his half of an encrypted conversation. %s will be a name."), 
    785790                        username]; 
    786         } 
    787          
    788         return localizedOTRMessage; 
     791                 
     792        } else if ([message isEqualToString:@"Private connection closed"]) { 
     793                localizedOTRMessage = AILocalizedString(@"Private connectiion closed", nil); 
     794 
     795        } else if ([message rangeOfString:@"has already closed his private connection to you"].location != NSNotFound) { 
     796                localizedOTRMessage = [NSString stringWithFormat: 
     797                        AILocalizedString(@"%@'s private connection to you is closed.", "Statement that someone's private (encrypted) connection is closed."), 
     798                        username]; 
     799 
     800        } else if ([message isEqualToString:@"Your message was not sent.  Either close your private connection to him, or refresh it."]) { 
     801                localizedOTRMessage = AILocalizedString(@"Your message was not sent. You should end the encrypted chat on your side or re-request encryption.", nil); 
     802        } 
     803         
     804        return (localizedOTRMessage ? localizedOTRMessage : message); 
    789805} 
    790806