From 4e2030607818d83b4e5987df2d889f64f8dce3b3 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 17 Jan 2016 17:03:56 +1000 Subject: Unify the message sending code a bit. --- src/libraries/SledjHamr.c | 47 +---------------------------------------------- src/libraries/SledjHamr.h | 3 --- 2 files changed, 1 insertion(+), 49 deletions(-) (limited to 'src/libraries') diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c index dff80ee..4d0efbc 100644 --- a/src/libraries/SledjHamr.c +++ b/src/libraries/SledjHamr.c @@ -88,31 +88,9 @@ static boolean checkConnection(Connection *conn, char *func, connType wanted, bo return result; } -void sendBack(Connection *conn, const char *SID, const char *message, ...) -{ - va_list args; -// Ecore_Con_Client *client = conn->conn.client.client; - char buf[PATH_MAX * 2]; - int length = strlen(SID); - - strncpy(buf, SID, length); - buf[length++] = '.'; - va_start(args, message); - length += vsprintf(&buf[length], message, args); - va_end(args); - buf[length++] = '\n'; - buf[length] = '\0'; -// PD("sendBack(%s", buf); -// ecore_con_client_send(client, buf, length); -// ecore_con_client_flush(client); -//Connection *conn = ecore_con_client_data_get(client); -if (conn) send2(conn, SID, buf); else PE("sendBack() can't find Connection!"); -} - -void sendForth(Connection *conn, const char *SID, const char *message, ...) +void send2(Connection *conn, const char *SID, const char *message, ...) { va_list args; -// Ecore_Con_Server *server = conn->conn.server.server; char buf[PATH_MAX * 2]; int length = strlen(SID); @@ -123,29 +101,6 @@ void sendForth(Connection *conn, const char *SID, const char *message, ...) va_end(args); buf[length++] = '\n'; buf[length] = '\0'; -// PD("sendForth(%s", buf); -// ecore_con_server_send(server, buf, length); -// ecore_con_server_flush(server); -//Connection *conn = ecore_con_server_data_get(server); -if (conn) send2(conn, SID, buf); else PE("sendForth() can't find Connection!"); -} - -void send2(Connection *conn, const char *SID, const char *message, ...) -{ - va_list args; - char buf[PATH_MAX * 2]; - int length = strlen(SID); - -length = 0; -// strncpy(buf, SID, length); -// buf[length++] = '.'; - va_start(args, message); -// length += vsprintf(&buf[length], message, args); - va_end(args); -strcpy(buf, message); -length = strlen(buf); -// buf[length++] = '\n'; - buf[length] = '\0'; // TODO - Should check if this is always gonna be local? Likely not. if (checkConnection(conn, "send2", conn->type, FALSE)) diff --git a/src/libraries/SledjHamr.h b/src/libraries/SledjHamr.h index 326e423..d5e0b1f 100644 --- a/src/libraries/SledjHamr.h +++ b/src/libraries/SledjHamr.h @@ -66,9 +66,6 @@ struct _Connection void *addMessage(Eina_Clist *list, size_t size, const char *message, ...); -void sendBack(Connection *conn, const char *SID, const char *message, ...); -void sendForth(Connection *conn, const char *SID, const char *message, ...); - void send2(Connection *conn, const char *SID, const char *message, ...); Connection *openArms(char *name, const char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del, streamParser _parser); Connection *reachOut(char *name, char *command, char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del, streamParser _parser); -- cgit v1.1