0

I use Smack lib. I need to send this(Android):

<presence type='initialize' location_id='570' user_id='8942'/>.

On Xcode:

XMPPPresence *presence = [XMPPPresence presence];
    [presence addAttributeWithName:@"location_id" stringValue:[NSString stringWithFormat:@"%lu", (unsigned long)Settings.LocationID]];
    [presence addAttributeWithName:@"user_id" stringValue:[NSString stringWithFormat:@"%lu", (unsigned long)Settings.UserID]];
    [presence addAttributeWithName:@"type" stringValue:@"initialize"];
    [_xmppStream sendElement:presence];
Flow
  • 23,572
  • 15
  • 99
  • 156
Andrew Brelyk
  • 45
  • 1
  • 8

1 Answers1

0

You can't. The value 'initialize' is not defined for the 'type' attribute of presences. Nor are 'location_id' or 'user_id'. If you want to add custom information to stanzas, use extension elements:

<presence ...>
  <myExtension xmlns='myns'>
    <initialize location_id='570' user_id='8942'/>
  </myExtension>
</presence>

See also: https://stackoverflow.com/a/26544842/194894

Community
  • 1
  • 1
Flow
  • 23,572
  • 15
  • 99
  • 156