From a92e3daafa6704b1267b4a3a34dcd459d1c80905 Mon Sep 17 00:00:00 2001 From: LDA Date: Tue, 6 Aug 2024 15:01:27 +0200 Subject: [PATCH] Install rules IDK I HATE GIT --- DATES.TXT | 4 +++- Makefile | 23 ++++++++++++++++++++--- README.MD | 18 +++++++++++++++--- XEPS-TBD.TXT | 11 ++++------- src/Command/Parser.c | 10 ++++++---- src/Signal.c | 10 ++++------ src/include/AS.h | 33 ++++++++++++++++++++++++++------- tools/aya.c | 3 --- 8 files changed, 78 insertions(+), 34 deletions(-) diff --git a/DATES.TXT b/DATES.TXT index 256475a..51c7719 100644 --- a/DATES.TXT +++ b/DATES.TXT @@ -2,4 +2,6 @@ Some dates for Parsee-related events. They mostly serve as LDA's TODOs with a strict deadline: - ~September 2024: Get Parsee into the _Phantasmagoria of Bug View_ stage (essentially - v0.0.1 for a public testing) once I can afford `yama`. + v0.0.1 for a public testing) once I can afford `yama`, and start + bridging the Matrix room alongside a shiny XMPP MUC, bridged by + yours truly. diff --git a/Makefile b/Makefile index 5bde52d..f02a9e5 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,11 @@ VERSION=0.0.0 REPOSITORY=$(shell git remote get-url origin) # =========================== Compilation Flags ============================ -CYTO_INC=/usr/local/include/ # Where Cytoplasm's include path is +CYTO_INC ?=/usr/local/include/ # Where Cytoplasm's include path is # located. -CYTO_LIB=/usr/local/lib # Where's Cytoplasm's library is +CYTO_LIB ?=/usr/local/lib # Where's Cytoplasm's library is # located. +PREFIX ?=/usr/local SOURCE=src OBJECT=build @@ -53,4 +54,20 @@ $(AYAS)/%.html: $(INCLUDES)/%.h @mkdir -p $(shell dirname "$@") tools/out/aya $(AFLAGS) -i $< -o $@ -# TODO: a install rule that reads prefix for software packagers? + +# Installs everything. Except Ayadocs. Get pranked. +install: binary utils ayadoc install_setup install_parsee install_tools + @echo $(PREFIX) + +install_setup: + install -dm755 "$(PREFIX)/bin" + install -dm755 "$(PREFIX)/doc" + +install_parsee: + install -Dm755 "$(BINARY)" "$(PREFIX)/bin/$(BINARY)" + +TOOLS:=$(shell find 'tools/out' -name '*') +ITOOL:=${subst tools/out/,$(PREFIX)/bin/,$(TOOLS)} +install_tools: $(ITOOL) +$(PREFIX)/bin/%: tools/out/% + install -Dm755 "$<" "$@" diff --git a/README.MD b/README.MD index ce9d4b5..28720b6 100644 --- a/README.MD +++ b/README.MD @@ -16,14 +16,19 @@ codebase I'm already familiar with. ### "Why not just use Matrix lol" ### "Why not just use XMPP lol" These two having the same answer should be enough information. Also can I *just* have fun? - -~~Also dependency bad.~~ +One could also argue that both sides need to migrate(onboard) the other side, so +a bridge may be a good way to start. ## BUILDING ```sh $ make # This generates a 'parsee' executable. -$ +$ cd tools # If you want to build more tools +$ make && cd .. +$ make ayadoc # If you want to build HTML documentation +# make [PREFIX=(install path)] install # To install Parsee. ``` +If there are any Cytoplasm-related build failures, you may want to check the Makefile to +change a few variables (you can set `CYTO_INC` and `CYTO_LIB`) ### DEPENDENCIES Parsee tries to avoid dependencies aside from [Cytoplasm](https://git.telodendria.io/Telodendria/Cytoplasm). @@ -35,6 +40,13 @@ TODO TODO ## TODOS +- Add [libomemo](https://github.com/gkdr/libomemo) 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. + - Matrix's libolm is deprecated. They replaced it with a Rust version that + pulls in *way too many* dependencies, and that lacks a C binding. We may + put in the work of either forking off libolm or making a binding to KappaChat. + - Mess with Cytoplasm to make it have support for something like LMDB as an *optional* dependency. This should increase reliability and speed for anyone. - Nesting might be an issue we'll need to deal with. libdb and Berkley DB diff --git a/XEPS-TBD.TXT b/XEPS-TBD.TXT index 9878acd..02a68ca 100644 --- a/XEPS-TBD.TXT +++ b/XEPS-TBD.TXT @@ -31,12 +31,6 @@ For future XEPs: A minor issue with that is pack management. XMPP requires a pack field which is used along PEP, it seems, and meanwhile Matrix has ''support'' for packs too, tracking them is between "annoyance" and "yeah, no.". - - https://xmpp.org/extensions/xep-0080.html - Doxxing people over two protocols is great! Sadly works over PEP it seems, - so I can't think of a good analogy tbf, also I hate dealing with PEP tbf. - - https://xmpp.org/extensions/xep-0118.html - I feel like polluting Matrix status(which more clients should implement) - sounds like a bad idea. When are we getting _extensible statuses_? ON STANDBY BECAUSE THESE HAVE BEEN TERRIBLE TO DEAL WITH AND WHO KEEPS WRITING THESE I WANT TO SEND THEM A NICE, BRIGHT GIFT: @@ -45,13 +39,16 @@ THESE I WANT TO SEND THEM A NICE, BRIGHT GIFT: Matrix and XMPP both have support for these. XEP-0084 is a pain in the ass to implement and seems generally just unreliable, however. + x https://xmpp.org/extensions/xep-0080.html + Can't think of a good analogy to these... Not XEPs, but ideas that _needs_ to be added: - ~ "also it [Bifrost] doesn't respect voice either" -> Send a form on moderated + v "also it [Bifrost] doesn't respect voice either" -> Send a form on moderated MUCs (which is standard, so its not too bad!). Currently WIP, and barely tested. ~ "GIVE THE PUPPETS APPROPRIATE PLS/ROLES" - Hydro/t4d - Standalone/Static Parsee, ideally as small as it can be(if not as APE). + - Kappa-like extension system(maybe bridging more than just Matrix-XMPP.) - https://www.youtube.com/watch?v=InL414iDZmY diff --git a/src/Command/Parser.c b/src/Command/Parser.c index 7545c6b..6ff55d3 100644 --- a/src/Command/Parser.c +++ b/src/Command/Parser.c @@ -49,6 +49,7 @@ CommandParse(char *cmd) char c = *cur; char *tmp; bool type; + char char_type; switch (state) { case STATE_WHITE: @@ -73,23 +74,24 @@ CommandParse(char *cmd) } break; case STATE_VALUE: - type = c == '"'; + type = c == '"' || c == '\''; if (type) { + char_type = c; cur++; } while (*cur) { char c = *cur; char cb[2] = { c, '\0' }; - if ((type && c == '"') || (!type && isblank(c))) + if ((type && c == char_type) || (!type && isblank(c))) { break; } - if (c == '\\' && *(cur + 1) == '"') + if (c == '\\' && *(cur + 1) == char_type) { - cb[0] = '"'; + cb[0] = char_type; cur++; } tmp = val; diff --git a/src/Signal.c b/src/Signal.c index 86142f5..179d84c 100644 --- a/src/Signal.c +++ b/src/Signal.c @@ -27,11 +27,9 @@ SignalHandler(int signal) { return; } - /* Create a loopback stanza, forcing the thread to die */ /* TODO: Better way to break out. */ Log(LOG_INFO, "Killing thread..."); - //XMPPKillThread(jabber, "killer"); XMPPFinishCompStream(jabber); pthread_join(xmpp_thr, NULL); valid = false; @@ -68,10 +66,10 @@ ParseeInitialiseSignals(HttpServer *s, pthread_t xmpp, XMPPComponent *j) Log(LOG_DEBUG, "Installed signal handler: %s", #sig); \ } - SIGACTION(SIGINT, &sigAction, NULL); - SIGACTION(SIGTERM, &sigAction, NULL); - SIGACTION(SIGPIPE, &sigAction, NULL); - SIGACTION(SIGUSR1, &sigAction, NULL); /* Make USR1 do a softrestart */ + SIGACTION(SIGINT, &sigAction, NULL); + SIGACTION(SIGTERM, &sigAction, NULL); + SIGACTION(SIGPIPE, &sigAction, NULL); + SIGACTION(SIGUSR1, &sigAction, NULL); /* Make USR1 do a softrestart */ #undef SIGACTION return ret; diff --git a/src/include/AS.h b/src/include/AS.h index f12d17a..cdb67c1 100644 --- a/src/include/AS.h +++ b/src/include/AS.h @@ -30,14 +30,33 @@ extern bool ASRegisterUser(const ParseeConfig *, char *); /* Pings the homeserver to get attention. */ extern void ASPing(const ParseeConfig *); -/* Joins a room from an ID and a given user we want to masquerade - * as. */ -extern char * ASJoin(const ParseeConfig *, char *, char *); +/** Joins a room from an {id} and a given {user} we want to masquerade + * as. + * -------------- + * Returns: the decoded room ID that was joined[HEAP] | NULL + * Modifies: the rooms/{user}s inner state */ +extern char * ASJoin(const ParseeConfig *config, char *id, char *user); -/* Bans from a room a specific user */ -extern void ASBan(const ParseeConfig *, char *, char *); -extern void ASKick(const ParseeConfig *, char *, char *); -extern void ASLeave(const ParseeConfig *, char *, char *); +/** Bans from a room a specific user + * --------------------- + * Returns: NOTHING + * Modifies: the rooms state + * See-Also: ASJoin, ASKick, ASLeave */ +extern void ASBan(const ParseeConfig *config, char *room, char *user); + +/** Kicks from a room a specific user + * --------------------- + * Returns: NOTHING + * Modifies: the rooms state + * See-Also: ASJoin, ASBan, ASLeave */ +extern void ASKick(const ParseeConfig *, char *room, char *user); + +/** Makes a specific user leave the room + * --------------------- + * Returns: NOTHING + * Modifies: the rooms state + * See-Also: ASJoin, ASKick, ASBan */ +extern void ASLeave(const ParseeConfig *config, char *room, char *user); /* Invites from a room a specific user */ extern void ASInvite(const ParseeConfig *, char *, char *); diff --git a/tools/aya.c b/tools/aya.c index 64f9b8f..6a76b69 100644 --- a/tools/aya.c +++ b/tools/aya.c @@ -329,7 +329,6 @@ GenerateHTML(Stream *out, AyadocComment *ayadoc, HeaderDeclaration decl) { if (StrEquals(attr, "Returns")) { - /* TODO: Be a little more advanced. */ StreamPrintf(out, "
", decl.name); StreamPrintf(out, "

Returns

"); GenerateReturns(out, ayadoc, decl, value); @@ -339,7 +338,6 @@ GenerateHTML(Stream *out, AyadocComment *ayadoc, HeaderDeclaration decl) } else if (StrEquals(attr, "See-Also")) { - /* TODO: Be a little more advanced. */ StreamPrintf(out, "
", decl.name); StreamPrintf(out, "

See also

"); GenerateSee(out, ayadoc, decl, value); @@ -349,7 +347,6 @@ GenerateHTML(Stream *out, AyadocComment *ayadoc, HeaderDeclaration decl) } else if (StrEquals(attr, "Thrasher")) { - /* TODO: Be a little more advanced. */ StreamPrintf(out, "

", decl.name); StreamPrintf(out, "This function may be destroyed with "); StreamPrintf(out, "%s", value, value);