mcabber/src/jabglue.c
changeset 444 5927c3bfba13
parent 441 51b8f10cfeb8
child 447 03bb57383cea
equal deleted inserted replaced
443:d8ddb26b9c14 444:5927c3bfba13
   156 void jb_disconnect(void)
   156 void jb_disconnect(void)
   157 {
   157 {
   158   if (!jc) return;
   158   if (!jc) return;
   159 
   159 
   160   // announce it to  everyone else
   160   // announce it to  everyone else
   161   jb_setstatus(offline, "");
   161   jb_setstatus(offline, NULL, "");
   162 
   162 
   163   // announce it to the user
   163   // announce it to the user
   164   statehandler(jc, JCONN_STATE_OFF);
   164   statehandler(jc, JCONN_STATE_OFF);
   165 
   165 
   166   jab_delete(jc);
   166   jab_delete(jc);
   253 inline enum imstatus jb_getstatus()
   253 inline enum imstatus jb_getstatus()
   254 {
   254 {
   255   return mystatus;
   255   return mystatus;
   256 }
   256 }
   257 
   257 
   258 void jb_setstatus(enum imstatus st, const char *msg)
   258 void jb_setstatus(enum imstatus st, const char *recipient, const char *msg)
   259 {
   259 {
   260   xmlnode x;
   260   xmlnode x;
   261   gchar *utf8_msg;
   261   gchar *utf8_msg;
   262 
   262 
   263   if (!online) return;
   263   if (!online) return;
   264 
   264 
   265   x = jutil_presnew(JPACKET__UNKNOWN, 0, 0);
   265   x = jutil_presnew(JPACKET__UNKNOWN, 0, 0);
       
   266 
       
   267   if (recipient)
       
   268     xmlnode_put_attrib(x, "to", recipient);
   266 
   269 
   267   switch(st) {
   270   switch(st) {
   268     case away:
   271     case away:
   269         xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "away",
   272         xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "away",
   270                 (unsigned) -1);
   273                 (unsigned) -1);
   313 
   316 
   314   jab_send(jc, x);
   317   jab_send(jc, x);
   315   xmlnode_free(x);
   318   xmlnode_free(x);
   316   g_free(utf8_msg);
   319   g_free(utf8_msg);
   317 
   320 
   318   //sendvisibility();   ???
   321   // If we didn't change our _global_ status, we are done
       
   322   if (recipient) return;
       
   323 
       
   324   // Buddy per buddy invisibility handling
       
   325   //sendvisibility();
   319 
   326 
   320   // We'll need to update the roster if we switch to/from offline because
   327   // We'll need to update the roster if we switch to/from offline because
   321   // we don't know the presences of buddies when offline...
   328   // we don't know the presences of buddies when offline...
   322   if (mystatus == offline || st == offline)
   329   if (mystatus == offline || st == offline)
   323     update_roster = TRUE;
   330     update_roster = TRUE;
   462   //flogged = TRUE;
   469   //flogged = TRUE;
   463   //ourstatus = available;
   470   //ourstatus = available;
   464 
   471 
   465   //setautostatus(jhook.manualstatus);
   472   //setautostatus(jhook.manualstatus);
   466 
   473 
   467   jb_setstatus(available, NULL);
   474   jb_setstatus(available, NULL, NULL);
   468   buddylist_build();
   475   buddylist_build();
   469   /*
   476   /*
   470   for (i = 0; i < clist.count; i++) {
   477   for (i = 0; i < clist.count; i++) {
   471     c = (icqcontact *) clist.at(i);
   478     c = (icqcontact *) clist.at(i);
   472 
   479