aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-04-11 23:38:44 +0100
committerJames Booth <boothj5@gmail.com>2015-04-11 23:38:44 +0100
commit7e4b756e44892fe726153652ecdb76d6158e3f30 (patch)
treeff56dd022dbdfd2942fccc91d5a8fadadb8ba7d5 /src/command
parent3597a892336097d6c1346fdad52420758609d2b0 (diff)
parenta2ccd896465982bd6059ae7770532417b1062bdb (diff)
downloadprofani-tty-7e4b756e44892fe726153652ecdb76d6158e3f30.tar.gz
Merge branch 'master' into pgp
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c13
-rw-r--r--src/command/commands.c21
2 files changed, 26 insertions, 8 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 994c1155..ab59e2a0 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -321,20 +321,21 @@ static struct cmd_t command_defs[] =
NULL } } },
{ "/join",
- cmd_join, parse_args, 1, 5, NULL,
- { "/join room[@server] [nick value] [password value]", "Join a chat room.",
- { "/join room[@server] [nick value] [password value]",
- "-------------------------------------------------",
+ cmd_join, parse_args, 0, 5, NULL,
+ { "/join [room] [nick value] [password value]", "Join a chat room.",
+ { "/join [room] [nick value] [password value]",
+ "-----------------------------------------",
"Join a chat room at the conference server.",
"",
- "room : Bare room JID, the chat server is determined by the 'muc.service' account property, 'conference.<domainpart>' by default.",
- "room@server : Full room JID.",
+ "room : Bare room JID (the chat server is determined by the 'muc.service' account property) or full room jid."
"nick value : Nickname to use in the room",
"password value : Password if the room requires it.",
"",
+ "If no room is supplied, a generated name will be used with the format private-chat-[UUID].",
"If no nickname is specified the account preference 'muc.nick' will be used which by default is the localpart of your JID.",
"If the room doesn't exist, and the server allows it, a new one will be created.",
"",
+ "Example: /join",
"Example: /join jdev@conference.jabber.org",
"Example: /join jdev@conference.jabber.org nick mynick",
"Example: /join private@conference.jabber.org nick mynick password mypassword",
diff --git a/src/command/commands.c b/src/command/commands.c
index 1d1b10e3..5cd9c347 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
+#include <uuid/uuid.h>
#include <glib.h>
#include "chat_session.h"
@@ -2081,8 +2082,24 @@ cmd_join(gchar **args, struct cmd_help_t help)
}
if (args[0] == NULL) {
- cons_show("Usage: %s", help.usage);
- cons_show("");
+ uuid_t uuid;
+ uuid_generate(uuid);
+ char *uuid_str = malloc(sizeof(char) * 37);
+ uuid_unparse_lower(uuid, uuid_str);
+
+ char *account_name = jabber_get_account_name();
+ ProfAccount *account = accounts_get_account(account_name);
+
+ GString *room_str = g_string_new("");
+ g_string_append_printf(room_str, "private-chat-%s@%s", uuid_str, account->muc_service);
+
+ presence_join_room(room_str->str, account->muc_nick, NULL);
+ muc_join(room_str->str, account->muc_nick, NULL, FALSE);
+
+ g_string_free(room_str, TRUE);
+ free(uuid_str);
+ account_free(account);
+
return TRUE;
}