comparison mcabber/src/settings.c @ 521:cc8c969ab6e5

"/status" changes - No hardcoded status message - If there is no user-defined status message, the current message is kept - "/status $status -" clears the status message - Auto-away improvement
author Mikael Berthe <mikael@lilotux.net>
date Sat, 19 Nov 2005 16:30:49 +0100
parents f8f3c7493457
children 8b3db0b555a1
comparison
equal deleted inserted replaced
520:c60175268eb5 521:cc8c969ab6e5
296 // Return a string with the current status message: 296 // Return a string with the current status message:
297 // - if there is a user-defined message ("message" option), 297 // - if there is a user-defined message ("message" option),
298 // return this message 298 // return this message
299 // - if there is a user-defined message for the given status (and no 299 // - if there is a user-defined message for the given status (and no
300 // generic user message), it is returned 300 // generic user message), it is returned
301 // - if no user-defined message is found, return the mcabber default msg 301 // - if no message is found, return NULL
302 // - if there is no default (offline, invisible), return an empty string
303 const gchar *settings_get_status_msg(enum imstatus status) 302 const gchar *settings_get_status_msg(enum imstatus status)
304 { 303 {
305 const gchar *rstatus = settings_opt_get("message"); 304 const gchar *rstatus = settings_opt_get("message");
306 305
307 if (rstatus) return rstatus; 306 if (rstatus) return rstatus;
308 307
309 switch(status) { 308 switch(status) {
310 case available: 309 case available:
311 if ((rstatus = settings_opt_get("message_avail")) == NULL) 310 rstatus = settings_opt_get("message_avail");
312 rstatus = MSG_AVAIL;
313 break; 311 break;
314 312
315 case freeforchat: 313 case freeforchat:
316 if ((rstatus = settings_opt_get("message_free")) == NULL) 314 rstatus = settings_opt_get("message_free");
317 rstatus = MSG_FREE;
318 break; 315 break;
319 316
320 case dontdisturb: 317 case dontdisturb:
321 if ((rstatus = settings_opt_get("message_dnd")) == NULL) 318 rstatus = settings_opt_get("message_dnd");
322 rstatus = MSG_DND;
323 break; 319 break;
324 320
325 case notavail: 321 case notavail:
326 if ((rstatus = settings_opt_get("message_notavail")) == NULL) 322 rstatus = settings_opt_get("message_notavail");
327 rstatus = MSG_NOTAVAIL;
328 break; 323 break;
329 324
330 case away: 325 case away:
331 if ((rstatus = settings_opt_get("message_away")) == NULL) 326 rstatus = settings_opt_get("message_away");
332 rstatus = MSG_AWAY; 327 break;
333 break; 328
334 329 default: // offline, invisible
335 default: 330 break;
336 rstatus = "";
337 } 331 }
338 return rstatus; 332 return rstatus;
339 } 333 }