The attached patch (applied to plugins/rms/src) adds SMS support to RMS
for LICQ.
Alon
--
This message was sent by Alon Altman ([EMAIL PROTECTED]) ICQ:1366540
GPG public key at http://alon.wox.org/pubkey.txt
Key fingerprint = A670 6C81 19D3 3773 3627 DE14 B44A 50A3 FE06 7F24
--------------------------------------------------------------------------
-=[ Random Fortune ]=-
You like to form new friendships and make new acquaintances.
diff -ru /home/alon/0/licq-20030618/plugins/rms/src/rms.cpp rms/src/rms.cpp
--- /home/alon/0/licq-20030618/plugins/rms/src/rms.cpp 2002-05-06 07:49:48.000000000
+0300
+++ rms/src/rms.cpp 2003-09-04 00:21:58.000000000 +0300
@@ -72,6 +72,8 @@
const unsigned short STATE_ENTERxURLxDESCRIPTION = 5;
const unsigned short STATE_ENTERxURL = 6;
const unsigned short STATE_ENTERxAUTOxRESPONSE = 7;
+const unsigned short STATE_ENTERxSMSxMESSAGE = 8;
+const unsigned short STATE_ENTERxSMSxNUMBER = 9;
#define NEXT_WORD(s) while (*s != '\0' && *s == ' ') s++;
@@ -82,7 +84,7 @@
char *help;
};
-static const unsigned short NUM_COMMANDS = 12;
+static const unsigned short NUM_COMMANDS = 13;
static struct Command commands[NUM_COMMANDS] =
{
{ "HELP", &CRMSClient::Process_HELP,
@@ -103,6 +105,8 @@
"Send a message { <uin> }." },
{ "URL", &CRMSClient::Process_URL,
"Send a url { <uin> }." },
+ { "SMS", &CRMSClient::Process_SMS,
+ "Send an sms { <uin> }." },
{ "LOG", &CRMSClient::Process_LOG,
"Dump log messages { <log types> }." },
{ "VIEW", &CRMSClient::Process_VIEW,
@@ -542,6 +546,16 @@
{
return Process_URL_url();
}
+ case STATE_ENTERxSMSxMESSAGE:
+ {
+ if (AddLineToText())
+ return Process_SMS_message();
+ break;
+ }
+ case STATE_ENTERxSMSxNUMBER:
+ {
+ return Process_SMS_number();
+ }
case STATE_ENTERxAUTOxRESPONSE:
{
if (AddLineToText())
@@ -936,6 +950,72 @@
/*---------------------------------------------------------------------------
+ * CRMSClient::Process_SMS
+ *
+ * Command:
+ * SMS <uin>
+ *
+ * Response:
+ * CODE_ENTERxLINE | CODE_INVALIDxUSER
+ * At which point the phone number should be entered on a line by itself
+ * without the "+", but including country code. Invalid user means the
+ * uin was invalid (< 10000) and the url was aborted.
+ * CODE_ENTERxTEXT
+ * Now the message should be entered and terminated by a "." on a line
+ * by itself.
+ * CODE_COMMANDxSTART
+ * < ...time... >
+ * CODE_RESULTxSUCCESS | CODE_EVENTxTIMEDOUT | CODE_EVENTxERROR
+ *-------------------------------------------------------------------------*/
+int CRMSClient::Process_SMS()
+{
+ unsigned long nUin = atol(data_arg);
+
+ if (nUin < 10000)
+ {
+ fprintf(fs, "%d Invalid UIN.\n", CODE_INVALIDxUSER);
+ return fflush(fs);
+ }
+ fprintf(fs, "%d Enter NUMBER:\n", CODE_ENTERxLINE);
+
+ m_nUin = nUin;
+ m_nTextPos = 0;
+
+ m_nState = STATE_ENTERxSMSxNUMBER;
+ return fflush(fs);
+}
+
+
+int CRMSClient::Process_SMS_number()
+{
+ strcpy(m_szLine, data_line);
+
+ fprintf(fs, "%d Enter message, terminate with a . on a line by itself:\n",
+ CODE_ENTERxTEXT);
+
+ m_szText[0] = '\0';
+ m_nTextPos = 0;
+
+ m_nState = STATE_ENTERxSMSxMESSAGE;
+ return fflush(fs);
+}
+
+
+int CRMSClient::Process_SMS_message()
+{
+ unsigned long tag = licqDaemon->icqSendSms(m_szLine,m_szText,m_nUin);
+
+ fprintf(fs, "%d [%ld] Sending SMS to %ld.\n", CODE_COMMANDxSTART,
+ tag, m_nUin);
+
+ tags.push_back(tag);
+ m_nState = STATE_COMMAND;
+
+ return fflush(fs);
+}
+
+
+/*---------------------------------------------------------------------------
* CRMSClient::Process_AR
*
* Command:
diff -ru /home/alon/0/licq-20030618/plugins/rms/src/rms.h rms/src/rms.h
--- /home/alon/0/licq-20030618/plugins/rms/src/rms.h 2002-09-10 02:06:45.000000000
+0300
+++ rms/src/rms.h 2003-09-04 00:17:13.000000000 +0300
@@ -75,6 +75,7 @@
int Process_LIST();
int Process_MESSAGE();
int Process_URL();
+ int Process_SMS();
int Process_LOG();
int Process_VIEW();
int Process_AR();
@@ -103,6 +104,8 @@
int Process_MESSAGE_text();
int Process_URL_url();
int Process_URL_text();
+ int Process_SMS_number();
+ int Process_SMS_message();
int Process_AR_text();