mirror of
https://github.com/irssi/irssi.git
synced 2026-08-18 08:02:13 +02:00
Added "message dcc xxx" signals for printing DCC messages.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2298 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
a01aab7a64
commit
6e4730b65d
7 changed files with 181 additions and 50 deletions
128
src/fe-common/irc/dcc/fe-dcc-chat-messages.c
Normal file
128
src/fe-common/irc/dcc/fe-dcc-chat-messages.c
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
fe-dcc-chat-messages.c : irssi
|
||||
|
||||
Copyright (C) 2002 Timo Sirainen
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "levels.h"
|
||||
|
||||
#include "irc-queries.h"
|
||||
#include "dcc-chat.h"
|
||||
|
||||
#include "module-formats.h"
|
||||
#include "printtext.h"
|
||||
|
||||
static void sig_message_dcc_own(CHAT_DCC_REC *dcc, const char *msg)
|
||||
{
|
||||
QUERY_REC *query;
|
||||
char *tag;
|
||||
|
||||
tag = g_strconcat("=", dcc->id, NULL);
|
||||
query = query_find(NULL, tag);
|
||||
|
||||
printformat(NULL, tag, MSGLEVEL_DCCMSGS | MSGLEVEL_NOHILIGHT,
|
||||
query != NULL ? IRCTXT_OWN_DCC_QUERY :
|
||||
IRCTXT_OWN_DCC, dcc->mynick, dcc->id, msg);
|
||||
g_free(tag);
|
||||
}
|
||||
|
||||
static void sig_message_dcc_own_action(CHAT_DCC_REC *dcc, const char *msg)
|
||||
{
|
||||
QUERY_REC *query;
|
||||
char *tag;
|
||||
|
||||
tag = g_strconcat("=", dcc->id, NULL);
|
||||
query = query_find(NULL, tag);
|
||||
|
||||
printformat(NULL, tag, MSGLEVEL_DCCMSGS | MSGLEVEL_NOHILIGHT,
|
||||
query != NULL ? IRCTXT_OWN_DCC_ACTION_QUERY :
|
||||
IRCTXT_OWN_DCC_ACTION, dcc->mynick, dcc->id, msg);
|
||||
g_free(tag);
|
||||
}
|
||||
|
||||
static void sig_message_dcc_own_ctcp(CHAT_DCC_REC *dcc, const char *cmd,
|
||||
const char *data)
|
||||
{
|
||||
char *tag;
|
||||
|
||||
tag = g_strconcat("=", dcc->id, NULL);
|
||||
|
||||
printformat(NULL, tag, MSGLEVEL_DCC, IRCTXT_OWN_DCC_CTCP,
|
||||
dcc->id, cmd, data);
|
||||
g_free(tag);
|
||||
}
|
||||
|
||||
static void sig_message_dcc(CHAT_DCC_REC *dcc, const char *msg)
|
||||
{
|
||||
QUERY_REC *query;
|
||||
char *tag;
|
||||
|
||||
tag = g_strconcat("=", dcc->id, NULL);
|
||||
|
||||
query = query_find(NULL, tag);
|
||||
printformat(NULL, tag, MSGLEVEL_DCCMSGS,
|
||||
query != NULL ? IRCTXT_DCC_MSG_QUERY : IRCTXT_DCC_MSG,
|
||||
dcc->id, msg);
|
||||
g_free(tag);
|
||||
}
|
||||
|
||||
static void sig_message_dcc_action(CHAT_DCC_REC *dcc, const char *msg)
|
||||
{
|
||||
QUERY_REC *query;
|
||||
char *tag;
|
||||
|
||||
tag = g_strconcat("=", dcc->id, NULL);
|
||||
|
||||
query = query_find(NULL, tag);
|
||||
printformat(NULL, tag, MSGLEVEL_DCCMSGS | MSGLEVEL_ACTIONS,
|
||||
query != NULL ? IRCTXT_ACTION_DCC_QUERY :
|
||||
IRCTXT_ACTION_DCC, dcc->id, dcc->mynick, msg);
|
||||
g_free(tag);
|
||||
}
|
||||
|
||||
static void sig_message_dcc_ctcp(CHAT_DCC_REC *dcc, const char *cmd,
|
||||
const char *data)
|
||||
{
|
||||
char *tag;
|
||||
|
||||
tag = g_strconcat("=", dcc->id, NULL);
|
||||
printformat(NULL, tag, MSGLEVEL_DCC, IRCTXT_DCC_CTCP,
|
||||
dcc->id, cmd, data);
|
||||
g_free(tag);
|
||||
}
|
||||
|
||||
void fe_dcc_chat_messages_init(void)
|
||||
{
|
||||
signal_add("message dcc own", (SIGNAL_FUNC) sig_message_dcc_own);
|
||||
signal_add("message dcc own_action", (SIGNAL_FUNC) sig_message_dcc_own_action);
|
||||
signal_add("message dcc own_ctcp", (SIGNAL_FUNC) sig_message_dcc_own_ctcp);
|
||||
signal_add("message dcc", (SIGNAL_FUNC) sig_message_dcc);
|
||||
signal_add("message dcc action", (SIGNAL_FUNC) sig_message_dcc_action);
|
||||
signal_add("message dcc ctcp", (SIGNAL_FUNC) sig_message_dcc_ctcp);
|
||||
}
|
||||
|
||||
void fe_dcc_chat_messages_deinit(void)
|
||||
{
|
||||
signal_remove("message dcc own", (SIGNAL_FUNC) sig_message_dcc_own);
|
||||
signal_remove("message dcc own_action", (SIGNAL_FUNC) sig_message_dcc_own_action);
|
||||
signal_remove("message dcc own_ctcp", (SIGNAL_FUNC) sig_message_dcc_own_ctcp);
|
||||
signal_remove("message dcc", (SIGNAL_FUNC) sig_message_dcc);
|
||||
signal_remove("message dcc action", (SIGNAL_FUNC) sig_message_dcc_action);
|
||||
signal_remove("message dcc ctcp", (SIGNAL_FUNC) sig_message_dcc_ctcp);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue