void send_request_for_marked_as_read(service_client* service_client, const int buddy_id, const int type_of_chat)
{
bundle *msg;
- char type_of_chat_str[50];
- char buddy_id_str[50];
+ char tmp[50];
int result;
if (!service_client) {
return;
}
- snprintf(buddy_id_str, sizeof(buddy_id_str) - 1, "%d", buddy_id);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", buddy_id);
- if (bundle_add_str(msg, "buddy_id", buddy_id_str) != 0) {
+ if (bundle_add_str(msg, "buddy_id", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- snprintf(type_of_chat_str, sizeof(type_of_chat_str) - 1, "%d", type_of_chat);
- if (bundle_add_str(msg, "type_of_chat", type_of_chat_str) != 0) {
+ snprintf(tmp, sizeof(tmp) - 1, "%d", type_of_chat);
+ if (bundle_add_str(msg, "type_of_chat", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
void send_request_for_message_transport(service_client* service_client, const int buddy_id, const int message_id, const int msg_type, const char* data, const int type_of_chat)
{
- char buddy_id_str[50];
+ char tmp[50];
bundle *msg;
- char message_id_str[50];
- char msg_type_str[10];
- char type_of_chat_str[50];
int result;
if (!service_client || !data) {
return;
}
- snprintf(buddy_id_str, sizeof(buddy_id_str), "%d", buddy_id);
+ snprintf(tmp, sizeof(tmp), "%d", buddy_id);
- if (bundle_add_str(msg, "buddy_id", buddy_id_str) != 0) {
+ if (bundle_add_str(msg, "buddy_id", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- snprintf(message_id_str, sizeof(message_id_str) - 1, "%d", message_id);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", message_id);
- if (bundle_add_str(msg, "message_id", message_id_str) != 0) {
+ if (bundle_add_str(msg, "message_id", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- snprintf(msg_type_str, sizeof(msg_type_str) - 1, "%d", msg_type);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", msg_type);
- if (bundle_add_str(msg, "message_type", msg_type_str) != 0) {
+ if (bundle_add_str(msg, "message_type", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- snprintf(type_of_chat_str, sizeof(type_of_chat_str), "%d", type_of_chat);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", type_of_chat);
- if (bundle_add_str(msg, "type_of_chat", type_of_chat_str) != 0) {
+ if (bundle_add_str(msg, "type_of_chat", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
void send_request_for_media_transport(service_client* service_client, const int buddy_id, const int message_id, const int media_id, const int msg_type, const char* file_path, const int type_of_chat)
{
bundle *msg;
- char buddy_id_str[50];
- char message_id_str[50];
- char media_id_str[50];
- char msg_type_str[10];
- char type_of_chat_str[50];
+ char tmp[50];
int result;
if (!service_client || !file_path) {
return;
}
- snprintf(buddy_id_str, sizeof(buddy_id_str) - 1, "%d", buddy_id);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", buddy_id);
- if (bundle_add_str(msg, "buddy_id", buddy_id_str) != 0) {
+ if (bundle_add_str(msg, "buddy_id", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- snprintf(message_id_str, sizeof(message_id_str) - 1, "%d", message_id);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", message_id);
- if (bundle_add_str(msg, "message_id", message_id_str) != 0) {
+ if (bundle_add_str(msg, "message_id", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- snprintf(media_id_str, sizeof(media_id_str) - 1, "%d", media_id);
- if (bundle_add_str(msg, "media_id", media_id_str) != 0) {
+ snprintf(tmp, sizeof(tmp) - 1, "%d", media_id);
+ if (bundle_add_str(msg, "media_id", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- sprintf(msg_type_str, "%d", msg_type);
+ sprintf(tmp, "%d", msg_type);
- if (bundle_add_str(msg, "message_type", msg_type_str) != 0) {
+ if (bundle_add_str(msg, "message_type", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
return;
}
- snprintf(type_of_chat_str, sizeof(type_of_chat_str) - 1, "%d", type_of_chat);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", type_of_chat);
- if (bundle_add_str(msg, "type_of_chat", type_of_chat_str) != 0) {
+ if (bundle_add_str(msg, "type_of_chat", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
void send_request_for_image_downloading(service_client* service_client, const int buddy_id, const long long media_id)
{
bundle *msg;
- char buddy_id_str[50];
- char media_id_str[50];
+ char tmp[50];
int result;
if (!service_client) {
return;
}
- snprintf(buddy_id_str, sizeof(buddy_id_str) - 1, "%d", buddy_id);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", buddy_id);
- if (bundle_add_str(msg, "buddy_id", buddy_id_str) != 0) {
+ if (bundle_add_str(msg, "buddy_id", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
}
- snprintf(media_id_str, sizeof(media_id_str) - 1, "%lld", media_id);
- if (bundle_add_str(msg, "media_id", media_id_str) != 0) {
+ snprintf(tmp, sizeof(tmp) - 1, "%lld", media_id);
+ if (bundle_add_str(msg, "media_id", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
}
{
bundle *msg;
int count;
- char count_str[50];
- char first_name_key[20];
- char last_name_key[20];
- char phone_number_key[20];
+ char tmp[50];
char *first_name;
char *last_name;
char *phone_number;
}
count = eina_list_count(contacts_list);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", count);
- snprintf(count_str, sizeof(count_str) - 1, "%d", count);
-
- if (bundle_add_str(msg, "count", count_str) != 0) {
+ if (bundle_add_str(msg, "count", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
last_name = "";
}
- snprintf(first_name_key, sizeof(first_name_key) - 1, "first_name_%d", i);
- snprintf(last_name_key, sizeof(last_name_key) - 1, "last_name_%d", i);
- snprintf(phone_number_key, sizeof(phone_number_key) - 1, "phone_number_%d", i);
-
- if (bundle_add_str(msg, first_name_key, first_name) != 0) {
+ snprintf(tmp, sizeof(tmp) - 1, "first_name_%d", i);
+ if (bundle_add_str(msg, tmp, first_name) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- if (bundle_add_str(msg, last_name_key, last_name) != 0) {
+ snprintf(tmp, sizeof(tmp) - 1, "last_name_%d", i);
+ if (bundle_add_str(msg, tmp, last_name) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
}
- if (bundle_add_str(msg, phone_number_key, phone_number) != 0) {
+ snprintf(tmp, sizeof(tmp) - 1, "phone_number_%d", i);
+ if (bundle_add_str(msg, tmp, phone_number) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
{
bundle *msg;
int count;
- char count_str[50];
+ char tmp[50];
user_data_with_pic_s *item;
user_data_s *contact_data;
Eina_List *l;
int i;
- char buddy_id_str[50];
char buddy_id_key[20];
int result;
}
count = eina_list_count(buddy_list);
- snprintf(count_str, sizeof(count_str) - 1, "%d", count);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", count);
- if (bundle_add_str(msg, "count", count_str) != 0) {
+ if (bundle_add_str(msg, "count", tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
continue;
}
- snprintf(buddy_id_str, sizeof(buddy_id_str) - 1, "%d", contact_data->user_id.id);
+ snprintf(tmp, sizeof(tmp) - 1, "%d", contact_data->user_id.id);
snprintf(buddy_id_key, sizeof(buddy_id_key) - 1, "buddy_id_%d", i);
- if (bundle_add_str(msg, buddy_id_key, buddy_id_str) != 0) {
+ if (bundle_add_str(msg, buddy_id_key, tmp) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
return;
i++;
}
-
if (bundle_add_str(msg, "group_name", group_name) != 0) {
ERR("Failed to add data by key to bundle");
bundle_free(msg);
Elm_Object_Item *it = event_info;
elm_genlist_item_selected_set(it, EINA_FALSE);
- int item_id = (int) data;
+ int item_id = (int)data;
appdata_s* ad = evas_object_data_get(obj, "app_data");
peer_with_pic_s *sel_item = eina_list_nth(ad->peer_list, item_id);
void left_panel_button_clicked_cb(void *data, Evas_Object * obj, void *event_info)
{
appdata_s *ad = data;
- if (!elm_object_disabled_get(ad->panel)) elm_panel_toggle(ad->panel);
+
+ if (!elm_object_disabled_get(ad->panel)) {
+ elm_panel_toggle(ad->panel);
+ }
}
void buddylist_naviframe_more_cb(void *data, Evas_Object *obj, void *event_info)
{
appdata_s *ad = data;
- if (!elm_object_disabled_get(ad->panel)) elm_panel_toggle(ad->panel);
+
+ if (!elm_object_disabled_get(ad->panel)) {
+ elm_panel_toggle(ad->panel);
+ }
}
void refresh_buddy_list(void *data)
appdata_s* ad = data;
Evas_Object *buddy_list = evas_object_data_get(ad->nf, "buddy_list");
if (buddy_list) {
+ int i = 0;
+ int size;
+ Eina_List *l;
+ static Elm_Genlist_Item_Class itc = {
+ .item_style = "double_label",
+ .func.text_get = on_list_text_get_cb,
+ .func.content_get = on_list_content_get_cb,
+ .func.state_get = NULL,
+ .func.del = NULL,
+ };
elm_genlist_clear(buddy_list);
load_group_chat_data(ad);
load_peer_data(ad);
- int i = 0;
- static Elm_Genlist_Item_Class itc;
- itc.item_style = "double_label";
- itc.func.text_get = on_list_text_get_cb;
- itc.func.content_get = on_list_content_get_cb;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
-
- int size = eina_list_count(ad->peer_list);
+ size = eina_list_count(ad->peer_list);
if(size > 0) {
for (i = 0; i < size; i++) {
elm_genlist_item_append(buddy_list, &itc, (void *) i, NULL, ELM_GENLIST_ITEM_NONE, on_buddy_clicked, (void*) i);
elm_genlist_item_append(buddy_list, &itc, (void *) i, NULL, ELM_GENLIST_ITEM_NONE, on_buddy_clicked, (void*) i);
}
evas_object_show(buddy_list);
-
}
}
void launch_buddy_list_cb(void *data)
{
+ int i;
+ Evas_Object *buddy_list;
appdata_s* ad = data;
-
Evas_Object *nf = ad->nf;
Elm_Object_Item* detail_nav_item = NULL;
+ int size;
+ static Elm_Genlist_Item_Class itc = {
+ .item_style = "double_label",
+ .func.text_get = on_list_text_get_cb,
+ .func.content_get = on_list_content_get_cb,
+ .func.state_get = NULL,
+ .func.del = NULL,
+ };
ad->current_app_state = TG_BUDDY_LIST_STATE;
elm_layout_theme_set(ad->layout, "layout", "drawer", "panel");
create_main_view(ad);
- int i;
- static Elm_Genlist_Item_Class itc;
- Evas_Object *buddy_list = NULL;
-
buddy_list = elm_genlist_add(nf);
elm_list_mode_set(buddy_list, ELM_LIST_COMPRESS);
elm_genlist_mode_set(buddy_list, ELM_LIST_COMPRESS);
evas_object_size_hint_weight_set(buddy_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(buddy_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
-
evas_object_data_set(buddy_list, "app_data", ad);
- itc.item_style = "double_label";
- itc.func.text_get = on_list_text_get_cb;
- itc.func.content_get = on_list_content_get_cb;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
-
- int size = eina_list_count(ad->peer_list);
-
+ size = eina_list_count(ad->peer_list);
if(size > 0) {
for (i = 0; i < size; i++) {
- elm_genlist_item_append(buddy_list, &itc, (void *) i, NULL, ELM_GENLIST_ITEM_NONE, on_buddy_clicked, (void*) i);
+ elm_genlist_item_append(buddy_list, &itc, (void *) i, NULL, ELM_GENLIST_ITEM_NONE, on_buddy_clicked, (void *)i);
}
} else {
i = 1;
- elm_genlist_item_append(buddy_list, &itc, (void *) i, NULL, ELM_GENLIST_ITEM_NONE, on_buddy_clicked, (void*) i);
+ elm_genlist_item_append(buddy_list, &itc, (void *) i, NULL, ELM_GENLIST_ITEM_NONE, on_buddy_clicked, (void *)i);
}
evas_object_show(buddy_list);
evas_object_data_set(nf, "buddy_list", buddy_list);
eext_object_event_callback_add(nf, EEXT_CALLBACK_MORE, buddylist_naviframe_more_cb, ad);
-
}