[ekg2-commit] r4029 - trunk/plugins/jabber: trunk/plugins/jabber/commands-en.txt trunk/plugins/jabber/commands-pl.txt trunk/plugins/jabber/commands.c
SVN commit
svn w toxygen.net
Czw, 26 Cze 2008, 00:26:54 CEST
Author: wiechu
Date: 2008-06-26 00:26:53 +0200 (Thu, 26 Jun 2008)
New Revision: 4029
Modified:
trunk/plugins/jabber/commands-en.txt
trunk/plugins/jabber/commands-pl.txt
trunk/plugins/jabber/commands.c
Log:
Simple /xmpp:topic & fix little memleak.
Modified: trunk/plugins/jabber/commands-en.txt
===================================================================
--- trunk/plugins/jabber/commands-en.txt 2008-06-23 13:50:25 UTC (rev 4028)
+++ trunk/plugins/jabber/commands-en.txt 2008-06-25 22:26:53 UTC (rev 4029)
@@ -152,6 +152,10 @@
Like msg, but additional, second arg specifies thread-ID to use.
+topic
+ parameters: [uid] <new topic>
+ short description: set MUC topic
+
userinfo
parameters:
short description: retrieves Jabber Directory info about given jid
Modified: trunk/plugins/jabber/commands-pl.txt
===================================================================
--- trunk/plugins/jabber/commands-pl.txt 2008-06-23 13:50:25 UTC (rev 4028)
+++ trunk/plugins/jabber/commands-pl.txt 2008-06-25 22:26:53 UTC (rev 4029)
@@ -227,6 +227,10 @@
Działa podobnie jak msg, z tym, że dodatkowy, drugi parametr zawiera
identyfikator wątku dla wiadomości.
+topic
+ parametry: [konferencja] <nowy temat>
+ krotki opis: ustawia topic MUC
+
userinfo
parametry:
krotki opis: pobiera informacje z katalogu Jabbera o danym jid
Modified: trunk/plugins/jabber/commands.c
===================================================================
--- trunk/plugins/jabber/commands.c 2008-06-23 13:50:25 UTC (rev 4028)
+++ trunk/plugins/jabber/commands.c 2008-06-25 22:26:53 UTC (rev 4029)
@@ -2042,18 +2042,29 @@
static COMMAND(jabber_muc_command_topic) {
jabber_private_t *j = session_private_get(session);
newconference_t *c;
+ char *subject, *tmp=NULL;
+
/* XXX da, /topic is possible in normal talk too... current limit only to muc. */
- if (!(c = newconference_find(session, target))) {
+ if (params[0] && (c = newconference_find(session, params[0]))) {
+ subject = jabber_escape(params[1]);
+ } else if (c = newconference_find(session, target)) {
+ if (params[0] && params[1]) {
+ tmp = saprintf("%s %s", params[0], params[1]);
+ subject = jabber_escape(tmp);
+ xfree(tmp);
+ } else
+ subject = jabber_escape(params[0]);
+ } else {
printq("generic_error", "/xmpp:topic only valid in MUC");
return -1;
}
- if (!params[1]) {
+ if (!subject) {
/* XXX, display current topic */
-
+ debug_error("jabber_muc_command_topic: Current topic is ??? -- not implemented yet\n");
} else {
- char *subject = jabber_escape(params[1]);
watch_write(j->send_watch, "<message to=\"%s\" type=\"groupchat\"><subject>%s</subject></message>", c->name+5, subject);
+ xfree(subject);
}
return 0;
@@ -2316,7 +2327,7 @@
command_add(&jabber_plugin, "xmpp:reply", "! !", jabber_command_reply, JABBER_FLAGS_TARGET, NULL);
command_add(&jabber_plugin, "xmpp:search", "? ?", jabber_command_search, JABBER_FLAGS, NULL);
command_add(&jabber_plugin, "xmpp:tmsg", "!uU ! !", jabber_command_msg, JABBER_FLAGS_TARGET, NULL); /* threaded msg */
- command_add(&jabber_plugin, "xmpp:topic", "! ?", jabber_muc_command_topic, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:topic", "? ?", jabber_muc_command_topic, JABBER_FLAGS_REQ, NULL);
command_add(&jabber_plugin, "xmpp:transpinfo", "? ?", jabber_command_transpinfo, JABBER_FLAGS, NULL);
command_add(&jabber_plugin, "xmpp:transports", "? ?", jabber_command_transports, JABBER_FLAGS, NULL);
command_add(&jabber_plugin, "xmpp:unban", "! ?", jabber_muc_command_ban, JABBER_FLAGS_TARGET, NULL);
Więcej informacji o liście dyskusyjnej ekg2-commit