extern void launch_messaging_view_cb(appdata_s* ad, int user_id);
extern void on_text_message_received_from_buddy(appdata_s* ad, long long message_id, int type_of_chat);
extern void on_text_message_state_changed(appdata_s* ad, tg_message_s *msg, int type_of_chat);
-extern void on_video_thumb_download_completed(appdata_s* ad, int buddy_id, long long media_id, const char* file_path);
-extern void on_media_download_completed(appdata_s* ad, int buddy_id, long long media_id, const char* file_path);
+extern void on_video_thumb_download_completed(appdata_s* ad, int buddy_id, long long media_id, const char* file_path, const char *caption);
+extern void on_media_download_completed(appdata_s* ad, int buddy_id, long long media_id, const char* file_path, const char *caption);
extern void on_user_presence_state_changed(appdata_s* ad, int buddy_id);
extern void on_user_status_changed(appdata_s* ad, char* status);
extern void on_group_chat_info_changed(appdata_s *ad, char *type_of_change);
show_toast(app, "media download failed.");
}
+ char* caption = NULL;
+ result = bundle_get_str(rec_msg, "caption", &caption);
+
+
if (file_name && app->current_app_state == TG_CHAT_MESSAGING_VIEW_STATE && app->peer_in_cahtting_data
&& app->peer_in_cahtting_data->use_data->peer_id == to_id) {
// update media to sent state
- on_media_download_completed(app, buddy_id, media_id, file_name);
+ on_media_download_completed(app, buddy_id, media_id, file_name, caption);
}
return result;
}
char* file_name = NULL;
result = bundle_get_str(rec_msg, "file_name", &file_name);
+ char* caption = NULL;
+ result = bundle_get_str(rec_msg, "caption", &caption);
+
if (file_name && app->current_app_state == TG_CHAT_MESSAGING_VIEW_STATE && app->peer_in_cahtting_data
&& app->peer_in_cahtting_data->use_data->peer_id == to_id) {
// update thumbnail icon
- on_video_thumb_download_completed(app, buddy_id, media_id, file_name);
+ on_video_thumb_download_completed(app, buddy_id, media_id, file_name, caption);
}
return result;
}
// To be handled for group chat
Eina_Strbuf *buf = eina_strbuf_new();
+ char *caption = NULL;
if (msg->media_type == tgl_message_media_none) {
char *temp_msg = replace(msg->message, '\n', "<br>");
elm_entry_item_provider_append(entry, item_provider, chat_scroller);
tgl_media_s *media_msg = get_media_details_from_db(atoll(msg->media_id));
+ if (media_msg->caption && strlen(media_msg) > 0) {
+ caption = strdup(media_msg->caption);
+ }
if (msg->out) {
if (media_msg) {
if (strstr(media_msg->doc_type, "audio") != NULL) {
} else if(msg->media_type == tgl_message_media_geo) {
tgl_media_s *media_msg = get_media_details_from_db(atoll(msg->media_id));
+ if (media_msg->caption && strlen(media_msg) > 0) {
+ caption = strdup(media_msg->caption);
+ }
char loc_url[4*256] = {0,};
if (media_msg) {
snprintf(loc_url, sizeof(loc_url), "https://maps.google.com/?q=%s,%s", media_msg->latitude, media_msg->longitude);
} else if(msg->media_type == tgl_message_media_contact) {
tgl_media_s *media_msg = get_media_details_from_db(atoll(msg->media_id));
+ if (media_msg->caption && strlen(media_msg) > 0) {
+ caption = strdup(media_msg->caption);
+ }
if (media_msg) {
char temp_msg[4*256] = {0,};
}
ad->loaded_msg_list = eina_list_append(ad->loaded_msg_list, entry);
+ if (caption) {
+ // implement UI.
+ free(caption);
+ }
//set time
time_t t = msg->date;
}
-void on_media_download_completed(appdata_s* ad, int buddy_id, long long media_id, const char* file_path)
+void on_media_download_completed(appdata_s* ad, int buddy_id, long long media_id, const char *file_path, const char *caption)
{
if (!ad)
return;
//elm_object_part_content_set(comp_img_layout, "swallow.chat_send_image", image);
-void on_video_thumb_download_completed(appdata_s* ad, int buddy_id, long long media_id, const char* file_path)
+void on_video_thumb_download_completed(appdata_s* ad, int buddy_id, long long media_id, const char* file_path, const char *caption)
{
- on_media_download_completed(ad, buddy_id, media_id, file_path);
+ on_media_download_completed(ad, buddy_id, media_id, file_path, caption);
}
void on_text_message_state_changed(appdata_s* ad, tg_message_s *msg, int type_of_chat)
extern void send_group_chat_deleted_response(tg_engine_data_s *tg_data, int chat_id, Eina_Bool is_success);
extern void send_selected_group_chats_deleted_response(tg_engine_data_s *tg_data);
extern void send_message_read_by_buddy_response(tg_engine_data_s *tg_data, int buddy_id, int message_id, char* table_name, char* phone, int type_of_chat);
-extern void send_media_download_completed_response(tg_engine_data_s *tg_data, int buddy_id, int to_id, long long media_id, const char* filename);
-extern void send_video_thumb_download_completed_response(tg_engine_data_s *tg_data, int buddy_id, int to_id, long long media_id, const char* filename);
+extern void send_media_download_completed_response(tg_engine_data_s *tg_data, int buddy_id, int to_id, long long media_id, const char* filename, const char *caption);
+extern void send_video_thumb_download_completed_response(tg_engine_data_s *tg_data, int buddy_id, int to_id, long long media_id, const char* filename, const char* caption);
extern void send_new_group_added_response(tg_engine_data_s *tg_data, int chat_id);
extern void send_new_buddy_added_response(tg_engine_data_s *tg_data, int buddy_id);
extern void send_group_chat_updated_response(tg_engine_data_s *tg_data, int chat_id, const char *type_of_change);
bundle_free(msg);
}
-void send_video_thumb_download_completed_response(tg_engine_data_s *tg_data, int buddy_id, int to_id, long long media_id, const char* filename)
+void send_video_thumb_download_completed_response(tg_engine_data_s *tg_data, int buddy_id, int to_id, long long media_id, const char* filename, const char* caption)
{
bundle *msg = bundle_create();
if (bundle_add_str(msg, "app_name", "Tizen Telegram") != 0) {
}
}
+ if (caption) {
+ if (bundle_add_str(msg, "caption", caption) != 0) {
+ ERR("Failed to add data by key to bundle");
+ bundle_free(msg);
+ }
+ } else {
+ if (bundle_add_str(msg, "caption", "") != 0) {
+ ERR("Failed to add data by key to bundle");
+ bundle_free(msg);
+ }
+ }
+
int result = SVC_RES_FAIL;
result = tg_server_send_message(tg_data->tg_server, msg);
bundle_free(msg);
}
-void send_media_download_completed_response(tg_engine_data_s *tg_data, int buddy_id, int to_id, long long media_id, const char* filename)
+void send_media_download_completed_response(tg_engine_data_s *tg_data, int buddy_id, int to_id, long long media_id, const char* filename, const char *caption)
{
bundle *msg = bundle_create();
if (bundle_add_str(msg, "app_name", "Tizen Telegram") != 0) {
}
}
+ if (caption) {
+ if (bundle_add_str(msg, "caption", caption) != 0) {
+ ERR("Failed to add data by key to bundle");
+ bundle_free(msg);
+ }
+ } else {
+ if (bundle_add_str(msg, "caption", "") != 0) {
+ ERR("Failed to add data by key to bundle");
+ bundle_free(msg);
+ }
+ }
+
int result = SVC_RES_FAIL;
result = tg_server_send_message(tg_data->tg_server, msg);
update_video_thumb_in_db(media_id, filename);
tg_engine_data_s *tg_data = TLS->callback_data;
if (M->from_id.id == tg_data->id.id) {
- send_video_thumb_download_completed_response(tg_data, M->from_id.id, M->to_id.id, media_id, filename);
+ send_video_thumb_download_completed_response(tg_data, M->from_id.id, M->to_id.id, media_id, filename, NULL);
} else {
send_message_received_response(TLS->callback_data, M->from_id.id, M->to_id.id, M->id, tgl_get_peer_type(M->to_id));
}
if(photo_prop && filename) {
update_receive_media_info_in_db(media_id, filename);
//send response to application
- send_media_download_completed_response(tg_data, buddy_id, to_id, media_id, filename);
+ send_media_download_completed_response(tg_data, buddy_id, to_id, media_id, filename, photo_prop->caption);
free(photo_prop);
}
} else {
- send_media_download_completed_response(tg_data, buddy_id, to_id, media_id, NULL);
+ send_media_download_completed_response(tg_data, buddy_id, to_id, media_id, NULL, NULL);
}
}
if(doc_prop && filename) {
update_receive_media_info_in_db(media_id, filename);
//send response to application
- send_media_download_completed_response(tg_data, buddy_id, to_id, media_id, filename);
+ send_media_download_completed_response(tg_data, buddy_id, to_id, media_id, filename, doc_prop->caption);
}
} else {
- send_media_download_completed_response(tg_data, buddy_id, to_id, media_id, NULL);
+ send_media_download_completed_response(tg_data, buddy_id, to_id, media_id, NULL, NULL);
}
if (doc_prop) {
struct tgl_media* img_details = get_media_details_from_db(media_id);
if(!img_details) {
- send_media_download_completed_response(tg_data, -1, buddy_id, media_id, NULL);
+ send_media_download_completed_response(tg_data, -1, buddy_id, media_id, NULL, NULL);
return;
} else {