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

View file

@ -26,11 +26,6 @@ SignalHandler(int signal)
HttpServerStop(data->server); HttpServerStop(data->server);
return; return;
} }
if (signal == SIGPIPE)
{
Log(LOG_DEBUG, "Caught a SIGPIPE...");
return;
}
} }
bool bool
@ -46,7 +41,7 @@ ParseeInitialiseSignals(ParseeData *d, pthread_t xmpp)
sa.sa_flags = SA_RESTART; sa.sa_flags = SA_RESTART;
#define Register(act) (sigaction(act, &sa, NULL) >= 0) #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..."); Log(LOG_ERR, "Couldn't register signals...");
return false; 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) 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); close(sd);
sd = -1; sd = -1;
continue; continue;
@ -82,6 +86,10 @@ XMPPInitialiseCompStream(char *addr, char *host, int port)
stream = StreamFd(sd); stream = StreamFd(sd);
if (!stream) if (!stream)
{ {
Log(LOG_ERR,
"%s: cannot connect to '%s': %s", __func__,
host, "couldn't create a Cytoplasm stream"
);
close(sd); close(sd);
return NULL; return NULL;
} }