mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Moved chat logging to profanity module
Removed jabber modules dependency on chat log
This commit is contained in:
parent
ee8407f4a4
commit
a970b9ea86
@ -28,6 +28,7 @@
|
||||
#include "command.h"
|
||||
#include "common.h"
|
||||
#include "contact_list.h"
|
||||
#include "chat_log.h"
|
||||
#include "history.h"
|
||||
#include "jabber.h"
|
||||
#include "log.h"
|
||||
@ -450,6 +451,12 @@ cmd_execute_default(const char * const inp)
|
||||
if (win_in_chat()) {
|
||||
char *recipient = win_get_recipient();
|
||||
jabber_send(inp, recipient);
|
||||
|
||||
if (prefs_get_chlog()) {
|
||||
const char *jid = jabber_get_jid();
|
||||
chat_log_chat(jid, recipient, inp, OUT);
|
||||
}
|
||||
|
||||
win_show_outgoing_msg("me", recipient, inp);
|
||||
free(recipient);
|
||||
} else {
|
||||
@ -604,8 +611,15 @@ _cmd_msg(const char * const inp, struct cmd_help_t help)
|
||||
if ((usr != NULL) && (strlen(inp) > (5 + strlen(usr) + 1))) {
|
||||
// get message
|
||||
msg = strndup(inp+5+strlen(usr)+1, strlen(inp)-(5+strlen(usr)+1));
|
||||
|
||||
if (msg != NULL) {
|
||||
jabber_send(msg, usr);
|
||||
|
||||
if (prefs_get_chlog()) {
|
||||
const char *jid = jabber_get_jid();
|
||||
chat_log_chat(jid, usr, msg, OUT);
|
||||
}
|
||||
|
||||
win_show_outgoing_msg("me", usr, msg);
|
||||
} else {
|
||||
char usage[strlen(help.usage + 8)];
|
||||
@ -641,6 +655,12 @@ _cmd_tiny(const char * const inp, struct cmd_help_t help)
|
||||
char *tiny = tinyurl_get(url);
|
||||
char *recipient = win_get_recipient();
|
||||
jabber_send(tiny, recipient);
|
||||
|
||||
if (prefs_get_chlog()) {
|
||||
const char *jid = jabber_get_jid();
|
||||
chat_log_chat(jid, recipient, tiny, OUT);
|
||||
}
|
||||
|
||||
win_show_outgoing_msg("me", recipient, tiny);
|
||||
free(recipient);
|
||||
free(tiny);
|
||||
|
15
src/jabber.c
15
src/jabber.c
@ -25,7 +25,6 @@
|
||||
|
||||
#include <strophe.h>
|
||||
|
||||
#include "chat_log.h"
|
||||
#include "common.h"
|
||||
#include "jabber.h"
|
||||
#include "log.h"
|
||||
@ -161,11 +160,6 @@ jabber_send(const char * const msg, const char * const recipient)
|
||||
free(coded_msg);
|
||||
free(coded_msg2);
|
||||
free(coded_msg3);
|
||||
|
||||
if (prefs_get_chlog()) {
|
||||
const char *jid = xmpp_conn_get_jid(jabber_conn.conn);
|
||||
chat_log_chat(jid, (char *)recipient, msg, OUT);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -280,15 +274,6 @@ _message_handler(xmpp_conn_t * const conn,
|
||||
char *from = xmpp_stanza_get_attribute(stanza, "from");
|
||||
prof_handle_incoming_message(from, message);
|
||||
|
||||
if (prefs_get_chlog()) {
|
||||
char from_cpy[strlen(from) + 1];
|
||||
strcpy(from_cpy, from);
|
||||
char *short_from = strtok(from_cpy, "/");
|
||||
const char *jid = xmpp_conn_get_jid(jabber_conn.conn);
|
||||
|
||||
chat_log_chat(jid, short_from, message, IN);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,15 @@ prof_handle_incoming_message(char *from, char *message)
|
||||
{
|
||||
win_show_incomming_msg(from, message);
|
||||
win_page_off();
|
||||
|
||||
if (prefs_get_chlog()) {
|
||||
char from_cpy[strlen(from) + 1];
|
||||
strcpy(from_cpy, from);
|
||||
char *short_from = strtok(from_cpy, "/");
|
||||
const char *jid = jabber_get_jid();
|
||||
|
||||
chat_log_chat(jid, short_from, message, IN);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user