comparison mcabber/src/jabglue.c @ 164:faf534be8ff0

[/trunk] Changeset 176 by mikael * Add roster_free() * Empty roster when disconnecting from the server / going offline * Don't display buddies status when we're offline * Fix a bug when the roster is empty and we try to send a message (commands.c)
author mikael
date Mon, 02 May 2005 20:31:01 +0000
parents ba51d1737086
children b4921dbf8709
comparison
equal deleted inserted replaced
163:a8f7dc0a56cb 164:faf534be8ff0
157 void jb_main() 157 void jb_main()
158 { 158 {
159 xmlnode x, z; 159 xmlnode x, z;
160 char *cid; 160 char *cid;
161 161
162 if (!online) 162 if (!online) return;
163 return; 163
164 if (jc && jc->state == JCONN_STATE_CONNECTING) { 164 if (jc && jc->state == JCONN_STATE_CONNECTING) {
165 jab_start(jc); 165 jab_start(jc);
166 return; 166 return;
167 } 167 }
168 168
211 211
212 void jb_setstatus(enum imstatus st, char *msg) 212 void jb_setstatus(enum imstatus st, char *msg)
213 { 213 {
214 xmlnode x; 214 xmlnode x;
215 215
216 if (!online) 216 if (!online) return;
217 return;
218 217
219 x = jutil_presnew(JPACKET__UNKNOWN, 0, 0); 218 x = jutil_presnew(JPACKET__UNKNOWN, 0, 0);
220 219
221 switch(st) { 220 switch(st) {
222 case away: 221 case away:
268 267
269 jab_send(jc, x); 268 jab_send(jc, x);
270 xmlnode_free(x); 269 xmlnode_free(x);
271 270
272 //sendvisibility(); ??? 271 //sendvisibility(); ???
272
273 // We'll need to update the roster if we switch to/from offline because
274 // we don't know the presences of buddies when offline...
275 if (mystatus == offline || st == offline)
276 update_roster = TRUE;
273 277
274 hk_mystatuschange(0, mystatus, st); 278 hk_mystatuschange(0, mystatus, st);
275 mystatus = st; 279 mystatus = st;
276 } 280 }
277 281
441 switch(state) { 445 switch(state) {
442 case JCONN_STATE_OFF: 446 case JCONN_STATE_OFF:
443 447
444 online = FALSE; 448 online = FALSE;
445 mystatus = offline; 449 mystatus = offline;
450 roster_free();
451 update_roster = TRUE;
446 452
447 if (previous_state != JCONN_STATE_OFF) { 453 if (previous_state != JCONN_STATE_OFF) {
448 scr_LogPrint("+ JCONN_STATE_OFF"); 454 scr_LogPrint("+ JCONN_STATE_OFF");
449 /* 455 /*
450 jhook.roster.clear(); 456 jhook.roster.clear();