Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MUC Light affiliation change handling #1000

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Extensions/XMPPMUCLight/XMPPMUCLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

- (void)xmppMUCLight:(nonnull XMPPMUCLight *)sender didDiscoverRooms:(nonnull NSArray<__kindof NSXMLElement*>*)rooms forServiceNamed:(nonnull NSString *)serviceName;
- (void)xmppMUCLight:(nonnull XMPPMUCLight *)sender failedToDiscoverRoomsForServiceNamed:(nonnull NSString *)serviceName withError:(nonnull NSError *)error;
- (void)xmppMUCLight:(nonnull XMPPMUCLight *)sender changedAffiliation:(nonnull NSString *)affiliation roomJID:(nonnull XMPPJID *)roomJID;
- (void)xmppMUCLight:(nonnull XMPPMUCLight *)sender changedAffiliation:(nonnull NSString *)affiliation userJID:(nonnull XMPPJID *)userJID roomJID:(nonnull XMPPJID *)roomJID;

- (void)xmppMUCLight:(nonnull XMPPMUCLight *)sender didRequestBlockingList:(nonnull NSArray<NSXMLElement*>*)items forServiceNamed:(nonnull NSString *)serviceName;
- (void)xmppMUCLight:(nonnull XMPPMUCLight *)sender failedToRequestBlockingList:(nonnull NSString *)serviceName withError:(nonnull XMPPIQ *)iq;
Expand Down
11 changes: 5 additions & 6 deletions Extensions/XMPPMUCLight/XMPPMUCLight.m
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,11 @@ - (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message

XMPPJID *from = message.from;
NSXMLElement *x = [message elementForName:@"x" xmlns:XMPPRoomLightAffiliations];
NSXMLElement *user = [x elementForName:@"user"];
NSString *affiliation = [user attributeForName:@"affiliation"].stringValue;

if (affiliation) {
[multicastDelegate xmppMUCLight:self changedAffiliation:affiliation roomJID:from];
}
for (NSXMLElement *user in [x elementsForName:@"user"]) {
NSString *affiliation = [user attributeForName:@"affiliation"].stringValue;
XMPPJID *userJID = [XMPPJID jidWithString:user.stringValue];
[multicastDelegate xmppMUCLight:self changedAffiliation:affiliation userJID:userJID roomJID:from];
}
}

- (void)xmppStream:(XMPPStream *)sender didRegisterModule:(id)module {
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 @@ -263,7 +263,7 @@ - (void)testChangeAffiliation {
}];
}

- (void)xmppMUCLight:(XMPPMUCLight *)sender changedAffiliation:(NSString *)affiliation roomJID:(XMPPJID *)roomJID {
- (void)xmppMUCLight:(XMPPMUCLight *)sender changedAffiliation:(NSString *)affiliation userJID:(XMPPJID *)userJID roomJID:(XMPPJID *)roomJID {
XCTAssertEqualObjects(affiliation, @"member");
XCTAssertEqualObjects(roomJID.full, @"[email protected]");
[self.delegateResponseExpectation fulfill];
Expand Down