adamvduke / mod_interact

A module to forward certain ejabberd notifications to an arbitrary url
89 stars 30 forks source link

Not an issue but just want more information #17

Open bhavikdesai94 opened 8 years ago

bhavikdesai94 commented 8 years ago

mod_offline_post returns for value to, from, message, access_token is their any possibilities to returns multiple information from the mod_offline_post because when i build a message stanza at that time i have also pass some additional parameter so if is their any possibilities about it than please inform me about it.

Thanks

lion8 commented 8 years ago

Sure, you can extract all from the packet. two examples: a message stanza looks something like this: <message ..><body>..</body>..</message> lets say you add an element to pass your parameter <message ..><body>..</body><yourElement>value</yourElement>..</message> or an attribute: <message yourAttribute="value" ..><body>..</body>..</message> now you can reach it so: --element: YourElement = xml:get_path_s(Packet, [{elem, list_to_binary("yourElement")}, cdata]), --attribute: YourAttribute = xml:get_tag_attr_s(list_to_binary("yourAttribute"), Packet),

and add it to the post request: --element

Post = [
          "to=", To#jid.luser, Sep,
          "from=", From#jid.luser, Sep,
          "body=", url_encode(binary_to_list(Body)), Sep,
          "yourElement=", url_encode(binary_to_list(YourElement)), Sep,
          "access_token=", Token],

Good Luck!