- Server return buffer wasn't allocated -> crash
- add mandatory parameter 'go' to delete_room, so we're realy shure which room to delete.
*/
void delete_room(void)
{
- StrBuf *Line;
+ StrBuf *Line = NewStrBuf();
+ const StrBuf *GoBstr;
- serv_puts("KILL 1");
- StrBuf_ServGetln(Line);
- if (GetServerStatusMsg(Line, NULL, 1, 2) != 2) {
- display_main_menu();
- } else {
- StrBuf *Buf;
-
- FlushRoomlist ();
- Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
- smart_goto(Buf);
- FreeStrBuf(&Buf);
+ GoBstr = sbstr("go");
+
+ if (GoBstr != NULL)
+ {
+ if (gotoroom(GoBstr) == 200)
+ {
+ serv_puts("KILL 1");
+ StrBuf_ServGetln(Line);
+ if (GetServerStatusMsg(Line, NULL, 1, 2) == 2) {
+ StrBuf *Buf;
+
+ FlushRoomlist ();
+ Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
+ smart_goto(Buf);
+ FreeStrBuf(&Buf);
+ FreeStrBuf(&Line);
+ return;
+ }
+ }
}
+ display_main_menu();
FreeStrBuf(&Line);
}
<div class="tabcontent">
<ul>
<li>
- <a href="delete_room" onClick="return confirm('<?_("Are you sure you want to delete this room?")>')">
+ <a href="delete_room?go=<?THISROOM("U")>" onClick="return confirm('<?_("Are you sure you want to delete this room?")>')">
<?_("Delete this room")>
</a>
</li>