mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:25:11 +00:00
[MOD] Do NOT JUST RANDOMLY BRIDGE PLUMBED MUCS
See README.MD for further thoughts that shall eventually be implemented. Still need to deal with MUC/room "consent". PM'ing the MUC owner with a form/using commands may be a nice course of action for that.
This commit is contained in:
parent
df394172ec
commit
9e5e741989
3 changed files with 24 additions and 14 deletions
|
|
@ -24,51 +24,40 @@ CommandHead(CmdPlumb, cmd, argp)
|
|||
BotRequired(room);
|
||||
|
||||
/* Check MUC viability */
|
||||
Log(LOG_INFO, "BAR1");
|
||||
if (ParseeManageBan(args->data, muc, NULL))
|
||||
{
|
||||
ReplySprintf("MUC '%s' is not allowed on this bridge.", muc);
|
||||
Log(LOG_INFO, "BAR1F");
|
||||
goto end;
|
||||
}
|
||||
Log(LOG_INFO, "BAR2");
|
||||
if (!XMPPQueryMUC(args->data->jabber, muc, &info))
|
||||
{
|
||||
ReplySprintf("MUC '%s' does not exist.", muc);
|
||||
Log(LOG_INFO, "BAR2F");
|
||||
goto end;
|
||||
}
|
||||
Log(LOG_INFO, "BAR3");
|
||||
if ((chat_id = ParseeGetFromMUCID(args->data, muc)))
|
||||
{
|
||||
ReplySprintf("MUC '%s' is already mapped to %s.", muc, chat_id);
|
||||
Free(chat_id);
|
||||
chat_id = NULL;
|
||||
ReplySprintf("MUC '%s' is already mapped.", muc);
|
||||
Log(LOG_INFO, "BAR3F");
|
||||
goto end;
|
||||
}
|
||||
|
||||
Log(LOG_INFO, "FOO");
|
||||
|
||||
/* Check room viability */
|
||||
room_id = ASJoin(args->data->config, room, NULL);
|
||||
if (!room_id)
|
||||
{
|
||||
ReplySprintf("Room '%s' does not exist.", room);
|
||||
Log(LOG_INFO, "FOO2");
|
||||
goto end;
|
||||
}
|
||||
Log(LOG_INFO, "FOO3");
|
||||
if ((chat_id = ParseeGetFromRoomID(args->data, room_id)))
|
||||
{
|
||||
Free(chat_id);
|
||||
chat_id = NULL;
|
||||
ReplySprintf("Room '%s' is already mapped.", room);
|
||||
Log(LOG_INFO, "FOO4");
|
||||
goto end;
|
||||
}
|
||||
|
||||
Log(LOG_INFO, "FOO5");
|
||||
chat_id = ParseePushMUC(args->data, room_id, muc);
|
||||
if (chat_id)
|
||||
{
|
||||
|
|
@ -77,11 +66,9 @@ CommandHead(CmdPlumb, cmd, argp)
|
|||
|
||||
Free(rev);
|
||||
}
|
||||
Log(LOG_INFO, "FOO6");
|
||||
|
||||
ReplySprintf("Plumbed '%s'", muc);
|
||||
end:
|
||||
Log(LOG_INFO, "End.");
|
||||
BotDestroy();
|
||||
Free(chat_id);
|
||||
Free(room_id);
|
||||
|
|
|
|||
|
|
@ -85,6 +85,18 @@ RouteHead(RouteRoomAck, arr, argp)
|
|||
);
|
||||
goto end;
|
||||
}
|
||||
if ((chatid = ParseeGetFromMUCID(args->data, muc)))
|
||||
{
|
||||
/* TODO: Should we map the plumbed MUC? */
|
||||
Free(chatid);
|
||||
chatid = NULL;
|
||||
HttpResponseStatus(args->ctx, HTTP_METHOD_NOT_ALLOWED);
|
||||
response = MatrixCreateError(
|
||||
"M_UNRECOGNIZED",
|
||||
"Room is already plumbed"
|
||||
);
|
||||
goto end;
|
||||
}
|
||||
creator = StrConcat(
|
||||
4,
|
||||
"@", args->data->config->sender_localpart, ":",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue