[MOD/FIX] Be a bit more specific with component errors

This commit is contained in:
lda 2025-01-28 15:01:57 +00:00
commit f9de7f1750
3 changed files with 11 additions and 14 deletions

View file

@ -26,20 +26,15 @@ JoinMUC(ParseeData *data, HashMap *event, char *jid, char *muc, char *name, char
char *rev = StrConcat(3, muc, "/", nick);
int nonce = 0;
Log(LOG_DEBUG, "MUCJOINER: filtered '%s' to '%s'", name, nick);
UnistrFree(uninick);
UnistrFree(filtered);
UnistrFree(filterASCII);
/* TODO: Make sure that we fall back to plain ASCII if it fails too many
* times. */
/* TODO: vCards! */
while (!XMPPJoinMUC(data->jabber, jid, rev, hash, -1, true) && nonce < 32)
{
char *nonce_str = StrInt(nonce);
char *input = StrConcat(3, sender, name, nonce_str);
char *hex = ParseeHMACS(data->id, input);
Unistr *filterASCII = UnistrFilter(uninick, UnistrIsASCII);
if (strlen(hex) >= 8)
{
@ -48,7 +43,6 @@ JoinMUC(ParseeData *data, HashMap *event, char *jid, char *muc, char *name, char
Free(nick);
Free(rev);
Free(revscii);
nick = StrConcat(4, name, "[", hex, "]");
rev = StrConcat(3, muc, "/", nick);
@ -368,7 +362,7 @@ ParseeMessageHandler(ParseeData *data, HashMap *event)
StanzaBuilder *builder = NULL;
DbRef *ref = NULL;
HashMap *json = NULL;
char *m_sender = GrabString(event, 1, "sender");
char *unedited_id = NULL;
char *body = GrabString(event, 2, "content", "body");

View file

@ -26,11 +26,6 @@ SignalHandler(int signal)
HttpServerStop(data->server);
return;
}
if (signal == SIGPIPE)
{
Log(LOG_DEBUG, "Caught a SIGPIPE...");
return;
}
}
bool
@ -46,7 +41,7 @@ ParseeInitialiseSignals(ParseeData *d, pthread_t xmpp)
sa.sa_flags = SA_RESTART;
#define Register(act) (sigaction(act, &sa, NULL) >= 0)
if (!Register(SIGTERM) || !Register(SIGINT) || !Register(SIGPIPE))
if (!Register(SIGTERM) || !Register(SIGINT))
{
Log(LOG_ERR, "Couldn't register signals...");
return false;

View file

@ -61,6 +61,10 @@ XMPPInitialiseCompStream(char *addr, char *host, int port)
if (connect(sd, res->ai_addr, res->ai_addrlen) < 0)
{
Log(LOG_ERR,
"%s: cannot connect to '%s': %s", __func__,
host, strerror(errno)
);
close(sd);
sd = -1;
continue;
@ -82,6 +86,10 @@ XMPPInitialiseCompStream(char *addr, char *host, int port)
stream = StreamFd(sd);
if (!stream)
{
Log(LOG_ERR,
"%s: cannot connect to '%s': %s", __func__,
host, "couldn't create a Cytoplasm stream"
);
close(sd);
return NULL;
}