mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
db: log "from" resource
This commit is contained in:
parent
9224331df3
commit
db502d7054
@ -45,7 +45,7 @@
|
||||
|
||||
static sqlite3 *g_chatlog_database;
|
||||
|
||||
static void _add_to_db(ProfMessage *message, const char * const type, const char * const from_jid, const char * const to_jid);
|
||||
static void _add_to_db(ProfMessage *message, const char * const type, const Jid * const from_jid, const char * const to_jid);
|
||||
static char* _get_db_filename(ProfAccount *account);
|
||||
|
||||
static char*
|
||||
@ -162,7 +162,7 @@ _log_database_add_incoming(ProfMessage *message, const char * const type)
|
||||
const char *jid = connection_get_fulljid();
|
||||
Jid *myjid = jid_create(jid);
|
||||
|
||||
_add_to_db(message, type, message->jid->barejid, myjid->barejid);
|
||||
_add_to_db(message, type, message->jid, myjid->barejid);
|
||||
|
||||
jid_destroy(myjid);
|
||||
}
|
||||
@ -197,7 +197,7 @@ _log_database_add_outgoing(const char * const type, const char * const id, const
|
||||
const char *jid = connection_get_fulljid();
|
||||
Jid *myjid = jid_create(jid);
|
||||
|
||||
_add_to_db(msg, type, myjid->barejid, msg->jid->barejid);
|
||||
_add_to_db(msg, type, myjid, msg->jid->barejid);
|
||||
|
||||
jid_destroy(myjid);
|
||||
message_free(msg);
|
||||
@ -222,7 +222,7 @@ log_database_add_outgoing_muc_pm(const char * const id, const char * const barej
|
||||
}
|
||||
|
||||
static void
|
||||
_add_to_db(ProfMessage *message, const char * const type, const char * const from_jid, const char * const to_jid)
|
||||
_add_to_db(ProfMessage *message, const char * const type, const Jid * const from_jid, const char * const to_jid)
|
||||
{
|
||||
if (!g_chatlog_database) {
|
||||
log_debug("log_database_add() called but db is not initialized");
|
||||
@ -235,8 +235,9 @@ _add_to_db(ProfMessage *message, const char * const type, const char * const fro
|
||||
//gchar *date_fmt = g_date_time_format_iso8601(message->timestamp);
|
||||
gchar *date_fmt = g_date_time_format(message->timestamp, "%Y/%m/%d %H:%M:%S");
|
||||
if (asprintf(&query, "INSERT INTO `ChatLogs` (`from_jid`, `from_resource`, `to_jid`, `message`, `timestamp`, `stanza_id`, `replace_id`, `type`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
|
||||
from_jid,
|
||||
"test" /*message->jid->resourcepart*/,
|
||||
from_jid->barejid,
|
||||
from_jid->resourcepart,
|
||||
//"test" /*message->jid->resourcepart*/,
|
||||
to_jid,
|
||||
message->plain,
|
||||
date_fmt,
|
||||
|
Loading…
Reference in New Issue
Block a user