adium 5697:70a132bee786: Make sure Bonjour does not refuse to se...
commits at adium.im
commits at adium.im
Tue Sep 10 11:14:42 UTC 2013
details: http://hg.adium.im/adium/rev/70a132bee786
revision: 5697:70a132bee786
branch: libotr4.0.0
author: Thijs Alkemade <me at thijsalkema.de>
date: Tue Sep 10 13:13:44 2013 +0200
Make sure Bonjour does not refuse to send or parse a message when the plain text variant is missing. This should ensure that OTR initiation works.
Fixes #16445
diffs (168 lines):
diff -r 065178d1bc3e -r 70a132bee786 Plugins/Bonjour/AWBonjourAccount.m
--- a/Plugins/Bonjour/AWBonjourAccount.m Tue Sep 10 01:44:51 2013 +0200
+++ b/Plugins/Bonjour/AWBonjourAccount.m Tue Sep 10 13:13:44 2013 +0200
@@ -326,10 +326,10 @@
- (BOOL)sendMessageObject:(AIContentMessage *)inContentMessage
{
- [libezv sendMessage:inContentMessage.messageString
- to:inContentMessage.destination.UID
- withHtml:inContentMessage.encodedMessage];
-
+ [libezv sendMessage:inContentMessage.messageString
+ to:inContentMessage.destination.UID
+ withHtml:inContentMessage.encodedMessage];
+
return YES;
}
diff -r 065178d1bc3e -r 70a132bee786 Plugins/Bonjour/libezv/Classes/AWEzvContact.m
--- a/Plugins/Bonjour/libezv/Classes/AWEzvContact.m Tue Sep 10 01:44:51 2013 +0200
+++ b/Plugins/Bonjour/libezv/Classes/AWEzvContact.m Tue Sep 10 13:13:44 2013 +0200
@@ -91,46 +91,51 @@
fixedHTML = [self fixHTML:html];
//XXX if self.ipAddr is nil, we should do something
if (self.ipAddr != nil) {
-
+
if (self.stream == nil) {
[self createConnection];
}
-
- /* Message cleanup */
- /* actual message */
+
+ /* Message cleanup */
+ /* actual message */
mutableString = [message mutableCopy];
[mutableString replaceOccurrencesOfString:@"<br>" withString:@"<br />"
- options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableString length])];
+ options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableString length])];
[mutableString replaceOccurrencesOfString:@"&" withString:@"&"
- options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
+ options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
[mutableString replaceOccurrencesOfString:@"<" withString:@"<"
- options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
+ options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
[mutableString replaceOccurrencesOfString:@">" withString:@">"
- options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
+ options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
messageExtraEscapedString = [mutableString copy];
[mutableString release];
-
+
mutableString = [fixedHTML mutableCopy];
[mutableString replaceOccurrencesOfString:@"<br>" withString:@"<br />"
- options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableString length])];
+ options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableString length])];
htmlFiltered = [mutableString copy];
[mutableString release];
-
- /* setup XML tree */
+
+ /* setup XML tree */
messageNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLElement name:@"message"];
//[messageNode addAttribute:@"to" withValue:self.ipAddr];
[messageNode addAttribute:@"to" withValue:self.uniqueID];
[messageNode addAttribute:@"from" withValue: [self.manager myInstanceName]];
[messageNode addAttribute:@"type" withValue:@"chat"];
-
- bodyNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLElement name:@"body"];
- [messageNode addChild:bodyNode];
-
- textNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLText name:messageExtraEscapedString];
- [bodyNode addChild:textNode];
-
-
+
+ if (messageExtraEscapedString) {
+ bodyNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLElement name:@"body"];
+
+ [messageNode addChild:bodyNode];
+ textNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLText name:messageExtraEscapedString];
+
+ [bodyNode addChild:textNode];
+
+ [textNode release];
+ [bodyNode release];
+ }
+
htmlNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLElement name:@"html"];
[htmlNode addAttribute:@"xmlns" withValue:@"http://www.w3.org/1999/xhtml"];
[messageNode addChild:htmlNode];
@@ -140,26 +145,22 @@
htmlMessageNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLRaw name:htmlFiltered];
[htmlBodyNode addChild:htmlMessageNode];
-
+
/* send the data */
[self.stream sendString:[messageNode xmlString]];
-
-
-
- /* release messages */
+
+ /* release messages */
[htmlMessageNode release];
[htmlBodyNode release];
[htmlNode release];
- [textNode release];
- [bodyNode release];
[messageNode release];
[messageExtraEscapedString release];
[htmlFiltered release];
-
+
} else {
[self setStatus: AWEzvUndefined];
-
+
/* and notify */
[self.manager.client.client userChangedState:self];
[self.manager.client.client reportError:@"Could Not Send" ofLevel:AWEzvError forUser:[self uniqueID]];
@@ -428,7 +429,7 @@
}
/* if we've got a message then we can send it to the client to display */
- if (plaintext.length > 0)
+ if (plaintext.length > 0 || html.length > 0)
[self.manager.client.client user:self sentMessage:plaintext withHtml:html];
}
diff -r 065178d1bc3e -r 70a132bee786 Plugins/Secure Messaging/ESSecureMessagingPlugin.h
--- a/Plugins/Secure Messaging/ESSecureMessagingPlugin.h Tue Sep 10 01:44:51 2013 +0200
+++ b/Plugins/Secure Messaging/ESSecureMessagingPlugin.h Tue Sep 10 13:13:44 2013 +0200
@@ -22,7 +22,6 @@
AISecureMessagingMenu_Root = 1,
AISecureMessagingMenu_Toggle,
AISecureMessagingMenu_ShowDetails,
- AISecureMessagingMenu_Verify,
AISecureMessagingMenu_Options,
AISecureMessagingMenu_ShowAbout,
AISecureMessagingMenu_VerifyManually,
diff -r 065178d1bc3e -r 70a132bee786 Plugins/Secure Messaging/ESSecureMessagingPlugin.m
--- a/Plugins/Secure Messaging/ESSecureMessagingPlugin.m Tue Sep 10 01:44:51 2013 +0200
+++ b/Plugins/Secure Messaging/ESSecureMessagingPlugin.m Tue Sep 10 13:13:44 2013 +0200
@@ -545,7 +545,6 @@
target:nil
action:nil
keyEquivalent:@""] autorelease];
- [item setTag:AISecureMessagingMenu_Verify];
NSMenu *verifySubmenu = [[NSMenu allocWithZone:[NSMenu menuZone]] init];
[item setSubmenu:verifySubmenu];
diff -r 065178d1bc3e -r 70a132bee786 Source/AdiumOTREncryption.m
--- a/Source/AdiumOTREncryption.m Tue Sep 10 01:44:51 2013 +0200
+++ b/Source/AdiumOTREncryption.m Tue Sep 10 13:13:44 2013 +0200
@@ -1093,7 +1093,7 @@
policyForContact([inChat listObject]));
[adium.contentController sendRawMessage:[NSString stringWithUTF8String:(msg ? msg : "?OTRv2?")]
- toContact:[inChat listObject]];
+ toContact:[inChat listObject]];
if (msg)
free(msg);
}
More information about the commits
mailing list