Skip to content

Commit

Permalink
Fix erroneous direct usage of DDXML
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Feb 22, 2017
1 parent f7806c3 commit 103c554
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Extensions/XEP-0045/XMPPRoom.m
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ - (void)inviteUsers:(NSArray<XMPPJID *> *)jids withMessage:(NSString *)invitatio
NSXMLElement *x = [NSXMLElement elementWithName:@"x" xmlns:XMPPMUCUserNamespace];

for (XMPPJID *jid in jids) {
DDXMLElement *invite = [self inviteElementWithJid:jid invitationMessage:invitationMessage];
NSXMLElement *invite = [self inviteElementWithJid:jid invitationMessage:invitationMessage];
[x addChild:invite];
}

Expand All @@ -868,7 +868,7 @@ - (void)inviteUsers:(NSArray<XMPPJID *> *)jids withMessage:(NSString *)invitatio
dispatch_async(moduleQueue, block);
}

- (DDXMLElement *)inviteElementWithJid:(XMPPJID *)jid invitationMessage:(NSString *)invitationMessage {
- (NSXMLElement *)inviteElementWithJid:(XMPPJID *)jid invitationMessage:(NSString *)invitationMessage {
NSXMLElement *invite = [NSXMLElement elementWithName:@"invite"];
[invite addAttributeWithName:@"to" stringValue:[jid full]];

Expand Down
8 changes: 4 additions & 4 deletions Xcode/Testing-Shared/OMEMOElementTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ - (void) testPublishDeviceBundle {
OMEMOSignedPreKey *signedPreKey = [[OMEMOSignedPreKey alloc] initWithPreKeyId:1 publicKey:signedPreKeyPublicData signature:signedPreKeySignatureData];
OMEMOBundle *bundle = [[OMEMOBundle alloc] initWithDeviceId:31415 identityKey:identityKeyData signedPreKey:signedPreKey preKeys:preKeys];
XMPPIQ *iq = [XMPPIQ omemo_iqPublishBundle:bundle elementId:@"announce2" xmlNamespace:self.ns];
XCTAssertEqualObjects([iq XMLStringWithOptions:DDXMLNodePrettyPrint], [expectedXML XMLStringWithOptions:DDXMLNodePrettyPrint]);
XCTAssertEqualObjects([iq XMLStringWithOptions:NSXMLNodePrettyPrint], [expectedXML XMLStringWithOptions:NSXMLNodePrettyPrint]);
}

/**
Expand Down Expand Up @@ -140,7 +140,7 @@ - (void) testFetchBundleForDeviceId {
XCTAssertNil(error);
XCTAssertNotNil(expectedElement);
XMPPIQ *iq = [XMPPIQ omemo_iqFetchBundleForDeviceId:31415 jid:[XMPPJID jidWithString:@"juliet@capulet.lit"] elementId:@"fetch1" xmlNamespace:self.ns];
XCTAssertEqualObjects([iq XMLStringWithOptions:DDXMLNodePrettyPrint], [expectedElement XMLStringWithOptions:DDXMLNodePrettyPrint]);
XCTAssertEqualObjects([iq XMLStringWithOptions:NSXMLNodePrettyPrint], [expectedElement XMLStringWithOptions:NSXMLNodePrettyPrint]);
}

/**
Expand Down Expand Up @@ -277,15 +277,15 @@ - (void) testBundleParsing {
OMEMOSignedPreKey *signedPreKey = [[OMEMOSignedPreKey alloc] initWithPreKeyId:1 publicKey:signedPreKeyPublicData signature:signedPreKeySignatureData];
OMEMOBundle *bundle = [[OMEMOBundle alloc] initWithDeviceId:31415 identityKey:identityKeyData signedPreKey:signedPreKey preKeys:preKeys];
XMPPIQ *iq = [XMPPIQ omemo_iqPublishBundle:bundle elementId:@"announce2" xmlNamespace:self.ns];
XCTAssertEqualObjects([iq XMLStringWithOptions:DDXMLNodePrettyPrint], [expectedXML XMLStringWithOptions:DDXMLNodePrettyPrint]);
XCTAssertEqualObjects([iq XMLStringWithOptions:NSXMLNodePrettyPrint], [expectedXML XMLStringWithOptions:NSXMLNodePrettyPrint]);

OMEMOBundle *expectedBundle = [[XMPPIQ iqFromElement:expectedXML] omemo_bundle:self.ns];
OMEMOBundle *bundle2 = [iq omemo_bundle:self.ns];

XMPPIQ *expectedIQ = [XMPPIQ omemo_iqPublishBundle:expectedBundle elementId:@"eid" xmlNamespace:self.ns];
XMPPIQ *bundle2iq = [XMPPIQ omemo_iqPublishBundle:bundle2 elementId:@"eid" xmlNamespace:self.ns];

XCTAssertEqualObjects([expectedIQ XMLStringWithOptions:DDXMLNodePrettyPrint], [bundle2iq XMLStringWithOptions:DDXMLNodePrettyPrint]);
XCTAssertEqualObjects([expectedIQ XMLStringWithOptions:NSXMLNodePrettyPrint], [bundle2iq XMLStringWithOptions:NSXMLNodePrettyPrint]);
}

- (void) testFetchDeviceList {
Expand Down
2 changes: 1 addition & 1 deletion Xcode/Testing-Shared/XMPPMUCLightTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ - (void)testRequestBlockingList{
}];
}

- (void) xmppMUCLight:(XMPPMUCLight *)sender didRequestBlockingList:(NSArray<DDXMLElement *> *)items forServiceNamed:(NSString *)serviceName{
- (void) xmppMUCLight:(XMPPMUCLight *)sender didRequestBlockingList:(NSArray<NSXMLElement *> *)items forServiceNamed:(NSString *)serviceName{
XCTAssertEqual(items.count, 2);
XCTAssertEqualObjects(serviceName, @"muclight.test.com");
[self.delegateResponseExpectation fulfill];
Expand Down

0 comments on commit 103c554

Please sign in to comment.