ReactionsElement.fromStanza constructor

ReactionsElement.fromStanza(
  1. XmppElement stanza
)

Implementation

ReactionsElement.fromStanza(XmppElement stanza) {
  userId = int.tryParse(stanza.getAttribute('user_id')?.value ?? '') ?? -1;
  messageId = stanza.getAttribute('message_id')?.value ?? '';

  for (var child in stanza.children) {
    for (var attribute in child.attributes) {
      if (attribute.name == 'add') {
        addReaction = child.getAttribute('type')?.value;
      } else if (attribute.name == 'remove') {
        removeReaction = child.getAttribute('type')?.value;
      }
    }
  }
}