mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 18:35:11 +00:00
[FIX/ADD/WIP] Fix very silly printf, media flags
This commit is contained in:
parent
033dba6840
commit
960599d983
4 changed files with 29 additions and 2 deletions
|
|
@ -707,3 +707,21 @@ ParseeSetChatSetting(ParseeData *data, char *chat, char *key, char *val)
|
||||||
DbUnlock(data->db, ref);
|
DbUnlock(data->db, ref);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bool
|
||||||
|
ParseeIsMediaEnabled(ParseeData *data, char *chat_id)
|
||||||
|
{
|
||||||
|
char *value;
|
||||||
|
bool ret;
|
||||||
|
if (!data || !chat_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = !StrEquals(
|
||||||
|
(value = ParseeGetChatSetting(data, chat_id, "p.media.enabled")),
|
||||||
|
"false"
|
||||||
|
);
|
||||||
|
Free(value);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ XMPPSendStanza(XMPPComponent *comp, XMLElement *stanza, size_t max)
|
||||||
|
|
||||||
|
|
||||||
pthread_mutex_lock(&comp->write_lock);
|
pthread_mutex_lock(&comp->write_lock);
|
||||||
StreamPrintf(comp->stream, c);
|
StreamPrintf(comp->stream, "%s", c);
|
||||||
StreamFlush(comp->stream);
|
StreamFlush(comp->stream);
|
||||||
pthread_mutex_unlock(&comp->write_lock);
|
pthread_mutex_unlock(&comp->write_lock);
|
||||||
Free(c);
|
Free(c);
|
||||||
|
|
|
||||||
|
|
@ -390,6 +390,12 @@ end_error:
|
||||||
if (ParseeVerifyAllStanza(args, stanza) && !replaced)
|
if (ParseeVerifyAllStanza(args, stanza) && !replaced)
|
||||||
{
|
{
|
||||||
XMLElement *oob, *oob_data;
|
XMLElement *oob, *oob_data;
|
||||||
|
char *chat_id = ParseeGetFromMUCID(args, from);
|
||||||
|
bool media_enabled = chat_id ?
|
||||||
|
ParseeIsMediaEnabled(args, chat_id) :
|
||||||
|
true ;
|
||||||
|
|
||||||
|
Free(chat_id);
|
||||||
|
|
||||||
pthread_mutex_unlock(&thr->info->chk_lock);
|
pthread_mutex_unlock(&thr->info->chk_lock);
|
||||||
|
|
||||||
|
|
@ -405,7 +411,7 @@ end_error:
|
||||||
|
|
||||||
/* Check if it is a media link */
|
/* Check if it is a media link */
|
||||||
oob = XMLookForTKV(stanza, "x", "xmlns", "jabber:x:oob");
|
oob = XMLookForTKV(stanza, "x", "xmlns", "jabber:x:oob");
|
||||||
if (oob && data)
|
if (oob && data && media_enabled)
|
||||||
{
|
{
|
||||||
char *mxc, *mime = NULL;
|
char *mxc, *mime = NULL;
|
||||||
HashMap *content = NULL;
|
HashMap *content = NULL;
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,9 @@ ParseeFreeChatSettings(HashMap *settings);
|
||||||
extern void
|
extern void
|
||||||
ParseeSetChatSetting(ParseeData *data, char *chat, char *key, char *val);
|
ParseeSetChatSetting(ParseeData *data, char *chat, char *key, char *val);
|
||||||
|
|
||||||
|
extern bool
|
||||||
|
ParseeIsMediaEnabled(ParseeData *data, char *chat_id);
|
||||||
|
|
||||||
/* Pushes a stanza ID to a chat ID */
|
/* Pushes a stanza ID to a chat ID */
|
||||||
extern void ParseePushStanza(ParseeData *, char *chat_id, char *stanza_id, char *origin_id, char *event, char *sender);
|
extern void ParseePushStanza(ParseeData *, char *chat_id, char *stanza_id, char *origin_id, char *event, char *sender);
|
||||||
extern void ParseePushDMStanza(ParseeData *, char *room_id, char *stanza_id, char *origin_id, char *event, char *sender);
|
extern void ParseePushDMStanza(ParseeData *, char *room_id, char *stanza_id, char *origin_id, char *event, char *sender);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue