Exemple #1
0
// Messages Received (with attachments)
static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg)
{
    qDebug() << "Unread:" << linphone_chat_room_get_unread_messages_count(room);
    linphone_chat_room_mark_as_read(room);


    QLinPhoneCore *lcc = static_cast<QLinPhoneCore *>(linphone_core_get_user_data(lc));
    lcc->messageReceivedCb(msg);
}
Exemple #2
0
/* Messages with attachments */
static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message)
{
	Q_UNUSED(lc)
	Q_UNUSED(room)

	qDebug() << "Unread:" << linphone_chat_room_get_unread_messages_count(room);
	linphone_chat_room_mark_as_read(room);

	SipClient *sc = SipClient::instance();
	sc->messageReceivedCb(message);
}
Exemple #3
0
void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr){
	LinphoneCore *lc=linphone_chat_room_get_core(cr);
	int read=1;
	char *peer;
	char *buf;

	if (lc->db==NULL) return ;

	// optimization: do not modify the database if no message is marked as unread
	if(linphone_chat_room_get_unread_messages_count(cr) == 0) return;

	peer=linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr));
	buf=sqlite3_mprintf("UPDATE history SET read=%i WHERE remoteContact = %Q;",
				   read,peer);
	linphone_sql_request(lc->db,buf);
	sqlite3_free(buf);
	ms_free(peer);

	cr->unread_count = 0;
}