Advertisement
Guest User

SubDoLubDub

a guest
Sep 27th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const SubDoLubDub = (client, stanzas) => {
  2.   const types = stanzas.utils;
  3.  
  4.   const Event = stanzas.define({
  5.     name: '_event',
  6.     element: 'event',
  7.     fields: {
  8.       node: types.attribute('node'),
  9.     },
  10.   });
  11.  
  12.   const Subscribe = stanzas.define({
  13.     name: 'mucsub',
  14.     namespace: 'urn:xmpp:mucsub:0',
  15.     element: 'subscribe',
  16.     fields: {
  17.       nick: types.attribute('nick'),
  18.       events: types.multiExtension(Event),
  19.     }
  20.   });
  21.  
  22.   stanzas.withIQ((IQ) => {
  23.     stanzas.extend(IQ, Subscribe);
  24.   });
  25. };
  26.  
  27. const client = XMPP.createClient({
  28.   ...
  29. });
  30.  
  31. client.use(SubDoLubDub);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement