mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 15:15:10 +00:00
32 lines
638 B
C
32 lines
638 B
C
#include <Parsee.h>
|
|
|
|
#include <string.h>
|
|
|
|
bool
|
|
ParseeIsPuppet(const ParseeConfig *conf, char *user)
|
|
{
|
|
char *localpart;
|
|
bool flag = true;
|
|
size_t len;
|
|
if (!user || !conf || *user != '@')
|
|
{
|
|
return false;
|
|
}
|
|
|
|
localpart = user + 1;
|
|
len = strlen(conf->namespace_base);
|
|
if (strncmp(localpart, conf->namespace_base, len))
|
|
{
|
|
flag = false;
|
|
}
|
|
|
|
len = strlen(conf->sender_localpart);
|
|
if (!strncmp(localpart, conf->sender_localpart, len))
|
|
{
|
|
flag = true;
|
|
}
|
|
|
|
/* TODO: Check serverpart. 2 Parsee instances may be running in the same
|
|
* room. */
|
|
return flag;
|
|
}
|