From 45a5b1f9b7709f8d93b57abea7ba46b44eac5707 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 10 Oct 2013 15:13:20 +0000 Subject: - MS_CLIST_GETSTATUSMODEDESCRIPTION replaced with the direct clist call - crazy & obsolete constant GSMDF_PREFIXONLINE removed git-svn-id: http://svn.miranda-ng.org/main/trunk@6428 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CmdLine/src/commonheaders.h | 1 + plugins/CmdLine/src/mimcmd_handlers.cpp | 78 ++++++--------------------------- 2 files changed, 14 insertions(+), 65 deletions(-) (limited to 'plugins/CmdLine') diff --git a/plugins/CmdLine/src/commonheaders.h b/plugins/CmdLine/src/commonheaders.h index eb64fbed2a..becf33539c 100644 --- a/plugins/CmdLine/src/commonheaders.h +++ b/plugins/CmdLine/src/commonheaders.h @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define _CRT_SECURE_NO_WARNINGS #include +#include #include #include "newpluginapi.h" diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 18c39570e7..b0cf21c1ca 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -339,70 +339,20 @@ int ParseValueParam(char *param, void *&result) int ParseStatusParam(char *status) { - int res = 0; - char lower[256]; - STRNCPY(lower, status, sizeof(lower)); + char *lower = NEWSTR_ALLOCA(status); + _strlwr(lower); - if (strcmp(lower, "offline") == 0) - { - res = ID_STATUS_OFFLINE; - } - else{ - if (strcmp(lower, "online") == 0) - { - res = ID_STATUS_ONLINE; - } - else{ - if (strcmp(lower, "away") == 0) - { - res = ID_STATUS_AWAY; - } - else{ - if (strcmp(lower, "dnd") == 0) - { - res = ID_STATUS_DND; - } - else{ - if (strcmp(lower, "na") == 0) - { - res = ID_STATUS_NA; - } - else{ - if (strcmp(lower, "occupied") == 0) - { - res = ID_STATUS_OCCUPIED; - } - else{ - if (strcmp(lower, "freechat") == 0) - { - res = ID_STATUS_FREECHAT; - } - else{ - if (strcmp(lower, "invisible") == 0) - { - res = ID_STATUS_INVISIBLE; - } - else{ - if (strcmp(lower, "onthephone") == 0) - { - res = ID_STATUS_ONTHEPHONE; - } - else{ - if (strcmp(lower, "outtolunch") == 0) - { - res = ID_STATUS_OUTTOLUNCH; - }//outtolunch - }//onthephone - }//invisible - }//freechat - }//occupied - }//na - } //dnd - } //away - } //online - } //offline - - return res; + if ( !strcmp(lower, "offline")) return ID_STATUS_OFFLINE; + if ( !strcmp(lower, "online")) return ID_STATUS_ONLINE; + if ( !strcmp(lower, "away")) return ID_STATUS_AWAY; + if ( !strcmp(lower, "dnd")) return ID_STATUS_DND; + if ( !strcmp(lower, "na")) return ID_STATUS_NA; + if ( !strcmp(lower, "occupied")) return ID_STATUS_OCCUPIED; + if ( !strcmp(lower, "freechat")) return ID_STATUS_FREECHAT; + if ( !strcmp(lower, "invisible")) return ID_STATUS_INVISIBLE; + if ( !strcmp(lower, "onthephone")) return ID_STATUS_ONTHEPHONE; + if ( !strcmp(lower, "outtolunch")) return ID_STATUS_OUTTOLUNCH; + return 0; } char *PrettyStatusMode(int status, char *buffer, int size) @@ -410,9 +360,7 @@ char *PrettyStatusMode(int status, char *buffer, int size) *buffer = 0; char *data = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, 0); if (data) - { STRNCPY(buffer, data, size); - } return buffer; } -- cgit v1.2.3