From 2324f9afc0b82a032100d96de65832863b49d076 Mon Sep 17 00:00:00 2001 From: LDA Date: Sun, 22 Sep 2024 18:36:53 +0200 Subject: [PATCH] [MOD/META] Clarify LICENSE more, fix chatstates --- CHANGELOG.md | 25 ++++++++++++++--------- LICENSE | 2 +- src/AS/Indicators.c | 5 +++-- src/XMPPThread/Stanzas/Message.c | 34 +++++++++++++++++++++++++++----- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e038b1..ea26c72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ Dates are to be written as DD/MM/YYYY. Please update the changelog as you go, no one wants to keep track of every commit done between releases. +## Release +*There is currently no full releases of Parsee* + +## Beta +*There is currently no beta releases of Parsee* + ## Alpha ### v0.1.0[tomboyish-bridges-adventure] <9/9/2024> Nothing much to say, but this is the first alpha release @@ -18,18 +24,19 @@ of Parsee. May occasionally deadlock. *NONE* ### v0.1.1[star-of-hope] -Fixes some media metadata things, and replaces the build -system of Parsee. +Fixes some media metadata things, replaces the build system, +and speeds up Parsee a tad bit. #### New things - Start dealing with some basic PEP-based avatars. -#### 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. -- Start fixing bug where Parsee takes several seconds to send a -message coming from XMPP +#### Bugfixes +- Adds more information to media events so that clients can +behave. +- Fixes issues where SIGPIPE can actually just kill Parsee. +- "Lone" XMPP messages no longer render weirdly on Element +Android's weird rendering. +- Start fixing bug where Parsee takes several seconds to send +a message coming from XMPP #### Deprecated features - The old `build.c` and `Makefile`s used for building are removed, and replaced by the `configure.c` C file(/script via TCC). diff --git a/LICENSE b/LICENSE index ce865e6..cb9aa73 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ For the files src/include/Unistring.h, src/Unistr.h rc/Parsee/HMAC.c, src/XML/*, tools/*, src/include/XML.h, etc/*, and Makefile, see COPYING.CC0. -For any other file in src/, see COPYING.AGPL as the primary license. +For any other file in src/, see COPYING.AGPL as the primary license(AGPL-3.0-or-later) As Parsee depends on Cytoplasm, its license is left here in COPYING.CYTO diff --git a/src/AS/Indicators.c b/src/AS/Indicators.c index afe860a..9797649 100644 --- a/src/AS/Indicators.c +++ b/src/AS/Indicators.c @@ -30,8 +30,9 @@ ASType(const ParseeConfig *c, char *user, char *room, bool status) json = HashMapCreate(); HashMapSet(json, "typing", JsonValueBoolean(status)); - /* If someone types for 10 minutes straight, they got something weird man. */ - HashMapSet(json, "timeout", JsonValueBoolean(10 MINUTES)); + /* If someone types for 5 minutes straight, they got something + * weird man. */ + HashMapSet(json, "timeout", JsonValueInteger(5 MINUTES)); ctx = ParseeCreateRequest(c, HTTP_PUT, path); Free(path); ASAuthenticateRequest(c, ctx); diff --git a/src/XMPPThread/Stanzas/Message.c b/src/XMPPThread/Stanzas/Message.c index a442db8..d477d8e 100644 --- a/src/XMPPThread/Stanzas/Message.c +++ b/src/XMPPThread/Stanzas/Message.c @@ -20,14 +20,22 @@ LazyRegister(ParseeData *data, char *mxid, char *name) { ASRegisterUser(data->config, mxid); ref = DbCreate(data->db, 2, "users", hash); - HashMapSet(DbJson(ref), "mxid", JsonValueString(mxid)); - HashMapSet(DbJson(ref), "ts", JsonValueInteger(UtilTsMillis())); + if (ref) + { + HashMapSet(DbJson(ref), "mxid", JsonValueString(mxid)); + HashMapSet(DbJson(ref), + "ts", JsonValueInteger(UtilTsMillis()) + ); + } } dbname = GrabString(DbJson(ref), 1, "name"); if (name && !StrEquals(dbname, name)) { ASSetName(data->config, mxid, name); - HashMapSet(DbJson(ref), "name", JsonValueString(name)); + if (ref) + { + HashMapSet(DbJson(ref), "name", JsonValueString(name)); + } } DbUnlock(data->db, ref); Free(hash); @@ -101,8 +109,24 @@ ProcessChatstates(ParseeData *args, XMLElement *stanza) mroom_id = NULL; from_matrix = NULL; } - if (XMLookForTKV(stanza, "paused", "xmlns", CHAT_STATES) || - XMLookForTKV(stanza, "received", "xmlns", "urn:xmpp:receipts") || + if (XMLookForTKV(stanza, "paused", "xmlns", CHAT_STATES)) + { + char *latest = NULL; + from_matrix = ParseeGetBridgedUser(args, stanza); + mroom_id = ParseeGetBridgedRoom(args, stanza); + + latest = ParseeLookupHead(mroom_id); + + ASType(args->config, from_matrix, mroom_id, false); + ASPresence(args->config, from_matrix, mroom_id, latest); + + Free(from_matrix); + Free(latest); + Free(mroom_id); + mroom_id = NULL; + from_matrix = NULL; + } + if (XMLookForTKV(stanza, "received", "xmlns", "urn:xmpp:receipts") || XMLookForTKV(stanza, "displayed", "xmlns", "urn:xmpp:chat-markers:0")) { /* TODO: Use stanza ID if possible */