| verzia 1.19, 2001/10/25 09:37:57 |
verzia 1.20, 2001/10/25 17:37:58 |
|
|
| /* |
/* |
| * Author: rajo <host8@kepler.fmph.uniba.sk> |
* Author: rajo <host8@kepler.fmph.uniba.sk> |
| * $Log$ |
* $Log$ |
| |
* Revision 1.20 2001/10/25 17:37:58 host8 |
| |
* Support only some sms-gates available. |
| |
* |
| * Revision 1.19 2001/10/25 09:37:57 host8 |
* Revision 1.19 2001/10/25 09:37:57 host8 |
| * Added support for selection only some sms-gates. |
* Added support for selection only some sms-gates. |
| * |
* |
|
|
| * Removed white characters in SMS message. |
* Removed white characters in SMS message. |
| * Minor bugfixies & lots of improvements. |
* Minor bugfixies & lots of improvements. |
| * Unneccessary files removed from CVS repository. |
* Unneccessary files removed from CVS repository. |
| * |
|
| * Revision 1.16 2001/10/02 14:46:14 host8 |
|
| * Patched syntax bug (bad global substitution). |
|
| * |
|
| * Revision 1.15 2001/09/28 18:05:35 host8 |
|
| * Test of CVSUSER |
|
| * |
|
| * Revision 1.14 2001/09/28 18:04:24 host8 |
|
| * Test of CVSUSER |
|
| */ |
*/ |
| /* README {{{1 |
/* README {{{1 |
| * - riadky, na ktorych sa nachadzaju zatvorky `{{{' alebo `}}}' |
* - riadky, na ktorych sa nachadzaju zatvorky `{{{' alebo `}}}' |
| * su urcene pre editor ViM 6.0 . ViM 6.0 podla tychto znaciek |
* su urcene pre editor ViM 6.0 . ViM 6.0 podla tychto znaciek |
| * rozoznava, kde sa zacina a konci jedna cast textu, kt. mozno |
* rozoznava, kde sa zacina a konci jedna cast textu, kt. mozno |
| * skryt. Preto prosim neprepisuj tieto riadky, pokial nevies |
* skryt. Preto prosim neprepisuj tieto riadky, pokial nevies |
| * co robis. D. |
* co robis. D. |
| * }}}1 |
* }}}1 |
| */ |
*/ |
| #include <stdio.h> |
#include <stdio.h> |
|
|
| #include <getopt.h> |
#include <getopt.h> |
| //#include <netdb.h> |
//#include <netdb.h> |
| |
|
| #include "config.h" |
#ifdef HAVE_CONFIG_H |
| |
# include "config.h" |
| |
#endif |
| #include "mail2sms.h" |
#include "mail2sms.h" |
| #include "http.h" |
#include "http.h" |
| #include "strings.h" |
#include "strings.h" |
| |
|
| |
#if defined(ENABLE_AZET) || defined(ENABLE_WHIZDIARY) || defined(ENABLE_SPISNET) || defined(ENABLE_GLOBTELNET) || defined(ENABLE_MTNSMS) |
| |
/* empty */ |
| |
#else |
| |
# error Please re-run ./configure with at least one argument --enable-* ! |
| |
#endif |
| |
|
| /* global variables {{{ */ |
/* global variables {{{ */ |
| char *message, *scratch, *keybd; |
char *message, *scratch, *keybd; |
| GLOB g; |
GLOB g; |
| Riadok 103 int sendsms(char *str, int show_info) |
|
| Riadok 105 int sendsms(char *str, int show_info) |
|
| //int info=show_info; |
//int info=show_info; |
| |
|
| // GET http request {{{ |
// GET http request {{{ |
| |
switch (id) { |
| #ifdef ENABLE_AZET |
#ifdef ENABLE_AZET |
| if (id == AZET) { |
case AZET: |
| http_request(HTTP_GET, "/index.phtml?", "sms.azet.sk", NULL); |
http_request(HTTP_GET, "/index.phtml?", "sms.azet.sk", NULL); |
| http_set_referer("sms2.azet.sk", "/"); |
http_set_referer("sms2.azet.sk", "/"); |
| http_request(HTTP_POST, "/index.phtml", "sms.azet.sk", |
http_request(HTTP_POST, "/index.phtml", "sms.azet.sk", |
| "Content-type: " |
"Content-type: " |
| "application/x-www-form-urlencoded\r\n" |
"application/x-www-form-urlencoded\r\n" |
| "Content-length: %d\r\n\r\n%s", |
"Content-length: %d\r\n\r\n%s", |
| strlen(str), str); |
strlen(str), str); |
| |
|
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_WHIZDIARY |
#ifdef ENABLE_WHIZDIARY |
| if (id == WHIZDIARY) { |
case WHIZDIARY: |
| http_request(HTTP_GET, "/home.asp", "www.whizdiary.com", NULL); |
http_request(HTTP_GET, "/home.asp", "www.whizdiary.com", NULL); |
| http_request(HTTP_GET, "/noCookies.asp", "www.whizdiary.com", NULL); |
http_request(HTTP_GET, "/noCookies.asp", "www.whizdiary.com", NULL); |
| http_request(HTTP_GET, "/default.asp", "www.whizdiary.com", NULL); |
http_request(HTTP_GET, "/default.asp", "www.whizdiary.com", NULL); |
| http_request(HTTP_GET, "/home.asp", "www.whizdiary.com", NULL); |
http_request(HTTP_GET, "/home.asp", "www.whizdiary.com", NULL); |
| http_request(HTTP_GET, "/sms.asp", "www.whizdiary.com", NULL); |
http_request(HTTP_GET, "/sms.asp", "www.whizdiary.com", NULL); |
| http_request(HTTP_POST, "/sms.asp", "www.whizdiary.com", |
http_request(HTTP_POST, "/sms.asp", "www.whizdiary.com", |
| "Content-type: " |
"Content-type: " |
| "application/x-www-form-urlencoded\r\n" |
"application/x-www-form-urlencoded\r\n" |
| "Content-length: %d\r\n\r\n%s", |
"Content-length: %d\r\n\r\n%s", |
| strlen(str), str); |
strlen(str), str); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_SPISNET |
#ifdef ENABLE_SPISNET |
| if (id == SPISNET) { |
case SPISNET: |
| http_request(HTTP_GET, "/top.php3", "sms.spisnet.sk", NULL); |
http_request(HTTP_GET, "/top.php3", "sms.spisnet.sk", NULL); |
| http_request(HTTP_POST, "/smssend.php3", "sms.spisnet.sk", |
http_request(HTTP_POST, "/smssend.php3", "sms.spisnet.sk", |
| "Content-type: " |
"Content-type: " |
| "application/x-www-form-urlencoded; " |
"application/x-www-form-urlencoded; " |
| "charset=windows-1250\r\n" |
"charset=windows-1250\r\n" |
| "Content-length: %d\r\n\r\n%s", |
"Content-length: %d\r\n\r\n%s", |
| strlen(str), str); |
strlen(str), str); |
| // "smsn=421903123123&chars=0&smsm=sorry%2C+test&submit=Odoslat+SMS+spr%E1vu" |
// "smsn=421903123123&chars=0&smsm=sorry%2C+test&submit=Odoslat+SMS+spr%E1vu" |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_GLOBTELNET |
#ifdef ENABLE_GLOBTELNET |
| if (id == GLOBTELNET) { |
case GLOBTELNET: |
| /* Begin of frames * |
/* Begin of frames * |
| http_request(HTTP_GET, "/get/guest/app.php3.html", |
http_request(HTTP_GET, "/get/guest/app.php3.html", |
| "www.globtelnet.sk", NULL); |
"www.globtelnet.sk", NULL); |
| http_request(HTTP_GET, "/get/guest/core/core.php3.html", |
http_request(HTTP_GET, "/get/guest/core/core.php3.html", |
| "www.globtelnet.sk", NULL); |
"www.globtelnet.sk", NULL); |
| http_request(HTTP_GET, "/get/guest/app.php3:_navigator:.html", |
http_request(HTTP_GET, "/get/guest/app.php3:_navigator:.html", |
| "www.globtelnet.sk", NULL); |
"www.globtelnet.sk", NULL); |
| http_request(HTTP_GET, "/get/all/app.php3:_linkbar.html", |
http_request(HTTP_GET, "/get/all/app.php3:_linkbar.html", |
| "www.globtelnet.sk", NULL); |
"www.globtelnet.sk", NULL); |
| * End of frames */ |
* End of frames */ |
| http_request(HTTP_GET, "/get/all/core/register.php3.html", |
http_request(HTTP_GET, "/get/all/core/register.php3.html", |
| "www.globtelnet.sk", NULL); |
"www.globtelnet.sk", NULL); |
| /* login */ |
/* login */ |
| http_request(HTTP_POST, "/core/do_user.php3", "www.globtelnet.sk", |
http_request(HTTP_POST, "/core/do_user.php3", "www.globtelnet.sk", |
| "Content-type: " |
"Content-type: " |
| "application/x-www-form-urlencoded; " |
"application/x-www-form-urlencoded; " |
| "charset=windows-1250\r\n" |
"charset=windows-1250\r\n" |
| "Content-length: 51\r\n\r\n"" |
"Content-length: 51\r\n\r\n"" |
| form_name=login" |
form_name=login" |
| "&next_page=&wa_na=%s&wa_pa=%s", |
"&next_page=&wa_na=%s&wa_pa=%s", |
| g.login, g.pass); |
g.login, g.pass); |
| http_request(HTTP_POST, "/sms/do_sms_send.php3", "www.globtelnet.sk", |
http_request(HTTP_POST, "/sms/do_sms_send.php3", "www.globtelnet.sk", |
| "Content-type: " |
"Content-type: " |
| "application/x-www-form-urlencoded; " |
"application/x-www-form-urlencoded; " |
| "charset=windows-1250\r\n" |
"charset=windows-1250\r\n" |
| "Content-length: %d\r\n\r\n%s", |
"Content-length: %d\r\n\r\n%s", |
| strlen(str), str); |
strlen(str), str); |
| http_request(HTTP_GET, "/comm/message.php3?readsess=1", |
http_request(HTTP_GET, "/comm/message.php3?readsess=1", |
| "www.globtelnet.sk", NULL); |
"www.globtelnet.sk", NULL); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_MTNSMS |
#ifdef ENABLE_MTNSMS |
| if (id == MTNSMS) { |
case MTNSMS: |
| http_request(HTTP_GET, "/", "www.mtnsms.com", NULL); |
http_request(HTTP_GET, "/", "www.mtnsms.com", NULL); |
| http_request(HTTP_POST, "/session.asp", "www.mtnsms.com", |
http_request(HTTP_POST, "/session.asp", "www.mtnsms.com", |
| "Content-type: " |
"Content-type: " |
| "application/x-www-form-urlencoded; " |
"application/x-www-form-urlencoded; " |
| "Content-length: 77\r\n\r\n%s", |
"Content-length: 77\r\n\r\n%s", |
| "username=%s&" |
"username=%s&" |
| "password=%s&email=&" |
"password=%s&email=&" |
| "joinusclick=no&returl=&x=40&y=39", |
"joinusclick=no&returl=&x=40&y=39", |
| g.login, g.pass); |
g.login, g.pass); |
| } |
break; |
| #endif |
#endif |
| |
default: |
| |
fprintf(stderr, "Somethings go wrong, " |
| |
"invalid id in sendsms()!\n"); |
| |
exit(1); |
| |
break; |
| |
} /* end switch (id) */ |
| // }}} |
// }}} |
| |
|
| fprintf(stderr, "text to sms [%d chars]:'%s'\n", |
fprintf(stderr, "text to sms [%d chars]:'%s'\n", |
| Riadok 207 void analyze_mail(char *str) |
|
| Riadok 212 void analyze_mail(char *str) |
|
| |
|
| if (str == strstr(str, "From:") && ! g.skipped_header) { |
if (str == strstr(str, "From:") && ! g.skipped_header) { |
| strncat(g.text, |
strncat(g.text, |
| compress_str(str + strlen("From:")), |
compress_str(str + strlen("From:")), |
| SMS_LEN - strlen(g.text)); |
SMS_LEN - strlen(g.text)); |
| strncat(g.text, SMS_SEPARATOR, SMS_LEN - strlen(g.text)); |
strncat(g.text, SMS_SEPARATOR, SMS_LEN - strlen(g.text)); |
| g.text[SMS_LEN] = '\0'; |
g.text[SMS_LEN] = '\0'; |
| |
|
| Riadok 219 void analyze_mail(char *str) |
|
| Riadok 224 void analyze_mail(char *str) |
|
| |
|
| if (str == strstr(str, "Subject:") && ! g.skipped_header) { |
if (str == strstr(str, "Subject:") && ! g.skipped_header) { |
| strncat(g.text, |
strncat(g.text, |
| compress_str(str + strlen("Subject:")), |
compress_str(str + strlen("Subject:")), |
| SMS_LEN - strlen(g.text)); |
SMS_LEN - strlen(g.text)); |
| strncat(g.text, SMS_SEPARATOR, SMS_LEN - strlen(g.text)); |
strncat(g.text, SMS_SEPARATOR, SMS_LEN - strlen(g.text)); |
| g.text[SMS_LEN] = '\0'; |
g.text[SMS_LEN] = '\0'; |
| |
|
| Riadok 233 void analyze_mail(char *str) |
|
| Riadok 238 void analyze_mail(char *str) |
|
| strcpy(pom, str); |
strcpy(pom, str); |
| strtolower(pom); |
strtolower(pom); |
| if (pom == strstr(pom, "content-transfer-encoding: ") |
if (pom == strstr(pom, "content-transfer-encoding: ") |
| && g.is_header) { |
&& g.is_header) { |
| if (pom == strstr(pom, "content-transfer-encoding: 8bit") |
if (pom == strstr(pom, "content-transfer-encoding: 8bit") |
| || pom == strstr(pom, "content-transfer-encoding:" |
|| pom == strstr(pom, "content-transfer-encoding:" |
| " 7bit")) { |
" 7bit")) { |
| } |
} |
| else { |
else { |
| Riadok 284 void print_usage(char *argv0) |
|
| Riadok 289 void print_usage(char *argv0) |
|
| fprintf(stderr, "Usage: %s [OPTIONS] [MESSAGE] ...\n", argv0); |
fprintf(stderr, "Usage: %s [OPTIONS] [MESSAGE] ...\n", argv0); |
| fprintf(stderr, " --number povinne tel. cislo [421903838302]\n"); |
fprintf(stderr, " --number povinne tel. cislo [421903838302]\n"); |
| fprintf(stderr, " --gate [" |
fprintf(stderr, " --gate [" |
| |
// #ifdef ENABLE_AZET {{{ |
| #ifdef ENABLE_AZET |
#ifdef ENABLE_AZET |
| "azet|" |
# define TMP_SOMETHING_ENABLED |
| |
"azet" |
| #endif |
#endif |
| |
// }}} #ifdef ENABLE_AZET |
| |
// #ifdef ENABLE_WHIZDIARY {{{ |
| #ifdef ENABLE_WHIZDIARY |
#ifdef ENABLE_WHIZDIARY |
| "whizdiary|" |
# ifndef TMP_SOMETHING_ENABLED |
| |
# define TMP_SOMETHING_ENABLED |
| |
# else |
| |
"|" |
| |
# endif |
| |
"whizdiary" |
| #endif |
#endif |
| |
// }}} #ifdef ENABLE_WHIZDIARY |
| |
// #ifdef ENABLE_SPISNET {{{ |
| #ifdef ENABLE_SPISNET |
#ifdef ENABLE_SPISNET |
| "spisnet|" |
# ifndef TMP_SOMETHING_ENABLED |
| |
# define TMP_SOMETHING_ENABLED |
| |
# else |
| |
"|" |
| |
# endif |
| |
"spisnet" |
| #endif |
#endif |
| |
// }}} #ifdef ENABLE_SPISNET |
| |
// #ifdef ENABLE_GLOBTELNET {{{ |
| #ifdef ENABLE_GLOBTELNET |
#ifdef ENABLE_GLOBTELNET |
| "globtelnet|" |
# ifndef TMP_SOMETHING_ENABLED |
| |
# define TMP_SOMETHING_ENABLED |
| |
# else |
| |
"|" |
| |
# endif |
| |
"globtelnet" |
| #endif |
#endif |
| |
// }}}#ifdef ENABLE_GLOBTELNET |
| |
// #ifdef ENABLE_MTNSMS {{{ |
| #ifdef ENABLE_MTNSMS |
#ifdef ENABLE_MTNSMS |
| "mtnsms" |
# ifndef TMP_SOMETHING_ENABLED |
| #endif |
# define TMP_SOMETHING_ENABLED |
| "]\n"); |
# else |
| |
"|" |
| |
# endif |
| |
"mtnsms" |
| |
#endif |
| |
// }}} #ifdef ENABLE_MTNSMS |
| |
"]\n"); |
| |
#undef TMP_SOMETHING_ENABLED |
| fprintf(stderr, " --mail standardny vstup je mail\n"); |
fprintf(stderr, " --mail standardny vstup je mail\n"); |
| fprintf(stderr, " --nomail standardny vstup nie je mail\n"); |
fprintf(stderr, " --nomail standardny vstup nie je mail\n"); |
| fprintf(stderr, " --reverse zmena poradia smsiek [123] -> [321]\n"); |
fprintf(stderr, " --reverse zmena poradia smsiek [123] -> [321]\n"); |
| |
#ifdef DEBUG |
| fprintf(stderr, " --debug vypis ladiacich informacii\n"); |
fprintf(stderr, " --debug vypis ladiacich informacii\n"); |
| |
#endif |
| fprintf(stderr, " --help vypis tejto informacie a koniec\n"); |
fprintf(stderr, " --help vypis tejto informacie a koniec\n"); |
| } // }}} |
} // }}} |
| // Function main() {{{ |
// Function main() {{{ |
| Riadok 314 int main(int argc, char *argv[]) |
|
| Riadok 353 int main(int argc, char *argv[]) |
|
| |
|
| g.is_mail = 0; |
g.is_mail = 0; |
| g.reverse = 0; |
g.reverse = 0; |
| |
#ifdef DEBUG |
| g.debug = 0; |
g.debug = 0; |
| |
#endif |
| |
|
| strcpy(argv[0], "lynx"); |
strcpy(argv[0], "lynx"); |
| if (argc < 2) { |
if (argc < 2) { |
| Riadok 333 int main(int argc, char *argv[]) |
|
| Riadok 374 int main(int argc, char *argv[]) |
|
| {"mail", 0, 0, 'm'}, |
{"mail", 0, 0, 'm'}, |
| {"nomail", 0, 0, 'M'}, |
{"nomail", 0, 0, 'M'}, |
| {"reverse", 0, 0, 'r'}, |
{"reverse", 0, 0, 'r'}, |
| |
#ifdef DEBUG |
| {"debug", 2, 0, 'd'}, |
{"debug", 2, 0, 'd'}, |
| |
#endif |
| {"help", 0, 0, 'h'}, |
{"help", 0, 0, 'h'}, |
| {0, 0, 0, 0} |
{0, 0, 0, 0} |
| }; |
}; |
| |
|
| c = getopt_long (argc, argv, "n:g:pmMrd::h", |
c = getopt_long (argc, argv, |
| |
#ifdef DEBUG |
| |
"n:g:pmMrd::h", |
| |
#else |
| |
"n:g:pmMrh", |
| |
#endif |
| long_options, &option_index); |
long_options, &option_index); |
| if (c == -1) |
if (c == -1) |
| break; |
break; |
| Riadok 391 int main(int argc, char *argv[]) |
|
| Riadok 439 int main(int argc, char *argv[]) |
|
| fprintf(stderr, "r: reverse = %d\n", g.reverse); |
fprintf(stderr, "r: reverse = %d\n", g.reverse); |
| #endif |
#endif |
| break; |
break; |
| |
#ifdef DEBUG |
| case 'd': |
case 'd': |
| if (optarg!=NULL) { |
if (optarg!=NULL) { |
| g.debug = atoi(optarg); |
g.debug = atoi(optarg); |
| } |
} |
| else g.debug = 1; |
else g.debug = 1; |
| #ifdef DEBUG |
|
| fprintf(stderr, "d: debug = %d\n", g.debug); |
fprintf(stderr, "d: debug = %d\n", g.debug); |
| #endif |
#endif |
| break; |
break; |
| Riadok 418 int main(int argc, char *argv[]) |
|
| Riadok 466 int main(int argc, char *argv[]) |
|
| keybd = (char *) malloc(KEYBD_LEN*sizeof(char)); |
keybd = (char *) malloc(KEYBD_LEN*sizeof(char)); |
| |
|
| // Preprocessing message {{{ |
// Preprocessing message {{{ |
| |
switch (id) { |
| #ifdef ENABLE_AZET |
#ifdef ENABLE_AZET |
| if (id == AZET) { |
case AZET: |
| //komu=0903&predvolba=0903&cislo=838302&sprava=caf+pokus1%0adaskfjkadf+%3Csipky%3E%0ahalo&oslovenie=Ahoj+Milacik%21+&velkost=420&odoslat=Ok&odoslat.x=0&odoslat.y=0", |
//komu=0903&predvolba=0903&cislo=838302&sprava=caf+pokus1%0adaskfjkadf+%3Csipky%3E%0ahalo&oslovenie=Ahoj+Milacik%21+&velkost=420&odoslat=Ok&odoslat.x=0&odoslat.y=0", |
| strcpy(message, "komu="); |
strcpy(message, "komu="); |
| strncat(message, g.number, 4); |
strncat(message, g.number, 4); |
| strcat(message, "&predvolba="); |
strcat(message, "&predvolba="); |
| strncat(message, g.number, 4); |
strncat(message, g.number, 4); |
| strcat(message, "&cislo="); |
strcat(message, "&cislo="); |
| strncat(message, g.number + 4, (strlen(g.number) - 4) ); |
strncat(message, g.number + 4, (strlen(g.number) - 4) ); |
| strcat(message, "&sprava="); |
strcat(message, "&sprava="); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_WHIZDIARY |
#ifdef ENABLE_WHIZDIARY |
| if (id == WHIZDIARY) { |
case WHIZDIARY: |
| strcpy(message, "theAction=Send+Message&cellnum=%2B"); |
strcpy(message, "theAction=Send+Message&cellnum=%2B"); |
| strncat(message, g.number, strlen(g.number)); |
strncat(message, g.number, strlen(g.number)); |
| strcat(message, "&message="); |
strcat(message, "&message="); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_SPISNET |
#ifdef ENABLE_SPISNET |
| if (id == SPISNET) { |
case SPISNET: |
| strcpy(message, "smsn="); |
strcpy(message, "smsn="); |
| strncat(message, g.number, strlen(g.number)); |
strncat(message, g.number, strlen(g.number)); |
| strcat(message, "&chars=0"); |
strcat(message, "&chars=0"); |
| strcat(message, "&smsm="); |
strcat(message, "&smsm="); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_GLOBTELNET |
#ifdef ENABLE_GLOBTELNET |
| if (id == GLOBTELNET) { |
case GLOBTELNET: |
| strcpy(message, "f_Slot_num=&f_Redirect=%2Fsms%2Fsms.php3" |
strcpy(message, "f_Slot_num=&f_Redirect=%2Fsms%2Fsms.php3" |
| "&f_TelNumber="); |
"&f_TelNumber="); |
| strncat(message, g.number, strlen(g.number)); |
strncat(message, g.number, strlen(g.number)); |
| strcat(message, "&x=25&y=10"); |
strcat(message, "&x=25&y=10"); |
| strcat(message, "&f_SMSBody="); |
strcat(message, "&f_SMSBody="); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_MTNSMS |
#ifdef ENABLE_MTNSMS |
| if (id == MTNSMS) { |
case MTNSMS: |
| } |
break; |
| #endif |
#endif |
| // }}} Preprocessing message |
default: |
| |
fprintf(stderr, "Somethings go wrong, invalid id in " |
| |
"preprocessing message!\n"); |
| |
exit(1); |
| |
break; |
| |
} /* end switch (id) */ |
| |
// }}} Preprocessing message |
| |
|
| if (optind < argc) { |
if (optind < argc) { |
| #ifdef DEBUG |
#ifdef DEBUG |
| if (g.debug) |
if (g.debug) |
| Riadok 482 int main(int argc, char *argv[]) |
|
| Riadok 533 int main(int argc, char *argv[]) |
|
| fprintf (stderr, "\n"); |
fprintf (stderr, "\n"); |
| #endif |
#endif |
| } |
} |
| |
#ifdef DEBUG |
| fprintf(stderr, "message: %s\n", message); |
fprintf(stderr, "message: %s\n", message); |
| |
#endif |
| |
|
| while (!koniec) { |
while (!koniec) { |
| FD_ZERO(&fds); |
FD_ZERO(&fds); |
| Riadok 509 int main(int argc, char *argv[]) |
|
| Riadok 562 int main(int argc, char *argv[]) |
|
| } // end while (!koniec) |
} // end while (!koniec) |
| strcat(message, g.text); |
strcat(message, g.text); |
| // Postprocessing message {{{ |
// Postprocessing message {{{ |
| |
switch (id) { |
| #ifdef ENABLE_AZET |
#ifdef ENABLE_AZET |
| if (id == AZET) { |
case AZET: |
| strcat(message, "&oslovenie=Ahoj+Milacik%21+&velkost=420" |
strcat(message, "&oslovenie=Ahoj+Milacik%21+&velkost=420" |
| "&odoslat=Ok&odoslat.x=0&odoslat.y=0"); |
"&odoslat=Ok&odoslat.x=0&odoslat.y=0"); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_WHIZDIARY |
#ifdef ENABLE_WHIZDIARY |
| if (id == WHIZDIARY) { |
case WHIZDIARY: |
| strcat(message, "&charsLeft="); |
strcat(message, "&charsLeft="); |
| strcat(message, "130&theNetwork=NONE&I4.x=0&I4.y=0"); |
strcat(message, "130&theNetwork=NONE&I4.x=0&I4.y=0"); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_SPISNET |
#ifdef ENABLE_SPISNET |
| if (id == SPISNET) { |
case SPISNET: |
| // "smsn=421903123123&chars=0&smsm=sorry%2C+test&submit=Odoslat+SMS+spr%E1vu" |
// "smsn=421903123123&chars=0&smsm=sorry%2C+test&submit=Odoslat+SMS+spr%E1vu" |
| strcat(message, "&submit=Odoslat+SMS+spr%E1vu"); |
strcat(message, "&submit=Odoslat+SMS+spr%E1vu"); |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_GLOBTELNET |
#ifdef ENABLE_GLOBTELNET |
| if (id == GLOBTELNET) { |
case GLOBTELNET: |
| /* empty */ |
/* empty */ |
| } |
break; |
| else |
|
| #endif |
#endif |
| #ifdef ENABLE_MTNSMS |
#ifdef ENABLE_MTNSMS |
| if (id == MTNSMS) { |
case MTNSMS: |
| /* empty */ |
/* empty */ |
| } |
break; |
| #endif |
#endif |
| |
default: |
| |
fprintf(stderr, "Somethings go wrong, invalid id in " |
| |
"postprocessing message!\n"); |
| |
exit(1); |
| |
break; |
| |
} /* end switch (id) */ |
| // }}} Postprocessing message |
// }}} Postprocessing message |
| |
|
| if (sendsms(message, g.debug-1) != 0) { |
if ( |
| |
#ifdef DEBUG |
| |
sendsms(message, g.debug-1) != 0 |
| |
#else |
| |
sendsms(message, 0) != 0 |
| |
#endif |
| |
) { |
| sleep(1); |
sleep(1); |
| fprintf(stderr, "Zlyhalo posielanie SMSky, " |
fprintf(stderr, "Zlyhalo posielanie SMSky, " |
| "skusam poslat este raz ...\n"); |
"skusam poslat este raz ...\n"); |
| |
#ifdef DEBUG |
| sendsms(message, g.debug-1); |
sendsms(message, g.debug-1); |
| |
#else |
| |
sendsms(message, 0); |
| |
#endif |
| } |
} |
| free(message); |
free(message); |
| free(scratch); |
free(scratch); |