Skip to content

Instantly share code, notes, and snippets.

@zeekay
Created December 15, 2013 07:44
Show Gist options
  • Save zeekay/7970108 to your computer and use it in GitHub Desktop.
Save zeekay/7970108 to your computer and use it in GitHub Desktop.
Homebrew formula for irssi with znc privmsg patch.
require 'formula'
class Irssi < Formula
homepage 'http://irssi.org/'
url 'http://irssi.org/files/irssi-0.8.15.tar.bz2'
sha1 'b79ce8c2c98a76b004f63706e7868cd363000d89'
option "without-perl", "Build without perl support."
depends_on :clt # See https://github.com/Homebrew/homebrew/issues/20952
depends_on 'pkg-config' => :build
depends_on 'glib'
# Fix Perl build flags and paths in man page
def patches; DATA; end
def install
args =%W[
--prefix=#{prefix}
--sysconfdir=#{etc}
--with-bot
--with-proxy
--enable-ssl
--enable-ipv6
--with-socks
]
if build.with? "perl"
args << "--with-perl=yes"
args << "--with-perl-lib=#{lib}/perl5/site_perl"
else
args << "--with-perl=no"
end
system "./configure", *args
# 'make' and 'make install' must be done separately on some systems
system "make"
system "make install"
end
end
__END__
--- a/configure 2009-12-03 19:35:07.000000000 -0800
+++ b/configure 2009-12-03 19:35:33.000000000 -0800
@@ -27419,7 +27419,7 @@
if test -z "$perlpath"; then
perl_check_error="perl binary not found"
else
- PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
+ PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null | $SED -e 's/-arch [^ ]\{1,\}//g'`
fi
if test "x$ac_cv_c_compiler_gnu" = "xyes" -a -z "`echo $host_os|grep 'bsd\|linux'`"; then
@@ -27437,7 +27437,7 @@
$as_echo "not found, building without Perl" >&6; }
want_perl=no
else
- PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
+ PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null | $SED -e 's/-arch [^ ]\{1,\}//g'`
if test "x$DYNLIB_MODULES" = "xno" -a "$want_perl" != "static"; then
want_perl=static
diff --git a/docs/irssi.1 b/docs/irssi.1
index 62c2844..482cd96 100644
--- a/docs/irssi.1
+++ b/docs/irssi.1
@@ -65,10 +65,10 @@ display brief usage message.
.SH SEE ALSO
.B Irssi
has been supplied with a huge amount of documentation. Check /help or look
-at the files contained by /usr/share/doc/irssi*
+at the files contained by HOMEBREW_PREFIX/share/doc/irssi*
.SH FILES
.TP
-.I /etc/irssi.conf
+.I HOMEBREW_PREFIX/etc/irssi.conf
Global configuration file
.TP
.I ~/.irssi/config
@@ -83,13 +83,13 @@ Default irssi theme
.I ~/.irssi/away.log
Logged messages in away status
.TP
-.I /usr/share/irssi/help/
+.I HOMEBREW_PREFIX/share/irssi/help/
Directory including many help files
.TP
-.I /usr/share/irssi/scripts/
+.I HOMEBREW_PREFIX/share/irssi/scripts/
Global scripts directory
.TP
-.I /usr/share/irssi/themes/
+.I HOMEBREW_PREFIX/share/irssi/themes/
Global themes directory
.TP
.I ~/.irssi/scripts/
diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c
index 846272f..0848fb2 100644
--- a/src/fe-common/core/fe-messages.c
+++ b/src/fe-common/core/fe-messages.c
@@ -231,19 +231,33 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
}
static void sig_message_private(SERVER_REC *server, const char *msg,
- const char *nick, const char *address)
+ const char *nick, const char *address, const char *target)
{
QUERY_REC *query;
char *freemsg = NULL;
+ int own = 0;
- query = query_find(server, nick);
+ /* my message returned by bouncer? */
+ if(!strcmp(nick, server->nick))
+ own = 1;
+
+ query = query_find(server, own == 1 ? target : nick);
if (settings_get_bool("emphasis"))
msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg);
+ if(own == 1)
+ {
+ printformat(server, target, MSGLEVEL_MSGS,
+ query == NULL ? TXT_OWN_MSG_PRIVATE :
+ TXT_OWN_MSG_PRIVATE_QUERY, target, msg, server->nick);
+ }
+ else
+ {
printformat(server, nick, MSGLEVEL_MSGS,
query == NULL ? TXT_MSG_PRIVATE :
TXT_MSG_PRIVATE_QUERY, nick, address, msg);
+ }
g_free_not_null(freemsg);
}
diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c
index adf2b3d..1904f5b 100644
--- a/src/fe-common/core/fe-queries.c
+++ b/src/fe-common/core/fe-queries.c
@@ -326,12 +326,17 @@ static int sig_query_autoclose(void)
}
static void sig_message_private(SERVER_REC *server, const char *msg,
- const char *nick, const char *address)
+ const char *nick, const char *address, const char *target)
{
QUERY_REC *query;
+ int own = 0;
+
+ /* my message returned by bouncer? */
+ if(!strcmp(nick, server->nick))
+ own = 1;
/* create query window if needed */
- query = privmsg_get_query(server, nick, FALSE, MSGLEVEL_MSGS);
+ query = privmsg_get_query(server, own == 1 ? target : nick, FALSE, MSGLEVEL_MSGS);
/* reset the query's last_unread_msg timestamp */
if (query != NULL)
diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c
index fb8d1e9..0b3fd09 100644
--- a/src/fe-common/irc/fe-irc-messages.c
+++ b/src/fe-common/irc/fe-irc-messages.c
@@ -160,6 +160,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
const char *oldtarget;
char *freemsg = NULL;
int level;
+ int own = 0;
oldtarget = target;
target = skip_target(IRC_SERVER(server), target);
@@ -172,8 +173,14 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
if (ischannel(*target))
item = irc_channel_find(server, target);
- else
+ else {
+ if(!strcmp(nick, server->nick)) {
+ own = 1;
+ item = privmsg_get_query(SERVER(server), target, FALSE, level);
+ } else {
item = privmsg_get_query(SERVER(server), nick, FALSE, level);
+ }
+ }
if (settings_get_bool("emphasis"))
msg = freemsg = expand_emphasis(item, msg);
@@ -191,11 +198,23 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
nick, oldtarget, msg);
}
} else {
+ /* own action bounced */
+ if(own)
+ {
+ printformat(server, target,
+ MSGLEVEL_ACTIONS | MSGLEVEL_MSGS,
+ item != NULL && oldtarget == target ? IRCTXT_OWN_ACTION : IRCTXT_OWN_ACTION_TARGET,
+ server->nick, msg, oldtarget);
+
+ }
/* private action */
+ else
+ {
printformat(server, nick, MSGLEVEL_ACTIONS | MSGLEVEL_MSGS,
item == NULL ? IRCTXT_ACTION_PRIVATE :
IRCTXT_ACTION_PRIVATE_QUERY,
nick, address == NULL ? "" : address, msg);
+ }
}
g_free_not_null(freemsg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment