# HG changeset patch # User Mikael Berthe # Date 1146766923 -7200 # Node ID f8c0447beec2a3523046a21f1cd6bb09bfc829c2 # Parent 2903fd66c3ad8c2093c683081ded33823a40b277 Allow "/room join . [nick]" if the current item is a MUC room diff -r 2903fd66c3ad -r f8c0447beec2 mcabber/doc/mcabber.1 --- a/mcabber/doc/mcabber.1 Thu May 04 19:04:22 2006 +0200 +++ b/mcabber/doc/mcabber.1 Thu May 04 20:22:03 2006 +0200 @@ -250,7 +250,7 @@ \fB/room\fR The room command handles Multi\-User Chat room actions\&. - \fBjoin\fR room nick join "room", using "nick" as nickname\&. If no nickname is provided, the "nickname" option value is used (see sample configuration file) + \fBjoin\fR [room [nick]] join "room", using "nick" as nickname\&. If no nickname is provided, the "nickname" option value is used (see sample configuration file)\&. If the currently selected entry is correctly recognized as a room by mcabber, the shortcut "\&." can be used instead of the full room id\&. \fBleave\fR [message] leave the current room \fBnames\fR display members of the current room \fBnick\fR nick change your nickname in the current room diff -r 2903fd66c3ad -r f8c0447beec2 mcabber/doc/mcabber.1.html --- a/mcabber/doc/mcabber.1.html Thu May 04 19:04:22 2006 +0200 +++ b/mcabber/doc/mcabber.1.html Thu May 04 20:22:03 2006 +0200 @@ -626,10 +626,10 @@ @@ -944,7 +944,7 @@ diff -r 2903fd66c3ad -r f8c0447beec2 mcabber/doc/mcabber.1.txt --- a/mcabber/doc/mcabber.1.txt Thu May 04 19:04:22 2006 +0200 +++ b/mcabber/doc/mcabber.1.txt Thu May 04 20:22:03 2006 +0200 @@ -231,7 +231,7 @@ /room invite|kick|ban|role|affil:: The 'room' command handles Multi-User Chat room actions. - 'join' room [nick];; join "room", using "nick" as nickname. If no nickname is provided, the "nickname" option value is used (see sample configuration file) + 'join' [room [nick]];; join "room", using "nick" as nickname. If no nickname is provided, the "nickname" option value is used (see sample configuration file). If the currently selected entry is correctly recognized as a room by mcabber, the shortcut "." can be used instead of the full room id. 'leave' [message];; leave the current room 'names';; display members of the current room 'nick' nick;; change your nickname in the current room diff -r 2903fd66c3ad -r f8c0447beec2 mcabber/src/commands.c --- a/mcabber/src/commands.c Thu May 04 19:04:22 2006 +0200 +++ b/mcabber/src/commands.c Thu May 04 20:22:03 2006 +0200 @@ -1432,15 +1432,25 @@ static void room_join(gpointer bud, char *arg) { char **paramlst; - char *roomname, *nick; + char *roomname, *nick, *roomname_tmp; char *tmpnick = NULL; paramlst = split_arg(arg, 2, 0); // roomid, nickname roomname = *paramlst; nick = *(paramlst+1); - - if (!roomname || strchr(roomname, '/')) { + if (!roomname || !strcmp(roomname, ".")) { + // If the current_buddy is recognized as a room, the room name + // can be omitted (or "." can be used). + if (!bud || !(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) { + scr_LogPrint(LPRINT_NORMAL, "Please specify a room name."); + free_arg_lst(paramlst); + return; + } + if (!roomname) + nick = NULL; + roomname = (char*)buddy_getjid(bud); + } else if (strchr(roomname, '/')) { scr_LogPrint(LPRINT_NORMAL, "Invalid room name."); free_arg_lst(paramlst); return; @@ -1470,10 +1480,11 @@ return; } - // Note that roomname is part of the array allocated by split_arg(), - // so we can modify it. - mc_strtolower(roomname); - roomname = to_utf8(roomname); + roomname_tmp = g_strdup(roomname); + mc_strtolower(roomname_tmp); + roomname = to_utf8(roomname_tmp); + g_free(roomname_tmp); + jb_room_join(roomname, nick); scr_LogPrint(LPRINT_LOGNORM, "Sent a join request to <%s>...", roomname); @@ -1897,7 +1908,7 @@ } if (!strcasecmp(subcmd, "join")) { - if ((arg = check_room_subcommand(arg, TRUE, NULL)) != NULL) + if ((arg = check_room_subcommand(arg, FALSE, NULL)) != NULL) room_join(bud, arg); } else if (!strcasecmp(subcmd, "invite")) { if ((arg = check_room_subcommand(arg, TRUE, bud)) != NULL)
-join room [nick] +join [room [nick]] -join "room", using "nick" as nickname. If no nickname is provided, the "nickname" option value is used (see sample configuration file) +join "room", using "nick" as nickname. If no nickname is provided, the "nickname" option value is used (see sample configuration file). If the currently selected entry is correctly recognized as a room by mcabber, the shortcut "." can be used instead of the full room id.