[ekg2-commit] ekg2: commands.c (HEAD) jabber.c (HEAD) jabber_dcc.c (HEAD) [peres]
CVS commit
cvs w toxygen.net
Wto, 16 Paź 2007, 20:31:38 CEST
Module name: ekg2
Changes by: peres 2007-10-16 20:31:35
Modified files:
commands.c jabber.c jabber_dcc.c
Log message:
Removing 'jid:' support; please check if everything works fine.
Index: commands.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/commands.c,v
diff -d -u -r1.203 -r1.204
--- commands.c 8 Oct 2007 07:42:26 -0000 1.203
+++ commands.c 16 Oct 2007 18:31:34 -0000 1.204
@@ -69,6 +69,8 @@
extern void *jconv_out; /* for msg */
+const char *jabber_prefixes[2] = { "xmpp:", "tlen:" };
+
static COMMAND(jabber_command_dcc) {
jabber_private_t *j = session_private_get(session);
@@ -434,10 +436,10 @@
if (!(uid = get_uid(s, target)))
uid = target;
-/* XXX, get_uid() checks if this plugin is ok to handle it. so we have here tlen: or jid: but, we must check
+/* XXX, get_uid() checks if this plugin is ok to handle it. so we have here tlen: or xmpp: but, we must check
* if this uid match istlen.. However doesn't matter which protocol is, function should work...
*/
- if (((!istlen && xstrncasecmp(uid, "xmpp:", 5) && xstrncasecmp(uid, "jid:", 4)) || (istlen && xstrncasecmp(uid, "tlen:", 5)))) {
+ if (xstrncasecmp(uid, jabber_prefixes[istlen], 5)) {
printq("invalid_session");
return NULL;
}
@@ -454,7 +456,6 @@
char *subject = NULL;
char *thread = NULL;
const char *uid;
- int payload = 4 + j->istlen;
newconference_t *c;
int ismuc = 0;
@@ -470,8 +471,6 @@
}
if (!(uid = jid_target2uid(session, target, quiet)))
return -1;
- if (tolower(uid[0]) == 'x')
- payload++;
/* threaded messages */
if (!xstrcmp(name, "tmsg")) {
@@ -549,12 +548,12 @@
if (j->send_watch) j->send_watch->transfer_limit = -1;
if (ismuc)
- watch_write(j->send_watch, "<message type=\"groupchat\" to=\"%s\" id=\"%d\">", uid+payload, time(NULL));
+ watch_write(j->send_watch, "<message type=\"groupchat\" to=\"%s\" id=\"%d\">", uid+5, time(NULL));
else
watch_write(j->send_watch, "<message %sto=\"%s\" id=\"%d\">",
chat ? "type=\"chat\" " : "",
/* j->istlen ? "type=\"normal\" " : "", */
- uid+payload, time(NULL));
+ uid+5, time(NULL));
if (subject) {
watch_write(j->send_watch, "<subject>%s</subject>", subject);
@@ -735,8 +734,6 @@
username = xstrdup(session->uid + 5);
*(xstrchr(username, '@')) = 0;
-// username = xstrndup(session->uid + 4, xstrchr(session->uid+4, '@') - session->uid+4);
-
if (!params[0]) {
char *tmp = password_input();
if (!tmp)
@@ -764,7 +761,6 @@
const char *action;
const char *uid;
- int payload = 4 + j->istlen;
if (params[1])
target = params[1];
@@ -773,45 +769,40 @@
return -1;
}
- /* XXX: shouldn't we use our magical jid_target2uid() here? */
- if (!(uid = get_uid(session, target)) || (j->istlen && (tolower(uid[0]) == 'j' || tolower(uid[0]) == 'x')) || (!j->istlen && tolower(uid[0]) == 't')) {
- printq("invalid_session");
+ if (!(uid = jid_target2uid(session, target, quiet)))
return -1;
- }
- if (tolower(uid[0]) == 'x')
- payload++;
/* user jest OK, więc lepiej mieć go pod ręką */
tabnick_add(uid);
if (match_arg(params[0], 'r', ("request"), 2)) {
action = "subscribe";
- printq("jabber_auth_request", uid+payload, session_name(session));
+ printq("jabber_auth_request", uid+5, session_name(session));
} else if (match_arg(params[0], 'a', ("accept"), 2)) {
action = "subscribed";
- printq("jabber_auth_accept", uid+payload, session_name(session));
+ printq("jabber_auth_accept", uid+5, session_name(session));
} else if (match_arg(params[0], 'c', ("cancel"), 2)) {
action = "unsubscribe";
- printq("jabber_auth_unsubscribed", uid+payload, session_name(session));
+ printq("jabber_auth_unsubscribed", uid+5, session_name(session));
} else if (match_arg(params[0], 'd', ("deny"), 2)) {
action = "unsubscribed";
if (userlist_find(session, uid)) // mamy w rosterze
- printq("jabber_auth_cancel", uid+payload, session_name(session));
+ printq("jabber_auth_cancel", uid+5, session_name(session));
else // nie mamy w rosterze
- printq("jabber_auth_denied", uid+payload, session_name(session));
+ printq("jabber_auth_denied", uid+5, session_name(session));
} else if (match_arg(params[0], 'p', ("probe"), 2)) { /* TLEN ? */
/* ha! undocumented :-); bo
[Used on server only. Client authors need not worry about this.] */
action = "probe";
- printq("jabber_auth_probe", uid+payload, session_name(session));
+ printq("jabber_auth_probe", uid+5, session_name(session));
} else {
printq("invalid_params", name);
return -1;
}
/* NOTE: libtlen send this without id */
- watch_write(j->send_watch, "<presence to=\"%s\" type=\"%s\" id=\"roster\"/>", uid+payload, action);
+ watch_write(j->send_watch, "<presence to=\"%s\" type=\"%s\" id=\"roster\"/>", uid+5, action);
return 0;
}
@@ -819,7 +810,6 @@
jabber_private_t *j = session->priv;
int addcom = !xstrcmp(name, ("add"));
- int payload = 4 + j->istlen;
const char *uid = NULL;
char *nickname = NULL;
@@ -846,14 +836,10 @@
}
/* XXX: jid_target2uid() ? */
- if (!(uid = get_uid(session, target)) || (j->istlen && (tolower(uid[0]) == 'j' || tolower(uid[0]) == 'x')) || (!j->istlen && tolower(uid[0]) == 't')) {
- printq("invalid_session");
+ if (!(uid = jid_target2uid(session, target, quiet)))
return -1;
- }
- if (tolower(uid[0]) == 'x')
- payload++;
- if (!u) u = xmalloc(sizeof(userlist_t)); /* alloc temporary memory for /jid:add */
+ if (!u) u = xmalloc(sizeof(userlist_t)); /* alloc temporary memory for /xmpp:add */
if (params[0]) {
char **argv = array_make(params[0], " \t", 0, 1, 1);
@@ -899,12 +885,12 @@
}
/* emulate gg:modify behavior */
if (!j->istlen && match_arg(argv[i], 'o', ("online"), 2)) { /* only jabber:iq:privacy */
- command_exec_format(target, session, 0, ("/jid:privacy --set %s +pin"), uid);
+ command_exec_format(target, session, 0, ("/xmpp:privacy --set %s +pin"), uid);
continue;
}
if (!j->istlen && match_arg(argv[i], 'O', ("offline"), 2)) { /* only jabber:iq:privacy */
- command_exec_format(target, session, 0, ("/jid:privacy --set %s -pin"), uid);
+ command_exec_format(target, session, 0, ("/xmpp:privacy --set %s -pin"), uid);
continue;
}
/* if this is -n smth */
@@ -931,8 +917,8 @@
watch_write(j->send_watch, "<iq type=\"set\"><query xmlns=\"jabber:iq:roster\">");
/* nickname always should be set */
- if (nickname) watch_write(j->send_watch, "<item jid=\"%s\" name=\"%s\"%s>", uid+payload, nickname, (u->groups ? "" : "/"));
- else watch_write(j->send_watch, "<item jid=\"%s\"%s>", uid+payload, (u->groups ? "" : "/"));
+ if (nickname) watch_write(j->send_watch, "<item jid=\"%s\" name=\"%s\"%s>", uid+5, nickname, (u->groups ? "" : "/"));
+ else watch_write(j->send_watch, "<item jid=\"%s\"%s>", uid+5, (u->groups ? "" : "/"));
for (m = u->groups; m ; m = m->next) {
struct ekg_group *g = m->data;
@@ -970,7 +956,7 @@
userlist_t *u = (del_all ? l->data : userlist_find_u(&l, target));
if (u) {
- if (!(uid = u->uid) || (j->istlen && (tolower(uid[0]) == 'j' || tolower(uid[0]) == 'x')) || (!j->istlen && tolower(uid[0]) == 't')) {
+ if (!(uid = u->uid) || xstrncmp(uid, jabber_prefixes[j->istlen], 5)) {
printq("invalid_session");
return -1;
}
@@ -1055,7 +1041,7 @@
{
jabber_private_t *j = session_private_get(session);
/* XXX: like above */
- char *xuid = jabber_escape(uid + (tolower(uid[0]) == 'x' ? 5 : 4));
+ char *xuid = jabber_escape(uid + 5);
watch_write(j->send_watch, "<iq id='%d' to='%s' type='get'><vCard xmlns='vcard-temp'/></iq>", \
j->id++, xuid);
xfree(xuid);
@@ -1114,7 +1100,7 @@
{
jabber_private_t *j = session_private_get(session);
/* XXX: like above, really worth escaping? */
- char *xuid = jabber_escape(uid + (tolower(uid[0]) == 'x' ? 5 : 4));
+ char *xuid = jabber_escape(uid + 5);
watch_write(j->send_watch, "<iq id='%d' to='%s' type='get'><query xmlns='jabber:iq:last'/></iq>", \
j->id++, xuid);
xfree(xuid);
@@ -1801,7 +1787,7 @@
}
if (!xstrcmp(params[0], "--set")) {
- /* Usage: --set [list] jid:/@grupa/typ
+ /* Usage: --set [list] xmpp:/@grupa/typ
* --order xyz : only with new lists... if you want to modify, please use --modify
* -* : set order to 1, enable blist[PRIVACY_LIST_ALL]
* +* : set order to 0, enable alist[PRIVACY_LIST_ALL]
@@ -1817,8 +1803,7 @@
return -1;
}
- if (!xstrncmp(params[1], "jid:", 4)) { type = "jid"; value = params[1]+4; }
- else if (!xstrncmp(params[1], "xmpp:", 5)) { type = "jid"; value = params[1]+5; }
+ if (!xstrncmp(params[1], "xmpp:", 5)) { type = "jid"; value = params[1]+5; }
else if (params[1][0] == '@') { type = "group"; value = params[1]+1; }
else if (!xstrcmp(params[1], "none") || !xstrcmp(params[1], "both") || !xstrcmp(params[1], "from") || !xstrcmp(params[1], "to"))
{ type = "subscription"; value = params[1]; }
@@ -2006,7 +1991,7 @@
}
if (params[0] && params[0][0] != '-') /* jesli nie opcja, to pewnie jest to lista, wyswietlamy liste */
- return command_exec_format(target, session, 0, "/jid:privacy --get %s", params[0]);
+ return command_exec_format(target, session, 0, "/xmpp:privacy --get %s", params[0]);
wcs_print("invalid_params", name);
return 1;
@@ -2114,7 +2099,7 @@
if (unignore_all) {
list_t l;
int x = 0;
-/* int x = command_exec_format(NULL, session, 1, ("/jid:privacy --unset")) == 0 ? 1 : 0; */ /* bad idea? */ /* --delete * -* ??!! XXX */
+/* int x = command_exec_format(NULL, session, 1, ("/xmpp:privacy --unset")) == 0 ? 1 : 0; */ /* bad idea? */ /* --delete * -* ??!! XXX */
for (l = session->userlist; l; ) {
userlist_t *u = l->data;
@@ -2136,7 +2121,7 @@
printq("user_not_found", params[0]);
return -1;
}
- retcode = command_exec_format(NULL, session, 1, ("/jid:privacy --delete %s"), params[0]) == 0 ? 1 : 0;
+ retcode = command_exec_format(NULL, session, 1, ("/xmpp:privacy --delete %s"), params[0]) == 0 ? 1 : 0;
retcode |= !ignored_remove(session, uid);
if (retcode) { printq("ignored_deleted", format_user(session, params[0])); config_changed = 1; }
@@ -2166,8 +2151,7 @@
return -1;
}
- if (!xstrncmp(target, "jid:", 4)) target += 4; /* remove jid: */
- else if (!xstrncmp(target, "xmpp:", 5)) target += 5;
+ if (!xstrncmp(target, "xmpp:", 5)) target += 5; /* remove xmpp: */
watch_write(j->send_watch, "<presence to='%s/%s'><x xmlns='http://jabber.org/protocol/muc#user'>%s</x></presence>",
target, username, password ? password : "");
@@ -2278,8 +2262,7 @@
char *reason = jabber_escape(params[2]);
const char *jid = params[1];
- if (!xstrncmp(jid, "jid:", 4)) jid += 4;
- else if (!xstrncmp(jid, "xmpp:", 5)) jid += 5;
+ if (!xstrncmp(jid, "xmpp:", 5)) jid += 5;
watch_write(j->send_watch,
"<iq id=\"%d\" to=\"%s\" type=\"set\">"
@@ -2678,7 +2661,7 @@
? config_subject_reply_prefix : ""), thr->subject);
}
- ret = command_exec_format(target, session, 0, "/jid:%smsg %s %s %s%s",
+ ret = command_exec_format(target, session, 0, "/xmpp:%smsg %s %s %s%s",
(thr->thread ? "t" : ""), thr->uid, (thr->thread ? thr->thread : ""), (tmp ? tmp : ""), params[1]);
xfree(tmp);
@@ -2814,78 +2797,70 @@
#define JABBER_FLAGS_REQ JABBER_FLAGS | COMMAND_ENABLEREQPARAMS
#define JABBER_FLAGS_TARGET JABBER_FLAGS_REQ | COMMAND_PARAMASTARGET
#define JABBER_FLAGS_TARGET_VALID JABBER_FLAGS_TARGET | COMMAND_TARGET_VALID_UID /* need audit, if it can be used everywhere instead JABBER_FLAGS_TARGET */
-#if 0 /* disabled until 'jid:' support removal */
commands_lock = &commands; /* keep it sorted or die */
-#endif
-
- /* XXX: VERY, VERY, VERY BIG, FAT WARNING:
- * Follow macro is used for the time that legacy 'jid:' prefix still allowed
- * I know we already change session UID, but some users may still like to explicitly use 'jid:'
- */
-#define COMMAND_ADD_J(a, b, c...) command_add(a, "jid:" b, c); command_add(a, "xmpp:" b, c);
- COMMAND_ADD_J(&jabber_plugin, "", "?", jabber_command_inline_msg, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "_autoaway", "r", jabber_command_away, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "_autoxa", "r", jabber_command_away, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "_autoback", "r", jabber_command_away, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "add", "U ?", jabber_command_modify, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "admin", "! ?", jabber_muc_command_admin, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "auth", "!p uU", jabber_command_auth, JABBER_FLAGS_REQ,
+ command_add(&jabber_plugin, "xmpp:", "?", jabber_command_inline_msg, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:_autoaway", "r", jabber_command_away, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:_autoxa", "r", jabber_command_away, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:_autoback", "r", jabber_command_away, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:add", "U ?", jabber_command_modify, JABBER_FLAGS, NULL);
+ command_add(&jabber_plugin, "xmpp:admin", "! ?", jabber_muc_command_admin, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:auth", "!p uU", jabber_command_auth, JABBER_FLAGS_REQ,
"-a --accept -d --deny -r --request -c --cancel");
- COMMAND_ADD_J(&jabber_plugin, "away", "r", jabber_command_away, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "back", "r", jabber_command_away, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "ban", "! ? ?", jabber_muc_command_ban, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "bookmark", "!p ?", jabber_command_private, JABBER_FLAGS_REQ,
+ command_add(&jabber_plugin, "xmpp:away", "r", jabber_command_away, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:back", "r", jabber_command_away, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:ban", "! ? ?", jabber_muc_command_ban, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:bookmark", "!p ?", jabber_command_private, JABBER_FLAGS_REQ,
"-a --add -c --clear -d --display -m --modify -r --remove");
- COMMAND_ADD_J(&jabber_plugin, "change", "!p ? p ? p ? p ? p ? p ?", jabber_command_change, JABBER_FLAGS_REQ,
+ command_add(&jabber_plugin, "xmpp:change", "!p ? p ? p ? p ? p ? p ?", jabber_command_change, JABBER_FLAGS_REQ,
"-f --fullname -c --city -b --born -d --description -n --nick -C --country");
- COMMAND_ADD_J(&jabber_plugin, "chat", "!uU !", jabber_command_msg, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "config", "!p", jabber_command_private, JABBER_FLAGS_REQ,
+ command_add(&jabber_plugin, "xmpp:chat", "!uU !", jabber_command_msg, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:config", "!p", jabber_command_private, JABBER_FLAGS_REQ,
"-c --clear -d --display -g --get -p --put");
- COMMAND_ADD_J(&jabber_plugin, "connect", NULL, jabber_command_connect, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "control", "! ? ?", jabber_command_control, JABBER_FLAGS_REQ, NULL);
- COMMAND_ADD_J(&jabber_plugin, "conversations", NULL, jabber_command_conversations, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "dcc", "p uU f ?", jabber_command_dcc, JABBER_ONLY,
+ command_add(&jabber_plugin, "xmpp:connect", NULL, jabber_command_connect, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:control", "! ? ?", jabber_command_control, JABBER_FLAGS_REQ, NULL);
+ command_add(&jabber_plugin, "xmpp:conversations", NULL, jabber_command_conversations, JABBER_FLAGS, NULL);
+ command_add(&jabber_plugin, "xmpp:dcc", "p uU f ?", jabber_command_dcc, JABBER_ONLY,
"send get resume voice close list");
- COMMAND_ADD_J(&jabber_plugin, "del", "!u", jabber_command_del, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "disconnect", "r", jabber_command_disconnect, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "dnd", "r", jabber_command_away, JABBER_ONLY, NULL);
-// COMMAND_ADD_J(&jabber_plugin, "ignore", "uUC I", jabber_command_ignore, JABBER_ONLY, "status descr notify msg dcc events *");
- COMMAND_ADD_J(&jabber_plugin, "ffc", "r", jabber_command_away, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "find", "?", jabber_command_find, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "invisible", "r", jabber_command_away, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "join", "! ? ?", jabber_muc_command_join, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "kick", "! ! ?", jabber_muc_command_ban, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "lastseen", "!u", jabber_command_lastseen, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "modify", "!Uu ?", jabber_command_modify,JABBER_FLAGS_REQ,
+ command_add(&jabber_plugin, "xmpp:del", "!u", jabber_command_del, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:disconnect", "r", jabber_command_disconnect, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:dnd", "r", jabber_command_away, JABBER_ONLY, NULL);
+// command_add(&jabber_plugin, "xmpp:ignore", "uUC I", jabber_command_ignore, JABBER_ONLY, "status descr notify msg dcc events *");
+ command_add(&jabber_plugin, "xmpp:ffc", "r", jabber_command_away, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:find", "?", jabber_command_find, JABBER_FLAGS, NULL);
+ command_add(&jabber_plugin, "xmpp:invisible", "r", jabber_command_away, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:join", "! ? ?", jabber_muc_command_join, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:kick", "! ! ?", jabber_muc_command_ban, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:lastseen", "!u", jabber_command_lastseen, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:modify", "!Uu ?", jabber_command_modify,JABBER_FLAGS_REQ,
"-n --nickname -g --group");
- COMMAND_ADD_J(&jabber_plugin, "msg", "!uU !", jabber_command_msg, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "part", "! ?", jabber_muc_command_part, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "passwd", "?", jabber_command_passwd, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "privacy", "? ? ?", jabber_command_privacy, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "private", "!p ! ?", jabber_command_private, JABBER_FLAGS_REQ,
+ command_add(&jabber_plugin, "xmpp:msg", "!uU !", jabber_command_msg, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:part", "! ?", jabber_muc_command_part, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:passwd", "?", jabber_command_passwd, JABBER_FLAGS, NULL);
+ command_add(&jabber_plugin, "xmpp:privacy", "? ? ?", jabber_command_privacy, JABBER_FLAGS, NULL);
+ command_add(&jabber_plugin, "xmpp:private", "!p ! ?", jabber_command_private, JABBER_FLAGS_REQ,
"-c --clear -d --display -p --put");
- COMMAND_ADD_J(&jabber_plugin, "pubsub", "!p ? ? ?", jabber_command_pubsub, JABBER_FLAGS,
+ command_add(&jabber_plugin, "xmpp:pubsub", "!p ? ? ?", jabber_command_pubsub, JABBER_FLAGS,
"-c --create -C --configure -d --delete -P --purge -m --manage -g --get -l --list -p --publish -r --remove -s --subscribe -S --status");
- COMMAND_ADD_J(&jabber_plugin, "reconnect", NULL, jabber_command_reconnect, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "register", "? ?", jabber_command_register, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "reply", "! !", jabber_command_reply, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "search", "? ?", jabber_command_search, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "stats", "? ?", jabber_command_stats, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "tmsg", "!uU ! !", jabber_command_msg, JABBER_FLAGS_TARGET, NULL); /* threaded msg */
- COMMAND_ADD_J(&jabber_plugin, "topic", "! ?", jabber_muc_command_topic, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "transpinfo", "? ?", jabber_command_transpinfo, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "transports", "? ?", jabber_command_transports, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "unban", "! ?", jabber_muc_command_ban, JABBER_FLAGS_TARGET, NULL);
-// COMMAND_ADD_J(&jabber_plugin, "unignore", "i ?", jabber_command_ignore, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "unregister", "?", jabber_command_register, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "userinfo", "!u", jabber_command_userinfo, JABBER_FLAGS_TARGET, NULL);
- COMMAND_ADD_J(&jabber_plugin, "userlist", "! ?", jabber_command_userlist, JABBER_FLAGS_REQ,
+ command_add(&jabber_plugin, "xmpp:reconnect", NULL, jabber_command_reconnect, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:register", "? ?", jabber_command_register, JABBER_ONLY, NULL);
+ 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:stats", "? ?", jabber_command_stats, 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: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);
+// command_add(&jabber_plugin, "xmpp:unignore", "i ?", jabber_command_ignore, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:unregister", "?", jabber_command_register, JABBER_FLAGS, NULL);
+ command_add(&jabber_plugin, "xmpp:userinfo", "!u", jabber_command_userinfo, JABBER_FLAGS_TARGET, NULL);
+ command_add(&jabber_plugin, "xmpp:userlist", "! ?", jabber_command_userlist, JABBER_FLAGS_REQ,
"-g --get -p --put"); /* BFW: it is unlike GG, -g gets userlist from file, -p writes it into it */
- COMMAND_ADD_J(&jabber_plugin, "vacation", "?", jabber_command_vacation, JABBER_FLAGS, NULL);
- COMMAND_ADD_J(&jabber_plugin, "ver", "!u", jabber_command_ver, JABBER_FLAGS_TARGET, NULL); /* ??? ?? ? ?@?!#??#!@? */
- COMMAND_ADD_J(&jabber_plugin, "xa", "r", jabber_command_away, JABBER_ONLY, NULL);
- COMMAND_ADD_J(&jabber_plugin, "xml", "!", jabber_command_xml, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:vacation", "?", jabber_command_vacation, JABBER_FLAGS, NULL);
+ command_add(&jabber_plugin, "xmpp:ver", "!u", jabber_command_ver, JABBER_FLAGS_TARGET, NULL); /* ??? ?? ? ?@?!#??#!@? */
+ command_add(&jabber_plugin, "xmpp:xa", "r", jabber_command_away, JABBER_ONLY, NULL);
+ command_add(&jabber_plugin, "xmpp:xml", "!", jabber_command_xml, JABBER_ONLY, NULL);
commands_lock = &commands;
Index: jabber.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber.c,v
diff -d -u -r1.351 -r1.352
--- jabber.c 8 Oct 2007 12:11:36 -0000 1.351
+++ jabber.c 16 Oct 2007 18:31:34 -0000 1.352
@@ -245,7 +245,7 @@
* checks, if @a uid is <i>proper for jabber plugin</i>.
*
* @note <i>Proper for jabber plugin</i> means either:
- * - If @a uid starts with jid: have got '@' (but jid:@ is wrong) and after '@' there is at least one char [<b>xmpp protocol</b>]<br>
+ * - If @a uid starts with xmpp: have got '@' (but xmpp:@ is wrong) and after '@' there is at least one char [<b>xmpp protocol</b>]<br>
* - If @a uid starts with tlen: (and len > 5) [<b>tlen protocol</b>]
*
* @param ap 1st param: <i>(char *) </i><b>uid</b> - of user/session/command/whatever
@@ -259,37 +259,13 @@
static QUERY(jabber_validate_uid) {
char *uid = *(va_arg(ap, char **));
int *valid = va_arg(ap, int *);
- const char *m;
- static char *lastdeprecated = NULL;
if (!uid)
return 0;
- /* minimum: jid:a w b */
- if (!xstrncasecmp(uid, "jid:", 4)
-#if 0 /* disable because we can also have JID without '@' - a transport, for example */
- && (m=xstrchr(uid+4, '@')) && ((uid+4)<m) && m[1] != '\0'
-#endif
- ) {
- if (xstrcmp(lastdeprecated, uid+4)) { /* avoid repeating the same if function called multiple times */
- print("jabber_deprecated_uid_warning", uid+4);
- xfree(lastdeprecated);
- lastdeprecated = xstrdup(uid+4);
- }
- (*valid)++;
- return -1;
- }
-
- if (!xstrncasecmp(uid, "xmpp:", 5)
-#if 0 /* like above */
- && (m=xstrchr(uid+4, '@')) && ((uid+4)<m) && m[1] != '\0'
-#endif
- ) {
- (*valid)++;
- return -1;
- }
+ /* XXX: think about 'at' in jabber UIDs */
- if (!xstrncasecmp(uid, "tlen:", 5) && uid[5] != '\0') {
+ if (!xstrncasecmp(uid, "xmpp:", 5) || !xstrncasecmp(uid, "tlen:", 5)) {
(*valid)++;
return -1;
}
@@ -301,12 +277,10 @@
* jabber_protocols()
*
* Handler for: <i>GET_PLUGIN_PROTOCOLS</i><br>
- * It just add "tlen:" and "jid:" to @a arr
+ * It just adds "tlen:" and "xmpp:" to @a arr
*
* @note I know it's nowhere used. It'll be used by d-bus plugin.
*
- * @todo Instead of "jid:" add "xmpp:" ?
- *
* @param ap 1st param: <i>(char **) </i><b>arr</b> - array with available protocols
* @param data NULL
*
@@ -317,7 +291,6 @@
char ***arr = va_arg(ap, char ***);
array_add(arr, "tlen:");
- array_add(arr, "jid:");
array_add(arr, "xmpp:");
return 0;
}
@@ -332,7 +305,7 @@
if (w && w->id && w->target && session_check(w->session, 1, "xmpp") && (c = newconference_find(w->session, w->target)) &&
(j = jabber_private(w->session)) && session_connected_get(w->session)) {
/* XXX: check really needed? vv */
- watch_write(j->send_watch, "<presence to=\"%s/%s\" type=\"unavailable\">%s</presence>", w->target + (tolower(w->target[0]) == 'j' ? 4 : 5), c->private, status ? status : "");
+ watch_write(j->send_watch, "<presence to=\"%s/%s\" type=\"unavailable\">%s</presence>", w->target + 5, c->private, status ? status : "");
newconference_destroy(c, 0);
}
@@ -1151,12 +1124,13 @@
session_t *s = session_find(sesion);
/* check this just to be sure... */
- if (!(session_check(s, 1, "jid"))) return 0;
+ if (session_check(s, 1, "xmpp"))
/* SPOT rule, first of all here was code to check sesion, valid user, etc...
* then send jabber:iq:roster request... with all new & old group...
* but it was code copied from modify command handler... so here it is.
*/
- command_exec_format(NULL, s, 0, ("/jid:modify %s -x"), uid);
+ command_exec_format(NULL, s, 0, ("/xmpp:modify %s -x"), uid);
+
return 0;
}
@@ -1373,7 +1347,6 @@
format_add("jabber_conversations_nothread", _("non-threaded"), 1);
format_add("jabber_conversations_nosubject", _("[no subject]"), 1);
- format_add("jabber_deprecated_uid_warning", _("%! Used UID is now deprecated, please use %Gxmpp:%1%n next time."), 1);
format_add("jabber_gone", _("%> (%1) User %G%2%n has left the conversation."), 1);
#endif /* !NO_DEFAULT_THEME */
@@ -1438,8 +1411,8 @@
for (l = sessions; l; l = l->next) {
session_t *s = l->data;
- /* check if it's jabber_plugin session, and if it's starts with 'j' or 'J' [DON'T DO IT ON TLEN SESSIONS] */
- if (s && s->plugin == &jabber_plugin && tolower(s->uid[0]) == 'j')
+ /* check if it's jabber_plugin session [DON'T DO IT ON TLEN SESSIONS] */
+ if (s && s->plugin == &jabber_plugin && !jabber_private(s)->istlen)
jabber_gpg_changed(s, NULL);
}
return 0;
@@ -1497,7 +1470,7 @@
const int len = *va_arg(ap, const int *);
const int first = *va_arg(ap, const int *);
- const char *jid = uid + (tolower(*uid) == 'j' ? 4 : 5);
+ const char *jid = uid + 5;
session_t *s = session_find(session);
jabber_private_t *j;
Index: jabber_dcc.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber_dcc.c,v
diff -d -u -r1.10 -r1.11
--- jabber_dcc.c 28 Jul 2007 10:30:30 -0000 1.10
+++ jabber_dcc.c 16 Oct 2007 18:31:35 -0000 1.11
@@ -377,7 +377,7 @@
}
}
-dcc_t *jabber_dcc_find(const char *uin, /* without jid: */ const char *id, const char *sid) {
+dcc_t *jabber_dcc_find(const char *uin, /* without xmpp: */ const char *id, const char *sid) {
#define DCC_RULE(x) (!xstrncmp(x->uid, "xmpp:", 5) && !xstrcmp(x->uid+5, uin))
list_t l;
if (!id && !sid) { debug_error("jabber_dcc_find() neither id nor sid passed.. Returning NULL\n"); return NULL; }
Więcej informacji o liście dyskusyjnej ekg2-commit