Allow "/room join . [nick]" if the current item is a MUC room
--- 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
--- 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 @@
<table class="hlist">
<tr valign="top">
<td>
-<b>join</b> room [nick]
+<b>join</b> [room [nick]]
</td>
<td>
-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.
</td>
</tr>
<tr valign="top">
@@ -944,7 +944,7 @@
<div id="footer">
<p>
Version 0.7.7-dev<br />
-Last updated 04-May-2006 18:51:26 CEST
+Last updated 04-May-2006 20:19:47 CEST
</p>
</div>
</div>
--- 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
--- 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)