mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 12:15:12 +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
11
README.MD
11
README.MD
|
|
@ -37,10 +37,21 @@ TODO
|
|||
## TODOS
|
||||
- Mess with Cytoplasm to make it have support for something like Berkeley DB as
|
||||
an *optional* dependency. This should increase reliability and speed for anyone.
|
||||
- Nesting might be an issue we'll need to deal with. libdb and Berkley DB
|
||||
seem to lack support for them. If we can shove entries at specific indices,
|
||||
we _might_ just manage to get some system that can at least emulate that,
|
||||
and hopefully be reasonably faster than the filesystem, with some added
|
||||
reliability.
|
||||
|
||||
- PROPER FUCKING AVATARS
|
||||
XEP-0084 IS THE WORST PIECE OF SHIT KNOWN TO MAN. If any Jabberbros want to
|
||||
look at terrible code/XML and suggest things to have *proper* avatar support,
|
||||
I'm all in.
|
||||
- Consider making room/MUC admins/owners be able to plumb instead of it being
|
||||
restricted to Parsee admins, with permission from MUC owners, too
|
||||
- Limiting to admins may be a way to "control" consent for both, but this is
|
||||
only if Parsee admins are good-willed, which we must assume such statment to
|
||||
be false by default.
|
||||
- Look at XEPS-TBD.TXT for XEPs to be done
|
||||
- Achievements
|
||||
### Why?
|
||||
|
|
|
|||
|
|
@ -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