1

When I have joined a MUC room with XMPPFramwork I receive new messages via the delegate method:

func xmppRoom(sender: XMPPRoom!, didReceiveMessage message: XMPPMessage!, fromOccupant occupantJID: XMPPJID!) {

}

How can I get the nickname of the user who send the message?

I tried message.from().user but this did not print the nickname.

I now use message.fromStr())!.lastPathComponent! but this feels very wrong.

Any better way to do this?

funkenstrahlen
  • 3,032
  • 2
  • 28
  • 40

2 Answers2

0

try following,

Message.from().resource

nikBhosale
  • 531
  • 1
  • 5
  • 27
-1

I know this is too late but, this answer may help others so I am posting answer

// this statement gives sender's nick name
message.attributeForName("from").stringValue

hope this helps.

s Hetul
  • 94
  • 6