From 7c5166b4af306f1a95cece4a310704b98429e4fa Mon Sep 17 00:00:00 2001 From: Pat Murphy Date: Fri, 5 Sep 2014 15:47:25 -0700 Subject: [PATCH 1/3] Updating XMPPStream for our servers --- Core/XMPPStream.m | 25 ++++++++++++++++++++++--- Vendor/KissXML/DDXML.h | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Core/XMPPStream.m b/Core/XMPPStream.m index 3ebe8a3db3..3a70001ab7 100644 --- a/Core/XMPPStream.m +++ b/Core/XMPPStream.m @@ -4067,15 +4067,34 @@ - (void)tryNextSrvResult NSError *connectError = nil; BOOL success = NO; - + + //Pull BundleIdentifier and rip out v2 (always present) to create xmppHostName + //This makes the xmpp Host Name dependent upon the bundle identifier name so it's easy to change + //for development or QA builds + NSString *xmppHostName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; + NSArray *xmppHostNameComponents = [xmppHostName componentsSeparatedByString:@"."]; + if([xmppHostNameComponents count] > 1) + { + NSString *tempHostName = [xmppHostNameComponents objectAtIndex:2]; + tempHostName = [tempHostName stringByReplacingOccurrencesOfString:@"v2" withString:@""]; + xmppHostName = [NSString stringWithFormat:@"xmpp.%@.com",tempHostName]; + } + else + { + xmppHostName = @"xmpp.medigram.com"; + } + NSLog(@"XMPPStream : tryNextSrvResult : xmppHostName = %@",xmppHostName); + while (srvResultsIndex < [srvResults count]) { + /* XMPPSRVRecord *srvRecord = [srvResults objectAtIndex:srvResultsIndex]; NSString *srvHost = srvRecord.target; UInt16 srvPort = srvRecord.port; - success = [self connectToHost:srvHost onPort:srvPort withTimeout:XMPPStreamTimeoutNone error:&connectError]; - + */ + success = [self connectToHost:xmppHostName onPort:5222 withTimeout:XMPPStreamTimeoutNone error:&connectError]; + if (success) { break; diff --git a/Vendor/KissXML/DDXML.h b/Vendor/KissXML/DDXML.h index 43dbd75e1b..00cbcaa338 100644 --- a/Vendor/KissXML/DDXML.h +++ b/Vendor/KissXML/DDXML.h @@ -189,7 +189,7 @@ // // The debugging macro adds a significant amount of overhead, and should NOT be enabled on production builds. -#if DEBUG +#ifdef DEBUG #define DDXML_DEBUG_MEMORY_ISSUES 0 #else #define DDXML_DEBUG_MEMORY_ISSUES 0 // Don't change me! From bf30643e0ff69efa36bad57c1c2d0269b196a9e6 Mon Sep 17 00:00:00 2001 From: Ryan Staatz Date: Thu, 13 Nov 2014 14:58:49 -0800 Subject: [PATCH 2/3] Detect staging vs. production for XMPPHostName instead of using bundleid --- Core/XMPPStream.m | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Core/XMPPStream.m b/Core/XMPPStream.m index 3a70001ab7..7fe3dab4e2 100644 --- a/Core/XMPPStream.m +++ b/Core/XMPPStream.m @@ -4068,20 +4068,11 @@ - (void)tryNextSrvResult NSError *connectError = nil; BOOL success = NO; - //Pull BundleIdentifier and rip out v2 (always present) to create xmppHostName - //This makes the xmpp Host Name dependent upon the bundle identifier name so it's easy to change - //for development or QA builds - NSString *xmppHostName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; - NSArray *xmppHostNameComponents = [xmppHostName componentsSeparatedByString:@"."]; - if([xmppHostNameComponents count] > 1) - { - NSString *tempHostName = [xmppHostNameComponents objectAtIndex:2]; - tempHostName = [tempHostName stringByReplacingOccurrencesOfString:@"v2" withString:@""]; - xmppHostName = [NSString stringWithFormat:@"xmpp.%@.com",tempHostName]; - } - else - { - xmppHostName = @"xmpp.medigram.com"; + //Check if app is for staging or production and set XMPPHostName accordingly + NSString *bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; + NSString *xmppHostName = @"xmpp.medigram.com"; + if( [bundleIdentifier isEqual: @"com.medigram.medigramv2-staging"] ){ + xmppHostName=@"xmpp.medigram-staging.com"; } NSLog(@"XMPPStream : tryNextSrvResult : xmppHostName = %@",xmppHostName); From 7876cf6bb1494bbb11e300b875c386d3628ee6dc Mon Sep 17 00:00:00 2001 From: AnthonyMl Date: Wed, 12 Aug 2015 17:04:53 -0400 Subject: [PATCH 3/3] Change Default Auth to Plain and change hardcoded xmpp host. --- Core/XMPPStream.m | 52 ++++-------------------- Extensions/XEP-0054/XMPPvCardTempEmail.h | 2 - 2 files changed, 8 insertions(+), 46 deletions(-) diff --git a/Core/XMPPStream.m b/Core/XMPPStream.m index 7fe3dab4e2..be82b6e1f1 100644 --- a/Core/XMPPStream.m +++ b/Core/XMPPStream.m @@ -1943,7 +1943,7 @@ - (BOOL)authenticateWithPassword:(NSString *)inPassword error:(NSError **)errPtr id someAuth = nil; - if ([self supportsSCRAMSHA1Authentication]) +/* if ([self supportsSCRAMSHA1Authentication]) { someAuth = [[XMPPSCRAMSHA1Authentication alloc] initWithStream:self password:password]; result = [self authenticate:someAuth error:&err]; @@ -1955,9 +1955,9 @@ - (BOOL)authenticateWithPassword:(NSString *)inPassword error:(NSError **)errPtr } else if ([self supportsPlainAuthentication]) { - someAuth = [[XMPPPlainAuthentication alloc] initWithStream:self password:password]; +*/ someAuth = [[XMPPPlainAuthentication alloc] initWithStream:self password:password]; result = [self authenticate:someAuth error:&err]; - } +/* } else if ([self supportsDeprecatedDigestAuthentication]) { someAuth = [[XMPPDeprecatedDigestAuthentication alloc] initWithStream:self password:password]; @@ -1976,7 +1976,7 @@ - (BOOL)authenticateWithPassword:(NSString *)inPassword error:(NSError **)errPtr err = [NSError errorWithDomain:XMPPStreamErrorDomain code:XMPPStreamUnsupportedAction userInfo:info]; result = NO; - } + }*/ }}; @@ -4069,47 +4069,11 @@ - (void)tryNextSrvResult BOOL success = NO; //Check if app is for staging or production and set XMPPHostName accordingly - NSString *bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; - NSString *xmppHostName = @"xmpp.medigram.com"; - if( [bundleIdentifier isEqual: @"com.medigram.medigramv2-staging"] ){ - xmppHostName=@"xmpp.medigram-staging.com"; - } - NSLog(@"XMPPStream : tryNextSrvResult : xmppHostName = %@",xmppHostName); - - while (srvResultsIndex < [srvResults count]) - { - /* - XMPPSRVRecord *srvRecord = [srvResults objectAtIndex:srvResultsIndex]; - NSString *srvHost = srvRecord.target; - UInt16 srvPort = srvRecord.port; - success = [self connectToHost:srvHost onPort:srvPort withTimeout:XMPPStreamTimeoutNone error:&connectError]; - */ - success = [self connectToHost:xmppHostName onPort:5222 withTimeout:XMPPStreamTimeoutNone error:&connectError]; + NSString *xmppHostName = @"xmpp.medigram-staging.com"; // TODO: change for release - if (success) - { - break; - } - else - { - srvResultsIndex++; - } - } - - if (!success) - { - // SRV resolution of the JID domain failed. - // As per the RFC: - // - // "If the SRV lookup fails, the fallback is a normal IPv4/IPv6 address record resolution - // to determine the IP address, using the "xmpp-client" port 5222, registered with the IANA." - // - // In other words, just try connecting to the domain specified in the JID. - - success = [self connectToHost:[myJID_setByClient domain] onPort:5222 withTimeout:XMPPStreamTimeoutNone error:&connectError]; - } - - if (!success) + success = [self connectToHost:xmppHostName onPort:5222 withTimeout:XMPPStreamTimeoutNone error:&connectError]; + + if (!success) { [self endConnectTimeout]; diff --git a/Extensions/XEP-0054/XMPPvCardTempEmail.h b/Extensions/XEP-0054/XMPPvCardTempEmail.h index 214efff848..a4abb75d1d 100644 --- a/Extensions/XEP-0054/XMPPvCardTempEmail.h +++ b/Extensions/XEP-0054/XMPPvCardTempEmail.h @@ -23,7 +23,5 @@ @property (nonatomic, assign, setter=setX400:) BOOL isX400; @property (nonatomic, assign, setter=setPreferred:) BOOL isPreferred; -@property (nonatomic, weak) NSString *userid; - @end