Difference between revisions of "Irssi-otr"

From ArchWiki
Jump to: navigation, search
m (Some minor formatting)
m (A few additions.)
Line 20: Line 20:
 
[http://git.tuxfamily.org/irssiotr/irssiotr.git?p=gitroot/irssiotr/irssiotr.git;a=blob_plain;f=README;hb=HEAD README].
 
[http://git.tuxfamily.org/irssiotr/irssiotr.git?p=gitroot/irssiotr/irssiotr.git;a=blob_plain;f=README;hb=HEAD README].
  
=Automatic loading & unloading=
+
=Loading the module on startup=
 
+
==Loading the module on startup==
+
  
 
If you are tired of typing <tt>/LOAD otr</tt> you can put the following
 
If you are tired of typing <tt>/LOAD otr</tt> you can put the following
Line 29: Line 27:
 
  LOAD otr
 
  LOAD otr
  
==Finishing conversations on /quit==
+
=Finishing OTR conversations on /QUIT=
  
If <tt>otr_finishonunload</tt> is set irssi-otr will finish all your OTR
+
If <tt>otr_finishonunload</tt> is set irssi-otr will finish all your
sessions when the module is unloaded.  However when you <tt>/QUIT</tt>,
+
OTR conversations when the module is unloaded.  However when you
Irssi disconnects from the IRC networks first and unloads its modules
+
<tt>/QUIT</tt>, Irssi disconnects from the IRC networks first and
afterwards.  Of course this will prevent your OTR sessions form being
+
unloads its modules afterwards.  Of course this will prevent your OTR
finished correctly.  To circumvent this you can define the following
+
conversations form being finished correctly.  To circumvent this you
alias:
+
can define the following alias:
  
 
  /ALIAS quit unload otr; quit
 
  /ALIAS quit unload otr; quit
Line 58: Line 56:
 
<tt>~/.irssi/startup</tt>.
 
<tt>~/.irssi/startup</tt>.
  
We will take a somewhat conservative approach.  We will only strip HTML
+
Since it is not possible to perfectly match HTML code with regular
tags we explicitly specified from PRIVMSGS from the BitlBee network,
+
expressions we will take a somewhat conservative approach.  We will only
where we assume you added you server.
+
strip HTML tags we explicitly specified from PRIVMSGS from the BitlBee
 +
network, where we assume you added you server.
  
  -privmsgs -nocase -tags 'BitlBee' -regexp '</?(a|b|body|div|em|font|i|s|u)( +\w+=".*?")*>' -replace ''  
+
  /TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '</?(a|b|body|div|em|font|i|s|u)( +\w+=".*?")*>' -replace ''  
  
Finally convert some escaped HTML characters:
+
And finally convert some escaped HTML characters:
  
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;amp;' -replace '&'  
+
  /TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;amp;' -replace '&'  
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;gt;' -replace '>'  
+
  /TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;gt;' -replace '>'  
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;lt;' -replace '<'  
+
  /TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;lt;' -replace '<'  
  -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;quot;' -replace '"'  
+
  /TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;quot;' -replace '"'  
  
 
<!--
 
<!--
 
vim: filetype=Wikipedia nowrap spell spelllang=en
 
vim: filetype=Wikipedia nowrap spell spelllang=en
 
-->
 
-->

Revision as of 20:37, 21 February 2009


About

The irssi-otr module brings Off-the-Record Messaging to your favorite IRC client.

Installing

You can install the Irssi OTR module from the AUR. If you like to test bleeding edge software, there is also a Git version.

Usage

See the README.

Loading the module on startup

If you are tired of typing /LOAD otr you can put the following in your ~/.irssi/startup:

LOAD otr

Finishing OTR conversations on /QUIT

If otr_finishonunload is set irssi-otr will finish all your OTR conversations when the module is unloaded. However when you /QUIT, Irssi disconnects from the IRC networks first and unloads its modules afterwards. Of course this will prevent your OTR conversations form being finished correctly. To circumvent this you can define the following alias:

/ALIAS quit unload otr; quit

Stripping HTML

If you use irssi-otr with BitlBee you will notice that some clients send you HTML formatted messages. Normally BitlBee automatically strips the HTML formatting, but since the messages are encrypted this doesn't work anymore. Nevertheless you can achieve the same by stripping the HTML with regular expressions using the Trigger script. Just make sure you load the script before the otr module. You can either do this manually or again make your ~/.irssi/startup look like this:

SCRIPT LOAD trigger.pl
LOAD otr

Also make sure that trigger.pl is not in ~/.irssi/scripts/autorun since the files from this directory are loaded after ~/.irssi/startup.

Since it is not possible to perfectly match HTML code with regular expressions we will take a somewhat conservative approach. We will only strip HTML tags we explicitly specified from PRIVMSGS from the BitlBee network, where we assume you added you server.

/TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '</?(a|b|body|div|em|font|i|s|u)( +\w+=".*?")*>' -replace  

And finally convert some escaped HTML characters:

/TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '&amp;' -replace '&' 
/TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '&gt;' -replace '>' 
/TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '&lt;' -replace '<' 
/TRIGGER ADD -privmsgs -nocase -tags 'BitlBee' -regexp '&quot;' -replace '"'