Skip to content

Commit f74ad40

Browse files
Merge pull request robbiehanson#945 from nixxcode/fix-iq-stanzas-missing-id-attribute
Fix missing "id" attribute in some IQ stanzas
2 parents fefd536 + 08aef09 commit f74ad40

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Core/XMPPIQ.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ - (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid
116116

117117
if (eid)
118118
[self addAttributeWithName:@"id" stringValue:eid];
119+
else
120+
[self addAttributeWithName:@"id" stringValue:[[NSUUID UUID] UUIDString]];
119121

120122
if (childElement)
121123
[self addChild:childElement];

Extensions/Roster/XMPPRoster.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,7 @@ - (void)addUser:(XMPPJID *)jid withNickname:(NSString *)optionalName groups:(NSA
515515
NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:@"jabber:iq:roster"];
516516
[query addChild:item];
517517

518-
NSXMLElement *iq = [NSXMLElement elementWithName:@"iq"];
519-
[iq addAttributeWithName:@"type" stringValue:@"set"];
520-
[iq addChild:query];
518+
XMPPIQ *iq = [XMPPIQ iqWithType:@"set" child:query];
521519

522520
[xmppStream sendElement:iq];
523521

0 commit comments

Comments
 (0)