[PATCH 2/2] Add RunOnSent.

Denis Carikli <[email protected]>
Newsgroups gmane.linux.drivers.gammu
Message-ID <[email protected]>
This is to execute a program after sending message.

Signed-off-by: Denis Carikli <[email protected]>
---
 smsd/core.c | 6 ++++++
 smsd/core.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/smsd/core.c b/smsd/core.c
index 2be4a3f..832f6f8 100644
--- a/smsd/core.c
+++ b/smsd/core.c
@@ -825,6 +825,7 @@ GSM_Error SMSD_ReadConfig(const char *filename, GSM_SMSDConfig *Config, gboolean
 
 	Config->RunOnReceive = INI_GetValue(Config->smsdcfgfile, "smsd", "runonreceive", FALSE);
 	Config->RunOnFailure = INI_GetValue(Config->smsdcfgfile, "smsd", "runonfailure", FALSE);
+	Config->RunOnSent = INI_GetValue(Config->smsdcfgfile, "smsd", "runonsent", FALSE);
 
 	str = INI_GetValue(Config->smsdcfgfile, "smsd", "smsc", FALSE);
 	if (str) {
@@ -1700,6 +1701,11 @@ GSM_Error SMSD_SendSMS(GSM_SMSDConfig *Config)
 		SMSD_LogError(DEBUG_ERROR, Config, "Error moving message", error);
 		Config->Service->MoveSMS(&sms,Config, Config->SMSID, TRUE, FALSE);
 	}
+
+	if (Config->RunOnSent != NULL && error == ERR_NONE) {
+		SMSD_RunOn(Config->RunOnSent, &sms, Config, Config->SMSID);
+	}
+
 	return ERR_NONE;
 failure_unsent:
 	if (Config->RunOnFailure != NULL) {
diff --git a/smsd/core.h b/smsd/core.h
index c76f3da..0ce499c 100644
--- a/smsd/core.h
+++ b/smsd/core.h
@@ -85,6 +85,7 @@ struct _GSM_SMSDConfig {
 	const char	*PhoneID;
 	const char   *RunOnReceive;
 	const char   *RunOnFailure; /* run this command on phone communication failure */
+	const char   *RunOnSent; /* run this command when an SMS has been sent successfully */
 	gboolean checksecurity;
 	gboolean hangupcalls;
 	gboolean checkbattery;
-- 
2.4.5


------------------------------------------------------------------------------
_______________________________________________
Gammu-users mailing list - https://lists.sourceforge.net/lists/listinfo/gammu-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.