mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 17:05:11 +00:00
[MOD] Add CHANGELOG, start PEPing
This commit is contained in:
parent
420c05690f
commit
f666f39b7c
7 changed files with 62 additions and 22 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -18,10 +18,16 @@ of Parsee. May occasionally deadlock.
|
|||
*NONE*
|
||||
|
||||
### v0.1.1[star-of-hope] <X/X/XXXX>
|
||||
Fixes some media metadata things.
|
||||
Fixes some media metadata things, and replaces the build
|
||||
system of Parsee.
|
||||
#### New things
|
||||
*NONE*
|
||||
#### Bugfixes
|
||||
- Adds more information to media events so that clients can behave.
|
||||
- Fixes issues where SIGPIPE can actually just kill Parsee.
|
||||
- Allows MbedTLS through a specific Cytoplasm patch.
|
||||
- "Lone" XMPP messages no longer render weirdly on Element Android's
|
||||
weird rendering.
|
||||
#### Deprecated features
|
||||
*NONE*
|
||||
- The old `build.c` and `Makefile`s used for building are removed,
|
||||
and replaced by the `configure.c` C file(/script via TCC).
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ Currently, the main sources of documentation are the Ayadocs(for headers) and th
|
|||
(see `etc/man`)
|
||||
|
||||
## TODOS before 1.0 rolls around
|
||||
- PROPER FUCKING AVATARS
|
||||
XMPP->Matrix is decent, Matrix->XMPP is effectiveny not done
|
||||
- Add [libomemo](https://github.com/gkdr/libomemo) or something as an optional dependency.
|
||||
- It depends on more stuff anyways, and I don't want to weigh down the
|
||||
dependency list of Parsee for that.
|
||||
|
|
@ -79,8 +81,6 @@ Currently, the main sources of documentation are the Ayadocs(for headers) and th
|
|||
extension packagers may integrate properly.
|
||||
- Get rid of the '?'-syntax and use another invalid Matrix char/valid XMPP char
|
||||
('$'?) for escaped?
|
||||
- PROPER FUCKING AVATARS
|
||||
XMPP->Matrix is decent, Matrix->XMPP is effectiveny not done
|
||||
- Consider making room/MUC admins/owners be able to plumb instead of it being
|
||||
restricted to Parsee admins, with permission from MUC owners, too
|
||||
- Limiting to admins may be a way to "control" consent for both, but this is
|
||||
|
|
@ -91,7 +91,6 @@ restricted to Parsee admins, with permission from MUC owners, too
|
|||
support XMPP->Matrix bridging.
|
||||
- Manage MUC DMs in a reasonable manner. Thanks `@freeoffers4u:matrix.org` for being
|
||||
a fucking annoyance and DMing an old Parsee semi-anon user for no clear reason.
|
||||
- Deadlocks. It's always deadlocks.
|
||||
|
||||
## DONATING/CONTRIBUTING
|
||||
If you know things about XMPP or Matrix, yet aren't familiar with C99, or just
|
||||
|
|
|
|||
|
|
@ -286,16 +286,6 @@ SetStanzaXParsee(StanzaBuilder *builder, HashMap *e)
|
|||
XMLAddChild(parsee_link, link_elem);
|
||||
XMLAddChild(parsee, parsee_link);
|
||||
|
||||
parsee_text = XMLCreateTag("zayds-note");
|
||||
text_elem = XMLCreateText("\"LDA HANG YOURSELF\" - Zayd");
|
||||
XMLAddChild(parsee_text, text_elem);
|
||||
XMLAddChild(parsee, parsee_text);
|
||||
|
||||
parsee_text = XMLCreateTag("mcnebs-note");
|
||||
text_elem = XMLCreateText("LDA will never beat the allegations");
|
||||
XMLAddChild(parsee_text, text_elem);
|
||||
XMLAddChild(parsee, parsee_text);
|
||||
|
||||
if (event_id)
|
||||
{
|
||||
parsee_event = XMLCreateTag("event-id");
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
#include <XMPP.h>
|
||||
#include <XML.h>
|
||||
|
||||
#define PUBSUB "http://jabber.org/protocol/pubsub"
|
||||
|
||||
XMLElement *
|
||||
CreatePubsubRequest(char *from, char *to, char *node)
|
||||
{
|
||||
|
|
@ -22,7 +24,7 @@ CreatePubsubRequest(char *from, char *to, char *node)
|
|||
XMLAddAttr(iq_req, "type", "set");
|
||||
|
||||
pubsub = XMLCreateTag("pubsub");
|
||||
XMLAddAttr(pubsub, "xmlns", "http://jabber.org/protocol/pubsub");
|
||||
XMLAddAttr(pubsub, "xmlns", PUBSUB);
|
||||
XMLAddChild(iq_req, pubsub);
|
||||
|
||||
sub = XMLCreateTag("subscribe");
|
||||
|
|
@ -34,12 +36,40 @@ CreatePubsubRequest(char *from, char *to, char *node)
|
|||
return iq_req;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsPubsubRequest(XMLElement *stanza)
|
||||
{
|
||||
char *type = HashMapGet(stanza ? stanza->attrs : NULL, "type");
|
||||
XMLElement *pubsub, *subscribe;
|
||||
if (!stanza)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!StrEquals(stanza->name, "iq") ||
|
||||
!StrEquals(type, "set"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pubsub = XMLookForTKV(stanza, "pubsub", "xmlns", PUBSUB);
|
||||
if (!pubsub)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return XMLookForUnique(pubsub, "subscribe");
|
||||
}
|
||||
|
||||
|
||||
struct PEPManager {
|
||||
pthread_mutex_t lock;
|
||||
|
||||
ParseeData *data;
|
||||
HashMap *node_table;
|
||||
|
||||
HashMap *followers;
|
||||
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
|
|
@ -56,6 +86,7 @@ CreatePEPManager(ParseeData *data, void *cookie)
|
|||
ret->cookie = cookie;
|
||||
ret->data = data;
|
||||
ret->node_table = HashMapCreate();
|
||||
ret->followers = HashMapCreate();
|
||||
pthread_mutex_init(&ret->lock, NULL);
|
||||
|
||||
return ret;
|
||||
|
|
@ -91,9 +122,9 @@ PEPManagerHandleEvent(PEPManager *manager, XMLElement *stanza)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
#define PEP_NS "http://jabber.org/protocol/pubsub"
|
||||
if (!(ps = XMLookForTKV(stanza, "pubsub", "xmlns", PEP_NS)) &&
|
||||
!(ev = XMLookForTKV(stanza, "event", "xmlns", PEP_NS "#event")))
|
||||
|
||||
if (!(ps = XMLookForTKV(stanza, "pubsub", "xmlns", PUBSUB)) &&
|
||||
!(ev = XMLookForTKV(stanza, "event", "xmlns", PUBSUB "#event")))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -135,6 +166,11 @@ PEPManagerHandle(PEPManager *manager, XMLElement *stanza)
|
|||
}
|
||||
|
||||
/* Check if it is a PEP stanza */
|
||||
if (IsPubsubRequest(stanza))
|
||||
{
|
||||
Log(LOG_DEBUG, "UNIMPLEMENTED PUBSUB SUBSCRIPTION");
|
||||
/* TODO */
|
||||
}
|
||||
if (PEPManagerHandleEvent(manager, stanza))
|
||||
{
|
||||
return true;
|
||||
|
|
@ -158,5 +194,8 @@ DestroyPEPManager(PEPManager *manager)
|
|||
Free(val);
|
||||
}
|
||||
HashMapFree(manager->node_table);
|
||||
|
||||
HashMapFree(manager->followers);
|
||||
|
||||
Free(manager);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ XMPPDispatcher(void *argp)
|
|||
|
||||
if (StrEquals(stanza->name, "presence"))
|
||||
{
|
||||
PresenceStanza(args, stanza);
|
||||
PresenceStanza(args, stanza, thread);
|
||||
XMLFreeElement(stanza);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ GuessStatus(XMLElement *stanza)
|
|||
return USER_STATUS_ONLINE;
|
||||
}
|
||||
void
|
||||
PresenceStanza(ParseeData *args, XMLElement *stanza)
|
||||
PresenceStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
||||
{
|
||||
#define MUC_USER_NS "http://jabber.org/protocol/muc#user"
|
||||
XMLElement *user_info;
|
||||
|
|
@ -66,6 +66,11 @@ PresenceStanza(ParseeData *args, XMLElement *stanza)
|
|||
|
||||
char *oid = HashMapGet(stanza->attrs, "from");
|
||||
|
||||
if (PEPManagerHandle(thr->info->pep_manager, stanza))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ServerHasXEP421(args, oid))
|
||||
{
|
||||
XMLElement *occupant = XMLookForTKV(
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ XMLElement * CreatePubsubRequest(char *from, char *to, char *node);
|
|||
|
||||
bool MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr);
|
||||
void IQStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr);
|
||||
void PresenceStanza(ParseeData *args, XMLElement *stanza);
|
||||
void PresenceStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr);
|
||||
|
||||
bool ServerHasXEP421(ParseeData *data, char *from);
|
||||
|
||||
|
|
@ -89,6 +89,7 @@ PEPManager * CreatePEPManager(ParseeData *data, void *cookie);
|
|||
void * PEPManagerCookie(PEPManager *manager);
|
||||
void PEPManagerAddEvent(PEPManager *manager, char *node, PEPEvent event);
|
||||
bool PEPManagerHandle(PEPManager *manager, XMLElement *stanza);
|
||||
void PEPManagerBroadcast(PEPManager *manager, char *as, XMLElement *item);
|
||||
void DestroyPEPManager(PEPManager *manager);
|
||||
|
||||
/* PEP callbacks for the handler */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue