comparison mcabber/src/screen.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 9480a76471b6
children ffdfddd351b8
comparison
equal deleted inserted replaced
520:c60175268eb5 521:cc8c969ab6e5
838 } 838 }
839 839
840 void inline set_autoaway(bool setaway) 840 void inline set_autoaway(bool setaway)
841 { 841 {
842 static enum imstatus oldstatus; 842 static enum imstatus oldstatus;
843 static char *oldmsg;
843 Autoaway = setaway; 844 Autoaway = setaway;
844 845
845 if (setaway) { 846 if (setaway) {
846 const char *msg; 847 const char *msg, *prevmsg;
847 oldstatus = jb_getstatus(); 848 oldstatus = jb_getstatus();
849 if (oldmsg) {
850 g_free(oldmsg);
851 oldmsg = NULL;
852 }
853 prevmsg = jb_getstatusmsg();
848 msg = settings_opt_get("message_autoaway"); 854 msg = settings_opt_get("message_autoaway");
849 if (!msg) msg = MSG_AUTOAWAY; 855 if (!msg)
856 msg = prevmsg;
857 if (prevmsg)
858 oldmsg = g_strdup(prevmsg);
850 jb_setstatus(away, NULL, msg); 859 jb_setstatus(away, NULL, msg);
851 } else { 860 } else {
852 // Back 861 // Back
853 jb_setstatus(oldstatus, NULL, NULL); 862 jb_setstatus(oldstatus, NULL, (oldmsg ? oldmsg : ""));
863 if (oldmsg) {
864 g_free(oldmsg);
865 oldmsg = NULL;
866 }
854 } 867 }
855 } 868 }
856 869
857 // Check if we should enter/leave automatic away status 870 // Check if we should enter/leave automatic away status
858 void scr_CheckAutoAway(bool activity) 871 void scr_CheckAutoAway(bool activity)