rem: if (state == 0) { tuple->state = PS_OFFLINE; } else { tuple->state = PS_ONLINE; }
add: if (state == 0) tuple->state = PS_OFFLINE; else tuple->state = PS_ONLINE;
context: void callback(str* _user, str *_contact, int state, void* data){     presentity_t *presentity;     get_act_time();     presentity = (struct presentity*)data;     if (presentity && callback_update_db) {	  presence_tuple_t *tuple = NULL;	  int orig;	  LOG(L_ERR, "callback: uri=%.*s contact=%.*s state=%d\n",	      presentity->uri.len, presentity->uri.s, (_contact ? _contact->len : 0), (_contact ? _contact->s : ""), state);	  if (_contact) {	       if (callback_lock_pdomain)		    lock_pdomain(presentity->pdomain);	       find_presence_tuple(_contact, presentity, &tuple);	       if (!tuple) {		    new_presence_tuple(_contact, act_time + default_expires, presentity, &tuple);		    add_presence_tuple(presentity, tuple);	       };	       orig = tuple->state;	       if (state == 0) {		    tuple->state = PS_OFFLINE;	       } else {		    tuple->state = PS_ONLINE;	       }	       tuple->expires = act_time + default_expires;	       db_update_presentity(presentity);	       if (orig != state) {		    presentity->flags |= PFLAG_PRESENCE_CHANGED;	       }	       if (callback_lock_pdomain)		    unlock_pdomain(presentity->pdomain);	  }     }}