else if (match(key, "join"))
chan->join = get_bool(value);
}
+ if (match(group, "autojoin")) {
+ xmpp_channel_t *chan = new0(xmpp_channel_t);
+ chan->channel.server = &srv->server;
+ chan->channel.name = strcopy(key);
+ chan->room = get_string(value);
+ chan->join = 1;
+ add_channel(&chan->channel);
+ }
}
void xmpp_complete(channel_t *channel, const char *text)
const char *arg;
/* Escape HTML */
+ const char *raw = text;
escape(buf, text, sizeof(buf));
text = buf;
/* Handle commands */
- if (text[0] == '/') {
+ if (text[0] == '/' && text[1] != '/') {
if (prefix(text, "/items", &arg)) {
net_print(&srv->net,
"<iq id='items' type='get' from='%s' to='%s'>"
}
} else {
debug("message: [%s]", text);
+ if (text[0] == '/')
+ text = &text[1];
if (chan == &srv->system) {
chan_notice(chan, "Cannot send to server");
}
"<body>%s</body>"
"</message>",
srv->id++, srv->bind, chan->dest, text);
- chat_recv(channel, &srv->myself.user, text);
+ chat_recv(channel, &srv->myself.user, raw);
}
}
}