send text to the channel when Enter is pressed

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2014-12-19 15:08:09 -05:00
parent 7f1371c61b
commit b05756d466
2 changed files with 20 additions and 2 deletions

View File

@ -27,6 +27,8 @@ struct _Channel
Eina_Bool focused : 1;
Eina_Bool unswallowed : 1;
Eina_Bool missed : 1;
Express_Network *net;
};
static void
@ -144,12 +146,21 @@ _cb_entry_go(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
char *txt;
chl = data;
if (!chl->net) return;
if ((txt = (char *)elm_entry_entry_get(chl->o_entry)))
{
if ((txt = elm_entry_markup_to_utf8(txt)))
{
DBG("Send Text To Channel %s", chl->name);
DBG("\t%s", txt);
char buff[PATH_MAX];
snprintf(buff, sizeof(buff), "%s\r\n", txt);
express_network_channel_priv_send(chl->net, chl->name, buff);
elm_entry_entry_set(chl->o_entry, "");
/* TODO */
/* _channel_text_append(chl, buff, txt); */
}
}
}
@ -535,3 +546,9 @@ _channel_window_set(Channel *chl, Evas_Object *win)
edje_object_part_swallow(chl->o_base, "channel.entry", chl->o_entry);
elm_entry_entry_set(chl->o_entry, "");
}
void
_channel_network_set(Channel *chl, Express_Network *net)
{
chl->net = net;
}

View File

@ -43,5 +43,6 @@ void _channel_spacer_create(Channel *chl);
void _channel_text_append(Channel *chl, const char *user, const char *txt);
void _channel_window_set(Channel *chl, Evas_Object *win);
void _channel_network_set(Channel *chl, Express_Network *net);
#endif