removeRosterItem method

Future<IqStanzaResult> removeRosterItem(
  1. Buddy rosterItem
)

Implementation

Future<IqStanzaResult> removeRosterItem(Buddy rosterItem) {
  var completer = Completer<IqStanzaResult>();
  var iqStanza = IqStanza(AbstractStanza.getRandomId(), IqStanzaType.SET);
  var queryElement = XmppElement();
  queryElement.name = 'query';
  queryElement.addAttribute(XmppAttribute('xmlns', 'jabber:iq:roster'));
  iqStanza.addChild(queryElement);
  var itemElement = XmppElement();
  itemElement.name = 'item';
  queryElement.addChild(itemElement);
  itemElement.addAttribute(XmppAttribute('jid', rosterItem.jid!.userAtDomain));
  itemElement.addAttribute(XmppAttribute('subscription', 'remove'));
  _myUnrespondedIqStanzas[iqStanza.id!] = Tuple2(iqStanza, completer);
  ;
  _connection.writeStanza(iqStanza);
  return completer.future;
}