[Freeswitch-branches] [commit] r11714 - freeswitch/branches/gmaruzz/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Mon Feb 9 10:10:52 PST 2009
Author: gmaruzz
Date: Mon Feb 9 12:10:52 2009
New Revision: 11714
Log:
skypiax: cleaning skypiax_protocol.c
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Mon Feb 9 12:10:52 2009
@@ -327,53 +327,32 @@
{
char read_from_pipe[4096];
- char messaggio[4096];
- char messaggio_2[4096];
+ char message[4096];
+ char message_2[4096];
char *buf, obj[512] = "", id[512] = "", prop[512] = "", value[512] = "", *where;
char **stringp = NULL;
- int rt;
int a;
unsigned int howmany;
unsigned int i;
-#ifndef WIN32
- int fdselect;
- fd_set fs;
- struct timeval to;
-#endif /* WIN32 */
memset(read_from_pipe, 0, 4096);
- memset(messaggio, 0, 4096);
- memset(messaggio_2, 0, 4096);
+ memset(message, 0, 4096);
+ memset(message_2, 0, 4096);
-#ifdef WIN32
- rt = 1;
-#else /* WIN32 */
- fdselect = tech_pvt->SkypiaxHandles.fdesc[0];
- FD_ZERO(&fs);
- FD_SET(fdselect, &fs);
- to.tv_usec = 2000000; //500 msec
- to.tv_sec = 0;
- rt = select(fdselect + 1, &fs, NULL, NULL, &to);
-#endif /* WIN32 */
-
- if (rt > 0) {
- if (tech_pvt->SkypiaxHandles.fdesc[0]) {
- howmany = sizeof(read_from_pipe);
howmany =
skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *) read_from_pipe,
- howmany);
+ sizeof(read_from_pipe));
a = 0;
for (i = 0; i < howmany; i++) {
- messaggio[a] = read_from_pipe[i];
+ message[a] = read_from_pipe[i];
a++;
if (read_from_pipe[i] == '\0') {
- //DEBUGA_SKYPE("read_skype: howmany=%d, i=%d, a=%d, |||%s||| \n", SKYPIAX_P_LOG, howmany, i, a, messaggio);
- DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, messaggio);
+ DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, message);
- if (!strcasecmp(messaggio, "ERROR 68")) { /* not yet protocol specified,
+ if (!strcasecmp(message, "ERROR 68")) { /* not yet protocol specified,
just authorized */
DEBUGA_SKYPE
("If I don't connect immediately, please give the Skype client authorization to be connected by Skypiax (and to not ask you again)\n",
@@ -384,9 +363,9 @@
return 0;
}
- if (!strncasecmp(messaggio, "ERROR 92 CALL", 12)) {
+ if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n",
- SKYPIAX_P_LOG, messaggio);
+ SKYPIAX_P_LOG, message);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
tech_pvt->skype_call_id[0] = '\0';
@@ -399,35 +378,35 @@
}
}
- strncpy(messaggio_2, messaggio, sizeof(messaggio) - 1);
+ strncpy(message_2, message, sizeof(message) - 1);
- buf = messaggio;
+ buf = message;
stringp = &buf;
where = strsep(stringp, " ");
if (!where) {
- WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, messaggio);
+ WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, message);
}
- if (!strcasecmp(messaggio, "#333")) {
- /* DEBUGA_SKYPE("Skype MSG: messaggio_2: %s, messaggio2[11]: %s\n", SKYPIAX_P_LOG,
- * messaggio_2, &messaggio_2[11]); */
+ if (!strcasecmp(message, "#333")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[11]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[11]); */
memset(tech_pvt->skype_friends, 0, 4096);
- strncpy(tech_pvt->skype_friends, &messaggio_2[11], 4095);
+ strncpy(tech_pvt->skype_friends, &message_2[11], 4095);
}
- if (!strcasecmp(messaggio, "#222")) {
- /* DEBUGA_SKYPE("Skype MSG: messaggio_2: %s, messaggio2[10]: %s\n", SKYPIAX_P_LOG,
- * messaggio_2, &messaggio_2[10]); */
+ if (!strcasecmp(message, "#222")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[10]); */
memset(tech_pvt->skype_fullname, 0, 512);
- strncpy(tech_pvt->skype_fullname, &messaggio_2[10], 511);
+ strncpy(tech_pvt->skype_fullname, &message_2[10], 511);
}
- if (!strcasecmp(messaggio, "#765")) {
- /* DEBUGA_SKYPE("Skype MSG: messaggio_2: %s, messaggio2[10]: %s\n", SKYPIAX_P_LOG,
- * messaggio_2, &messaggio_2[10]); */
+ if (!strcasecmp(message, "#765")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[10]); */
memset(tech_pvt->skype_displayname, 0, 512);
- strncpy(tech_pvt->skype_displayname, &messaggio_2[10], 511);
+ strncpy(tech_pvt->skype_displayname, &message_2[10], 511);
}
- if (!strcasecmp(messaggio, "ERROR")) {
- ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, messaggio);
+ if (!strcasecmp(message, "ERROR")) {
+ ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
tech_pvt->skype_call_id[0] = '\0';
@@ -439,7 +418,7 @@
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
}
}
- if (!strcasecmp(messaggio, "CURRENTUSERHANDLE")) {
+ if (!strcasecmp(message, "CURRENTUSERHANDLE")) {
strncpy(obj, where, sizeof(obj) - 1);
where = strsep(stringp, " ");
@@ -449,12 +428,12 @@
if (!strcasecmp(id, tech_pvt->skype_user)) {
tech_pvt->SkypiaxHandles.api_connected = 1;
DEBUGA_SKYPE
- ("Skype MSG: messaggio: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, tech_pvt->skype_user);
+ ("Skype MSG: message: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, tech_pvt->skype_user);
}
}
- if (!strcasecmp(messaggio, "USER")) {
+ if (!strcasecmp(message, "USER")) {
strncpy(obj, where, sizeof(obj) - 1);
where = strsep(stringp, " ");
@@ -467,8 +446,8 @@
if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) {
char msg_to_skype[256];
- DEBUGA_SKYPE("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop);
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop);
//FIXME: TODO: allow authorization based on config param
sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
@@ -476,7 +455,7 @@
}
}
- if (!strcasecmp(messaggio, "MESSAGE")) {
+ if (!strcasecmp(message, "MESSAGE")) {
strncpy(obj, where, sizeof(obj) - 1);
where = strsep(stringp, " ");
@@ -496,8 +475,8 @@
if (!strcasecmp(value, "RECEIVED")) {
char msg_to_skype[256];
DEBUGA_SKYPE
- ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s value: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop, value);
+ ("Skype MSG: message: %s, obj: %s, id: %s, prop: %s value: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop, value);
//FIXME: TODO: allow authorization based on config param
sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
@@ -506,8 +485,8 @@
} else if (!strcasecmp(prop, "BODY")) {
char msg_to_skype[256];
- DEBUGA_SKYPE("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop);
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop);
//FIXME: TODO: on config param ???
sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
@@ -516,7 +495,7 @@
}
- if (!strcasecmp(messaggio, "CALL")) {
+ if (!strcasecmp(message, "CALL")) {
strncpy(obj, where, sizeof(obj) - 1);
@@ -535,8 +514,8 @@
where = strsep(stringp, " ");
DEBUGA_SKYPE
- ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop, value, where ? where : "NULL");
+ ("Skype MSG: message: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
if (!strcasecmp(prop, "PARTNER_HANDLE")) {
strncpy(tech_pvt->callid_number, value,
@@ -741,8 +720,6 @@
} //message end
} //read_from_pipe
- }
- }
return 0;
}
More information about the Freeswitch-branches
mailing list