mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:25:11 +00:00
[ADD] Push pupmet events too.
This commit is contained in:
parent
1126497d5b
commit
82bed09b03
4 changed files with 25 additions and 5 deletions
|
|
@ -93,7 +93,7 @@ ParseeMessageHandler(ParseeData *data, HashMap *event)
|
||||||
char *user = GrabString(json, 1, "xmpp_user");
|
char *user = GrabString(json, 1, "xmpp_user");
|
||||||
char *local = ParseeEncodeMXID(sender);
|
char *local = ParseeEncodeMXID(sender);
|
||||||
|
|
||||||
XMPPSendPlain(jabber, local, user, body, NULL, NULL, NULL);
|
XMPPSendPlain(jabber, local, user, body, NULL, NULL, NULL, ev_id);
|
||||||
|
|
||||||
Free(local);
|
Free(local);
|
||||||
Free(reply_id);
|
Free(reply_id);
|
||||||
|
|
@ -124,7 +124,7 @@ ParseeMessageHandler(ParseeData *data, HashMap *event)
|
||||||
XMPPSendPlain(
|
XMPPSendPlain(
|
||||||
jabber, jid, muc_id,
|
jabber, jid, muc_id,
|
||||||
xepd ? xepd : body, "groupchat",
|
xepd ? xepd : body, "groupchat",
|
||||||
stanza, sender
|
stanza, sender, ev_id
|
||||||
);
|
);
|
||||||
Free(rev);
|
Free(rev);
|
||||||
Free(name);
|
Free(name);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <XML.h>
|
#include <XML.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type, char *rst, char *rse)
|
XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type, char *rst, char *rse, char *event_id)
|
||||||
{
|
{
|
||||||
XMLElement *message, *body, *data, *parsee;
|
XMLElement *message, *body, *data, *parsee;
|
||||||
char *from;
|
char *from;
|
||||||
|
|
@ -33,6 +33,7 @@ XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type, ch
|
||||||
XMLElement *parsee_version, *ver_elem;
|
XMLElement *parsee_version, *ver_elem;
|
||||||
XMLElement *parsee_link, *link_elem;
|
XMLElement *parsee_link, *link_elem;
|
||||||
XMLElement *parsee_text, *text_elem;
|
XMLElement *parsee_text, *text_elem;
|
||||||
|
XMLElement *parsee_event, *event_elem;
|
||||||
|
|
||||||
parsee_version = XMLCreateTag("version");
|
parsee_version = XMLCreateTag("version");
|
||||||
ver_elem = XMLCreateText(VERSION);
|
ver_elem = XMLCreateText(VERSION);
|
||||||
|
|
@ -53,6 +54,14 @@ XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type, ch
|
||||||
text_elem = XMLCreateText("LDA will never beat the allegations");
|
text_elem = XMLCreateText("LDA will never beat the allegations");
|
||||||
XMLAddChild(parsee_text, text_elem);
|
XMLAddChild(parsee_text, text_elem);
|
||||||
XMLAddChild(parsee, parsee_text);
|
XMLAddChild(parsee, parsee_text);
|
||||||
|
|
||||||
|
if (event_id)
|
||||||
|
{
|
||||||
|
parsee_event = XMLCreateTag("event-id");
|
||||||
|
event_elem = XMLCreateText(event_id);
|
||||||
|
XMLAddChild(parsee_event, event_elem);
|
||||||
|
XMLAddChild(parsee, parsee_event);
|
||||||
|
}
|
||||||
/* TODO: Add custom fields depending on the caller's wishes */
|
/* TODO: Add custom fields depending on the caller's wishes */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,18 @@ MessageStanza(ParseeData *args, XMLElement *stanza)
|
||||||
Free(res);
|
Free(res);
|
||||||
Free(encoded);
|
Free(encoded);
|
||||||
}
|
}
|
||||||
|
else if (mroom_id)
|
||||||
|
{
|
||||||
|
XMLElement *parsee = XMLookForUnique(stanza, "x-parsee");
|
||||||
|
XMLElement *event = XMLookForUnique(parsee, "event-id");
|
||||||
|
XMLElement *e_d = ArrayGet(event ? event->children : NULL, 0);
|
||||||
|
char *s_id_str = XMPPGetStanzaID(stanza);
|
||||||
|
char *id_str = HashMapGet(stanza->attrs, "id");
|
||||||
|
if (ParseeVerifyStanza(args, chat_id, s_id_str))
|
||||||
|
{
|
||||||
|
ParseePushStanza(args, chat_id, s_id_str, id_str, e_d->data, from);
|
||||||
|
}
|
||||||
|
}
|
||||||
Free(chat_id);
|
Free(chat_id);
|
||||||
Free(mroom_id);
|
Free(mroom_id);
|
||||||
Free(from_matrix);
|
Free(from_matrix);
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,7 @@ extern bool XMPPAuthenticateCompStream(XMPPComponent *comp, char *shared);
|
||||||
extern void XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc);
|
extern void XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc);
|
||||||
|
|
||||||
/* TODO: XMPP stuff, I don't fucking know, I'm not a Jabbernerd. */
|
/* TODO: XMPP stuff, I don't fucking know, I'm not a Jabbernerd. */
|
||||||
extern void XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type, char *rst, char *rse);
|
extern void XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type, char *rst, char *rse, char *event_id);
|
||||||
extern void XMPPSendMUC(XMPPComponent *comp, char *fr, char *as, char *to, char *msg, char *type);
|
|
||||||
|
|
||||||
/* Closes a raw component stream. */
|
/* Closes a raw component stream. */
|
||||||
extern void XMPPEndCompStream(XMPPComponent *stream);
|
extern void XMPPEndCompStream(XMPPComponent *stream);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue