Merge branch '18-fix-html-entities-in-messages' into 'master'

Fix HTML entities in outgoing messages

Closes #18

See merge request lupine/purple-plugin-delta!11
This commit is contained in:
2019-04-11 23:20:41 +00:00

View File

@@ -97,7 +97,7 @@ delta_process_incoming_message(void *data)
delta_recv_im(pr->conn, pr->msg_id); delta_recv_im(pr->conn, pr->msg_id);
free(data); g_free(data);
return FALSE; return FALSE;
} }
@@ -120,7 +120,7 @@ delta_process_connection_state(void *data)
purple_connection_set_state(pr->conn->pc, PURPLE_CONNECTED); purple_connection_set_state(pr->conn->pc, PURPLE_CONNECTED);
} }
free(data); g_free(data);
return FALSE; return FALSE;
} }
@@ -143,7 +143,7 @@ delta_process_fresh_messages(void *data)
delta_recv_im(pr->conn, dc_array_get_id(fresh_msgs, i)); delta_recv_im(pr->conn, dc_array_get_id(fresh_msgs, i));
} }
free(fresh_msgs); g_free(fresh_msgs);
return FALSE; return FALSE;
} }
@@ -291,7 +291,7 @@ my_delta_handler(dc_context_t* mailbox, int event, uintptr_t data1, uintptr_t da
pthread_cond_destroy(&cond); pthread_cond_destroy(&cond);
pthread_mutex_destroy(&mutex); pthread_mutex_destroy(&mutex);
free(pr); g_free(pr);
break; break;
case DC_EVENT_IS_OFFLINE: case DC_EVENT_IS_OFFLINE:
@@ -400,8 +400,12 @@ delta_send_im(PurpleConnection *pc, const char *who, const char *message, Purple
uint32_t contact_id = dc_create_contact(mailbox, NULL, who); uint32_t contact_id = dc_create_contact(mailbox, NULL, who);
uint32_t chat_id = dc_create_chat_by_contact_id(mailbox, contact_id); uint32_t chat_id = dc_create_chat_by_contact_id(mailbox, contact_id);
char *unescaped_message = purple_unescape_html(message);
g_assert(unescaped_message != NULL);
dc_send_text_msg(mailbox, chat_id, unescaped_message);
g_free(unescaped_message);
dc_send_text_msg(mailbox, chat_id, message);
return 1; // success; echo the message to the chat window return 1; // success; echo the message to the chat window
} }