killpresence/killpresence.c
changeset 50 9ebfc7b83319
parent 47 dcef1b8f2e05
child 54 123580cd5450
equal deleted inserted replaced
49:a276e2435f04 50:9ebfc7b83319
   172 static void reset_chat_states(const char *fulljid)
   172 static void reset_chat_states(const char *fulljid)
   173 {
   173 {
   174   char *rname, *barejid;
   174   char *rname, *barejid;
   175   GSList *sl_buddy;
   175   GSList *sl_buddy;
   176   struct xep0085 *xep85;
   176   struct xep0085 *xep85;
       
   177 #if defined XEP0022
   177   struct xep0022 *xep22;
   178   struct xep0022 *xep22;
       
   179 #endif
   178 
   180 
   179   rname = strchr(fulljid, JID_RESOURCE_SEPARATOR);
   181   rname = strchr(fulljid, JID_RESOURCE_SEPARATOR);
   180   if (!rname++) {
   182   if (!rname++) {
   181     scr_log_print(LPRINT_NORMAL, "I need a /full/ JID.");
   183     scr_log_print(LPRINT_NORMAL, "I need a /full/ JID.");
   182     return;
   184     return;
   190     scr_log_print(LPRINT_NORMAL, "Resource not found.");
   192     scr_log_print(LPRINT_NORMAL, "Resource not found.");
   191     return;
   193     return;
   192   }
   194   }
   193 
   195 
   194   xep85 = buddy_resource_xep85(sl_buddy->data, rname);
   196   xep85 = buddy_resource_xep85(sl_buddy->data, rname);
       
   197 #if defined XEP0022
   195   xep22 = buddy_resource_xep22(sl_buddy->data, rname);
   198   xep22 = buddy_resource_xep22(sl_buddy->data, rname);
       
   199 #endif
   196 
   200 
   197   // Reset Chat States (0085)
   201   // Reset Chat States (0085)
   198   if (xep85) {
   202   if (xep85) {
   199     if (xep85->support == CHATSTATES_SUPPORT_PROBED)
   203     if (xep85->support == CHATSTATES_SUPPORT_PROBED)
   200       xep85->support = CHATSTATES_SUPPORT_UNKNOWN;
   204       xep85->support = CHATSTATES_SUPPORT_UNKNOWN;
   201     xep85->last_state_rcvd = ROSTER_EVENT_NONE;
   205     xep85->last_state_rcvd = ROSTER_EVENT_NONE;
   202   }
   206   }
       
   207 #if defined XEP0022
   203   // Reset Message Events (0022)
   208   // Reset Message Events (0022)
   204   if (xep22) {
   209   if (xep22) {
   205     if (xep22->support == CHATSTATES_SUPPORT_PROBED)
   210     if (xep22->support == CHATSTATES_SUPPORT_PROBED)
   206       xep22->support = CHATSTATES_SUPPORT_UNKNOWN;
   211       xep22->support = CHATSTATES_SUPPORT_UNKNOWN;
   207     xep22->last_state_rcvd = ROSTER_EVENT_NONE;
   212     xep22->last_state_rcvd = ROSTER_EVENT_NONE;
   208     g_free(xep22->last_msgid_sent);
   213     g_free(xep22->last_msgid_sent);
   209     g_free(xep22->last_msgid_rcvd);
   214     g_free(xep22->last_msgid_rcvd);
   210     xep22->last_msgid_sent = NULL;
   215     xep22->last_msgid_sent = NULL;
   211     xep22->last_msgid_rcvd = NULL;
   216     xep22->last_msgid_rcvd = NULL;
   212   }
   217   }
       
   218 #endif
   213 
   219 
   214   // Finally reset the roster hint for the UI
   220   // Finally reset the roster hint for the UI
   215   buddy_resource_setevents(sl_buddy->data, rname, ROSTER_EVENT_NONE);
   221   buddy_resource_setevents(sl_buddy->data, rname, ROSTER_EVENT_NONE);
   216   update_roster = TRUE;
   222   update_roster = TRUE;
   217 }
   223 }