accept friendship fix

- insert_member new friend & add to friends mapping
- set proper user availability on both sides after friendship established
This commit is contained in:
Gabor Adam Toth 2010-02-20 23:28:17 +01:00
parent 424bc2bf70
commit cde31fce59
1 changed files with 9 additions and 2 deletions

View File

@ -2422,6 +2422,12 @@ friend(rm, entity, ni, trustee) {
// if (member(ppl, t)) switch(ppl[t][PPL_NOTIFY]) {
switch (member(ppl, t) ? ppl[t][PPL_NOTIFY] : PPL_NOTIFY_NONE) {
case PPL_NOTIFY_OFFERED:
sPerson(t, PPL_NOTIFY, PPL_NOTIFY_DEFAULT);
friends[entity, FRIEND_NICK] = ni || 1;
if (objectp(entity))
insert_member(entity);
else
insert_member(entity, parse_uniform(entity, 1)[URoot]);
// this used to imply a symmetric request for
// friendship, but we prefer to make it an
// informational message instead. the protocol
@ -2438,7 +2444,9 @@ friend(rm, entity, ni, trustee) {
// within psyc.. even jabber should
// normally auto-acknowledge this request
sendmsg(entity, "_request_friendship_implied",
0, ([ "_nick": MYNICK ]) );
0, ([ "_nick": MYNICK, "_degree_availability": availability ]) );
sendmsg(entity, "_request_status_person",
0, ([ "_nick": MYNICK ]) );
// did i just say something about symmetry?
#ifdef TRY_THIS
// currently friend() only gets called from
@ -2450,7 +2458,6 @@ friend(rm, entity, ni, trustee) {
// carrying _presence be enough? well, we
// don't have _presence yet
#endif
sPerson(t, PPL_NOTIFY, PPL_NOTIFY_DEFAULT);
return 1;
case PPL_NOTIFY_NONE:
sPerson(t, PPL_NOTIFY, PPL_NOTIFY_PENDING);