Enlightenment CVS committal Author : dj2 Project : e17 Module : apps/express
Dir : e17/apps/express/src Modified Files: exp_eb.c exp_eb.h Log Message: - add in the message and notify_3rdperson events - currently the same event, we may want to change this - fix the defines, enums and events to use EXP in upper case =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/express/src/exp_eb.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- exp_eb.c 13 Jan 2005 06:49:45 -0000 1.4 +++ exp_eb.c 13 Jan 2005 07:12:31 -0000 1.5 @@ -22,6 +22,7 @@ static void exp_eb_cb_event_dialog_free(void *data, void *ev); static void exp_eb_cb_event_buddy_login_free(void *data, void *ev); static void exp_eb_cb_event_buddy_logout_free(void *data, void *ev); +static void exp_eb_cb_event_message_free(void *data, void *ev); int exp_eb_init(const char *eb_dir) @@ -45,9 +46,9 @@ return 0; } - Exp_EB_EVENT_DIALOG = ecore_event_type_new(); - Exp_EB_EVENT_BUDDY_LOGIN = ecore_event_type_new(); - Exp_EB_EVENT_BUDDY_LOGOUT = ecore_event_type_new(); + EXP_EB_EVENT_DIALOG = ecore_event_type_new(); + EXP_EB_EVENT_BUDDY_LOGIN = ecore_event_type_new(); + EXP_EB_EVENT_BUDDY_LOGOUT = ecore_event_type_new(); if (*eb_dir == '~') { @@ -298,6 +299,7 @@ { } + /* contact functions */ else if (!strcmp(cmds[0], "list_group")) { @@ -315,8 +317,9 @@ { - /* adding and deleting groups/contacts/accounts */ } + + /* adding and deleting groups/contacts/accounts */ else if (!strcmp(cmds[0], "add_group")) { @@ -390,9 +393,9 @@ else if (!strcmp(cmds[0], "unset_away")) { - - /* dialogs */ } + + /* dialogs */ else if (!strcmp(cmds[0], "dialog_resolved")) { printf("dialog resolved (%s)\n", cmds[1]); @@ -403,12 +406,12 @@ Exp_Eb_Event_Dialog *ev; ev = calloc(1, sizeof(Exp_Eb_Event_Dialog)); - ev->type = Exp_EB_EVENT_DIALOG_ERROR; + ev->type = EXP_EB_EVENT_DIALOG_ERROR; ev->tag = strdup(cmds[1]); ev->title = strdup(cmds[2]); ev->msg = strdup(cmds[3]); - ecore_event_add(Exp_EB_EVENT_DIALOG, ev, + ecore_event_add(EXP_EB_EVENT_DIALOG, ev, exp_eb_cb_event_dialog_free, NULL); } @@ -417,12 +420,12 @@ Exp_Eb_Event_Dialog *ev; ev = calloc(1, sizeof(Exp_Eb_Event_Dialog)); - ev->type = Exp_EB_EVENT_DIALOG_YES_NO; + ev->type = EXP_EB_EVENT_DIALOG_YES_NO; ev->tag = strdup(cmds[1]); ev->title = strdup(cmds[2]); ev->msg = strdup(cmds[3]); - ecore_event_add(Exp_EB_EVENT_DIALOG, ev, + ecore_event_add(EXP_EB_EVENT_DIALOG, ev, exp_eb_cb_event_dialog_free, NULL); /* FIXME FAKE IT FOR NOW */ @@ -435,7 +438,7 @@ int i; ev = calloc(1, sizeof(Exp_Eb_Event_Dialog)); - ev->type = Exp_EB_EVENT_DIALOG_LIST; + ev->type = EXP_EB_EVENT_DIALOG_LIST; ev->tag = strdup(cmds[1]); ev->title = strdup(cmds[2]); ev->msg = strdup(cmds[3]); @@ -445,7 +448,7 @@ for(i = 0; i < ev->num_opts; i++) ev->opts[i] = strdup(cmds[i + 5]); - ecore_event_add(Exp_EB_EVENT_DIALOG, ev, + ecore_event_add(EXP_EB_EVENT_DIALOG, ev, exp_eb_cb_event_dialog_free, NULL); } @@ -454,11 +457,11 @@ Exp_Eb_Event_Dialog *ev; ev = calloc(1, sizeof(Exp_Eb_Event_Dialog)); - ev->type = Exp_EB_EVENT_DIALOG_TEXT; + ev->type = EXP_EB_EVENT_DIALOG_TEXT; ev->tag = strdup(cmds[1]); ev->msg = strdup(cmds[2]); - ecore_event_add(Exp_EB_EVENT_DIALOG, ev, + ecore_event_add(EXP_EB_EVENT_DIALOG, ev, exp_eb_cb_event_dialog_free, NULL); } @@ -467,10 +470,10 @@ Exp_Eb_Event_Dialog *ev; ev = calloc(1, sizeof(Exp_Eb_Event_Dialog)); - ev->type = Exp_EB_EVENT_DIALOG_CLIENT_ERROR; + ev->type = EXP_EB_EVENT_DIALOG_CLIENT_ERROR; ev->msg = strdup(cmds[1]); - ecore_event_add(Exp_EB_EVENT_DIALOG, ev, + ecore_event_add(EXP_EB_EVENT_DIALOG, ev, exp_eb_cb_event_dialog_free, NULL); } @@ -484,7 +487,7 @@ ev->service = strdup(cmds[2]); ev->buddy = strdup(cmds[3]); - ecore_event_add(Exp_EB_EVENT_BUDDY_LOGOUT, ev, + ecore_event_add(EXP_EB_EVENT_BUDDY_LOGOUT, ev, exp_eb_cb_event_buddy_logout_free, NULL); } @@ -497,7 +500,7 @@ ev->service = strdup(cmds[2]); ev->buddy = strdup(cmds[3]); - ecore_event_add(Exp_EB_EVENT_BUDDY_LOGIN, ev, + ecore_event_add(EXP_EB_EVENT_BUDDY_LOGIN, ev, exp_eb_cb_event_buddy_login_free, NULL); } @@ -513,10 +516,31 @@ /* sending/receiving messages */ else if (!strcmp(cmds[0], "message_receive")) { + Exp_Eb_Event_Message *ev; + + ev = calloc(1, sizeof(Exp_Eb_Event_Message)); + ev->group = strdup(cmds[1]); + ev->contact = strdup(cmds[2]); + ev->local_handle = strdup(cmds[3]); + ev->service = strdup(cmds[4]); + ev->buddy = strdup(cmds[5]); + ev->msg = strdup(cmds[6]); + + ecore_event_add(EXP_EB_EVENT_MESSAGE, ev, + exp_eb_cb_event_message_free, NULL); } else if (!strcmp(cmds[0], "notify_3rdperson")) { + Exp_Eb_Event_Message *ev; + + ev = calloc(1, sizeof(Exp_Eb_Event_Message)); + ev->group = strdup(cmds[1]); + ev->contact = strdup(cmds[2]); + ev->msg = strdup(cmds[3]); + + ecore_event_add(EXP_EB_EVENT_MESSAGE, ev, + exp_eb_cb_event_message_free, NULL); } else if (!strcmp(cmds[0], "message_send")) @@ -1196,5 +1220,37 @@ data = NULL; } +static void +exp_eb_cb_event_message_free(void *data, void *ev) +{ + Exp_Eb_Event_Message *e; + + e = ev; + if (!e) return; + + if (e->group) free(e->group); + e->group = NULL; + + if (e->contact) free(e->contact); + e->contact = NULL; + + if (e->local_handle) free(e->local_handle); + e->local_handle = NULL; + + if (e->service) free(e->service); + e->service = NULL; + + if (e->buddy) free(e->buddy); + e->buddy = NULL; + + if (e->msg) free(e->msg); + e->msg = NULL; + + free(e); + e = NULL; + + return; + data = NULL; +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/express/src/exp_eb.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- exp_eb.h 12 Jan 2005 23:55:53 -0000 1.1 +++ exp_eb.h 13 Jan 2005 07:12:32 -0000 1.2 @@ -3,44 +3,44 @@ #include "Express.h" -#define Exp_EB_PREFERENCE_ROOT "mainprefs" -#define Exp_EB_ACCOUNTS_ROOT "accounts" +#define EXP_EB_PREFERENCE_ROOT "mainprefs" +#define EXP_EB_ACCOUNTS_ROOT "accounts" typedef enum Exp_Eb_Capabilities Exp_Eb_Capabilities; enum Exp_Eb_Capabilities { - Exp_EB_CAN_OFFLINE = 0x1, - Exp_EB_CAN_GROUPCHAT = 0x2, - Exp_EB_CAN_NAME_CHAT = 0x4 + EXP_EB_CAN_OFFLINE = 0x1, + EXP_EB_CAN_GROUPCHAT = 0x2, + EXP_EB_CAN_NAME_CHAT = 0x4 }; typedef enum Exp_Eb_Actions Exp_Eb_Actions; enum Exp_Eb_Actions { - Exp_EB_ACTION_BUDDY, - Exp_EB_ACTION_GROUPCHAT, - Exp_EB_ACTION_GROUP_USERS + EXP_EB_ACTION_BUDDY, + EXP_EB_ACTION_GROUPCHAT, + EXP_EB_ACTION_GROUP_USERS }; typedef enum Exp_Eb_Components Exp_Eb_Components; enum Exp_Eb_Component { - Exp_EB_COMPONENT_LABEL, - Exp_EB_COMPONENT_STRING, - Exp_EB_COMPONENT_PASSWD, - Exp_EB_COMPONENT_TOGGLE, - Exp_EB_COMPONENT_OPTION, - Exp_EB_COMPONENT_BUTTON + EXP_EB_COMPONENT_LABEL, + EXP_EB_COMPONENT_STRING, + EXP_EB_COMPONENT_PASSWD, + EXP_EB_COMPONENT_TOGGLE, + EXP_EB_COMPONENT_OPTION, + EXP_EB_COMPONENT_BUTTON }; typedef enum Exp_Eb_Event_Dialog_Type Exp_Eb_Event_Dialog_Type; enum Exp_Eb_Event_Dialog_Type { - Exp_EB_EVENT_DIALOG_ERROR, - Exp_EB_EVENT_DIALOG_YES_NO, - Exp_EB_EVENT_DIALOG_LIST, - Exp_EB_EVENT_DIALOG_TEXT, - Exp_EB_EVENT_DIALOG_CLIENT_ERROR + EXP_EB_EVENT_DIALOG_ERROR, + EXP_EB_EVENT_DIALOG_YES_NO, + EXP_EB_EVENT_DIALOG_LIST, + EXP_EB_EVENT_DIALOG_TEXT, + EXP_EB_EVENT_DIALOG_CLIENT_ERROR }; typedef struct Exp_Eb_Event_Dialog Exp_Eb_Event_Dialog; @@ -71,9 +71,21 @@ char *buddy; }; -int Exp_EB_EVENT_DIALOG; -int Exp_EB_EVENT_BUDDY_LOGIN; -int Exp_EB_EVENT_BUDDY_LOGOUT; +typedef struct Exp_Eb_Event_Message Exp_Eb_Event_Message; +struct Exp_Eb_Event_Message +{ + char *group; + char *contact; + char *local_handle; + char *service; + char *buddy; + char *msg; +}; + +int EXP_EB_EVENT_DIALOG; +int EXP_EB_EVENT_BUDDY_LOGIN; +int EXP_EB_EVENT_BUDDY_LOGOUT; +int EXP_EB_EVENT_MESSAGE; int exp_eb_init(const char *eb_dir); int exp_eb_connect(Exp *exp, const char *srv); ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs