1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

fixed major bug in output of jabber presence state

This commit is contained in:
psyc://psyced.org/~lynX 2009-03-02 18:57:20 +01:00
parent ccf63004c8
commit 85c3ee031d
8 changed files with 60 additions and 47 deletions

View file

@ -9,6 +9,9 @@ ________________________________________________________________________
- when a jabber clients disconnects and reconnects quickly, before the sane
quit delay has operated, it will not be given other people's presence again.
+ should ignored people receive an echo for the sake of not being
distinguishable from not ignored people? yes...
? marenz says, remote topic isn't working
http://about.psyc.eu/?title=Talk:Bug_Report&curid=1506&diff=10174&oldid=10173
@ -3916,3 +3919,6 @@ install.sh
=== 200902 ============================================================
archetype
+ when joe says "/nick joe" it is understood as removing the /nick
jabber/user
- fixed major bug in output of presence state (showFriends)

View file

@ -11,6 +11,12 @@
#define JABBER_TRANSPARENCY // switching this off improves parser
// performance but kills file transfers
// local debug messages - turn them on by using psyclpc -DDjabber=<level>
#ifdef Djabber
# undef DEBUG
# define DEBUG Djabber
#endif
#include <net.h>
#include <xml.h>
#include <sys/time.h>
@ -25,8 +31,6 @@ virtual inherit JABBER_PATH "common";
#endif
#define COMBINE_CHARSET XML_CHARSET
//"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 </=\"'?.:@-"
// combining > errors
// eigentlich schon ein fall für textdb
// siehe auch MISC/jabber/conference.fmt

View file

@ -444,7 +444,7 @@ open_stream(XMLNode node) {
string features;
string header;
P2(("jabber/server open_stream\n"))
P2(("%O open_stream from %O\n", ME, query_ip_name()))
streamid = RANDHEXSTRING;
unless(node["@xmlns"] == "jabber:client") {

View file

@ -30,8 +30,6 @@ qResource() { return resource; }
qHasCurrentPlace() { return 0; }
showFriends() {}
/* it should be posible to do some things in a way that can be shared between
* user and active/gateway... mostly stuff like MUC-support, version requests
* and such -- TODO
@ -129,14 +127,14 @@ msg(source, mc, data, mapping vars, showingLog) {
case "_status_person_present_implied":
case "_status_person_absent":
case "_status_person_absent_recorded":
PT(("%O got %O\n", ME, mc))
P2(("%O got %O\n", ME, mc))
// actually.. we never send _time_idle with this
if (member(vars, "_time_idle")) {
t = vars["_time_idle"];
if (stringp(t)) {
t = to_int(t);
PT(("_time_idle %O == %O, right?\n", vars["_time_idle"], t))
P2(("_time_idle %O == %O, right?\n", vars["_time_idle"], t))
}
t = gmtime(time() - t);
vars["_INTERNAL_time_jabber"] = JABBERTIME(t);
@ -232,6 +230,25 @@ msg(source, mc, data, mapping vars, showingLog) {
return ::msg(source, mc, data, vars, showingLog);
}
showFriends() {
// send presence for online friends
string template = T("_notice_presence_here_plain",
"<presence to='[_INTERNAL_target_jabber]' "
"from='[_INTERNAL_source_jabber]'/>");
string packet = "";
foreach(mixed friend : m_indices(friends)) {
if (friend)
packet += psyctext(template, ([
"_INTERNAL_target_jabber" : myjid,
"_INTERNAL_source_jabber" : mkjid(friend),
"_INTERNAL_mood_jabber" : "neutral"
]));
}
if (strlen(packet)) emit(packet);
P2(("%O jabberish showFriends: %O outputs as %O\n", ME, friends, packet))
}
logon() {
// language support is in server.c
vSet("scheme", "jabber");
@ -250,6 +267,8 @@ logon() {
myjid = NODEPREP(MYLOWERNICK) +"@" + NAMEPREP(SERVER_HOST);
myjidresource = myjid +"/"+ RESOURCEPREP(resource);
P2(("%O ready to rumble (%O)\n", myjidresource, ME))
// reicht auch aufzurufen, wenn announce 0 returned..
showFriends();
return ::logon();
}
@ -708,7 +727,7 @@ iq(XMLNode node) {
]));
if (ro) packet += ro;
else {
PT(("%O empty result for %O with buddy %O\n",
P2(("%O empty result for %O with buddy %O\n",
ME, "_list_acquaintance_notification" + variant + "_roster", friend))
}
}
@ -718,21 +737,8 @@ iq(XMLNode node) {
// foreach skipped
// _list_acquaintance_notification_pending
// _list_acquaintance_notification_offered
packet = "";
// send presence for online friends
// P2(("friends: %O\n", friends))
template = T("_notice_presence_here_plain",
"<presence to='[_INTERNAL_target_jabber]' "
"from='[_INTERNAL_source_jabber]'/>");
foreach(friend : m_values(friends)) {
if (friend)
packet += psyctext(template, ([
"_INTERNAL_target_jabber" : myjid,
"_INTERNAL_source_jabber" : mkjid(friend),
"_INTERNAL_mood_jabber" : "neutral"
]));
}
break; // showFriends() ?
showFriends();
break;
case "set":
helper = helper["/item"];
if (helper && helper["@subscription"] == "remove") {
@ -936,7 +942,7 @@ iq(XMLNode node) {
// this one is public while v("email") is more
// private
mvars = convert_profile(node["/vCard"], "jCard");
PT(("%O received vCard from client (%O)\n", ME, sizeof(mvars)))
P2(("%O received vCard from client (%O)\n", ME, sizeof(mvars)))
emit("<iq type='result' id='" + tag + "'/>");
request(ME, "_store", mvars);
return;
@ -1220,7 +1226,7 @@ w(string mc, string data, mapping vars, mixed source) {
// (they already closed the connection when we get here)
return;
case "_error_status_place_matches":
PT(("still _error_status_place_matches?\n"))
P2(("still _error_status_place_matches?\n"))
return;
case "_echo_request_friendship":
vars["_list_groups"] = xbuddylist[vars["_nick"]] || "";

View file

@ -2479,7 +2479,9 @@ logon(host) {
#endif
host = "?";
P2(("%O person:logon %O\n", ME, IS_NEWBIE? "(newbie)": "(registered)" ))
P2(("%O person:logon %s, logged_on = %O\n", ME,
IS_NEWBIE? "(newbie)": "(registered)",
logged_on ))
log_file("LOGON", "[%s] %s %s %s(%s) %s/%s/%s \"%s\"\n", ctime(),
logged_on ? "O" : IS_NEWBIE ? "*" : "+", MYNICK,
#ifdef _flag_log_hosts
@ -2543,9 +2545,7 @@ logon(host) {
// check by raising a version counter
}
}
# ifdef XMPPERIMENTAL
PT(("smarticast distribution structure: %O\n", _routes))
# endif
P3(("smarticast distribution structure in %O: %O\n", ME, _routes))
#endif
#ifndef _flag_disable_module_presence
switch(v("scheme")) {
@ -2780,6 +2780,7 @@ announce(level, manual, verbose, text) {
text = text ? (MYNICK +" "+ text +".") : "";
// fun: "Reclaim your chat. Use PSYC. PSYC delivers.";
}
// can this "optimization" cause async presence effects..?
if (!changed && availability == level) return 0;
if (level) vSet("availability", availability = level);
else level = availability; // sending EXPIRED not permitted here

View file

@ -46,8 +46,7 @@ void create() {
// supercede this in inheriting server class
createUser(nick) {
PT(("net/server:createUser() called in %O\n", ME))
// this is pretty unlikely to work
P3(("%O net/server:createUser(%O)\n", ME, nick))
return named_clone(NET_PATH "user", nick);
}
@ -82,7 +81,7 @@ hello(ni, elm, try, method, salt) {
ni, try, elm);
}
#ifdef REGISTERED_USERS_ONLY
#ifdef REGISTERED_USERS_ONLY // TODO: rename into a _flag
ohYeah(whatever) {
input_to(#'ohYeah, input_to_settings);
// input ignore warning? inverting mc's is really a good idea!
@ -177,8 +176,8 @@ authChecked(int result, ni, try, elm) {
password(try, method, salt) {
mixed authCb;
unless (user) {
pr("_failure_object_destructed",
"Huh? Your user object has disappeared!\n");
w("_failure_object_destructed", // never happens
"Huh? Your user object has disappeared!");
QUIT
}
// nick, guesses needed?
@ -212,8 +211,8 @@ morph() {
if (user) destruct(user);
unless (user = createUser(nick)) {
pr("_failure_object_creation",
"Cannot create new user object.\n");
w("_failure_object_creation",
"Cannot create new user object.");
QUIT
}
}
@ -249,12 +248,6 @@ disconnected(remaining) {
logon() {
if (nick) {
// authlocal support!
#if 0
// replace former interactive of nick
user = find_person(nick) || createUser(nick);
morph();
return 0;
#else
// only auto-login the first instance of nick
user = find_person(nick);
unless (user) {
@ -268,18 +261,15 @@ logon() {
}
// otherwise prompt regularely
nick = user = 0;
#endif
}
#ifdef LIMIT_USERS
// TODO: admins MUST be able to login!
// hmm.. what does 'nick &&' do here?
if (AMOUNT_SOCKETS >= LIMIT_USERS) {
w("_failure_exceeded_limit_users", "Extremely sorry, but "
"the maximum possible amount of people has been reached.");
QUIT
}
#endif
// bei jabber.. input_to(): Change in CHARMODE mode requested for object 'net/jabber/server#2107' with telnet disabled.
input_to(#'hello, input_to_settings);
call_out(#'quit, TIME_LOGIN_IDLE);
guesses = 0;

View file

@ -1675,7 +1675,7 @@ static showFriends(verbose) {
array(mixed) k;
mixed o, n, *fmt;
P3(("showFriends: %O\n", friends))
P3(("showFriends in %O: %O\n", ME, friends))
k = m_indices(friends);
unless(k && sizeof(k)) return;

View file

@ -1557,8 +1557,14 @@ request(source, mc, vars, data) {
mixed t, s;
int glyph;
P2(("»»> request(%O) %O from %O in %O (%O)\n",
#if DEBUG > 3
// in case of _store from jabber client vars may contain photo data
P4(("»»> request(%O) %O from %O in %O (%O)\n",
mc, data, source, ME, vars))
#else
P2(("»»> request(%O) %O from %O in %O\n",
mc, data, source, ME))
#endif
PSYC_TRY(mc) {
// quite dubious choice of method names.. sigh
case "_message_private":