diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-10 15:13:20 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-10 15:13:20 +0000 |
commit | 45a5b1f9b7709f8d93b57abea7ba46b44eac5707 (patch) | |
tree | 03f5a5db7a5e8a951951710a3d383a936a14ce74 /plugins/CmdLine/src | |
parent | eb25a0d7ed0da6bd4630c553be933df5bd46b6b9 (diff) |
- 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
Diffstat (limited to 'plugins/CmdLine/src')
-rw-r--r-- | plugins/CmdLine/src/commonheaders.h | 1 | ||||
-rw-r--r-- | plugins/CmdLine/src/mimcmd_handlers.cpp | 78 |
2 files changed, 14 insertions, 65 deletions
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 <windows.h>
+#include <malloc.h>
#include <time.h>
#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;
}
|