Logo Search packages:      
Sourcecode: jabber-jit version File versions  Download package

void it_contact_subscribe ( contact  c,
const char *  name 
)

Add contact to roster

Definition at line 381 of file contact.c.

References session_st::contact_count, session_st::from, session_st::id, it_contact_set_status(), contact_st::s, contact_st::sms, iti::sms_id, iti::sms_show, iti::sms_status, contact_st::status, session_st::ti, and contact_st::uin.

Referenced by it_s10n(), and it_unknown_contact_add().

{
  xmlnode x;
  session s = c->s;

  if (c->uin == SMS_CONTACT) {
    /* This is a SMS contact, simply add to roster. */
    c->status = s->ti->sms_show;
    s->contact_count++;
      
    /* change jabber main roster */
    x = jutil_presnew(JPACKET__SUBSCRIBED,jid_full(s->id),NULL);
    xmlnode_put_attrib(x,"from",jid_full(it_sms2jid(xmlnode_pool(x),
                            c->sms,s->ti->sms_id)));

    it_deliver(s->ti,x);

    it_contact_set_status(c, s->ti->sms_show,s->ti->sms_status);

    return;
  }

  /* This is a standard contact */
  c->status = ICQ_STATUS_OFFLINE;
  s->contact_count++;
    
  /* Propagate to C++ backend */
  AddICQContact(c);

  /* We do not want to request auth on auto-import of contacts */
  if(name == NULL) {
    /* Request auth from ICQ side
       We don't need that for presence but this is the only way to contact
       peers who ignore messages from contacts not on their contact list */
    SendAuthRequest(c,LNG_AUTH_REQUEST);
  }

  /* Send "subscribed" presence. Fortunately, jabberd will add this
     contact to the user's roster if it was not present */
  x = jutil_presnew(JPACKET__SUBSCRIBED,jid_full(s->id),NULL);
  xmlnode_put_attrib(x,"from",jid_full(it_uin2jid(xmlnode_pool(x),c->uin,s->from->server)));
  if(name != NULL) 
      xmlnode_put_attrib(x,"name",it_convert_windows2utf8(xmlnode_pool(x),name));
  it_deliver(s->ti,x);
}


Generated by  Doxygen 1.6.0   Back to index