Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/jabglue.c @ 519:5c338d31de56
Show current global status message in "/status"
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 14 Nov 2005 18:47:08 +0100 |
parents | d40c434fff46 |
children | cc8c969ab6e5 |
comparison
equal
deleted
inserted
replaced
518:9480a76471b6 | 519:5c338d31de56 |
---|---|
42 static unsigned int KeepaliveDelay; | 42 static unsigned int KeepaliveDelay; |
43 static unsigned int prio; | 43 static unsigned int prio; |
44 static int s_id; | 44 static int s_id; |
45 static int regmode, regdone; | 45 static int regmode, regdone; |
46 static enum imstatus mystatus = offline; | 46 static enum imstatus mystatus = offline; |
47 static gchar *mystatusmsg; | |
47 static unsigned char online; | 48 static unsigned char online; |
48 | 49 |
49 char imstatus2char[imstatus_size+1] = { | 50 char imstatus2char[imstatus_size+1] = { |
50 '_', 'o', 'i', 'f', 'd', 'n', 'a', '\0' | 51 '_', 'o', 'i', 'f', 'd', 'n', 'a', '\0' |
51 }; | 52 }; |
261 inline enum imstatus jb_getstatus() | 262 inline enum imstatus jb_getstatus() |
262 { | 263 { |
263 return mystatus; | 264 return mystatus; |
264 } | 265 } |
265 | 266 |
267 inline const char *jb_getstatusmsg() | |
268 { | |
269 return mystatusmsg; | |
270 } | |
271 | |
266 void jb_setstatus(enum imstatus st, const char *recipient, const char *msg) | 272 void jb_setstatus(enum imstatus st, const char *recipient, const char *msg) |
267 { | 273 { |
268 xmlnode x; | 274 xmlnode x; |
269 gchar *utf8_msg; | 275 gchar *utf8_msg; |
270 | 276 |
337 if (mystatus == offline || st == offline) | 343 if (mystatus == offline || st == offline) |
338 update_roster = TRUE; | 344 update_roster = TRUE; |
339 | 345 |
340 hk_mystatuschange(0, mystatus, st, msg); | 346 hk_mystatuschange(0, mystatus, st, msg); |
341 mystatus = st; | 347 mystatus = st; |
348 if (mystatusmsg) g_free(mystatusmsg); | |
349 if (msg) mystatusmsg = g_strdup(msg); | |
350 else mystatusmsg = NULL; | |
342 } | 351 } |
343 | 352 |
344 void jb_send_msg(const char *jid, const char *text, int type, | 353 void jb_send_msg(const char *jid, const char *text, int type, |
345 const char *subject) | 354 const char *subject) |
346 { | 355 { |
796 if (previous_state != JCONN_STATE_OFF) | 805 if (previous_state != JCONN_STATE_OFF) |
797 scr_LogPrint(LPRINT_LOGNORM, "[Jabber] Not connected to the server"); | 806 scr_LogPrint(LPRINT_LOGNORM, "[Jabber] Not connected to the server"); |
798 | 807 |
799 online = FALSE; | 808 online = FALSE; |
800 mystatus = offline; | 809 mystatus = offline; |
810 if (mystatusmsg) { | |
811 g_free(mystatusmsg); | |
812 mystatusmsg = NULL; | |
813 } | |
801 roster_free(); | 814 roster_free(); |
802 update_roster = TRUE; | 815 update_roster = TRUE; |
803 break; | 816 break; |
804 | 817 |
805 case JCONN_STATE_CONNECTED: | 818 case JCONN_STATE_CONNECTED: |