diff options
Diffstat (limited to 'plugins/CmdLine/src')
-rw-r--r-- | plugins/CmdLine/src/mimcmd_data.h | 4 | ||||
-rw-r--r-- | plugins/CmdLine/src/mimcmd_handlers.cpp | 30 | ||||
-rw-r--r-- | plugins/CmdLine/src/version.h | 2 |
3 files changed, 23 insertions, 13 deletions
diff --git a/plugins/CmdLine/src/mimcmd_data.h b/plugins/CmdLine/src/mimcmd_data.h index 03500c69b4..713496f7b3 100644 --- a/plugins/CmdLine/src/mimcmd_data.h +++ b/plugins/CmdLine/src/mimcmd_data.h @@ -1,7 +1,7 @@ /*
CmdLine plugin for Miranda IM
-Copyright © 2007 Cristian Libotean
+Copyright � 2007 Cristian Libotean
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -100,7 +100,7 @@ typedef TSharedData *PSharedData; #define MIMCMD_HELP_EXCHANGE LPGEN("Notifies Exchange plugin to check for email.\nUsage: exchange check.")
#define MIMCMD_HELP_YAMN LPGEN("Notifies YAMN plugin to check for email.\nUsage: yamn check.")
#define MIMCMD_HELP_CALLSERVICE LPGEN("Calls a Miranda service.\nUsage: callservice <service> (d|s)<wParam> (d|s)<lParam>.\nThe command will call Miranda <service> service using wParam and lParam as arguments; the first letter of the paramater must be either 'd' if the parameter is a decimal number or 's' if the parameter is a string. Be careful when you use this function as you can only pass numbers and strings as data.\nNOTE: If you pass invalid data to a service Miranda might crash.")
-#define MIMCMD_HELP_MESSAGE LPGEN("Sends a message to the specified contact(s).\nUsage: message <contact> [<contact> [<contact> [...]]] <message>.\nThe command will send <message> to the specified contact(s) - at least one contact must be specified - all parameters except the last one are considered recipients.\n<Contact> has the following format: <name>[:<account>]. <Name> is the contact display name or unique ID and <account> is an optional parameter representing the account of the contact (useful in case there is more than one contact with the same name).\nNOTE: The message string cannot exceed 512 characters.")
+#define MIMCMD_HELP_MESSAGE LPGEN("Sends a message to the specified contact(s).\nUsage: message <contact> [<contact> [<contact> [...]]] <message>.\nThe command will send <message> to the specified contact(s) - at least one contact must be specified - all parameters except the last one are considered recipients.\n<Contact> has the following format: <name>[:<account>]. <Name> is the contact display name or unique ID and <account> is an optional parameter representing the account of the contact (useful in case there is more than one contact with the same name).\nNOTE: The message string cannot exceed 512 characters. You can use \\n for new line (and \\\\n for \\n).")
#define MIMCMD_HELP_DATABASE LPGEN("Allows you to manage database settings.\nUsage:\n db set <module> <name> (b|i|d|s|w)<value>\n db delete <module> <name>\n db get <module> <name>.\nThe command can set a database entry to the specified value (if the entry does not exist it will be created) as well as read or delete a specified database entry. <Module> is the name of the module where the key should be located, <name> is the name of the key and <value> is the value to be written. A character must be placed before <value> in order to specify what kind of data to write: b - byte, i - integer (word), d - double word, s - string, w - wide string.")
#define MIMCMD_HELP_PROXY LPGEN("Configures proxy settings either globally or per account.\nUsage: proxy (global|<account>) <setting> [<params>].\n<Setting> is one of the following settings:\n status (disable | enable | toggle)\n server <proxy type> <server> <port>.")
#define MIMCMD_HELP_CONTACTS LPGEN("Allows you to search/list contacts or open a message windows for specified contacts.\nUsage:\n contacts list [<keyword> [account:<account>] [id:<id>] [status:<status>] [<keyword> [...]]].\nThe command will search all contacts and display the ones matching the search criteria. To search for a specific account use the keyword 'account:<account>'. To search for contacts that have a certain ID use the keyword 'id:<id>'. To search for contacts that have a certain status use 'status:<status>'.\n contacts open [<keyword> [account:<account>] [id:<id>] [status:<status>] [<keyword> [...]]].\nThe command will open a message window for all contacts that match the search criteria. To search for a specific account use the keyword 'account:<account>'. To search for contacts that have a certain ID use the keyword 'id:<id>'. To search for contacts that have a certain status use 'status:<status>'. If no keyword is specified the command will open a message window for all contacts that have unread messages.")
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 6552deb408..20c6c63b4a 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1,7 +1,7 @@ /*
CmdLine plugin for Miranda IM
-Copyright © 2007 Cristian Libotean
+Copyright � 2007 Cristian Libotean
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -1065,6 +1065,18 @@ void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PRepl }
}
+void ParseMessage(char buffer[512], const char *message) {
+ unsigned int j = 0;
+ for (unsigned int i = 0; i < strlen(message); ++i) {
+ char c = message[i];
+ if (c == '\\' && i < (strlen(message) - 1) && message[i+1] == 'n') {
+ c = '\n';
+ i++;
+ }
+ buffer[j++] = c;
+ }
+ buffer[j] = '\0';
+}
MCONTACT ParseContactParam(char *contact)
{
@@ -1095,22 +1107,20 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re {
if (argc >= 4)
{
- char *message = argv[argc - 1]; //get the message
- int i;
- char *contact;
+ char message[512];
+ ParseMessage(message, argv[argc - 1]); //get the message
+
char buffer[1024];
- MCONTACT hContact;
- HANDLE hProcess = NULL;
ACKDATA *ack = NULL;
- for (i = 2; i < argc - 1; i++)
+ for (int i = 2; i < argc - 1; i++)
{
- contact = argv[i];
- hContact = ParseContactParam(contact);
+ char *contact = argv[i];
+ MCONTACT hContact = ParseContactParam(contact);
if (hContact)
{
bShouldProcessAcks = TRUE;
- hProcess = (HANDLE) CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM) message);
+ HANDLE hProcess = (HANDLE)CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)message);
const int MAX_COUNT = 60;
int counter = 0;
while (((ack = GetAck(hProcess)) == NULL) && (counter < MAX_COUNT))
diff --git a/plugins/CmdLine/src/version.h b/plugins/CmdLine/src/version.h index 2b2d62a030..fff697ffd6 100644 --- a/plugins/CmdLine/src/version.h +++ b/plugins/CmdLine/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
#define __RELEASE_NUM 4
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>
|