[Pkg-privacy-commits] [irssi-plugin-otr] 85/267: Cleanup Cmake and add autoconf build system

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:26:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.

commit 748c26c93d50002fbcbe405da13481b096aac921
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Fri Nov 2 16:10:10 2012 -0400

    Cleanup Cmake and add autoconf build system
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 .gitignore                             |  32 +-
 .uncrustify.cfg                        | 105 ----
 AUTHORS                                |   0
 CMakeLists.txt                         | 229 ---------
 HOWTO_PACKAGE                          |  17 -
 Makefile.am                            |   8 +
 Packaging-DEB.cmake                    |   7 -
 Packaging-RPM.cmake                    |  23 -
 Packaging.cmake                        |  42 --
 README                                 |  85 ---
 README.irssi-headers                   |   3 -
 README.md                              |   4 +
 README.xchat                           |   9 -
 bootstrap                              |  10 +
 cmake-extensions/COPYING-CMAKE-SCRIPTS |  22 -
 cmake-extensions/FindLibGcrypt.cmake   |  52 --
 cmake-extensions/FindLibOTR.cmake      |  49 --
 cmake-extensions/Git.cmake             |  20 -
 cmake-extensions/cscope.cmake          |  17 -
 configure.ac                           |  80 +++
 formats.txt                            | 104 ----
 io-config.h.in                         |   4 -
 io_set.c                               |  64 ---
 io_util.c                              | 349 -------------
 irssi/CMakeLists.txt                   |  68 ---
 irssi/irssi_otr.c                      | 374 --------------
 irssi/irssi_otr.h                      |  91 ----
 makeformats.py                         | 130 -----
 mksrcpackage.sh                        |  17 -
 otr.h                                  | 269 ----------
 otr_key.c                              | 364 -------------
 otr_ops.c                              | 398 --------------
 otr_util.c                             | 915 ---------------------------------
 weechat/.gitignore                     |   1 -
 weechat/CMakeLists.txt                 |  37 --
 weechat/weechat_otr.c                  | 377 --------------
 weechat/weechat_otr.h                  | 158 ------
 xchat/CMakeLists.txt                   |  35 --
 xchat/xchat_otr.c                      | 246 ---------
 xchat/xchat_otr.h                      |  86 ----
 40 files changed, 128 insertions(+), 4773 deletions(-)

diff --git a/.gitignore b/.gitignore
index 886bc2e..d196ee4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,29 @@
 *.o
 *.so
-term.h
-statusbar.h
-mainwindows.h
-.exrc
 *.swp
-cscope.files
-cscope.out
+*.o
+*.swo
+*.pyc
+Makefile
+.libs/
+.deps/
+*~
+*.la
+*.lo
+Makefile.in
+*.loT
+*.info
+*.bz2
+*.tar
+configure
+aclocal.m4
+autom4te.cache/
+config.h
+config.h.in
+config.log
+config.status
+stamp-h1
+libtool
+tags
+
+config/
diff --git a/.uncrustify.cfg b/.uncrustify.cfg
deleted file mode 100644
index 5591dfa..0000000
--- a/.uncrustify.cfg
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# K&R (sort-of)
-#
-# minor modifications
-#
-
-indent_with_tabs		= 2		# 1=indent to level only, 2=indent with tabs
-input_tab_size			= 8		# original tab size
-output_tab_size			= 8		# new tab size
-indent_columns			= output_tab_size
-indent_label			= 2		# pos: absolute col, neg: relative column
-#indent_var_def_cont                      = true
-#indent_continue                          = 4
-indent_class = true
-
-# indent_align_string		= False		# align broken strings
-# indent_brace			= 0
-
-nl_enum_brace			= remove	# "enum {" vs "enum \n {"
-nl_union_brace			= remove	# "union {" vs "union \n {"
-nl_struct_brace			= remove	# "struct {" vs "struct \n {"
-nl_do_brace			= remove	# "do {" vs "do \n {"
-nl_if_brace			= remove	# "if () {" vs "if () \n {"
-nl_for_brace			= remove	# "for () {" vs "for () \n {"
-nl_else_brace			= remove	# "else {" vs "else \n {"
-nl_while_brace			= remove	# "while () {" vs "while () \n {"
-nl_switch_brace			= remove	# "switch () {" vs "switch () \n {"
-# nl_func_var_def_blk		= 1
-# nl_before_case			= 1
-nl_fcall_brace			= add		# "foo() {" vs "foo()\n{"
-nl_fdef_brace			= add		# "int foo() {" vs "int foo()\n{"
-# nl_after_return			= TRUE
-nl_brace_while			= remove
-nl_brace_else			= remove
-nl_squeeze_ifdef		= TRUE
-
-# Don't split one-line braced statements inside a class xx { } body
-nl_class_leave_one_liners                = true    # false/true
-# Don't split one-line function definitions - 'int foo() { return 0; }'
-nl_func_leave_one_liners                 = true    # false/true
-# Whether to collapse empty blocks between '{' and '}'
-nl_collapse_empty_body                   = true    # false/true
-# ^^
-
-# mod_paren_on_return		= add		# "return 1;" vs "return (1);"
-# mod_full_brace_if		= add		# "if (a) a--;" vs "if (a) { a--; }"
-# mod_full_brace_for		= add		# "for () a--;" vs "for () { a--; }"
-# mod_full_brace_do		= add		# "do a--; while ();" vs "do { a--; } while ();"
-# mod_full_brace_while		= add		# "while (a) a--;" vs "while (a) { a--; }"
-
-sp_before_semi			= remove
-sp_paren_paren			= remove	# space between (( and ))
-sp_return_paren			= remove	# "return (1);" vs "return(1);"
-sp_sizeof_paren			= remove	# "sizeof (int)" vs "sizeof(int)"
-sp_before_sparen		= force		# "if (" vs "if("
-sp_after_sparen			= force		# "if () {" vs "if (){"
-sp_after_cast			= remove	# "(int) a" vs "(int)a"
-sp_inside_braces		= force		# "{ 1 }" vs "{1}"
-sp_inside_braces_struct		= force		# "{ 1 }" vs "{1}"
-sp_inside_braces_enum		= force		# "{ 1 }" vs "{1}"
-sp_inside_paren			= remove	# "( 1 )" vs "(1)"
-sp_inside_fparen		= remove        # "( 1 )" vs "(1)" - functions
-sp_inside_sparen		= remove        # "( 1 )" vs "(1)" - if/for/etc
-# sp_type_func			= ignore
-sp_assign			= force
-sp_arith			= force
-sp_bool				= force
-sp_compare			= force
-sp_after_comma			= force
-sp_func_def_paren		= remove	# "int foo (){" vs "int foo(){"
-sp_func_call_paren		= remove	# "foo (" vs "foo("
-sp_func_proto_paren		= remove	# "int foo ();" vs "int foo();"
-
-# align_with_tabs			= FALSE		# use tabs to align
-# align_on_tabstop		= FALSE		# align on tabstops
-# align_enum_equ_span		= 4
-# align_nl_cont			= TRUE
-# align_var_def_span		= 2
-# align_var_def_inline		= TRUE
-# align_var_def_star		= TRUE
-# align_var_def_colon		= TRUE
-# align_assign_span		= 1
-# align_struct_init_span		= 3
-# align_var_struct_span		= 3
-# align_right_cmt_span		= 3
-# align_pp_define_span		= 3
-# align_pp_define_gap		= 4
-# align_number_left		= TRUE
-# align_typedef_span		= 5
-# align_typedef_gap		= 3
-
-# cmt_star_cont			= TRUE
-
-eat_blanks_before_close_brace	= TRUE
-eat_blanks_after_open_brace	= TRUE
-
-# Try to limit code width to N number of columns
-code_width                               = 78        # number
-cmt_width                                = 80        # number
-
-# Whether to fully split long 'for' statements at semi-colons
-ls_for_split_full                        = false    # false/true
-
-# Whether to fully split long function protos/calls at commas
-ls_func_split_full                       = false    # false/true
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..e69de29
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 38090e1..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,229 +0,0 @@
-#
-# Off-the-Record Messaging (OTR) modules for IRC
-# Copyright (C) 2008  Uli Meis <a.sporto+bee at gmail.com>
-#
-# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
-#
-
-PROJECT(irc-otr)
-
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
-IF(COMMAND cmake_policy)
-  cmake_policy(SET CMP0003 NEW)
-ENDIF(COMMAND cmake_policy)
-
-SET(CMAKE_MODULE_PATH 
-  ${PROJECT_SOURCE_DIR}/cmake-extensions/
-  ${PROJECT_BINARY_DIR})
-
-INCLUDE(cmake-extensions/cscope.cmake)
-INCLUDE(cmake-extensions/Git.cmake)
-INCLUDE(CheckFunctionExists)
-INCLUDE(CheckIncludeFile)
-INCLUDE(CheckIncludeFiles)
-INCLUDE(tarballdefs.cmake OPTIONAL)
-
-# get version from git
-
-IF(NOT IRCOTR_VERSION)
-  IF(NOT EXISTS "${PROJECT_SOURCE_DIR}/.git")
-    MESSAGE(FATAL_ERROR "Cannot determine the irc-otr version since this is "
-    "not a git checkout. Please set IRCOTR_VERSION, e.g.
-    cmake -DIRCOTR_VERSION=mydistro-0.1
-    or
-    cmake -DIRCOTR_VERSION=mydistro-git-<git-commit>")
-  ENDIF(NOT EXISTS "${PROJECT_SOURCE_DIR}/.git")
-  FIND_GIT_TAGORCOMMIT(${PROJECT_SOURCE_DIR} IRCOTR_VERSION)
-  IF(NOT IRCOTR_VERSION)
-    MESSAGE(FATAL_ERROR 
-      "Couldn't determine version. Please run cmake -DIRCOTR_VERSION=...")
-  ENDIF(NOT IRCOTR_VERSION)
-ENDIF(NOT IRCOTR_VERSION)
-
-MESSAGE(STATUS "Building irc-otr version ${IRCOTR_VERSION}")
-
-# PkgConfig. Only available since 2.4.7, fetch if unavailable so people with
-# older cmake can run this
-
-FIND_PACKAGE(PkgConfig QUIET)
-
-IF(NOT PKG_CONFIG_FOUND)
-  MESSAGE(STATUS "Couldn't find the pkg-config cmake module. Seems you're
-  running cmake < 2.4.7. Will try to fetch the module from 2.4.7...")
-  FIND_PACKAGE(Wget REQUIRED)
-  EXECUTE_PROCESS(COMMAND "bash" "-c"
-    "${WGET_EXECUTABLE} '-O' '-' \\
-    'http://www.cmake.org/files/v2.4/cmake-2.4.7.tar.gz' | \\
-    tar xz cmake-2.4.7/Modules/FindPkgConfig.cmake && \\
-    mv cmake-2.4.7/Modules/FindPkgConfig.cmake . && \\
-    rmdir -p cmake-2.4.7/Modules"
-    RESULT_VARIABLE PKGCONF_RET)
-  IF(NOT PKGCONF_RET EQUAL 0)
-    MESSAGE(FATAL_ERROR "Couldnt download cmake module for pkg-config")
-  ENDIF(NOT PKGCONF_RET EQUAL 0)
-  FIND_PACKAGE(PkgConfig REQUIRED)
-ENDIF(NOT PKG_CONFIG_FOUND)
-
-# GLIB
-
-pkg_check_modules(GLIB REQUIRED glib-2.0)
-
-# Python
-
-FIND_PACKAGE(PythonInterp)
-IF(NOT PYTHON_EXECUTABLE)
-  MESSAGE(FATAL_ERROR "Couldn't find a python interpreter")
-ENDIF(NOT PYTHON_EXECUTABLE)
-
-# LIBOTR
-
-FIND_PACKAGE(LibOTR REQUIRED)
-IF (LIBOTR_VERSION LESS "3.1.0")
-  MESSAGE(FATAL_ERROR "Need libotr version >= 3.1.0 (fragmentation)")
-ENDIF (LIBOTR_VERSION LESS "3.1.0")
-IF (LIBOTR_VERSION LESS "4.0.0")
-  MESSAGE(STATUS "libotr<4, no Q&A authentication support")
-  SET(LIBOTR3 ON)
-ENDIF (LIBOTR_VERSION LESS "4.0.0")
-
-# LIBGCRYPT. A dependency of libotr and therefore one of ours.
-
-FIND_PACKAGE(LibGcrypt REQUIRED)
-
-# includes
-
-SET(IRCOTR_INCLUDE_DIRS
-  ${PROJECT_SOURCE_DIR} 
-  ${PROJECT_BINARY_DIR} 
-  ${GLIB_INCLUDE_DIRS} 
-  ${LIBOTR_INCLUDE_DIRS})
-
-SET(CMAKE_REQUIRED_INCLUDES ${IRCOTR_INCLUDE_DIRS})
-SET(CMAKE_REQUIRED_DEFINITIONS -DHAVE_CONFIG_H ${LIBGCRYPT_CFLAGS})
-
-
-include_directories(${IRCOTR_INCLUDE_DIRS})
-
-# gregex.h 
-# available since 2.13 AFAIK
-# optional for html stripping and nick ignoring
-
-CHECK_INCLUDE_FILE(glib/gregex.h HAVE_GREGEX_H)
-
-# check for strsignal
-
-CHECK_FUNCTION_EXISTS(strsignal HAVE_STRSIGNAL)
-
-# generate io-config.h
-
-CONFIGURE_FILE(io-config.h.in io-config.h)
-
-# defs
-
-IF(NOT CMAKE_BUILD_TYPE)
-  SET(CMAKE_BUILD_TYPE debug)
-ENDIF(NOT CMAKE_BUILD_TYPE)
-SET(CMAKE_C_FLAGS_DEBUG -g)
-
-MESSAGE(STATUS "This is a ${CMAKE_BUILD_TYPE} build")
-
-ADD_DEFINITIONS(-DHAVE_CONFIG_H -Wall ${LIBGCRYPT_CFLAGS})
-
-# generate otr-formats.{c,h}
-
-ADD_CUSTOM_COMMAND(OUTPUT 
-  otr-formats.c 
-  xchat-formats.c 
-  DEPENDS makeformats.py formats.txt README
-  COMMAND 
-  ${PYTHON_EXECUTABLE}
-  ${PROJECT_SOURCE_DIR}/makeformats.py 
-  ${PROJECT_SOURCE_DIR}/formats.txt
-  ${PROJECT_SOURCE_DIR}/README
-  )
-
-
-add_custom_target(otrformats DEPENDS otr-formats.c)
-
-# Now that took some time to figure out...
-
-IF(APPLE)
-  SET(APPLE_LDFLAGS "-single_module -undefined dynamic_lookup")
-ENDIF(APPLE)
-
-FOREACH(X ${LIBGCRYPT_LDFLAGS} ${GLIB_LDFLAGS} ${APPLE_LDFLAGS})
-  SET(MAIN_LDFLAGS "${MAIN_LDFLAGS} ${X}")
-ENDFOREACH(X ${LIBGCRYPT_LDFLAGS} ${GLIB_LDFLAGS} ${APPLE_LDFLAGS})
-
-FIND_PATH(IRSSI_INCLUDE_DIR NAMES irssi/src/core/module.h)
-MARK_AS_ADVANCED(IRSSI_INCLUDE_DIR)
-
-FIND_PATH(WEECHAT_INCLUDE_DIR NAMES weechat/weechat-plugin.h
-  PATHS ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
-MARK_AS_ADVANCED(WEECHAT_INCLUDE_DIR)
-
-FIND_PATH(XCHAT_INCLUDE_DIR NAMES xchat/xchat-plugin.h)
-MARK_AS_ADVANCED(XCHAT_INCLUDE_DIR)
-
-IF(CMAKE_SOURCE_DIR MATCHES "irssi-[^/]*$")
-  SET(W_IRSSI ON)
-ELSEIF(CMAKE_SOURCE_DIR MATCHES "xchat-[^/]*$")
-  SET(W_XCHAT ON)
-ELSEIF(CMAKE_SOURCE_DIR MATCHES "weechat-[^/]*$")
-  SET(W_WEECHAT ON)
-ELSEIF(CMAKE_SOURCE_DIR MATCHES "bitlbee-[^/]*$")
-  SET(W_BITLBEE ON)
-ELSE(CMAKE_SOURCE_DIR MATCHES "irssi-[^/]*$")
-  IF(IRSSI_INCLUDE_DIR)
-    SET(W_IRSSI ON)
-  ENDIF(IRSSI_INCLUDE_DIR)
-  IF(XCHAT_INCLUDE_DIR)
-    SET(W_XCHAT ON)
-  ENDIF(XCHAT_INCLUDE_DIR)
-  IF(WEECHAT_INCLUDE_DIR)
-    SET(W_WEECHAT ON)
-  ENDIF(WEECHAT_INCLUDE_DIR)
-  IF(BITLBEE_INCLUDE_DIR)
-    SET(W_BITLBEE ON)
-  ENDIF(BITLBEE_INCLUDE_DIR)
-ENDIF(CMAKE_SOURCE_DIR MATCHES "irssi-[^/]*$")
-
-OPTION(WANT_IRSSI "build irssi plugin" ${W_IRSSI})
-OPTION(WANT_XCHAT "build xchat plugin" ${W_XCHAT})
-OPTION(WANT_WEECHAT "build weechat plugin" ${W_WEECHAT})
-OPTION(WANT_BITLBEE "build bitlbee plugin" ${W_BITLBEE})
-
-IF(WANT_IRSSI)
-  add_subdirectory(irssi)
-ENDIF(WANT_IRSSI)
-IF(WANT_XCHAT)
-  add_subdirectory(xchat)
-ENDIF(WANT_XCHAT)
-IF(WANT_WEECHAT)
-  add_subdirectory(weechat)
-ENDIF(WANT_WEECHAT)
-IF(WANT_BITLBEE)
-  add_subdirectory(bitlbee)
-ENDIF(WANT_BITLBEE)
-
-# cscope
-
-FILE(GLOB CSANDHS *.c *.h)
-ADD_CSCOPE_TARGET("${CSANDHS}" "${IRCOTR_INCLUDE_DIRS}")
-
-# Source tarball
-ADD_CUSTOM_TARGET(src-tarball 
-  ${PROJECT_SOURCE_DIR}/mksrcpackage.sh ${PROJECT_SOURCE_DIR} 
-  ${IRCOTR_VERSION})
diff --git a/HOWTO_PACKAGE b/HOWTO_PACKAGE
deleted file mode 100644
index 90334d5..0000000
--- a/HOWTO_PACKAGE
+++ /dev/null
@@ -1,17 +0,0 @@
-You can let cmake generate a package for you. But don't expect it to be in
-full conformance with your distribution.
-
-You'll need cmake >= 2.6. In theory, all you should have to do is:
-
-	$ cmake -DCMAKE_INSTALL_TYPE=package-deb /path/to/src
-	$ sudo make package
-
-For an RPM it should be package-rpm and for TGZ...you can imagine.
-
-I'm not sure yet if the RPMs/DEBs generated by cmake/CPack are 100% OK. You can
-tweak the settings in Packaging-{RPM,DEB}.cmake. If you wanna see how CPack does
-it and what variables affect it, check out:
-
-	/usr/share/cmake/Modules/CPackDeb.cmake
-	/usr/share/cmake/Modules/CPackRPM.cmake
-
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..ca421d0
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,8 @@
+AM_CFLAGS = $(PACKAGE_CFLAGS)
+
+ACLOCAL_AMFLAGS = -I config
+
+SUBDIRS = src
+
+dist_doc_DATA = LICENSE \
+                ChangeLog
diff --git a/Packaging-DEB.cmake b/Packaging-DEB.cmake
deleted file mode 100644
index 88cd52f..0000000
--- a/Packaging-DEB.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-INSTALL(TARGETS irssiotr DESTINATION lib${LIB_SUFFIX}/irssi/modules)
-INSTALL(FILES README LICENSE DESTINATION ${DOCDIR})
-
-SET(CPACK_GENERATOR DEB)
-#SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
-SET(CPACK_DEBIAN_PACKAGE_SECTION "net")
-SET(CPACK_DEBIAN_PACKAGE_DEPENDS "irssi, libotr2 (>= 3.1.0)")
diff --git a/Packaging-RPM.cmake b/Packaging-RPM.cmake
deleted file mode 100644
index d560e81..0000000
--- a/Packaging-RPM.cmake
+++ /dev/null
@@ -1,23 +0,0 @@
-INSTALL(TARGETS irssiotr DESTINATION lib${LIB_SUFFIX}/irssi/modules)
-INSTALL(FILES README DESTINATION ${DOCDIR})
-
-SET(CPACK_GENERATOR RPM)
-SET(CPACK_RPM_PACKAGE_DEBUG)
-SET(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
-SET(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
-
-EXECUTE_PROCESS(COMMAND bash -c
-  "ARCH=`which arch` && $ARCH | tr -d '\n'"
-  OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE)
-
-#IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
-#  SET(CPACK_RPM_PACKAGE_ARCHITECTURE i386)
-#ELSE
-#  SET(CPACK_RPM_PACKAGE_ARCHITECTURE i386)
-#ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
-
-SET(CPACK_RPM_PACKAGE_RELEASE 1)
-SET(CPACK_RPM_PACKAGE_GROUP "unknown")
-SET(CPACK_RPM_FILE_NAME
-  ${CPACK_PACKAGE_FILE_NAME}-${CPACK_RPM_PACKAGE_RELEASE}.${CPACK_RPM_PACKAGE_ARCHITECTURE})
-SET(CPACK_PACKAGE_FILE_NAME ${CPACK_RPM_FILE_NAME})
diff --git a/Packaging.cmake b/Packaging.cmake
deleted file mode 100644
index e57d041..0000000
--- a/Packaging.cmake
+++ /dev/null
@@ -1,42 +0,0 @@
-SET(CPACK_PACKAGE_CONTACT "Ulim <a.sporto+bee at gmail.com>")
-SET(CPACK_PACKAGE_VENDOR ${CPACK_PACKAGE_CONTACT})
-
-SET(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)
-SET(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README)
-
-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY 
-  "Off-The-Record Messaging (OTR) for irssi")
-
-SET(CPACK_PACKAGE_FILE_NAME
-  ${CMAKE_PROJECT_NAME}-${IRCOTR_VERSION})
-
-SET(CPACK_GENERATOR TGZ)
-
-SET(CPACK_PACKAGE_VERSION ${IRCOTR_VERSION})
-
-IF(CMAKE_INSTALL_TYPE STREQUAL "package-rpm")
-  CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-  INCLUDE(Packaging-RPM.cmake)
-ELSEIF(CMAKE_INSTALL_TYPE STREQUAL "package-deb")
-  CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-  INCLUDE(Packaging-DEB.cmake)
-ELSEIF(CMAKE_INSTALL_TYPE STREQUAL "package-tgz")
-  INSTALL(TARGETS irssiotr DESTINATION irssi/lib/modules)
-  INSTALL(FILES README LICENSE DESTINATION ${DOCDIR})
-ELSE(CMAKE_INSTALL_TYPE STREQUAL "package-rpm")
-  MESSAGE(FATAL_ERROR "Unknown build type '${CMAKE_INSTALL_TYPE}'")
-ENDIF(CMAKE_INSTALL_TYPE STREQUAL "package-rpm")
-
-
-
-#ENDIF(CMAKE_INSTALL_TYPE STREQUAL "package-tgz")
-#ENDIF(CMAKE_INSTALL_TYPE STREQUAL "package-deb")
-
-#SET(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/README)
-#SET(CPACK_PACKAGE_VERSION_MAJOR "0")
-#SET(CPACK_PACKAGE_VERSION_MINOR "1")
-#SET(CPACK_PACKAGE_VERSION_PATCH "0")
-#SET(CPACK_PACKAGE_FILE_NAME
-#  ${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
-
-INCLUDE(CPack)
diff --git a/README b/README
deleted file mode 100644
index 31e46ce..0000000
--- a/README
+++ /dev/null
@@ -1,85 +0,0 @@
-Quick start:  Do "/load otr"  (irssi syntax), write  "?OTR?" to your  OTR buddy,
-wait until the now ongoing key  generation finishes and write "?OTR?" again. You
-should "go secure".
-
-Key generation happens in a separate  process and its duration mainly depends on
-the available entropy. On  my desktop it takes about 6  Minutes, about 2 Minutes
-if I run  "du /" in parallel  and on an idle  server system it can  even take an
-hour.
-
-The  default  OTR  policy  of  irc-otr  is  now  something  between  manual  and
-opportunistic. Manual  means you have to  start it yourself by  issuing "?OTR?",
-opportunistic means  both peers send  some magic  whitespace and start  OTR once
-they receive this whitespace from the other side. irc-otr uses a mode in between
-where we are not sending whitespace as an announcement (as in opportunistic) but
-we still  handle whitespace if  we see  it from the  other side (I'm  calling it
-handlews). Therefore if your peer  uses opportunistic the handshake should still
-start automatically once he writes something.
-
-You can  now set the  OTR policy  per peer via  the otr_policy /setting.  It's a
-comma separated  list of "<nick>@<server> <policy>"  pairs where <nick>@<server>
-is interpreted as a glob pattern, i.e. you can use wildcard "*" and joker "?" as
-you would  in a shell.  The policy  can be one  of never, manual,  handlews (the
-default),  opportunistic, and  always. Be  aware that  the opportunistic  policy
-fails with  some IRC  servers since  they strip off  the whitespace.  The always
-policy has  the nice side effect  that the first  line you type will  already be
-encrypted.
-
-If  a  fingerprint can  be  found  for someone,  i.e.  someone  you had  an  OTR
-conversation  with  before,  then  the otr_policy_known  setting  applies  after
-otr_policy. It has the same syntax. The  default is "* always", i.e. enforce OTR
-with anyone you've used OTR with before.
-
-Should you finish an OTR session via  "/otr finish" and should the active policy
-be always  or opportunistic then  it will be  temporarily set back  to handlews.
-Otherwise OTR would start again right away  which is probably not what you want.
-This is however reset once you close the query window.
-
-To make  sure that you are  actually talking to your  buddy, you can agree  on a
-secret somehow  and then one does  "/otr auth <secret>". Shortly  afterwards the
-other  one will  be  asked to  do  the  same and  you're  done. The  traditional
-alternative, comparing  fingerprints over a secure  line, can also be  used. Use
-"/otr trust" once you're sure they match.
-
-I also  strongly recommend to do  "/statusbar window add otr"  (irssi syntax) so
-you're informed about what's going on.
-
-In "<client config dir>/otr/otr.{key,fp}" you'll  find the fingerprints and your
-private keys(should you at any point be interested).
-
-Commands:
-
-/otr genkey nick at irc.server.com 
-	Manually generate a key for the given account(also done on demand)
-/otr auth [<nick>@<server>] <secret>
-	Initiate or respond to an authentication challenge
-/otr authabort [<nick>@<server>] 
-	Abort any ongoing authentication
-/otr trust [<nick>@<server>]
-	Trust the fingerprint of the user in the current window.
-	You should only do this after comparing fingerprints over a secure line
-/otr debug
-	Switch debug mode on/off
-/otr contexts
-	List all OTR contexts along with their fingerprints and status
-/otr finish [<nick>@<server>]
-	Finish an OTR conversation
-/otr version
-	Display irc-otr version. Might be a git commit
-
-Settings:
-
-otr_policy
-	Comma-separated list of "<nick>@<server> <policy>" pairs. See comments
-	above.
-otr_policy_known
-	Same syntax as otr_policy. Only applied where a fingerprint is
-	available.
-otr_ignore
-	Conversations with nicks that match this regular expression completely
-	bypass libotr. It is very unlikely that you need to touch this setting,
-	just use the OTR policy never to prevent OTR sessions with some nicks.
-otr_finishonunload
-	If true running OTR sessions are finished on /unload and /quit.
-otr_createqueries
-	If true queries are automatically created for OTR log messages.
diff --git a/README.irssi-headers b/README.irssi-headers
deleted file mode 100644
index 2d7c9d7..0000000
--- a/README.irssi-headers
+++ /dev/null
@@ -1,3 +0,0 @@
-statusbar-item.h is an irssi header;
-hence it is licensed under the same license as irssi (GPLv2).
-If you want to know why it is here, check out irssi FS#535.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..ca899d8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+irssi-otr
+=========
+
+LibOTR support for IRSSI
\ No newline at end of file
diff --git a/README.xchat b/README.xchat
deleted file mode 100644
index e55029f..0000000
--- a/README.xchat
+++ /dev/null
@@ -1,9 +0,0 @@
-The README  file is written  for irssi but what's  said there mostly  applies to
-xchat  as  well. The  only  difference  is  that  xchat doesn't  support  adding
-/settings, so in order to see and change the current settings you'll have to use
-the "/otr set" command. Without arguments  it will show the current settings and
-if supplied with  a setting name and  a value it will change  the given setting.
-There is no  persistence, i.e. each time you start  xchat the hardcoded defaults
-will be active. Please use standard xchat scripting magic to change the defaults
-to your liking on startup. It seems overkill to have a config parser/writer just
-for this plugin and it is fortunately not neccessary.
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000..ef679a1
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+ACLOCAL_FLAGS="-I /usr/local/share/aclocal"
+
+set -x
+if [ ! -e config ]; then
+	mkdir config
+fi
+
+autoreconf -i -s $ACLOCAL_FLAGS
diff --git a/cmake-extensions/COPYING-CMAKE-SCRIPTS b/cmake-extensions/COPYING-CMAKE-SCRIPTS
deleted file mode 100644
index 4b41776..0000000
--- a/cmake-extensions/COPYING-CMAKE-SCRIPTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. The name of the author may not be used to endorse or promote products 
-   derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cmake-extensions/FindLibGcrypt.cmake b/cmake-extensions/FindLibGcrypt.cmake
deleted file mode 100644
index 9e5a245..0000000
--- a/cmake-extensions/FindLibGcrypt.cmake
+++ /dev/null
@@ -1,52 +0,0 @@
-# This is from KDE SVN, I just changed LIBGCRYPT_LIBRARIES to LIBGCRYPT_LDFLAGS
-# cause that's what it is at least on my system - Uli
-
-# - Try to find the Gcrypt library
-# Once run this will define
-#
-#  LIBGCRYPT_FOUND - set if the system has the gcrypt library
-#  LIBGCRYPT_CFLAGS - the required gcrypt compilation flags
-#  LIBGCRYPT_LDFLAGS - the linker libraries needed to use the gcrypt library
-#
-# Copyright (c) 2006 Brad Hards <bradh at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-# libgcrypt is moving to pkg-config, but earlier version don't have it
-
-#search in typical paths for libgcrypt-config
-FIND_PROGRAM(LIBGCRYPTCONFIG_EXECUTABLE NAMES libgcrypt-config)
-
-#reset variables
-set(LIBGCRYPT_LDFLAGS)
-set(LIBGCRYPT_CFLAGS)
-
-# if libgcrypt-config has been found
-IF(LIBGCRYPTCONFIG_EXECUTABLE)
-
-  EXEC_PROGRAM(${LIBGCRYPTCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE LIBGCRYPT_LDFLAGS)
-
-  EXEC_PROGRAM(${LIBGCRYPTCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE LIBGCRYPT_CFLAGS)
-
-  IF(${LIBGCRYPT_CFLAGS} MATCHES "\n")
-    SET(LIBGCRYPT_CFLAGS " ")
-  ENDIF(${LIBGCRYPT_CFLAGS} MATCHES "\n")
-
-  IF(LIBGCRYPT_LDFLAGS AND LIBGCRYPT_CFLAGS)
-    SET(LIBGCRYPT_FOUND TRUE)
-  ENDIF(LIBGCRYPT_LDFLAGS AND LIBGCRYPT_CFLAGS)
-
-ENDIF(LIBGCRYPTCONFIG_EXECUTABLE)
-
-if (LIBGCRYPT_FOUND)
-   if (NOT LibGcrypt_FIND_QUIETLY)
-      message(STATUS "Found libgcrypt: ${LIBGCRYPT_LDFLAGS}")
-   endif (NOT LibGcrypt_FIND_QUIETLY)
-else (LIBGCRYPT_FOUND)
-   if (LibGcrypt_FIND_REQUIRED)
-      message(FATAL_ERROR "Could not find libgcrypt libraries")
-   endif (LibGcrypt_FIND_REQUIRED)
-endif (LIBGCRYPT_FOUND)
-
-MARK_AS_ADVANCED(LIBGCRYPT_CFLAGS LIBGCRYPT_LDFLAGS)
diff --git a/cmake-extensions/FindLibOTR.cmake b/cmake-extensions/FindLibOTR.cmake
deleted file mode 100644
index 63624c9..0000000
--- a/cmake-extensions/FindLibOTR.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-# 
-# Uli Meis <a.sporto+bee at gmail.com>
-#
-# Mostly taken from cmake findcurl, version stuff from kopete
-#
-# - Find libotr
-# Find the libotr headers and library.
-#
-#  LIBOTR_INCLUDE_DIR
-#  LIBOTR_LIBRARIES
-#  LIBOTR_FOUND
-
-# Look for the header file.
-FIND_PATH(LIBOTR_INCLUDE_DIR NAMES libotr/version.h)
-MARK_AS_ADVANCED(LIBOTR_INCLUDE_DIR)
-
-# Look for the library.
-FIND_LIBRARY(LIBOTR_LIBRARY NAMES otr)
-MARK_AS_ADVANCED(LIBOTR_LIBRARY)
-
-# Copy the results to the output variables.
-IF(LIBOTR_INCLUDE_DIR AND LIBOTR_LIBRARY)
-  SET(LIBOTR_FOUND 1)
-  SET(LIBOTR_LIBRARIES ${LIBOTR_LIBRARY})
-  SET(LIBOTR_INCLUDE_DIRS ${LIBOTR_INCLUDE_DIR})
-  EXECUTE_PROCESS(COMMAND grep "OTRL_VERSION" 
-    "${LIBOTR_INCLUDE_DIR}/libotr/version.h" OUTPUT_VARIABLE output)
-  STRING(REGEX MATCH "OTRL_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+" 
-    LIBOTR_VERSION "${output}")
-  STRING(REGEX REPLACE "^OTRL_VERSION \"" "" LIBOTR_VERSION "${LIBOTR_VERSION}")
-  MESSAGE(STATUS "  found libotr, version ${LIBOTR_VERSION}" )
-ELSE(LIBOTR_INCLUDE_DIR AND LIBOTR_LIBRARY)
-  SET(LIBOTR_FOUND 0)
-  SET(LIBOTR_LIBRARIES)
-  SET(LIBOTR_INCLUDE_DIRS)
-ENDIF(LIBOTR_INCLUDE_DIR AND LIBOTR_LIBRARY)
-
-# Report the results.
-IF(NOT LIBOTR_FOUND)
-  SET(LIBOTR_DIR_MESSAGE
-    "LIBOTR was not found. Make sure LIBOTR_LIBRARY and LIBOTR_INCLUDE_DIR are set.")
-  IF(NOT LIBOTR_FIND_QUIETLY)
-    MESSAGE(STATUS "${LIBOTR_DIR_MESSAGE}")
-  ELSE(NOT LIBOTR_FIND_QUIETLY)
-    IF(LIBOTR_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "${LIBOTR_DIR_MESSAGE}")
-    ENDIF(LIBOTR_FIND_REQUIRED)
-  ENDIF(NOT LIBOTR_FIND_QUIETLY)
-ENDIF(NOT LIBOTR_FOUND)
diff --git a/cmake-extensions/Git.cmake b/cmake-extensions/Git.cmake
deleted file mode 100644
index d731c82..0000000
--- a/cmake-extensions/Git.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Uli Meis <a.sporto+bee at gmail.com>
-#
-# Handy macro for fetching current tag or commit of a git repo.
-#
-MACRO(FIND_GIT_TAGORCOMMIT GITDIR CMAKEVAR)
-  EXECUTE_PROCESS(COMMAND bash -c 
-    "GITCOMMIT=`git log | head -n1 | cut -d' ' -f2`;\\
-     if [ -z \"$GITCOMMIT\" ]; then exit 1;fi; \\
-     GITTAG=`cd .git/refs/tags && grep $GITCOMMIT * | cut -d: -f1` ;\\
-     if [ -n \"$GITTAG\" ]; then \\
-       echo -n $GITTAG | tr -d v; else \\
-       echo -n git-$GITCOMMIT;fi"
-    WORKING_DIRECTORY ${GITDIR} 
-    OUTPUT_VARIABLE GIT_TAGORCOMMIT
-    RESULT_VARIABLE GIT_TAGORCOMMITRET)
-  IF(GIT_TAGORCOMMITRET EQUAL 0)
-    SET(${CMAKEVAR} ${GIT_TAGORCOMMIT})
-  ENDIF(GIT_TAGORCOMMITRET EQUAL 0)
-ENDMACRO(FIND_GIT_TAGORCOMMIT)
diff --git a/cmake-extensions/cscope.cmake b/cmake-extensions/cscope.cmake
deleted file mode 100644
index 59594b4..0000000
--- a/cmake-extensions/cscope.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Uli Meis <a.sporto+bee at gmail.com>
-#
-# Handy macro for generating the cscope database
-#
-
-MACRO(ADD_CSCOPE_TARGET CSCOPE_SOURCES CSCOPE_INCLUDES)
-  ADD_CUSTOM_COMMAND(
-    OUTPUT cscope.out
-    DEPENDS ${CSCOPE_SOURCES}
-    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
-    COMMAND 
-      echo '${CSCOPE_SOURCES}' | tr ' ' '\\n' >cscope.files
-    COMMAND
-      cscope -b `echo ${CSCOPE_INCLUDES} | xargs -n1 bash -c 'echo -I$$0'`)
-  ADD_CUSTOM_TARGET(cscope DEPENDS cscope.out)
-ENDMACRO(ADD_CSCOPE_TARGET)
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..f18ddea
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,80 @@
+AC_INIT([irssi-otr],[1.0.0],[dgoulet at ev0ke.net],[],[Web])
+AC_CONFIG_AUX_DIR([config])
+AC_CANONICAL_TARGET
+AC_CANONICAL_HOST
+AC_CONFIG_MACRO_DIR([config])
+AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AC_PROG_GREP
+AC_PROG_CC
+
+AM_PROG_LIBTOOL
+
+# Check for pthread
+AC_CHECK_LIB([pthread], [pthread_create], [],
+	[AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])]
+)
+
+AC_SEARCH_LIBS([otrl_init], [otr], [],
+	[AC_MSG_ERROR([Cannot find libotr. Use [LDFLAGS]=-Ldir to specify its location.])]
+)
+
+# Check for Glib. It needs to be installed anyway or this macro will not be defined.
+AM_PATH_GLIB_2_0([2.22.0], [],
+			[AC_MSG_ERROR([Glib 2.22 is required in order to compile.
+			Please install the Glib development files.])], [gmodule])
+
+AM_PATH_LIBGCRYPT(1:1.2.0,,AC_MSG_ERROR(libgcrypt 1.2.0 or newer is required.))
+
+AM_PATH_LIBOTR(4.0.0, [], [AC_MSG_ERROR([libotr 4.0.0 or newer is required.])])
+
+pkg_modules="gmodule-2.0 >= 2.0.0"
+PKG_CHECK_MODULES(GMODULE, [$pkg_modules])
+AC_SUBST(PACKAGE_LIBS)
+LIBS="$LIBS $GMODULE_LIBS"
+
+PACKAGE_CFLAGS="$GMODULE_CFLAGS -Wall -Werror=format-security"
+AC_SUBST(PACKAGE_CFLAGS)
+
+LT_INIT
+
+CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing"
+
+DEFAULT_INCLUDES="-I\$(top_srcdir) -I\$(top_builddir) -I\$(top_builddir)/src -I\$(top_builddir)/include"
+
+AC_SUBST(DEFAULT_INCLUDES)
+
+AC_CONFIG_FILES([
+	Makefile
+	src/Makefile
+])
+
+AC_OUTPUT
+
+#
+# Mini-report on what will be built
+#
+AS_ECHO()
+
+# Target architecture we're building for
+target_arch=$host_cpu
+[
+for f in $CFLAGS; do
+        if test $f = "-m32"; then
+			target_arch="32-bit"
+        elif test $f = "-m64"; then
+			target_arch="64-bit"
+        fi
+done
+]
+AS_ECHO_N("Target architecture: ")
+AS_ECHO($target_arch)
+
+# Print the bindir and libdir this `make install' will install into.
+AS_ECHO()
+AS_ECHO_N("Binaries will be installed in:  ")
+AS_ECHO("`eval eval echo $bindir`")
+AS_ECHO_N("Libraries will be installed in: ")
+AS_ECHO("`eval eval echo $libdir`")
+AS_ECHO()
diff --git a/formats.txt b/formats.txt
deleted file mode 100644
index 2afeb38..0000000
--- a/formats.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-Keys
-kg_failed	Key generation for %s: failed: %s (%s)
-kg_completed	Key generation for %s: completed in %d seconds. Reloading keys
-kg_aborted_dup	Key generation for %s: aborted. Key generation for %s still in progress
-kg_aborted_dir	Key generation for %s: aborted, failed creating directory %s: %s
-kg_mkdir	created directory %s
-kg_pipe	Key generation for %s: error creating pipe: %s
-kg_fork	Key generation for %s: fork() error: %s
-kg_initiated	Key generation for %s: initiated. This might take several minutes or on some systems even an hour. If you wanna check that something is happening, see if there are two processes of your IRC client.
-kg_exited	Key generation for %s: child terminated for unknown reason
-kg_exitsig	Key generation for %s: child was killed by signal %s
-kg_pollerr	Key generation for %s: error poll()ing child: %s
-kg_abort	Key generation for %s: aborted
-kg_needacc	I need an account name. Try something like /otr genkey mynick at irc.server.net
-kg_noabort	No ongoing key generation to abort
-key_not_found	no private keys found
-key_loaded	private keys loaded
-key_load_error	Error loading private keys: %s (%s)
-Fingerprints
-fp_saved	fingerprints saved
-fp_save_error	Error saving fingerprints: %s (%s)
-fp_not_found	no fingerprints found
-fp_loaded	fingerprints loaded
-fp_load_error	Error loading fingerprints: %s (%s)
-fp_trust	Trusting fingerprint from %s
-Instance Tags
-instag_saved	instance tags saved
-instag_save_error	Error saving instance tags: %s (%s)
-instag_not_found	no instance tags found
-instag_loaded	instance tags loaded
-instag_load_error	Error loading instance tags: %s (%s)
-Callbacks
-ops_notify_bug	BUG() in ops_notify
-ops_notify	title: %s prim: %s sec: %s
-ops_display_bug	BUG() in ops_display
-ops_display	msg: %s
-ops_sec	gone %%9secure%%9
-ops_fpcomp	Your peer is not authenticated. To make sure you're talking to the right guy you can either agree on a secret and use the authentication described in %9/otr auth%9, or use the traditional way and compare fingerprints over a secure line (e.g. telephone) and subsequently enter %9/otr trust%9.  Your fingerprint is: %s. %s's fingerprint: %s
-ops_insec	gone %9insecure%9
-ops_still_reply	still %%9secure%9 (is reply)
-ops_still_no_reply	still %%9secure%9 (is not reply)
-ops_log	log msg: %s
-ops_inject	Couldn't inject message from %s for %s: %s
-ops_handle_msg	Message event %s, msg %s
-SendingReceiving
-send_failed	send failed: msg=%s
-send_change	couldn't find context also OTR changed the outgoing message(BUG?)
-send_fragment	failed to fragment message: msg=%s
-send_converted	OTR converted sent message to %s
-receive_ignore_query	ignoring rest of OTR default query msg
-receive_dequeued	dequeued msg of length %d
-receive_queued	queued msg of length %d
-receive_ignore	ignoring protocol message of length %d, acc=%s, from=%s: %s
-receive_converted	OTR converted received message
-otr_better_two	<b>%s</b> has requested an <a href=\"http://otr.cypherpunks.ca/\">Off-the-Record private conversation</a>.  However, you do not have a plugin to support that.
-otr_better_three	See <a href=\"http://otr.cypherpunks.ca/\">http://otr.cypherpunks.ca/</a> for more information.
-Context
-ctx_not_found	couldn't find context: acc=%s nick=%s
-ctx_not_create	couldn't create/find context: acc=%s from=%s
-Authentication
-auth_aborted_ongoing	Ongoing authentication aborted
-auth_aborted	Authentication aborted
-auth_responding	Responding to authentication request...
-auth_initiated	Initiated authentication...
-auth_have_old	%s wanted to authenticate but an old authentication was still ongoing.  Old authentication will be aborted, please try again.
-auth_peer	%s wants to authenticate. Type /otr auth <your-shared-secret> to complete.
-auth_peer_qa	%s wants to authenticate and asked you \"%s\". Type /otr auth <answer> to complete.
-auth_peer_reply_wrong	%s replied to an auth we didn't start.
-auth_peer_replied	%s replied to our auth request...
-auth_peer_wrong_smp3	%s sent a wrong authentication message (SMP3).
-auth_peer_wrong_smp4	%s sent a wrong authentication message (SMP4).
-auth_successful	Authentication successful!
-auth_failed	Authentication failed!
-auth_needenc	You need to establish an OTR session before you can authenticate.
-Commands
-cmd_otr	We're alive
-cmd_qnotfound	Failed: Can't get nick and server of current query window. (Or maybe you're doing this in the status window?)
-cmd_auth	Please agree on a secret with your peer and then initiate the authentication with /otr auth <secret> or let him initiate. Should you initiate your peer will after a little while be instructed to enter the secret as well. Once he has done so the authentication will finish up. Should you have both typed in the same secret the authentication should be successful.
-cmd_debug_on	Debug mode is on
-cmd_debug_off	Debug mode is off
-cmd_finish	Finished conversation with %s@%s.
-cmd_finishall_none	No conversations to finish.
-cmd_version	This is irc-otr version %s
-peer_finished	%s has finished the OTR conversation. If you want to continue talking enter %9/otr finish%9 for plaintext or ?OTR? to restart OTR.
-Contexts
-ctx_ctx_unencrypted	%%9%20s%%9    %30s    plaintext
-ctx_ctx_encrypted	%%9%20s%%9    %30s    %gencrypted%n
-ctx_ctx_finished	%%9%20s%%9    %30s    finished
-ctx_ctx_unknown	%%9%20s%%9    %30s    unknown state(BUG?)
-ctx_fps_no	%s %rnot authenticated%n
-ctx_fps_smp	%s %gauthenticated%n via shared secret (SMP)
-ctx_fps_man	%s %gauthenticated%n manually
-ctx_noctxs	No active OTR contexts found
-Statusbar
-st_plaintext	{sb plaintext}
-st_untrusted	{sb %rOTR(not auth'ed)%n}
-st_trust_smp	{sb %gOTR%n}
-st_trust_manual	{sb %gOTR%n}
-st_smp_incoming	{sb {hilight incoming auth request...}}
-st_smp_outgoing	{sb {hilight awaiting auth reply...}}
-st_smp_finalize	{sb {hilight finalizing auth...}}
-st_smp_unknown	{sb {hilight unknown auth state!}}
-st_finished	{sb finished}
-st_unknown	{sb {hilight state unknown (BUG!)}}
diff --git a/io-config.h.in b/io-config.h.in
deleted file mode 100644
index d3cc4e8..0000000
--- a/io-config.h.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#cmakedefine HAVE_STRSIGNAL
-#cmakedefine HAVE_GREGEX_H
-#cmakedefine LIBOTR3
-#define IRCOTR_VERSION "${IRCOTR_VERSION}"
diff --git a/io_set.c b/io_set.c
deleted file mode 100644
index 93e5413..0000000
--- a/io_set.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2009  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "otr.h"
-
-#ifdef HAVE_GREGEX_H
-extern GRegex *regex_nickignore;
-#endif
-
-char set_policy[512] = IO_DEFAULT_POLICY;
-char set_policy_known[512] = IO_DEFAULT_POLICY_KNOWN;
-char set_ignore[512] = IO_DEFAULT_IGNORE;
-int set_finishonunload = TRUE;
-
-void cmd_set(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-	     char *argv_eol[],
-	     char *target)
-{
-	char *setting, *value;
-
-	if (argc) {
-		setting = argv[0];
-		value = argv[1] ? : "";
-	}
-
-	if (!argc) {
-		otr_logst(MSGLEVEL_CRAP, "policy: %s\n"
-			  "policy_known: %s\nignore: %s\n"
-			  "finishonunload: %s\n",
-			  set_policy, set_policy_known, set_ignore,
-			  set_finishonunload ? "true" : "false");
-	} else if (strcmp(setting, "policy") == 0) {
-		otr_setpolicies(ioustate, value, FALSE);
-		strcpy(set_policy, value);
-	} else if (strcmp(setting, "policy_known") == 0) {
-		otr_setpolicies(ioustate, value, TRUE);
-		strcpy(set_policy_known, value);
-	} else if (strcmp(setting, "ignore") == 0) {
-#ifdef HAVE_GREGEX_H
-		if (regex_nickignore)
-			g_regex_unref(regex_nickignore);
-		regex_nickignore = g_regex_new(value, 0, 0, NULL);
-		strcpy(set_ignore, value);
-#endif
-	} else if (strcmp(setting, "finishonunload") == 0) {
-		set_finishonunload = (strcasecmp(value, "true") == 0);
-	}
-}
diff --git a/io_util.c b/io_util.c
deleted file mode 100644
index 4d1c71b..0000000
--- a/io_util.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2008  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "otr.h"
-
-char *otr_status_txt[] = {
-	"FINISHED",
-	"TRUST_MANUAL",
-	"TRUST_SMP",
-	"SMP_ABORT",
-	"SMP_STARTED",
-	"SMP_RESPONDED",
-	"SMP_INCOMING",
-	"SMP_FINALIZE",
-	"SMP_ABORTED",
-	"PEER_FINISHED",
-	"SMP_FAILED",
-	"SMP_SUCCESS",
-	"GONE_SECURE",
-	"GONE_INSECURE",
-	"CTX_UPDATE"
-};
-
-char *otr_msg_event_txt[] = {
-	"NONE",
-	"ENCRYPTION_REQUIRED",
-	"ENCRYPTION_ERROR",
-	"CONNECTION_ENDED",
-	"SETUP_ERROR",
-	"MSG_REFLECTED",
-	"MSG_RESENT",
-	"RCVDMSG_NOT_IN_PRIVATE",
-	"RCVDMSG_UNREADABLE",
-	"RCVDMSG_MALFORMED",
-	"LOG_HEARTBEAT_RCVD",
-	"LOG_HEARTBEAT_SENT",
-	"RCVDMSG_GENERAL_ERR",
-	"RCVDMSG_UNENCRYPTED",
-	"RCVDMSG_UNRECOGNIZED",
-	"RCVDMSG_FOR_OTHER_INSTANCE"
-};
-
-int extract_nick(char *nick, char *line)
-{
-	char *excl;
-
-	if (*line++ != ':')
-		return FALSE;
-
-	strcpy(nick, line);
-
-	if ((excl = strchr(nick, '!')))
-		*excl = '\0';
-
-	return TRUE;
-}
-
-int cmd_generic(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-		char *argv_eol[],
-		char *target)
-{
-	char *cmd;
-	struct _cmds *commands = cmds;
-
-	if (!argc) {
-		otr_noticest(TXT_CMD_OTR);
-		return TRUE;
-	}
-
-	cmd = argv[0];
-
-	argv++;
-	argv_eol++;
-	argc--;
-
-	do {
-		if (strcmp(commands->name, cmd) == 0) {
-			commands->cmdfunc(ioustate, ircctx, argc, argv,
-					  argv_eol,
-					  target);
-			return TRUE;
-		}
-	} while ((++commands)->name);
-
-	return FALSE;
-}
-
-void cmd_debug(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-	       char *argv_eol[],
-	       char *target)
-{
-	debug = !debug;
-	otr_noticest(debug ? TXT_CMD_DEBUG_ON : TXT_CMD_DEBUG_OFF);
-}
-
-void cmd_version(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-		 char *argv_eol[],
-		 char *target)
-{
-	otr_noticest(TXT_CMD_VERSION, IRCOTR_VERSION);
-}
-
-void cmd_help(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-	      char *argv_eol[],
-	      char *target)
-{
-	otr_log(ircctx, target, MSGLEVEL_CRAP, otr_help);
-}
-
-void cmd_finish(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-		char *argv_eol[],
-		char *target)
-{
-	if (argc)
-		otr_finish(NULL, NULL, argv[0], TRUE);
-	else if (ircctx && target)
-		otr_finish(ircctx, target, NULL, TRUE);
-	else
-		otr_noticest(TXT_CMD_QNOTFOUND);
-}
-
-void cmd_trust(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-	       char *argv_eol[],
-	       char *target)
-{
-	if (argc)
-		otr_trust(NULL, NULL, argv[0]);
-	else if (ircctx && target)
-		otr_trust(ircctx, target, NULL);
-	else
-		otr_noticest(TXT_CMD_QNOTFOUND);
-}
-
-void cmd_authabort(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc,
-		   char *argv[], char *argv_eol[],
-		   char *target)
-{
-	if (argc)
-		otr_authabort(NULL, NULL, argv[0]);
-	else if (ircctx && target)
-		otr_authabort(ircctx, target, NULL);
-	else
-		otr_noticest(TXT_CMD_QNOTFOUND);
-}
-
-void cmd_genkey(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-		char *argv_eol[],
-		char *target)
-{
-	if (argc) {
-		if (strcmp(argv[0], "abort") == 0)
-			keygen_abort(ioustate, FALSE);
-		else if (strchr(argv[0], '@'))
-			keygen_run(ioustate, argv[0]);
-		else
-			otr_noticest(TXT_KG_NEEDACC);
-	} else {
-		otr_noticest(TXT_KG_NEEDACC);
-	}
-}
-
-void _cmd_auth(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-	       char *argv_eol[],
-	       char *target,
-	       int qanda)
-{
-	char *accountname = NULL;
-	char *question = NULL;
-	char *secret;
-
-	/* have args? */
-	if (argc < (qanda ? 2 : 1)) {
-		otr_notice(ircctx, target,
-			   TXT_CMD_AUTH);
-		return;
-	}
-
-	/* have buddy? */
-	if (!(ircctx && target)) {
-		accountname = strchr(argv[0], '@');
-		if (!accountname) {
-			otr_noticest(TXT_CMD_QNOTFOUND);
-			return;
-		}
-		ircctx = NULL;
-		target = NULL;
-		argv++; argv_eol++; argc--;
-	}
-
-	/* have question? */
-	if (qanda) {
-		question = argv[0];
-		argv++; argv_eol++; argc--;
-	}
-
-	secret = argv_eol[0];
-
-	otr_auth(ircctx, target, accountname, question, secret);
-}
-
-void cmd_authq(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-	       char *argv_eol[],
-	       char *target)
-{
-	_cmd_auth(ioustate, ircctx, argc, argv, argv_eol, target, TRUE);
-}
-
-void cmd_auth(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-	      char *argv_eol[],
-	      char *target)
-{
-	_cmd_auth(ioustate, ircctx, argc, argv, argv_eol, target, FALSE);
-}
-
-/*
- * /otr contexts
- */
-void cmd_contexts(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-		  char *argv_eol[],
-		  char *target)
-{
-	struct ctxlist_ *ctxlist = otr_contexts(ioustate), *ctxnext = ctxlist;
-	struct fplist_ *fplist, *fpnext;
-
-	if (!ctxlist)
-		otr_infost(TXT_CTX_NOCTXS);
-
-	while (ctxlist) {
-		otr_infost(TXT_CTX_CTX_UNENCRYPTED + ctxlist->state,
-			   ctxlist->username,
-			   ctxlist->accountname);
-
-		fplist = ctxlist->fplist;
-		while (fplist) {
-			otr_infost(TXT_CTX_FPS_NO + fplist->authby,
-				   fplist->fp);
-			fplist = fplist->next;
-		}
-		ctxlist = ctxlist->next;
-	}
-	while ((ctxlist = ctxnext)) {
-		ctxnext = ctxlist->next;
-		fpnext = ctxlist->fplist;
-		while ((fplist = fpnext)) {
-			fpnext = fplist->next;
-			g_free(fplist->fp);
-			g_free(fplist);
-		}
-		g_free(ctxlist);
-	}
-}
-
-struct _cmds cmds[] = {
-	{ "version", cmd_version },
-	{ "debug", cmd_debug },
-	{ "help", cmd_help },
-	{ "finish", cmd_finish },
-	{ "trust", cmd_trust },
-	{ "authabort", cmd_authabort },
-	{ "auth", cmd_auth },
-#ifndef LIBOTR3
-	{ "authq", cmd_authq },
-#endif
-	{ "genkey", cmd_genkey },
-	{ "contexts", cmd_contexts },
-	{ NULL, NULL },
-	{ NULL, NULL }
-};
-
-void io_explode_args(const char *args, char ***argvp, char ***argv_eolp,
-		     int *argcp)
-{
-	char **argv, **argv_eol;
-	char *s = (char*)args;
-	int argc = 1, i;
-
-	while ((s = strchr(s + 1, ' ')))
-		argc++;
-
-	argv = (char**)malloc(sizeof(char *) * argc);
-	argv_eol = (char**)malloc(sizeof(char *) * argc);
-
-	s = (char*)args;
-	argv_eol[0] = strdup(args);
-	i = 0;
-	while (++i < argc)
-		argv_eol[i] = strchr(argv_eol[i - 1], ' ') + 1;
-
-	argv[0] = strtok(strdup(args), " ");
-	i = 1;
-	while (i < argc) {
-		argv[i++] = strtok(NULL, " ");
-		otr_logst(MSGLEVEL_CRAP, "arg %d: %s", i, argv[i - 1]);
-	}
-
-	*argvp = argv;
-	*argv_eolp = argv_eol;
-	*argcp = argc;
-}
-
-/*
- * Get a format describing the OTR status of this conversation.
- */
-int otr_getstatus_format(IRC_CTX *ircctx, const char *nick)
-{
-	int status = otr_getstatus(ircctx, nick);
-
-	if (status & (IO_ST_SMP_ONGOING)) {
-		/* we don't care about the trust level in that case */
-		status = status & IO_ST_SMP_ONGOING;
-	}
-
-	switch (status) {
-	case IO_ST_PLAINTEXT:
-		return TXT_ST_PLAINTEXT;
-	case IO_ST_FINISHED:
-		return TXT_ST_FINISHED;
-	case IO_ST_UNTRUSTED:
-		return TXT_ST_UNTRUSTED;
-	case IO_ST_SMP_INCOMING:
-		return TXT_ST_SMP_INCOMING;
-	case IO_ST_SMP_OUTGOING:
-		return TXT_ST_SMP_OUTGOING;
-	case IO_ST_SMP_FINALIZE:
-		return TXT_ST_SMP_FINALIZE;
-	case IO_ST_TRUST_MANUAL:
-		return TXT_ST_TRUST_MANUAL;
-	case IO_ST_TRUST_SMP:
-		return TXT_ST_TRUST_SMP;
-	default:
-		return TXT_ST_SMP_UNKNOWN;
-	}
-}
diff --git a/irssi/CMakeLists.txt b/irssi/CMakeLists.txt
deleted file mode 100644
index b630df7..0000000
--- a/irssi/CMakeLists.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-IF(NOT IRSSI_INCLUDE_DIR)
-  MESSAGE(FATAL_ERROR "*** no irssi found. If you don't want this plugin set the
-  appropriate option to OFF, use for instance 'ccmake .' ***")
-ENDIF(NOT IRSSI_INCLUDE_DIR)
-
-MESSAGE(STATUS "*** building for irssi ***")
-
-SET(IRSSIOTR_INCLUDE_DIRS
-  ${IRSSI_INCLUDE_DIR}/irssi
-  ${IRSSI_INCLUDE_DIR}/irssi/src
-  ${IRSSI_INCLUDE_DIR}/irssi/src/core
-  ${PROJECT_BINARY_DIR}/irssi-headers
-  ${PROJECT_SOURCE_DIR}/irssi-headers
-  ${PROJECT_SOURCE_DIR}/irssi)
-
-INCLUDE_DIRECTORIES(${IRSSIOTR_INCLUDE_DIRS})
-
-SET(CMAKE_REQUIRED_INCLUDES ${IRCOTR_INCLUDE_DIRS} ${IRSSIOTR_INCLUDE_DIRS})
-
-# irssi statusbar header
-
-CHECK_INCLUDE_FILES("glib.h;common.h;fe-text/statusbar-item.h" HAVE_IRSSISBAR_H)
-
-# Bad hack
-
-IF (NOT HAVE_IRSSISBAR_H)
-  MESSAGE(STATUS "Need to fetch irssi header statusbar-item.h (you don't have it yet)")
-  IF (NOT WGET_EXECUTABLE)
-    FIND_PACKAGE(Wget REQUIRED)
-  ENDIF (NOT WGET_EXECUTABLE)
-  EXECUTE_PROCESS(COMMAND "mkdir" -p irssi-headers/fe-text)
-  EXECUTE_PROCESS(COMMAND "bash" "-c"
-    "${WGET_EXECUTABLE} '--post-data=revision=4936&root=irssi' \\
-    'http://svn.irssi.org/cgi-bin/viewvc.cgi/irssi/trunk/src/fe-text/statusbar-item.h' || exit 1"
-    ${PROJECT_SOURCE_DIR} WORKING_DIRECTORY irssi-headers/fe-text
-    RESULT_VARIABLE IISBAR_RET)
-  IF(NOT IISBAR_RET EQUAL 0)
-    MESSAGE(FATAL_ERROR_ERROR "Couldn't check out irssi headers from SVN")
-  ENDIF(NOT IISBAR_RET EQUAL 0)
-  SET(HAVE_IRSSISBAR_H 1 CACHE INTERNAL "Having irssi headers" FORCE)
-ENDIF (NOT HAVE_IRSSISBAR_H)
-
-ADD_LIBRARY(irssiotr SHARED irssi_otr.c ../otr_util.c ../otr_ops.c ../otr_key.c ../io_util.c ${CMAKE_BINARY_DIR}/otr-formats.c)
-TARGET_LINK_LIBRARIES(irssiotr ${GLIB_LIBRARIES} ${LIBOTR_LIBRARIES})
-SET_TARGET_PROPERTIES(irssiotr PROPERTIES 
-  COMPILE_FLAGS -DTARGET_IRSSI
-  OUTPUT_NAME "otr"
-  LINK_FLAGS "${MAIN_LDFLAGS}")
-
-add_dependencies(irssiotr otrformats)
-set_source_files_properties(${CMAKE_BINARY_DIR}/otr-formats.c PROPERTIES GENERATED TRUE)
-
-IF(APPLE)
-  SET_TARGET_PROPERTIES(irssiotr PROPERTIES SUFFIX ".so")
-ENDIF(APPLE)
-
-# docdir
-
-IF(NOT DOCDIR)
-  SET(DOCDIR share/doc/irssi-otr)
-ENDIF(NOT DOCDIR)
-
-IF(CMAKE_INSTALL_TYPE MATCHES "home")
-  INSTALL(TARGETS irssiotr DESTINATION "$ENV{HOME}/.irssi/modules")
-ELSE(CMAKE_INSTALL_TYPE MATCHES "home")
-  INSTALL(TARGETS irssiotr DESTINATION lib${LIB_SUFFIX}/irssi/modules)
-  INSTALL(FILES README LICENSE DESTINATION ${DOCDIR})
-ENDIF(CMAKE_INSTALL_TYPE MATCHES "home")
diff --git a/irssi/irssi_otr.c b/irssi/irssi_otr.c
deleted file mode 100644
index f6be919..0000000
--- a/irssi/irssi_otr.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) module for the irssi IRC client
- *
- * Copyright (C) 2008  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "otr.h"
-
-int debug = FALSE;
-
-static const char *signal_args_otr_event[] = {
-	"iobject", "string", "string", "NULL"
-};
-
-static const char *lvlstring[] = {
-	"NOTICE", "DEBUG",
-};
-
-static IOUSTATE *ioustate;
-
-#ifdef HAVE_GREGEX_H
-/* Define in io_set.c as extern */
-GRegex *regex_nickignore = NULL;
-#endif
-
-/*
- * Need this to decode arguments in perl signal handlers. Maybe irssi should
- * install perl/perl-signals.h which is where this definition comes from?
- */
-void perl_signal_register(const char *signal, const char **args);
-
-/*
- * Pipes all outgoing private messages through OTR
- */
-static void sig_server_sendmsg(SERVER_REC *server, const char *target,
-			       const char *msg, void *target_type_p)
-{
-	if (GPOINTER_TO_INT(target_type_p) == SEND_TARGET_NICK) {
-		char *otrmsg;
-
-#ifdef HAVE_GREGEX_H
-		if (g_regex_match(regex_nickignore, target, 0, NULL))
-			return;
-#endif
-		otrmsg = otr_send(server, msg, target);
-		if (otrmsg && (otrmsg != msg)) {
-			signal_continue(4, server, target, otrmsg,
-					target_type_p);
-			otrl_message_free(otrmsg);
-		} else if (!otrmsg)
-			signal_stop();
-	}
-}
-
-/*
- * Pipes all incoming private messages through OTR
- */
-static void sig_message_private(SERVER_REC *server, const char *msg,
-				const char *nick, const char *address)
-{
-	char *newmsg;
-
-#ifdef HAVE_GREGEX_H
-	if (g_regex_match(regex_nickignore, nick, 0, NULL))
-		return;
-#endif
-
-	newmsg = otr_receive(server, msg, nick);
-
-	if (newmsg && (newmsg != msg)) {
-		if (g_str_has_prefix(newmsg, IRCACTIONMARK)) {
-			signal_stop();
-			signal_emit("message irc action",
-				    5,
-				    server,
-				    newmsg + IRCACTIONMARKLEN,
-				    nick,
-				    address,
-				    nick);
-		} else {
-			signal_continue(4, server, newmsg, nick, address);
-		}
-		otrl_message_free(newmsg);
-	} else if (newmsg == NULL)
-		signal_stop();
-}
-
-static void cmd_me(const char *data, IRC_SERVER_REC *server,
-		   WI_ITEM_REC *item)
-{
-	QUERY_REC *query = QUERY(item);
-	const char *target;
-	char *otrmsg, *msg;
-	int unchanged;
-
-	if (!query || !query->server)
-		return;
-
-	CMD_IRC_SERVER(server);
-	if (!IS_IRC_QUERY(item))
-		return;
-
-	if (server == NULL || !server->connected)
-		cmd_return_error(CMDERR_NOT_CONNECTED);
-
-	target = window_item_get_target(item);
-
-#ifdef HAVE_GREGEX_H
-	if (g_regex_match(regex_nickignore, target, 0, NULL))
-		return;
-#endif
-
-	/*
-	 * Since we can't track the message anymore once it's encrypted, mark it
-	 * as
-	 * a /me inline.
-	 */
-	msg = g_strconcat(IRCACTIONMARK, data, NULL);
-
-	otrmsg = otr_send(query->server, msg, target);
-
-	unchanged = otrmsg == msg;
-	g_free(msg);
-
-	if (unchanged)
-		return;
-
-	signal_stop();
-
-	if (otrmsg) {
-		irc_send_message(SERVER(server), target, otrmsg);
-		otrl_message_free(otrmsg);
-	}
-
-	signal_emit("message irc own_action", 3, server, data,
-		    item->visible_name);
-}
-
-
-/*
- * Finish an OTR conversation when its query is closed.
- */
-static void sig_query_destroyed(QUERY_REC *query)
-{
-	if (query && query->server && query->server->connrec) {
-		otr_finish(query->server, query->name, NULL, FALSE);
-	}
-}
-
-/*
- * Irssi command /otr <arg>...
- */
-static void cmd_otr(const char *data, void *server, WI_ITEM_REC *item)
-{
-	char **argv, **argv_eol;
-	int argc;
-	QUERY_REC *query = QUERY(item);
-
-	if (*data == '\0') {
-		otr_noticest(TXT_CMD_OTR);
-		return;
-	}
-
-	io_explode_args(data, &argv, &argv_eol, &argc);
-
-	if (query && query->server && query->server->connrec) {
-		cmd_generic(ioustate, query->server, argc, argv, argv_eol,
-			    query->name);
-	} else {
-		cmd_generic(ioustate, NULL, argc, argv, argv_eol, NULL);
-	}
-
-	statusbar_items_redraw("otr");
-
-	g_free(argv_eol[0]);
-	g_free(argv_eol);
-	g_free(argv);
-}
-
-/*
- * Optionally finish conversations on /quit. We're already doing this on unload
- * but the quit handler terminates irc connections before unloading.
- */
-static void cmd_quit(const char *data, void *server, WI_ITEM_REC *item)
-{
-	if (settings_get_bool("otr_finishonunload"))
-		otr_finishall(ioustate);
-}
-
-/*
- * otr statusbar
- */
-static void otr_statusbar(struct SBAR_ITEM_REC *item, int get_size_only)
-{
-	WI_ITEM_REC *wi = active_win->active;
-	QUERY_REC *query = QUERY(wi);
-	int formatnum = 0;
-
-	if (query && query->server && query->server->connrec)
-		formatnum = otr_getstatus_format(query->server, query->name);
-
-	statusbar_item_default_handler(
-		item, get_size_only,
-		formatnum ? formats[formatnum].def :
-		"", " ", FALSE);
-}
-
-static void read_settings(void)
-{
-	otr_setpolicies(ioustate, settings_get_str("otr_policy"), FALSE);
-	otr_setpolicies(ioustate, settings_get_str("otr_policy_known"), TRUE);
-#ifdef HAVE_GREGEX_H
-	if (regex_nickignore)
-		g_regex_unref(regex_nickignore);
-	regex_nickignore = g_regex_new(settings_get_str(
-					       "otr_ignore"), 0, 0, NULL);
-#endif
-}
-
-void irc_send_message(IRC_CTX *ircctx, const char *recipient, char *msg)
-{
-	ircctx->send_message(ircctx, recipient, msg,
-			     GPOINTER_TO_INT(SEND_TARGET_NICK));
-}
-
-void otr_status_change(IRC_CTX *ircctx, const char *nick, int event)
-{
-	statusbar_items_redraw("otr");
-	signal_emit("otr event", 3, ircctx, nick, otr_status_txt[event]);
-}
-
-IRC_CTX *ircctx_by_peername(const char *peername, char *nick)
-{
-	GSList *tmp;
-	char pname[256];
-	char *address;
-
-	strcpy(pname, peername);
-
-	address = strchr(pname, '@');
-	if (!address)
-		return NULL;
-
-	*address = '\0';
-	strcpy(nick, pname);
-	*address++ = '@';
-
-	for (tmp = servers; tmp != NULL; tmp = tmp->next) {
-		SERVER_REC *server = tmp->data;
-
-		if (g_strcasecmp(server->connrec->address, address) == 0)
-			return server;
-	}
-
-	return NULL;
-}
-
-void otr_query_create(SERVER_REC *server, const char *nick)
-{
-	if (!server || !nick || !settings_get_bool("otr_createqueries")
-	    || query_find(server, nick))
-		return;
-
-	irc_query_create(server->tag, nick, TRUE);
-}
-
-void otr_log(IRC_CTX *server, const char *nick, int level,
-	     const char *format, ...)
-{
-	va_list params;
-	va_start(params, format);
-	char msg[LOGMAX], *s = msg;
-
-	if ((level == LVL_DEBUG) && !debug)
-		return;
-
-	s += sprintf(s, "%s", "%9OTR%9");
-
-	if (level != LVL_NOTICE)
-		s += sprintf(s, "(%s)", lvlstring[level]);
-
-	s += sprintf(s, ": ");
-
-	if (vsnprintf(s, LOGMAX, format, params) < 0)
-		sprintf(s, "internal error parsing error string (BUG)");
-
-	va_end(params);
-
-	printtext(server, nick, MSGLEVEL_MSGS, msg);
-}
-
-/*
- * irssi init()
- */
-void otr_init(void)
-{
-	module_register(MODULE_NAME, "core");
-
-	theme_register(formats);
-
-	if (otrlib_init())
-		return;
-
-	ioustate = otr_init_user("one to rule them all");
-
-	signal_add_first("server sendmsg", (SIGNAL_FUNC)sig_server_sendmsg);
-	signal_add_first("message private", (SIGNAL_FUNC)sig_message_private);
-	command_bind_irc_first("me", NULL, (SIGNAL_FUNC)cmd_me);
-	signal_add("query destroyed", (SIGNAL_FUNC)sig_query_destroyed);
-
-	command_bind("otr", NULL, (SIGNAL_FUNC)cmd_otr);
-
-	command_bind_first("quit", NULL, (SIGNAL_FUNC)cmd_quit);
-
-	settings_add_str("otr", "otr_policy", IO_DEFAULT_POLICY);
-	settings_add_str("otr", "otr_policy_known", IO_DEFAULT_POLICY_KNOWN);
-	settings_add_str("otr", "otr_ignore", IO_DEFAULT_IGNORE);
-	settings_add_bool("otr", "otr_finishonunload", TRUE);
-	settings_add_bool("otr", "otr_createqueries", TRUE);
-	read_settings();
-	signal_add("setup changed", (SIGNAL_FUNC)read_settings);
-
-	statusbar_item_register("otr", NULL, otr_statusbar);
-
-	statusbar_items_redraw("window");
-
-	perl_signal_register("otr event", signal_args_otr_event);
-}
-
-/*
- * irssi deinit()
- */
-void otr_deinit(void)
-{
-#ifdef HAVE_GREGEX_H
-	g_regex_unref(regex_nickignore);
-#endif
-
-	signal_remove("server sendmsg", (SIGNAL_FUNC)sig_server_sendmsg);
-	signal_remove("message private", (SIGNAL_FUNC)sig_message_private);
-	command_unbind("me", (SIGNAL_FUNC)cmd_me);
-	signal_remove("query destroyed", (SIGNAL_FUNC)sig_query_destroyed);
-
-	command_unbind("otr", (SIGNAL_FUNC)cmd_otr);
-
-	command_unbind("quit", (SIGNAL_FUNC)cmd_quit);
-
-	signal_remove("setup changed", (SIGNAL_FUNC)read_settings);
-
-	statusbar_item_unregister("otr");
-
-	if (settings_get_bool("otr_finishonunload"))
-		otr_finishall(ioustate);
-
-	otr_deinit_user(ioustate);
-
-	otrlib_deinit();
-
-	theme_unregister();
-}
diff --git a/irssi/irssi_otr.h b/irssi/irssi_otr.h
deleted file mode 100644
index 3eb0d28..0000000
--- a/irssi/irssi_otr.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) module for the irssi IRC client
- *
- * Copyright (C) 2008  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#ifndef IRSSI_OTR_H
-#define IRSSI_OTR_H
-
-#include <common.h>
-#include <core/commands.h>
-#include <core/modules.h>
-#include <core/servers.h>
-#include <core/signals.h>
-#include <core/levels.h>
-#include <core/queries.h>
-#include <fe-common/core/printtext.h>
-#include <fe-common/core/fe-windows.h>
-#include <fe-common/core/module-formats.h>
-#include <core/modules.h>
-#include <core/settings.h>
-#include <irc/core/irc.h>
-#include <irc/core/irc-queries.h>
-#include <irc/core/irc-servers.h>
-#include <irc/core/irc-commands.h>
-
-#include <fe-text/statusbar-item.h>
-
-#define IRC_CTX SERVER_REC
-
-#define get_client_config_dir get_irssi_dir
-
-#define IRCCTX_ADDR(ircctx) ircctx->connrec->address
-#define IRCCTX_NICK(ircctx) ircctx->nick
-#define IRCCTX_ACCNAME(accname, ircctx) sprintf(accname, "%s@%s", \
-						ircctx->nick, \
-						ircctx->connrec->address)
-#define IRCCTX_IO_US(ircctx) (&ioustate_uniq)
-#define IO_CREATE_US(user) (&ioustate_uniq)
-
-#define otr_noticest(formatnum, ...) \
-	printformat(NULL, NULL, MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__)
-
-#define otr_notice(ircctx, nick, formatnum, ...) { \
-		otr_query_create(ircctx, nick);	\
-		printformat(ircctx, nick, MSGLEVEL_MSGS, formatnum, \
-			    ## __VA_ARGS__); }
-
-#define otr_infost(formatnum, ...) \
-	printformat(NULL, NULL, MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
-
-#define otr_info(server, nick, formatnum, ...) { \
-		otr_query_create(ircctx, nick);	\
-		printformat(ircctx, nick, MSGLEVEL_CRAP, formatnum, \
-			    ## __VA_ARGS__); }
-
-#define otr_debug(ircctx, nick, formatnum, ...) { \
-		if (debug) { \
-			otr_query_create(ircctx, nick);	\
-			printformat(ircctx, nick, MSGLEVEL_MSGS, formatnum, \
-				    ## __VA_ARGS__); } }
-
-static inline IRC_CTX *IRCCTX_DUP(IRC_CTX *ircctx)
-{
-	server_ref(ircctx);
-	return ircctx;
-}
-
-static inline IRC_CTX *IRCCTX_FREE(IRC_CTX *ircctx)
-{
-	server_unref(ircctx);
-	return ircctx;
-}
-
-void otr_query_create(IRC_CTX *ircctx, const char *nick);
-
-#endif /* IRSSI_OTR_H */
diff --git a/makeformats.py b/makeformats.py
deleted file mode 100755
index 40a8706..0000000
--- a/makeformats.py
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/python
-#
-# Uli Meis <a.sporto+bee at gmail.com>
-#
-# Just a short script to generate our FORMAT_REC
-#
-
-import sys,os,re
-
-lines = map(lambda x: x.strip(),open(sys.argv[1],"r").readlines())
-
-hdr = open("otr-formats.h","w")
-src = open("otr-formats.c","w")
-srcx = open("xchat-formats.c","w")
-
-src.write('#include "otr.h"\n');
-srcx.write('#include "otr.h"\n');
-
-src.write("""char *otr_help = "%s";\n""" % "\\n".join(
-	["%9- OTR help -%9"]+
-	[re.sub('^(/otr.*)$','%_\\1%_',
-		re.sub('^(otr_[a-z_]*)$','%_\\1%_',
-			re.sub('"([^"]*)"','\\"%_\\1%_\\"',
-				x.replace('\n','').replace("\t","        ") 
-				)))
-		for x in open(sys.argv[2],"r").readlines()]
-	+["%9- End of OTR help -%9"]
-	))
-
-srcx.write("""char *otr_help = "%s";\n""" % "\\n".join(
-	["- OTR help -"]+
-	[re.sub('"([^"]*)"','\\"\\1\\"',
-		x.replace('\n','').replace("\t","        ") )
-		for x in open(sys.argv[2],"r").readlines()]
-	+["- End of OTR help -"]
-	))
-
-src.write('FORMAT_REC formats[] = {\n')
-srcx.write('FORMAT_REC formats[] = {\n')
-
-src.write('{ MODULE_NAME, "otr", 0}\n')
-srcx.write('{ MODULE_NAME, "otr", 0}\n')
-
-hdr.write("extern char *otr_help;\n\n");
-
-hdr.write("enum {\n")
-
-hdr.write("TXT_OTR_MODULE_NAME")
-
-fills = 0
-
-section = None
-
-for line in lines:
-	src.write(",\n")
-	srcx.write(",\n")
-
-	e = line.split("\t")
-
-	if len(e)==1:
-		# Section name
-		section = e[0]
-		src.write("""{ NULL, "%s", 0 }\n""" % (e[0]))
-		srcx.write("""{ NULL, "%s", 0 }\n""" % (e[0]))
-
-		hdr.write(",\nTXT_OTR_FILL_%d" % fills)
-		
-		fills += 1
-
-		continue
-
-	params = []
-	fo = e[1]
-	new = ""
-	last=0
-	i=0
-	srcx.write("""{ "%s", "%s", 0""" % (e[0],fo.replace("%%9","").replace("%9","").replace("%g","").replace("%n","")))
-	for m in re.finditer("(^|[^%])%([0-9]*)[ds]",fo):
-		if m.group()[-1]=='d':
-			params += ['1']
-		else:
-			params += ['0']
-		new += fo[last:m.start()+len(m.group(1))].replace('%%','%')+"$"
-		if m.group(2): new+= "[%s]" % m.group(2)
-		new += "%d" % i
-		last = m.end()
-		i += 1
-
-	new += fo[last:].replace('%%','%')
-
-	e[1] = new
-	e += [len(params)] + params
-
-	#print "Handling line %s with elen %d" % (line,len(e))
-
-	premsg = ""
-	if e[1][0] != "{" and section!="Nickignore" and section!="Contexts":
-		premsg = "%9OTR%9: "
-
-	src.write("""{ "%s", "%s%s", %s""" % (e[0],premsg,e[1],e[2]))
-
-	if len(params)>0:
-		src.write(", { %s }" % ", ".join(params))
-
-	src.write("}")
-	srcx.write("}")
-
-	hdr.write(",\n")
-
-	hdr.write("TXT_%s" % e[0].upper())
-
-hdr.write("""
-};
-
-extern FORMAT_REC formats[];
-""")
-
-src.write(""",
-{ NULL, NULL, 0 }
-};
-""")
-
-srcx.write(""",
-{ NULL, NULL, 0 }
-};
-""")
-
-hdr.close()
-src.close()
-srcx.close()
diff --git a/mksrcpackage.sh b/mksrcpackage.sh
deleted file mode 100755
index 7d75cbc..0000000
--- a/mksrcpackage.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-if [ -z "$2" ]; then echo "Syntax: $0 <src-dir> <git-commit/tag>"; exit 1;fi
-SDIR="$1"
-VER=$2
-
-PKG=irc-otr-$VER.tar
-HDIR=irc-otr-$VER
-mkdir "$HDIR" &&\
-(cd "$HDIR" && ln -s ../irssi-headers &&\
-	echo -e "SET(IRCOTR_VERSION $VER)" >tarballdefs.cmake) &&\
-	for plugin in irc xchat irssi; do
-		pkg=$plugin-otr-$VER
-		(cd "$SDIR" && git archive --format=tar --prefix=$pkg/ HEAD )>$pkg.tar &&\
-		tar rhf $pkg.tar "$HDIR" 
-		gzip $pkg.tar
-	done && rm $HDIR/{irssi-headers,tarballdefs.cmake} &&\
-rmdir $HDIR
diff --git a/otr.h b/otr.h
deleted file mode 100644
index c52e0ca..0000000
--- a/otr.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2008  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-
-/* OTR */
-
-#include <libotr/proto.h>
-#include <libotr/context.h>
-#include <libotr/message.h>
-#include <libotr/privkey.h>
-
-/* glib */
-
-#include <glib.h>
-#include <glib/gprintf.h>
-#include <glib/gstdio.h>
-
-/* user state */
-
-typedef struct {
-	OtrlUserState otr_state;
-	GSList *plistunknown;
-	GSList *plistknown;
-} IOUSTATE;
-
-#ifndef TARGET_BITLBEE
-/* there can be only one */
-extern IOUSTATE ioustate_uniq;
-#endif
-
-/* irssi */
-
-#ifdef TARGET_IRSSI
-#include <irssi/irssi_otr.h>
-#endif
-
-/* xchat */
-
-#ifdef TARGET_XCHAT
-#include <xchat/xchat_otr.h>
-#endif
-
-/* weechat */
-
-#ifdef TARGET_WEECHAT
-#include <weechat/weechat_otr.h>
-#endif
-
-/* bitlbee */
-
-#ifdef TARGET_BITLBEE
-#include <bitlbee/bitlbee_otr.h>
-#endif
-
-/* log stuff */
-
-#define LOGMAX 1024
-
-#define LVL_NOTICE  0
-#define LVL_DEBUG   1
-
-#define otr_logst(level, format, ...) \
-	otr_log(NULL, NULL, level, format, ## __VA_ARGS__)
-
-void otr_log(IRC_CTX *server, const char *to,
-	     int level, const char *format, ...);
-
-/* own */
-
-#include "io-config.h"
-
-/* irssi module name */
-#define MODULE_NAME "otr"
-
-#include "otr-formats.h"
-
-/*
- * maybe this should be configurable?
- * I believe bitlbee has something >500.
- */
-#define OTR_MAX_MSG_SIZE 400
-
-/* otr protocol id */
-#define PROTOCOLID "IRC"
-
-#define KEYFILE    "/otr/otr.key"
-#define TMPKEYFILE "/otr/otr.key.tmp"
-#define FPSFILE    "/otr/otr.fp"
-#define INSTAGFILE "/otr/otr.instag"
-
-/* some defaults */
-#define IO_DEFAULT_POLICY \
-	"*@localhost opportunistic,*bitlbee* opportunistic,*@im.* opportunistic, *serv at irc* never"
-#define IO_DEFAULT_POLICY_KNOWN "* always"
-#define IO_DEFAULT_IGNORE "xmlconsole[0-9]*"
-
-/* used as a prefix for /me messages.
- * This makes it readable and sensible for
- * people not on IRC (i.e. in case of a gateway
- * like bitlbee)
- */
-#define IRCACTIONMARK "/me "
-#define IRCACTIONMARKLEN 4
-
-/* one for each OTR context (=communication pair) */
-struct co_info {
-	char *msgqueue;                 /* holds partially reconstructed base64
-	                                   messages */
-	IRC_CTX *ircctx;                /* irssi server object for this peer */
-	int received_smp_init;          /* received SMP init msg */
-	int smp_failed;                 /* last SMP failed */
-	char better_msg_two[256];       /* what the second line of the "better"
-	                                   default query msg should like. Eat it
-	                                   up when it comes in */
-	int finished;                   /* true after you've /otr finished */
-};
-
-/* these are returned by /otr contexts */
-
-struct fplist_ {
-	char *fp;
-	enum { NOAUTH, AUTHSMP, AUTHMAN } authby;
-	struct fplist_ *next;
-};
-
-struct ctxlist_ {
-	char *username;
-	char *accountname;
-	enum { STUNENCRYPTED, STENCRYPTED, STFINISHED, STUNKNOWN } state;
-	struct fplist_ *fplist;
-	struct ctxlist_ *next;
-};
-
-/* returned by otr_getstatus */
-enum {
-	IO_ST_PLAINTEXT,
-	IO_ST_FINISHED,
-	IO_ST_SMP_INCOMING,
-	IO_ST_SMP_OUTGOING,
-	IO_ST_SMP_FINALIZE,
-	IO_ST_UNKNOWN,
-	IO_ST_UNTRUSTED=32,
-	IO_ST_TRUST_MANUAL=64,
-	IO_ST_TRUST_SMP=128,
-	IO_ST_SMP_ONGOING=
-		IO_ST_SMP_INCOMING | IO_ST_SMP_OUTGOING | IO_ST_SMP_FINALIZE
-};
-
-/* given to otr_status_change */
-enum {
-	IO_STC_FINISHED,
-	IO_STC_TRUST_MANUAL,
-	IO_STC_TRUST_SMP,
-	IO_STC_SMP_ABORT,
-	IO_STC_SMP_STARTED,
-	IO_STC_SMP_RESPONDED,
-	IO_STC_SMP_INCOMING,
-	IO_STC_SMP_FINALIZE,
-	IO_STC_SMP_ABORTED,
-	IO_STC_PEER_FINISHED,
-	IO_STC_SMP_FAILED,
-	IO_STC_SMP_SUCCESS,
-	IO_STC_GONE_SECURE,
-	IO_STC_GONE_INSECURE,
-	IO_STC_CTX_UPDATE
-};
-
-/* libotr4 handle_msg_event */
-extern char *otr_msg_event_txt[];
-
-/* the above as text for scripting */
-extern char *otr_status_txt[];
-
-/* policy list generated from /set otr_policy */
-
-struct plistentry {
-	GPatternSpec *namepat;
-	OtrlPolicy policy;
-};
-
-/* used by the logging functions below */
-extern int debug;
-
-void irc_send_message(IRC_CTX *ircctx, const char *recipient, char *msg);
-void otr_status_change(IRC_CTX *ircctx, const char *nick, int event);
-IRC_CTX *ircctx_by_peername(const char *peername, char *nick);
-
-/* init stuff */
-
-int otrlib_init();
-void otrlib_deinit();
-void otr_initops();
-void otr_setpolicies(IOUSTATE *ioustate, const char *policies, int known);
-IOUSTATE *otr_init_user(char *user);
-void otr_deinit_user(IOUSTATE *ioustate);
-
-/* basic send/receive/status stuff */
-
-char *otr_send(IRC_CTX *server, const char *msg, const char *to);
-char *otr_receive(IRC_CTX *server, const char *msg, const char *from);
-int otr_getstatus(IRC_CTX *ircctx, const char *nick);
-ConnContext *otr_getcontext(const char *accname, const char *nick, int create,
-			    IRC_CTX *ircctx);
-
-/* user interaction */
-
-void otr_trust(IRC_CTX *server, char *nick, const char *peername);
-void otr_finish(IRC_CTX *server, char *nick, const char *peername,
-		int inquery);
-void otr_auth(IRC_CTX *server, char *nick, const char *peername,
-	      const char *question, const char *secret);
-void otr_authabort(IRC_CTX *server, char *nick, const char *peername);
-void otr_abort_auth(ConnContext *co, IRC_CTX *ircctx, const char *nick);
-struct ctxlist_ *otr_contexts(IOUSTATE *ioustate);
-void otr_finishall(IOUSTATE *ioustate);
-
-
-/* key/fingerprint stuff */
-
-void keygen_run(IOUSTATE *ioustate, const char *accname);
-void keygen_abort(IOUSTATE *ioustate, int ignoreidle);
-void key_load(IOUSTATE *ioustate);
-void fps_load(IOUSTATE *ioustate);
-void otr_writefps(IOUSTATE *ioustate);
-
-#ifndef LIBOTR3
-/* instance tags */
-void instag_load(IOUSTATE *ioustate);
-void otr_writeinstags(IOUSTATE *ioustate);
-#endif
-
-int extract_nick(char *nick, char *line);
-
-struct _cmds {
-	char *name;
-	void (*cmdfunc)(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc,
-			char *argv[], char *argv_eol[], char *target);
-};
-
-/* see io_util.c */
-#define CMDCOUNT 9
-extern struct _cmds cmds[];
-
-int cmd_generic(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-		char *argv_eol[],
-		char *target);
-int otr_getstatus_format(IRC_CTX *ircctx, const char *nick);
-
-void io_explode_args(const char *args, char ***argvp, char ***argv_eolp,
-		     int *argcp);
diff --git a/otr_key.c b/otr_key.c
deleted file mode 100644
index 1082bc5..0000000
--- a/otr_key.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2008  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#define _GNU_SOURCE
-
-#include "otr.h"
-
-#include <libgen.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
-#include <signal.h>
-
-typedef enum { KEYGEN_NO, KEYGEN_RUNNING } keygen_status_t;
-
-struct {
-	keygen_status_t status;
-	char *accountname;
-	char *protocol;
-	time_t started;
-	GIOChannel *ch[2];
-	guint cpid;
-	guint cwid;
-	pid_t pid;
-	IOUSTATE *ioustate;
-} kg_st = { .status = KEYGEN_NO };
-
-void keygen_childwatch(GPid pid, gint status, gpointer data)
-{
-	struct pollfd pfd = {
-		.fd = g_io_channel_unix_get_fd(kg_st.ch[0]),
-		.events = POLLIN
-	};
-	int ret;
-
-	/* nothing to do if keygen_complete has already been called */
-	if (data)
-		return;
-
-	kg_st.pid = 0;
-
-	ret = poll(&pfd, 1, 0);
-
-	/* data is there, let's wait for keygen_complete to be called */
-	if (ret == 1)
-		return;
-
-	/* no data, report error and reset kg_st */
-	if (ret == 0) {
-		if (WIFSIGNALED(status)) {
-			char sigstr[16];
-
-			sprintf(sigstr,
-#ifndef HAVE_STRSIGNAL
-				"%d", WTERMSIG(status));
-#else
-				"%s", strsignal(WTERMSIG(status)));
-#endif
-			otr_noticest(TXT_KG_EXITSIG,
-				     kg_st.accountname,
-				     sigstr);
-		}else
-			otr_noticest(TXT_KG_EXITED, kg_st.accountname);
-	} else if (ret == -1)
-		otr_noticest(TXT_KG_POLLERR, kg_st.accountname,
-			     strerror(errno));
-
-	keygen_abort(kg_st.ioustate, FALSE);
-}
-
-/*
- * Installed as g_io_watch and called when the key generation
- * process finishs.
- */
-gboolean keygen_complete(GIOChannel *source, GIOCondition condition,
-			 gpointer data)
-{
-	gcry_error_t err;
-	const char *clconfdir = get_client_config_dir();
-	char *filename = g_strconcat(clconfdir, KEYFILE, NULL);
-	char *tmpfilename = g_strconcat(clconfdir, TMPKEYFILE, NULL);
-
-	read(g_io_channel_unix_get_fd(kg_st.ch[0]), &err, sizeof(err));
-
-	g_source_remove(kg_st.cpid);
-	g_io_channel_shutdown(kg_st.ch[0], FALSE, NULL);
-	g_io_channel_shutdown(kg_st.ch[1], FALSE, NULL);
-	g_io_channel_unref(kg_st.ch[0]);
-	g_io_channel_unref(kg_st.ch[1]);
-
-	if (err)
-		otr_noticest(TXT_KG_FAILED,
-			     kg_st.accountname,
-			     gcry_strerror(err),
-			     gcry_strsource(err));
-	else {
-		/* reload keys */
-		otr_noticest(TXT_KG_COMPLETED,
-			     kg_st.accountname,
-			     time(NULL) - kg_st.started);
-		rename(tmpfilename, filename);
-		//otrl_privkey_forget_all(otr_state); <-- done by lib
-		key_load(kg_st.ioustate);
-	}
-
-	g_source_remove(kg_st.cwid);
-	kg_st.cwid = g_child_watch_add(kg_st.pid, keygen_childwatch, (void*)1);
-
-	kg_st.status = KEYGEN_NO;
-	g_free(kg_st.accountname);
-
-	g_free(filename);
-	g_free(tmpfilename);
-
-	return FALSE;
-}
-
-/*
- * Run key generation in a seperate process (takes ages).
- * The other process will rewrite the key file, we shouldn't
- * change anything till it's done and we've reloaded the keys.
- */
-void keygen_run(IOUSTATE *ioustate, const char *accname)
-{
-	gcry_error_t err;
-	int ret;
-	int fds[2];
-	char *filename = g_strconcat(
-		get_client_config_dir(), TMPKEYFILE,
-		NULL), *filenamedup = g_strdup(
-		filename);
-	char *dir = dirname(filenamedup);
-
-	if (kg_st.status != KEYGEN_NO) {
-		if (strcmp(accname, kg_st.accountname) != 0)
-			otr_noticest(TXT_KG_ABORTED_DUP,
-				     accname, kg_st.accountname);
-		return;
-	}
-
-	if (!g_file_test(dir, G_FILE_TEST_EXISTS)) {
-		if (g_mkdir(dir, S_IRWXU)) {
-			otr_noticest(TXT_KG_ABORTED_DIR,
-				     accname, dir, strerror(errno));
-			g_free(dir);
-			g_free(filename);
-			return;
-		} else
-			otr_noticest(TXT_KG_MKDIR, dir);
-	}
-	g_free(filenamedup);
-
-	if (pipe(fds) != 0) {
-		otr_noticest(TXT_KG_PIPE,
-			     accname, strerror(errno));
-		g_free(filename);
-		return;
-	}
-
-	kg_st.ch[0] = g_io_channel_unix_new(fds[0]);
-	kg_st.ch[1] = g_io_channel_unix_new(fds[1]);
-
-	kg_st.accountname = g_strdup(accname);
-	kg_st.ioustate = ioustate;
-	kg_st.protocol = PROTOCOLID;
-	kg_st.started = time(NULL);
-
-	if ((ret = fork())) {
-		g_free(filename);
-		if (ret == -1) {
-			otr_noticest(TXT_KG_FORK,
-				     accname, strerror(errno));
-			return;
-		}
-
-		kg_st.status = KEYGEN_RUNNING;
-		kg_st.pid = ret;
-
-		otr_noticest(TXT_KG_INITIATED,
-			     accname);
-
-		kg_st.cpid = g_io_add_watch(kg_st.ch[0], G_IO_IN,
-					    (GIOFunc)keygen_complete, NULL);
-		kg_st.cwid = g_child_watch_add(kg_st.pid, keygen_childwatch,
-					       NULL);
-
-		kg_st.started = time(NULL);
-		return;
-	}
-
-	/* child */
-
-	err = otrl_privkey_generate(ioustate->otr_state, filename, accname,
-				    PROTOCOLID);
-	write(fds[1], &err, sizeof(err));
-
-	g_free(filename);
-	_exit(0);
-}
-
-/*
- * Abort ongoing key generation.
- */
-void keygen_abort(IOUSTATE *ioustate, int ignoreidle)
-{
-	if (kg_st.status != KEYGEN_RUNNING) {
-		if (!ignoreidle)
-			otr_noticest(TXT_KG_NOABORT);
-		return;
-	}
-
-	otr_noticest(TXT_KG_ABORT, kg_st.accountname);
-
-	g_source_remove(kg_st.cpid);
-	g_source_remove(kg_st.cwid);
-	g_free(kg_st.accountname);
-
-	if (kg_st.pid != 0) {
-		kill(kg_st.pid, SIGTERM);
-		g_child_watch_add(kg_st.pid, keygen_childwatch, (void*)1);
-	}
-
-	kg_st.status = KEYGEN_NO;
-}
-
-/*
- * Write fingerprints to file.
- */
-void otr_writefps(IOUSTATE *ioustate)
-{
-	gcry_error_t err;
-	char *filename = g_strconcat(get_client_config_dir(), FPSFILE, NULL);
-
-	err = otrl_privkey_write_fingerprints(ioustate->otr_state, filename);
-
-	if (err == GPG_ERR_NO_ERROR) {
-		otr_noticest(TXT_FP_SAVED);
-	} else {
-		otr_noticest(TXT_FP_SAVE_ERROR,
-			     gcry_strerror(err),
-			     gcry_strsource(err));
-	}
-	g_free(filename);
-}
-
-#ifndef LIBOTR3
-/*
- * Write instance tags to file.
- */
-void otr_writeinstags(IOUSTATE *ioustate)
-{
-	gcry_error_t err;
-	char *filename = g_strconcat(
-		get_client_config_dir(), INSTAGFILE, NULL);
-
-	err = otrl_instag_write(ioustate->otr_state, filename);
-
-	if (err == GPG_ERR_NO_ERROR) {
-		otr_noticest(TXT_INSTAG_SAVED);
-	} else {
-		otr_noticest(TXT_INSTAG_SAVE_ERROR,
-			     gcry_strerror(err),
-			     gcry_strsource(err));
-	}
-	g_free(filename);
-}
-#endif
-
-/*
- * Load private keys.
- */
-void key_load(IOUSTATE *ioustate)
-{
-	gcry_error_t err;
-	char *filename = g_strconcat(get_client_config_dir(), KEYFILE, NULL);
-
-	if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
-		otr_noticest(TXT_KEY_NOT_FOUND);
-		return;
-	}
-
-	err = otrl_privkey_read(ioustate->otr_state, filename);
-
-	if (err == GPG_ERR_NO_ERROR) {
-		otr_noticest(TXT_KEY_LOADED);
-	} else {
-		otr_noticest(TXT_KEY_LOAD_ERROR,
-			     gcry_strerror(err),
-			     gcry_strsource(err));
-	}
-	g_free(filename);
-}
-
-/*
- * Load fingerprints.
- */
-void fps_load(IOUSTATE *ioustate)
-{
-	gcry_error_t err;
-	char *filename = g_strconcat(get_client_config_dir(), FPSFILE, NULL);
-
-	if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
-		otr_noticest(TXT_FP_NOT_FOUND);
-		return;
-	}
-
-	err =
-		otrl_privkey_read_fingerprints(ioustate->otr_state, filename,
-					       NULL,
-					       NULL);
-
-	if (err == GPG_ERR_NO_ERROR) {
-		otr_noticest(TXT_FP_LOADED);
-	} else {
-		otr_noticest(TXT_FP_LOAD_ERROR,
-			     gcry_strerror(err),
-			     gcry_strsource(err));
-	}
-	g_free(filename);
-}
-
-#ifndef LIBOTR3
-/*
- * Load instance tags.
- */
-void instag_load(IOUSTATE *ioustate)
-{
-	gcry_error_t err;
-	char *filename = g_strconcat(
-		get_client_config_dir(), INSTAGFILE, NULL);
-
-	if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
-		otr_noticest(TXT_INSTAG_NOT_FOUND);
-		return;
-	}
-
-	err = otrl_instag_read(ioustate->otr_state, filename);
-
-	if (err == GPG_ERR_NO_ERROR) {
-		otr_noticest(TXT_INSTAG_LOADED);
-	} else {
-		otr_noticest(TXT_INSTAG_LOAD_ERROR,
-			     gcry_strerror(err),
-			     gcry_strsource(err));
-	}
-	g_free(filename);
-}
-#endif
diff --git a/otr_ops.c b/otr_ops.c
deleted file mode 100644
index 6b0bdb6..0000000
--- a/otr_ops.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2008  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "otr.h"
-
-OtrlMessageAppOps otr_ops;
-
-OtrlPolicy IO_DEFAULT_OTR_POLICY =
-	OTRL_POLICY_MANUAL | OTRL_POLICY_WHITESPACE_START_AKE;
-
-/*
- * Return policy for given context based on the otr_policy /setting
- */
-OtrlPolicy ops_policy(void *opdata, ConnContext *context)
-{
-	struct co_info *coi = context->app_data;
-	char *server = strchr(context->accountname, '@') + 1;
-	OtrlPolicy op = IO_DEFAULT_OTR_POLICY;
-	GSList *pl;
-	char fullname[1024];
-	IOUSTATE *ioustate = IRCCTX_IO_US(coi->ircctx);
-
-	sprintf(fullname, "%s@%s", context->username, server);
-
-	/* loop through otr_policy */
-
-	if (ioustate->plistunknown) {
-		pl = ioustate->plistunknown;
-		do {
-			struct plistentry *ple = pl->data;
-
-			if (g_pattern_match_string(ple->namepat, fullname))
-				op = ple->policy;
-		} while ((pl = g_slist_next(pl)));
-	}
-
-	if (ioustate->plistknown && context->fingerprint_root.next) {
-		pl = ioustate->plistknown;
-
-		/* loop through otr_policy_known */
-
-		do {
-			struct plistentry *ple = pl->data;
-
-			if (g_pattern_match_string(ple->namepat, fullname))
-				op = ple->policy;
-		} while ((pl = g_slist_next(pl)));
-	}
-
-	if (coi && coi->finished &&
-	    (op == OTRL_POLICY_OPPORTUNISTIC ||
-	     op == OTRL_POLICY_ALWAYS))
-		op = OTRL_POLICY_MANUAL | OTRL_POLICY_WHITESPACE_START_AKE;
-	return op;
-}
-
-/*
- * Request for key generation.
- * The lib actually expects us to be finished before the call returns.
- * Since this can take more than an hour on some systems there isn't even
- * a point in trying...
- */
-void ops_create_privkey(void *opdata, const char *accountname,
-			const char *protocol)
-{
-	IRC_CTX *ircctx __attribute__((unused)) = opdata;
-
-	keygen_run(IRCCTX_IO_US(ircctx), accountname);
-}
-
-/*
- * Inject OTR message.
- * Deriving the server is currently a hack,
- * need to derive the server from accountname.
- */
-void ops_inject_msg(void *opdata, const char *accountname,
-		    const char *protocol, const char *recipient,
-		    const char *message)
-{
-	IRC_CTX *a_serv;
-	char *msgcopy = g_strdup(message);
-
-	/* OTR sometimes gives us multiple lines
-	 * (e.g. the default query (a.k.a. "better") message) */
-	g_strdelimit(msgcopy, "\n", ' ');
-	a_serv = opdata;
-	if (!a_serv) {
-		char nick[256];
-		a_serv = ircctx_by_peername(accountname, nick);
-	}
-	if (!a_serv) {
-		otr_notice(a_serv, recipient, TXT_OPS_INJECT,
-			   accountname, recipient, message);
-	} else {
-		otr_logst(MSGLEVEL_CRAP, "%d: INJECT %s", time(NULL), msgcopy);
-		irc_send_message(a_serv, recipient, msgcopy);
-	}
-	g_free(msgcopy);
-}
-
-/*
- * OTR notification. Haven't seen one yet.
- */
-void ops_notify(void *opdata, OtrlNotifyLevel level, const char *accountname,
-		const char *protocol, const char *username,
-		const char *title, const char *primary,
-		const char *secondary)
-{
-	ConnContext *co = otr_getcontext(accountname, username, FALSE, NULL);
-	IRC_CTX *server = opdata;
-	struct co_info *coi;
-	if (co) {
-		coi = co->app_data;
-		server = coi->ircctx;
-	} else
-		otr_notice(server, username, TXT_OPS_NOTIFY_BUG);
-
-	otr_notice(server, username, TXT_OPS_NOTIFY,
-		   title, primary, secondary);
-}
-
-#ifdef HAVE_GREGEX_H
-
-/* This is kind of messy. */
-const char *convert_otr_msg(const char *msg)
-{
-	GRegex *regex_bold = g_regex_new("</?i([ /][^>]*)?>", 0, 0, NULL);
-	GRegex *regex_del = g_regex_new("</?b([ /][^>]*)?>", 0, 0, NULL);
-	gchar *msgnohtml =
-		g_regex_replace_literal(regex_del, msg, -1, 0, "", 0, NULL);
-
-	msg = g_regex_replace_literal(regex_bold, msgnohtml, -1, 0, "*", 0,
-				      NULL);
-
-	g_free(msgnohtml);
-	g_regex_unref(regex_del);
-	g_regex_unref(regex_bold);
-
-	return msg;
-}
-
-#endif
-
-/*
- * OTR message. E.g. "following has been transmitted in clear: ...".
- * We're trying to kill the ugly HTML.
- */
-int ops_display_msg(void *opdata, const char *accountname,
-		    const char *protocol, const char *username,
-		    const char *msg)
-{
-	ConnContext *co = otr_getcontext(accountname, username, FALSE, opdata);
-	IRC_CTX *server = opdata;
-	struct co_info *coi;
-
-	if (co) {
-		coi = co->app_data;
-		server = coi->ircctx;
-	} else
-		otr_notice(server, username, TXT_OPS_DISPLAY_BUG);
-
-#ifdef HAVE_GREGEX_H
-	msg = convert_otr_msg(msg);
-	otr_notice(server, username, TXT_OPS_DISPLAY, msg);
-	g_free((char*)msg);
-#else
-	otr_notice(server, username, TXT_OPS_DISPLAY, msg);
-#endif
-
-	return 0;
-}
-
-/*
- * Gone secure.
- */
-void ops_secure(void *opdata, ConnContext *context)
-{
-	struct co_info *coi = context->app_data;
-	char * trust = context->active_fingerprint->trust ? : "";
-	char ownfp[45], peerfp[45];
-
-	otr_notice(coi->ircctx,
-		   context->username, TXT_OPS_SEC);
-	otr_status_change(coi->ircctx, context->username, IO_STC_GONE_SECURE);
-
-	//TODO: pull master context
-	coi->finished = FALSE;
-
-	if (*trust != '\0')
-		return;
-
-	/* not authenticated.
-	 * Let's print out the fingerprints for comparison */
-
-	otrl_privkey_hash_to_human(peerfp,
-				   context->active_fingerprint->fingerprint);
-
-	otr_notice(coi->ircctx, context->username, TXT_OPS_FPCOMP,
-		   otrl_privkey_fingerprint(IRCCTX_IO_US(coi->ircctx)->
-					    otr_state,
-					    ownfp,
-					    context->accountname,
-					    PROTOCOLID),
-		   context->username,
-		   peerfp);
-}
-
-/*
- * Gone insecure.
- */
-void ops_insecure(void *opdata, ConnContext *context)
-{
-	struct co_info *coi = context->app_data;
-	otr_notice(coi->ircctx,
-		   context->username, TXT_OPS_INSEC);
-	otr_status_change(coi->ircctx, context->username,
-			  IO_STC_GONE_INSECURE);
-}
-
-/*
- * Still secure? Need to find out what that means...
- */
-void ops_still_secure(void *opdata, ConnContext *context, int is_reply)
-{
-	struct co_info *coi = context->app_data;
-	otr_notice(coi->ircctx,
-		   context->username, is_reply ?
-		   TXT_OPS_STILL_REPLY :
-		   TXT_OPS_STILL_NO_REPLY);
-}
-
-/*
- * OTR log message. IIRC heartbeats are of this category.
- */
-void ops_log(void *opdata, const char *message)
-{
-	otr_infost(TXT_OPS_LOG, message);
-}
-
-/*
- * Really critical with IRC.
- * Unfortunately, we can't tell our peer which size to use.
- * (reminds me of MTU determination...)
- */
-int ops_max_msg(void *opdata, ConnContext *context)
-{
-	return OTR_MAX_MSG_SIZE;
-}
-
-#ifndef LIBOTR3
-void ops_handle_msg_event(void *opdata, OtrlMessageEvent msg_event,
-			  ConnContext *context, const char *message,
-			  gcry_error_t err)
-{
-	IRC_CTX *server = opdata;
-	char *username = context->username;
-
-	otr_debug(server,
-		  username,
-		  TXT_OPS_HANDLE_MSG,
-		  otr_msg_event_txt[msg_event], message);
-}
-#endif
-
-/*
- * A context changed.
- * I believe this is not happening for the SMP expects.
- */
-void ops_up_ctx_list(void *opdata)
-{
-	otr_status_change(opdata, NULL, IO_STC_CTX_UPDATE);
-}
-
-/*
- * Save fingerprint changes.
- */
-void ops_writefps(void *data)
-{
-	IRC_CTX *ircctx __attribute__((unused)) = data;
-
-	otr_writefps(IRCCTX_IO_US(ircctx));
-}
-
-int ops_is_logged_in(void *opdata, const char *accountname,
-		     const char *protocol, const char *recipient)
-{
-	/*TODO register a handler for event 401 no such nick and set
-	 * a variable offline=TRUE. Reset it to false in otr_receive and
-	 * otr_send */
-	return TRUE;
-}
-
-#ifndef LIBOTR3
-void ops_create_instag(void *opdata, const char *accountname,
-		       const char *protocol)
-{
-	otrl_instag_generate(IRCCTX_IO_US(
-				     ircctx)->otr_state, "/dev/null",
-			     accountname, protocol);
-	otr_writeinstags(IRCCTX_IO_US(ircctx));
-}
-
-void ops_smp_event(void *opdata, OtrlSMPEvent smp_event,
-		   ConnContext *context, unsigned short progress_percent,
-		   char *question)
-{
-	IRC_CTX *ircctx = (opdata);
-	char *from = context->username;
-	struct co_info *coi = context->app_data;
-
-	coi->received_smp_init =
-		(smp_event == OTRL_SMPEVENT_ASK_FOR_SECRET) ||
-		(smp_event == OTRL_SMPEVENT_ASK_FOR_ANSWER);
-
-	switch (smp_event) {
-	case OTRL_SMPEVENT_ASK_FOR_SECRET:
-		otr_notice(ircctx, from, TXT_AUTH_PEER,
-			   from);
-		otr_status_change(ircctx, from, IO_STC_SMP_INCOMING);
-		break;
-	case OTRL_SMPEVENT_ASK_FOR_ANSWER:
-		otr_notice(ircctx, from, TXT_AUTH_PEER_QA, from, question);
-		otr_status_change(ircctx, from, IO_STC_SMP_INCOMING);
-		break;
-	case OTRL_SMPEVENT_IN_PROGRESS:
-		otr_notice(ircctx, from,
-			   TXT_AUTH_PEER_REPLIED,
-			   from);
-		otr_status_change(ircctx, from, IO_STC_SMP_FINALIZE);
-		break;
-	case OTRL_SMPEVENT_SUCCESS:
-		otr_notice(ircctx, from,
-			   TXT_AUTH_SUCCESSFUL);
-		otr_status_change(ircctx, from, IO_STC_SMP_SUCCESS);
-		break;
-	case OTRL_SMPEVENT_ABORT:
-		otr_abort_auth(context, ircctx, from);
-		otr_status_change(ircctx, from, IO_STC_SMP_ABORTED);
-		break;
-	case OTRL_SMPEVENT_FAILURE:
-	case OTRL_SMPEVENT_CHEATED:
-	case OTRL_SMPEVENT_ERROR:
-		otr_notice(ircctx, from, TXT_AUTH_FAILED);
-		coi->smp_failed = TRUE;
-		otr_status_change(ircctx, from, IO_STC_SMP_FAILED);
-		break;
-	default:
-		otr_logst(MSGLEVEL_CRAP, "Received unknown SMP event");
-		break;
-	}
-}
-
-#endif
-
-/*
- * Initialize our OtrlMessageAppOps
- */
-void otr_initops()
-{
-	memset(&otr_ops, 0, sizeof(otr_ops));
-
-	otr_ops.policy = ops_policy;
-	otr_ops.create_privkey = ops_create_privkey;
-	otr_ops.inject_message = ops_inject_msg;
-	otr_ops.gone_secure = ops_secure;
-	otr_ops.gone_insecure = ops_insecure;
-	otr_ops.still_secure = ops_still_secure;
-	otr_ops.max_message_size = ops_max_msg;
-	otr_ops.update_context_list = ops_up_ctx_list;
-	otr_ops.write_fingerprints = ops_writefps;
-	otr_ops.is_logged_in = ops_is_logged_in;
-
-#ifdef LIBOTR3
-	otr_ops.notify = ops_notify;
-	otr_ops.display_otr_message = ops_display_msg;
-	otr_ops.log_message = ops_log;
-#else
-	otr_ops.handle_msg_event = ops_handle_msg_event;
-	otr_ops.create_instag = ops_create_instag;
-	otr_ops.handle_smp_event = ops_smp_event;
-#endif
-}
diff --git a/otr_util.c b/otr_util.c
deleted file mode 100644
index 987ab6d..0000000
--- a/otr_util.c
+++ /dev/null
@@ -1,915 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2008  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "otr.h"
-
-#include <gcrypt.h>
-
-extern OtrlMessageAppOps otr_ops;
-static int otrinited = FALSE;
-
-#ifdef TARGET_BITLBEE
-GHashTable *ioustates;
-#else
-IOUSTATE ioustate_uniq = { 0, 0, 0 };
-#endif
-
-#ifdef HAVE_GREGEX_H
-GRegex *regex_policies;
-#endif
-
-IOUSTATE *otr_init_user(char *user)
-{
-	IOUSTATE *ioustate = IO_CREATE_US(user);
-
-	ioustate->otr_state = otrl_userstate_create();
-
-	/* load keys and fingerprints */
-
-#ifndef LIBOTR3
-	instag_load(ioustate);
-#endif
-	key_load(ioustate);
-	fps_load(ioustate);
-
-	return ioustate;
-}
-
-void otr_deinit_user(IOUSTATE *ioustate)
-{
-	keygen_abort(ioustate, TRUE);
-
-	if (ioustate->otr_state) {
-		otr_writefps(ioustate);
-		otrl_userstate_free(ioustate->otr_state);
-		ioustate->otr_state = NULL;
-	}
-	otr_setpolicies(ioustate, "", FALSE);
-	otr_setpolicies(ioustate, "", TRUE);
-}
-
-/*
- * init otr lib.
- */
-int otrlib_init()
-{
-	if (!otrinited) {
-		/* apparently used in pidgin-otr to
-		 * force gcrypt to /dev/urandom */
-		/*
-		   gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
-		   gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0);
-		 */
-		OTRL_INIT;
-		otrinited = TRUE;
-	}
-
-#ifdef TARGET_BITLBEE
-	ioustates = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
-					  otr_deinit_user);
-#endif
-
-	otr_initops();
-
-#ifdef HAVE_GREGEX_H
-	regex_policies =
-		g_regex_new(
-			"([^,]+) (never|manual|handlews|opportunistic|always)"
-			"(,|$)", 0, 0, NULL);
-#endif
-
-	return 0;
-}
-
-/*
- * deinit otr lib.
- */
-void otrlib_deinit()
-{
-#ifdef HAVE_GREGEX_H
-	g_regex_unref(regex_policies);
-#endif
-
-#ifdef TARGET_BITLBEE
-	g_hash_table_destroy(ioustates);
-#endif
-}
-
-
-/*
- * Free our app data.
- */
-void context_free_app_info(void *data)
-{
-	struct co_info *coi = data;
-	if (coi->msgqueue) {
-		g_free(coi->msgqueue);
-	}
-	if (coi->ircctx)
-		IRCCTX_FREE(coi->ircctx);
-}
-
-/*
- * Add app data to context.
- * See struct co_info for details.
- */
-void context_add_app_info(void *data, ConnContext *co)
-{
-	IRC_CTX *ircctx = IRCCTX_DUP(data);
-	struct co_info *coi = g_malloc(sizeof(struct co_info));
-
-	memset(coi, 0, sizeof(struct co_info));
-	co->app_data = coi;
-	co->app_data_free = context_free_app_info;
-
-	coi->ircctx = ircctx;
-	sprintf(coi->better_msg_two, formats[TXT_OTR_BETTER_TWO].def,
-		co->accountname);
-}
-
-/*
- * Get a context from a pair.
- */
-ConnContext *otr_getcontext(const char *accname, const char *nick,
-			    int create, IRC_CTX *ircctx)
-{
-	ConnContext *co = otrl_context_find(
-		IRCCTX_IO_US(ircctx)->otr_state,
-		nick,
-		accname,
-		PROTOCOLID,
-#ifndef LIBOTR3
-		OTRL_INSTAG_BEST,
-#endif
-		create,
-		NULL,
-		context_add_app_info,
-		ircctx);
-
-	/* context came from a fingerprint */
-	if (co && ircctx && !co->app_data)
-		context_add_app_info(ircctx, co);
-
-	return co;
-}
-
-/*
- * Hand the given message to OTR.
- * Returns NULL if OTR handled the message and
- * the original message otherwise.
- */
-char *otr_send(IRC_CTX *ircctx, const char *msg, const char *to)
-{
-	gcry_error_t err;
-	char *newmessage = NULL;
-	ConnContext *co;
-	char accname[256];
-
-	IRCCTX_ACCNAME(accname, ircctx);
-
-	otr_logst(MSGLEVEL_CRAP, "%d: send...", time(NULL));
-	err = otrl_message_sending(
-		IRCCTX_IO_US(ircctx)->otr_state,
-		&otr_ops,
-		ircctx,
-		accname,
-		PROTOCOLID,
-		to,
-#ifndef LIBOTR3
-		OTRL_INSTAG_BEST,
-#endif
-		msg,
-		NULL,
-		&newmessage,
-#ifndef LIBOTR3
-		OTRL_FRAGMENT_SEND_ALL,
-		&co,
-#endif
-		context_add_app_info,
-		ircctx);
-	otr_logst(MSGLEVEL_CRAP, "%d: sent", time(NULL));
-
-	if (err != 0) {
-		otr_notice(ircctx, to, TXT_SEND_FAILED, msg);
-		return NULL;
-	}
-
-	if (newmessage == NULL)
-		return (char*)msg;
-
-	/* OTR message. Need to do fragmentation */
-
-#ifdef LIBOTR3
-	if (!(co = otr_getcontext(accname, to, FALSE, ircctx))) {
-		otr_notice(ircctx, to, TXT_SEND_CHANGE);
-		return NULL;
-	}
-
-	err = otrl_message_fragment_and_send(
-		&otr_ops,
-		ircctx,
-		co,
-		newmessage,
-		OTRL_FRAGMENT_SEND_ALL,
-		NULL);
-
-	if (err != 0) {
-		otr_notice(ircctx, to, TXT_SEND_FRAGMENT, msg);
-	} else
-		otr_debug(ircctx, to, TXT_SEND_CONVERTED, newmessage);
-#endif
-
-	return NULL;
-}
-
-struct ctxlist_ *otr_contexts(IOUSTATE *ioustate)
-{
-	ConnContext *context;
-	Fingerprint *fprint;
-	struct ctxlist_ *ctxlist = NULL, *ctxhead = NULL;
-	struct fplist_ *fplist, *fphead;
-	char fp[41];
-	char *trust;
-	int i;
-
-	for (context = ioustate->otr_state->context_root; context;
-	     context = context->next) {
-		if (!ctxlist)
-			ctxhead = ctxlist = g_malloc0(sizeof(struct ctxlist_));
-		else
-			ctxlist = ctxlist->next = g_malloc0(sizeof(struct
-								   ctxlist_));
-		switch (context->msgstate) {
-		case OTRL_MSGSTATE_PLAINTEXT: ctxlist->state = STUNENCRYPTED;
-			break;
-		case OTRL_MSGSTATE_ENCRYPTED: ctxlist->state = STENCRYPTED;
-			break;
-		case OTRL_MSGSTATE_FINISHED: ctxlist->state = STFINISHED;
-			break;
-		default: ctxlist->state = STUNKNOWN; break;
-		}
-		ctxlist->username = context->username;
-		ctxlist->accountname = context->accountname;
-
-		fplist = fphead = NULL;
-		for (fprint = context->fingerprint_root.next; fprint;
-		     fprint = fprint->next) {
-			if (!fplist)
-				fphead = fplist = g_malloc0(sizeof(struct
-								   fplist_));
-			else
-				fplist = fplist->next =
-						 g_malloc0(sizeof(struct
-								  fplist_));
-			trust = fprint->trust ? : "";
-			for (i = 0; i < 20; ++i)
-				sprintf(fp + i * 2, "%02x",
-					fprint->fingerprint[i]);
-			fplist->fp = g_strdup(fp);
-			if (*trust == '\0')
-				fplist->authby = NOAUTH;
-			else if (strcmp(trust, "smp") == 0)
-				fplist->authby = AUTHSMP;
-			else
-				fplist->authby = AUTHMAN;
-		}
-
-		ctxlist->fplist = fphead;
-	}
-	return ctxhead;
-}
-
-/*
- * Get the OTR status of this conversation.
- */
-int otr_getstatus(IRC_CTX *ircctx, const char *nick)
-{
-	ConnContext *co;
-	char accname[128];
-	struct co_info *coi;
-
-	IRCCTX_ACCNAME(accname, ircctx);
-
-	if (!(co = otr_getcontext(accname, nick, FALSE, ircctx))) {
-		return IO_ST_PLAINTEXT;
-	}
-
-	coi = co->app_data;
-
-	switch (co->msgstate) {
-	case OTRL_MSGSTATE_PLAINTEXT:
-		return IO_ST_PLAINTEXT;
-	case OTRL_MSGSTATE_ENCRYPTED: {
-		char *trust = co->active_fingerprint->trust;
-		int ex = co->smstate->nextExpected;
-		int code = 0;
-
-		switch (ex) {
-		case OTRL_SMP_EXPECT1:
-			if (coi->received_smp_init)
-				code = IO_ST_SMP_INCOMING;
-			break;
-		case OTRL_SMP_EXPECT2:
-			code = IO_ST_SMP_OUTGOING;
-			break;
-		case OTRL_SMP_EXPECT3:
-		case OTRL_SMP_EXPECT4:
-			code = IO_ST_SMP_FINALIZE;
-			break;
-		default:
-			otr_logst(
-				MSGLEVEL_CRAP,
-				"Encountered unknown SMP state in libotr, please let maintainers know");
-			return IO_ST_UNKNOWN;
-		}
-
-		if (trust && (*trust != '\0'))
-			code |= strcmp(trust, "smp") == 0 ? IO_ST_TRUST_SMP :
-				IO_ST_TRUST_MANUAL;
-		else
-			code |= IO_ST_UNTRUSTED;
-
-		return code;
-	}
-	case OTRL_MSGSTATE_FINISHED:
-		return IO_ST_FINISHED;
-	default:
-		otr_logst(
-			MSGLEVEL_CRAP,
-			"BUG Found! Please write us a mail and describe how you got here");
-		return IO_ST_UNKNOWN;
-	}
-}
-
-/*
- * Finish the conversation.
- */
-void otr_finish(IRC_CTX *ircctx, char *nick, const char *peername,
-		int inquery)
-{
-	ConnContext *co;
-	char accname[128];
-	struct co_info *coi;
-	char nickbuf[128];
-
-	if (peername) {
-		nick = nickbuf;
-		ircctx = ircctx_by_peername(peername, nick);
-		if (!ircctx)
-			return;
-	}
-
-	IRCCTX_ACCNAME(accname, ircctx);
-
-	if (!(co = otr_getcontext(accname, nick, FALSE, ircctx))) {
-		if (inquery)
-			otr_noticest(TXT_CTX_NOT_FOUND,
-				     accname, nick);
-		return;
-	}
-
-	otrl_message_disconnect(IRCCTX_IO_US(ircctx)->otr_state,
-				&otr_ops, ircctx, accname,
-				PROTOCOLID,
-#ifdef LIBOTR3
-				nick);
-#else
-				nick, co->their_instance);
-#endif
-
-	otr_status_change(ircctx, nick, IO_STC_FINISHED);
-
-	if (inquery) {
-		otr_info(ircctx, nick, TXT_CMD_FINISH, nick,
-			 IRCCTX_ADDR(ircctx));
-	} else {
-		otr_infost(TXT_CMD_FINISH, nick, IRCCTX_ADDR(ircctx));
-	}
-
-	coi = co->app_data;
-
-	/* finish if /otr finish has been issued. Reset if
-	 * we're called cause the query window has been closed. */
-	if (coi)
-		coi->finished = inquery;
-
-#ifndef LIBOTR3
-	// write the finished into the master as well
-	co = otrl_context_find(
-		IRCCTX_IO_US(ircctx)->otr_state,
-		nick,
-		accname,
-		PROTOCOLID,
-		OTRL_INSTAG_MASTER,
-		FALSE,
-		NULL,
-		NULL,
-		NULL);
-	coi = co->app_data;
-	if (coi)
-		coi->finished = inquery;
-#endif
-}
-
-void otr_finishall(IOUSTATE *ioustate)
-{
-	ConnContext *context;
-	int finished = 0;
-
-	for (context = ioustate->otr_state->context_root; context;
-	     context = context->next) {
-		struct co_info *coi = context->app_data;
-
-		if (context->msgstate != OTRL_MSGSTATE_ENCRYPTED)
-			continue;
-
-		otrl_message_disconnect(ioustate->otr_state, &otr_ops,
-					coi->ircctx,
-					context->accountname,
-					PROTOCOLID,
-#ifdef LIBOTR3
-					context->username);
-#else
-					context->username,
-					context->their_instance);
-#endif
-		otr_status_change(coi->ircctx, context->username,
-				  IO_STC_FINISHED);
-
-		otr_infost(TXT_CMD_FINISH, context->username,
-			   IRCCTX_ADDR(coi->ircctx));
-		finished++;
-	}
-
-	if (!finished)
-		otr_infost(TXT_CMD_FINISHALL_NONE);
-}
-
-/*
- * Trust our peer.
- */
-void otr_trust(IRC_CTX *ircctx, char *nick, const char *peername)
-{
-	ConnContext *co;
-	char accname[128];
-	struct co_info *coi;
-	char nickbuf[128];
-
-	if (peername) {
-		nick = nickbuf;
-		ircctx = ircctx_by_peername(peername, nick);
-		if (!ircctx)
-			return;
-	}
-
-	IRCCTX_ACCNAME(accname, ircctx);
-
-	if (!(co = otr_getcontext(accname, nick, FALSE, ircctx))) {
-		otr_noticest(TXT_CTX_NOT_FOUND,
-			     accname, nick);
-		return;
-	}
-
-	otrl_context_set_trust(co->active_fingerprint, "manual");
-	otr_status_change(ircctx, nick, IO_STC_TRUST_MANUAL);
-
-	coi = co->app_data;
-	coi->smp_failed = FALSE;
-
-	otr_notice(ircctx, nick, TXT_FP_TRUST, nick);
-}
-
-/*
- * Abort any ongoing SMP authentication.
- */
-void otr_abort_auth(ConnContext *co, IRC_CTX *ircctx, const char *nick)
-{
-	struct co_info *coi;
-
-	coi = co->app_data;
-
-	coi->received_smp_init = FALSE;
-
-	otr_notice(ircctx, nick,
-		   co->smstate->nextExpected != OTRL_SMP_EXPECT1 ?
-		   TXT_AUTH_ABORTED_ONGOING :
-		   TXT_AUTH_ABORTED);
-
-	otrl_message_abort_smp(IRCCTX_IO_US(
-				       ircctx)->otr_state, &otr_ops, ircctx,
-			       co);
-	otr_status_change(ircctx, nick, IO_STC_SMP_ABORT);
-}
-
-/*
- * implements /otr authabort
- */
-void otr_authabort(IRC_CTX *ircctx, char *nick, const char *peername)
-{
-	ConnContext *co;
-	char accname[128];
-	char nickbuf[128];
-
-	if (peername) {
-		nick = nickbuf;
-		ircctx = ircctx_by_peername(peername, nick);
-		if (!ircctx)
-			return;
-	}
-
-	IRCCTX_ACCNAME(accname, ircctx);
-
-	if (!(co = otr_getcontext(accname, nick, FALSE, ircctx))) {
-		otr_noticest(TXT_CTX_NOT_FOUND,
-			     accname, nick);
-		return;
-	}
-
-	otr_abort_auth(co, ircctx, nick);
-}
-
-/*
- * Initiate or respond to SMP authentication.
- */
-void otr_auth(IRC_CTX *ircctx, char *nick, const char *peername,
-	      const char *question, const char *secret)
-{
-	ConnContext *co;
-	char accname[128];
-	struct co_info *coi;
-	char nickbuf[128];
-
-	if (peername) {
-		nick = nickbuf;
-		ircctx = ircctx_by_peername(peername, nick);
-		if (!ircctx)
-			return;
-	}
-
-	IRCCTX_ACCNAME(accname, ircctx);
-
-	if (!(co = otr_getcontext(accname, nick, FALSE, ircctx))) {
-		otr_noticest(TXT_CTX_NOT_FOUND,
-			     accname, nick);
-		return;
-	}
-
-	if (co->msgstate != OTRL_MSGSTATE_ENCRYPTED) {
-		otr_notice(ircctx, nick, TXT_AUTH_NEEDENC);
-		return;
-	}
-
-	coi = co->app_data;
-
-	/* Aborting an ongoing auth */
-	if (co->smstate->nextExpected != OTRL_SMP_EXPECT1)
-		otr_abort_auth(co, ircctx, nick);
-
-	coi->smp_failed = FALSE;
-
-	/* reset trust level */
-	if (co->active_fingerprint) {
-		char *trust = co->active_fingerprint->trust;
-		if (trust && (*trust != '\0')) {
-			otrl_context_set_trust(co->active_fingerprint, "");
-			otr_writefps(IRCCTX_IO_US(ircctx));
-		}
-	}
-
-	if (!coi->received_smp_init) {
-#ifndef LIBOTR3
-		if (question)
-			otrl_message_initiate_smp_q(
-				IRCCTX_IO_US(ircctx)->otr_state,
-				&otr_ops,
-				ircctx,
-				co,
-				question,
-				(unsigned char*)secret,
-				strlen(secret));
-		else
-#endif
-		otrl_message_initiate_smp(
-			IRCCTX_IO_US(ircctx)->otr_state,
-			&otr_ops,
-			ircctx,
-			co,
-			(unsigned char*)secret,
-			strlen(secret));
-
-		otr_status_change(ircctx, nick, IO_STC_SMP_STARTED);
-	} else {
-		otrl_message_respond_smp(
-			IRCCTX_IO_US(ircctx)->otr_state,
-			&otr_ops,
-			ircctx,
-			co,
-			(unsigned char*)secret,
-			strlen(secret));
-		otr_status_change(ircctx, nick, IO_STC_SMP_RESPONDED);
-	}
-
-	otr_notice(ircctx, nick,
-		   coi->received_smp_init ?
-		   TXT_AUTH_RESPONDING :
-		   TXT_AUTH_INITIATED);
-}
-
-/*
- * Handles incoming TLVs of the SMP authentication type. We're not only updating
- * our own state but also giving libotr a leg up so it gets through the auth.
- */
-void otr_handle_tlvs(OtrlTLV *tlvs, ConnContext *co,
-		     struct co_info *coi,
-		     IRC_CTX *ircctx, const char *from)
-{
-	int abort = FALSE;
-
-	OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1);
-	if (tlv) {
-		if (co->smstate->nextExpected != OTRL_SMP_EXPECT1) {
-			otr_notice(ircctx, from, TXT_AUTH_HAVE_OLD,
-				   from);
-			abort = TRUE;
-		} else {
-			otr_notice(ircctx, from, TXT_AUTH_PEER,
-				   from);
-			coi->received_smp_init = TRUE;
-			otr_status_change(ircctx, from, IO_STC_SMP_INCOMING);
-		}
-	}
-
-	tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP2);
-	if (tlv) {
-		if (co->smstate->nextExpected != OTRL_SMP_EXPECT2) {
-			otr_notice(ircctx, from,
-				   TXT_AUTH_PEER_REPLY_WRONG,
-				   from);
-			abort = TRUE;
-		} else {
-			otr_notice(ircctx, from,
-				   TXT_AUTH_PEER_REPLIED,
-				   from);
-			co->smstate->nextExpected = OTRL_SMP_EXPECT4;
-			otr_status_change(ircctx, from, IO_STC_SMP_FINALIZE);
-		}
-	}
-
-	tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP3);
-	if (tlv) {
-		if (co->smstate->nextExpected != OTRL_SMP_EXPECT3) {
-			otr_notice(ircctx, from,
-				   TXT_AUTH_PEER_WRONG_SMP3,
-				   from);
-			abort = TRUE;
-		} else {
-			char *trust = co->active_fingerprint->trust;
-			if (trust && (*trust != '\0')) {
-				otr_notice(ircctx, from,
-					   TXT_AUTH_SUCCESSFUL);
-				otr_status_change(ircctx, from,
-						  IO_STC_SMP_SUCCESS);
-			} else {
-				otr_notice(ircctx, from,
-					   TXT_AUTH_FAILED);
-				coi->smp_failed = TRUE;
-				otr_status_change(ircctx, from,
-						  IO_STC_SMP_FAILED);
-			}
-			co->smstate->nextExpected = OTRL_SMP_EXPECT1;
-			coi->received_smp_init = FALSE;
-		}
-	}
-
-	tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP4);
-	if (tlv) {
-		if (co->smstate->nextExpected != OTRL_SMP_EXPECT4) {
-			otr_notice(ircctx, from,
-				   TXT_AUTH_PEER_WRONG_SMP4,
-				   from);
-			abort = TRUE;
-		} else {
-			char *trust = co->active_fingerprint->trust;
-			if (trust && (*trust != '\0')) {
-				otr_notice(ircctx, from,
-					   TXT_AUTH_SUCCESSFUL);
-				otr_status_change(ircctx, from,
-						  IO_STC_SMP_SUCCESS);
-			} else {
-				/* unreachable since 4 is never sent out on
-				 * error */
-				otr_notice(ircctx, from,
-					   TXT_AUTH_FAILED);
-				coi->smp_failed = TRUE;
-				otr_status_change(ircctx, from,
-						  IO_STC_SMP_FAILED);
-			}
-			co->smstate->nextExpected = OTRL_SMP_EXPECT1;
-			coi->received_smp_init = FALSE;
-		}
-	}
-	if (abort) {
-		otr_abort_auth(co, ircctx, from);
-		otr_status_change(ircctx, from, IO_STC_SMP_ABORTED);
-	}
-
-	tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
-	if (tlv) {
-		otr_status_change(ircctx, from, IO_STC_PEER_FINISHED);
-		otr_notice(ircctx, from, TXT_PEER_FINISHED, from);
-	}
-}
-
-/*
- * Hand the given message to OTR.
- * Returns NULL if its an OTR protocol message and
- * the (possibly) decrypted message otherwise.
- */
-char *otr_receive(IRC_CTX *ircctx, const char *msg, const char *from)
-{
-	int ignore_message;
-	char *newmessage = NULL;
-	char accname[256];
-	char *lastmsg;
-	ConnContext *co;
-	struct co_info *coi;
-	OtrlTLV *tlvs;
-
-	IRCCTX_ACCNAME(accname, ircctx);
-
-	if (!(co = otr_getcontext(accname, from, TRUE, ircctx))) {
-		otr_noticest(TXT_CTX_NOT_CREATE,
-			     accname, from);
-		return NULL;
-	}
-
-	coi = co->app_data;
-
-	/* Really lame but I don't see how you could do this in a generic
-	 * way unless the IRC server would somehow mark continuation messages.
-	 */
-	if ((strcmp(msg, coi->better_msg_two) == 0) ||
-	    (strcmp(msg, formats[TXT_OTR_BETTER_THREE].def) == 0)) {
-		otr_debug(ircctx, from, TXT_RECEIVE_IGNORE_QUERY);
-		return NULL;
-	}
-
-	/* The server might have split lines that were too long
-	 * (bitlbee does that). The heuristic is simple: If we can find ?OTR:
-	 * in the message but it doesn't end with a ".", queue it and wait
-	 * for the rest.
-	 */
-	lastmsg = co->app_data;
-
-	if (coi->msgqueue) { /* already something in the queue */
-		strcpy(coi->msgqueue + strlen(coi->msgqueue), msg);
-
-		/* wait for more? */
-		if ((strlen(msg) > OTR_MAX_MSG_SIZE) &&
-		    (msg[strlen(msg) - 1] != '.') &&
-		    (msg[strlen(msg) - 1] != ','))
-			return NULL;
-
-		otr_debug(ircctx, from, TXT_RECEIVE_DEQUEUED,
-			  strlen(coi->msgqueue));
-
-		msg = coi->msgqueue;
-		coi->msgqueue = NULL;
-
-		/* this is freed thru our caller by otrl_message_free.
-		 * Currently ok since that just uses free().
-		 */
-	} else if (strstr(msg, "?OTR:") &&
-		   (strlen(msg) > OTR_MAX_MSG_SIZE) &&
-		   (msg[strlen(msg) - 1] != '.') &&
-		   (msg[strlen(msg) - 1] != ',')) {
-		coi->msgqueue = malloc(4096 * sizeof(char));
-		strcpy(coi->msgqueue, msg);
-		otr_debug(ircctx, from, TXT_RECEIVE_QUEUED, strlen(msg));
-		return NULL;
-	}
-
-	otr_logst(MSGLEVEL_CRAP, "%d: receive...", time(NULL));
-	ignore_message = otrl_message_receiving(
-		IRCCTX_IO_US(ircctx)->otr_state,
-		&otr_ops,
-		ircctx,
-		accname,
-		PROTOCOLID,
-		from,
-		msg,
-		&newmessage,
-		&tlvs,
-#ifdef LIBOTR3
-		NULL,
-		NULL);
-#else
-		&co,
-		context_add_app_info,
-		ircctx);
-#endif
-	otr_logst(MSGLEVEL_CRAP, "%d: received", time(NULL));
-
-	if (tlvs) {
-#ifdef LIBOTR3
-		otr_handle_tlvs(tlvs, co, coi, ircctx, from);
-#else
-		OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
-		if (tlv) {
-			otr_status_change(ircctx, from, IO_STC_PEER_FINISHED);
-			otr_notice(ircctx, from, TXT_PEER_FINISHED, from);
-		}
-#endif
-	}
-
-	if (ignore_message) {
-		otr_debug(ircctx, from,
-			  TXT_RECEIVE_IGNORE, strlen(msg), accname, from, msg);
-		return NULL;
-	}
-
-	if (newmessage)
-		otr_debug(ircctx, from, TXT_RECEIVE_CONVERTED);
-
-	return newmessage ? : (char*)msg;
-}
-
-void otr_setpolicies(IOUSTATE *ioustate, const char *policies, int known)
-{
-#ifdef HAVE_GREGEX_H
-	GMatchInfo *match_info;
-	GSList *plist = known ? ioustate->plistknown : ioustate->plistunknown;
-
-	if (plist) {
-		GSList *p = plist;
-		do {
-			struct plistentry *ple = p->data;
-			g_pattern_spec_free(ple->namepat);
-			g_free(p->data);
-		} while ((p = g_slist_next(p)));
-
-		g_slist_free(plist);
-		plist = NULL;
-	}
-
-	g_regex_match(regex_policies, policies, 0, &match_info);
-
-	while (g_match_info_matches(match_info)) {
-		struct plistentry *ple =
-			(struct plistentry*)g_malloc0(sizeof(struct
-							     plistentry));
-		char *pol = g_match_info_fetch(match_info, 2);
-
-		ple->namepat =
-			g_pattern_spec_new(g_match_info_fetch(match_info, 1));
-
-		switch (*pol) {
-		case 'n':
-			ple->policy = OTRL_POLICY_NEVER;
-			break;
-		case 'm':
-			ple->policy = OTRL_POLICY_MANUAL;
-			break;
-		case 'h':
-			ple->policy = OTRL_POLICY_MANUAL |
-				      OTRL_POLICY_WHITESPACE_START_AKE;
-			break;
-		case 'o':
-			ple->policy = OTRL_POLICY_OPPORTUNISTIC;
-			break;
-		case 'a':
-			ple->policy = OTRL_POLICY_ALWAYS;
-			break;
-		}
-
-		plist = g_slist_append(plist, ple);
-
-		g_free(pol);
-
-		g_match_info_next(match_info, NULL);
-	}
-
-	g_match_info_free(match_info);
-
-	if (known)
-		ioustate->plistknown = plist;
-	else
-		ioustate->plistunknown = plist;
-#endif
-}
diff --git a/weechat/.gitignore b/weechat/.gitignore
deleted file mode 100644
index 73fe751..0000000
--- a/weechat/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-weechat-plugin.h
diff --git a/weechat/CMakeLists.txt b/weechat/CMakeLists.txt
deleted file mode 100644
index 7369388..0000000
--- a/weechat/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-IF(NOT WEECHAT_INCLUDE_DIR)
-  MESSAGE(FATAL_ERROR "*** no weechat found. If you don't want this plugin set the
-  appropriate option to OFF, use for instance 'ccmake .' ***")
-ENDIF(NOT WEECHAT_INCLUDE_DIR)
-
-MESSAGE(STATUS "*** building for weechat ***")
-
-SET(WEECHATOTR_INCLUDE_DIRS
-  ${WEECHAT_INCLUDE_DIR}/weechat
-  ${PROJECT_SOURCE_DIR}/weechat)
-
-INCLUDE_DIRECTORIES(${WEECHATOTR_INCLUDE_DIRS})
-
-ADD_LIBRARY(weechatotr SHARED weechat_otr.c ../otr_util.c ../otr_ops.c ../otr_key.c ../io_util.c ../io_set.c ${PROJECT_BINARY_DIR}/xchat-formats.c)
-TARGET_LINK_LIBRARIES(weechatotr ${GLIB_LIBRARIES} ${LIBOTR_LIBRARIES})
-SET_TARGET_PROPERTIES(weechatotr PROPERTIES 
-  COMPILE_FLAGS -DTARGET_WEECHAT
-  OUTPUT_NAME "weechatotr"
-  LINK_FLAGS "${MAIN_LDFLAGS}")
-
-add_dependencies(weechatotr otrformats)
-set_source_files_properties(${CMAKE_BINARY_DIR}/xchat-formats.c PROPERTIES GENERATED TRUE)
-
-IF(APPLE)
-  SET_TARGET_PROPERTIES(weechatotr PROPERTIES SUFFIX ".so")
-ENDIF(APPLE)
-
-# docdir
-
-IF(NOT DOCDIR)
-  SET(DOCDIR share/doc/weechat-otr)
-ENDIF(NOT DOCDIR)
-
-SET_TARGET_PROPERTIES(weechatotr PROPERTIES PREFIX "" OUTPUT_NAME "irc-otr")
-
-INSTALL(TARGETS weechatotr DESTINATION lib${LIB_SUFFIX}/weechat/plugins)
-INSTALL(FILES README LICENSE DESTINATION ${DOCDIR})
diff --git a/weechat/weechat_otr.c b/weechat/weechat_otr.c
deleted file mode 100644
index 32b84fe..0000000
--- a/weechat/weechat_otr.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2009  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "otr.h"
-
-WEECHAT_PLUGIN_NAME("irc-otr");
-WEECHAT_PLUGIN_DESCRIPTION("Off-The-Record Messaging for WeeChat");
-WEECHAT_PLUGIN_AUTHOR("Uli Meis <a.sporto+bee at gmail.com>");
-WEECHAT_PLUGIN_VERSION(IRCOTR_VERSION);
-WEECHAT_PLUGIN_WEECHAT_VERSION("unknown");
-WEECHAT_PLUGIN_LICENSE("GPL3");
-
-struct t_weechat_plugin *weechat_otr_plugin = NULL;
-struct t_gui_bar_item *otr_statusbar;
-
-int debug = 0;
-
-#ifdef HAVE_GREGEX_H
-GRegex *regex_nickignore = NULL;
-#endif
-
-static IOUSTATE *ioustate;
-
-void printformatva(IRC_CTX *ircctx, const char *nick, const char *format,
-		   va_list params)
-{
-	char msg[LOGMAX], *s = msg;
-	char *server = NULL;
-	struct t_gui_buffer *buffer = NULL;
-
-	if (ircctx)
-		server = ircctx->address;
-
-	if (server && nick) {
-		char s[256];
-		sprintf(s, "%s.%s", ircctx->address, nick);
-		buffer = weechat_buffer_search("irc", s);
-		if (!buffer) {
-			char cmd[256];
-			sprintf(cmd, "/query -server %s %s", ircctx->address,
-				nick);
-			weechat_command(NULL, cmd);
-			buffer = weechat_buffer_search("irc", s);
-			if (!buffer)
-				weechat_printf(
-					NULL, "OTR:\tFailed to create "
-					"a buffer for the following "
-					"message! server=%s,nick=%s",
-					ircctx->address, nick);
-		}
-	}
-
-	if (vsnprintf(s, LOGMAX, format, params) < 0)
-		sprintf(s, "internal error parsing error string (BUG)");
-	va_end(params);
-
-	weechat_printf(buffer, "OTR:\t%s", s);
-}
-
-void printformat(IRC_CTX *ircctx, const char *nick, int lvl, int fnum, ...)
-{
-	va_list params;
-	va_start(params, fnum);
-
-	printformatva(ircctx, nick, formats[fnum].def, params);
-}
-
-void otr_log(IRC_CTX *ircctx, const char *nick, int level, const char *format,
-	     ...)
-{
-	va_list params;
-	va_start(params, format);
-
-	printformatva(ircctx, nick, format, params);
-}
-
-#define wc_printf(server, nick, format, ...) \
-	otr_log(server, nick, 0, format, ## __VA_ARGS__)
-
-#define wc_debug(server, nick, format, ...) { \
-		if (debug) \
-			wc_printf(server, nick,	\
-				  format, ## __VA_ARGS__); \
-}
-
-void irc_send_message(IRC_CTX *ircctx, const char *recipient, char *msg)
-{
-	char nmsg[512];
-
-	wc_debug(ircctx, recipient, "OTR injection %s.%s: %s",
-		 ircctx->address, recipient,
-		 msg);
-	sprintf(nmsg, "/quote -server %s PRIVMSG %s :%s", ircctx->address,
-		recipient,
-		msg);
-	weechat_command(NULL, nmsg);
-}
-
-IRC_CTX *ircctx_by_peername(const char *peername, char *nick)
-{
-	char *address;
-	static IRC_CTX ircctx;
-	static char pname[256];
-
-	strcpy(pname, peername);
-
-	address = strchr(pname, '@');
-
-	if (!address)
-		return NULL;
-
-	*address = '\0';
-	strcpy(nick, pname);
-	*address++ = '@';
-
-	ircctx.address = address;
-	ircctx.nick = pname;
-
-	return &ircctx;
-}
-
-char *wc_modifier_privmsg_in(void *data, const char *modifier,
-			     const char *modifier_data, const char *string)
-{
-	int argc;
-	char **argv, **argv_eol;
-	char nick[256];
-	char *newmsg, *msg;
-	IRC_CTX ircctx;
-	char cmsg[512];
-
-	string = strdup(string);
-
-	argv = weechat_string_explode(string, " ", 0, 0, &argc);
-	argv_eol = weechat_string_explode(string, " ", 1, 0, NULL);
-
-	if (!extract_nick(nick, argv[0]))
-		goto done;
-
-	if ((*argv[2] == '&') || (*argv[2] == '#'))
-		goto done;
-
-#ifdef HAVE_GREGEX_H
-	if (g_regex_match(regex_nickignore, nick, 0, NULL))
-		goto done;
-#endif
-
-	ircctx.address = (char*)modifier_data;
-	ircctx.nick = argv[2];
-
-	msg = argv_eol[3] + 1;
-	wc_debug(&ircctx, nick,
-		 "otr receive own %s, server %s, nick %s, msg %s",
-		 ircctx.nick, ircctx.address, nick,
-		 msg);
-	newmsg = otr_receive(&ircctx, msg, nick);
-
-	if (!newmsg) {
-		string = strdup("");
-		goto done;
-	}
-
-	if (newmsg == msg) {
-		goto done;
-	}
-
-	snprintf(cmsg, 511, "%s %s %s :%s", argv[0], argv[1], argv[2], newmsg);
-
-	otrl_message_free(newmsg);
-
-	string = strdup(cmsg);
- done:
-	weechat_string_free_exploded(argv);
-	weechat_string_free_exploded(argv_eol);
-
-	return (char*)string;
-}
-
-char *wc_modifier_privmsg_out(void *data, const char *modifier,
-			      const char *modifier_data, const char *string)
-{
-	int argc;
-	char **argv, **argv_eol;
-	IRC_CTX ircctx;
-	char newmsg[512];
-	char *otrmsg;
-	char s[256];
-	char *msg;
-
-	argv = weechat_string_explode(string, " ", 0, 0, &argc);
-	argv_eol = weechat_string_explode(string, " ", 1, 0, NULL);
-
-	string = strdup(string);
-
-	if ((*argv[1] == '&') || (*argv[1] == '#'))
-		goto done;
-
-	msg = argv_eol[2] + 1;
-
-#ifdef HAVE_GREGEX_H
-	if (g_regex_match(regex_nickignore, argv[1], 0, NULL))
-		goto done;
-#endif
-
-	/* we're unfortunately fed back stuff from irc_send_message above */
-	if (strncmp(msg, "?OTR", 4) == 0)
-		goto done;
-
-	ircctx.address = (char*)modifier_data;
-	sprintf(s, "%s.%s", ircctx.address, argv[1]);
-
-	ircctx.nick = (char*)weechat_info_get("irc_nick", ircctx.address);
-
-	wc_debug(&ircctx, argv[1],
-		 "otr send own %s, server %s, nick %s, msg %s",
-		 ircctx.nick, ircctx.address, argv[1],
-		 msg);
-	otrmsg = otr_send(&ircctx, msg, argv[1]);
-
-	if (otrmsg == msg)
-		goto done;
-
-	if (!otrmsg) {
-		wc_debug(&ircctx, argv[1], "OTR send NULL");
-		free((char*)string);
-		string = strdup("");
-		goto done;
-	}
-
-	wc_debug(&ircctx, argv[1], "NEWMSG");
-	snprintf(newmsg, 511, "PRIVMSG %s :%s", argv[1], otrmsg);
-
-	otrl_message_free(otrmsg);
-
-	free((char*)string);
-	string = newmsg;
-
- done:
-	weechat_string_free_exploded(argv);
-	weechat_string_free_exploded(argv_eol);
-
-	return (char*)string;
-}
-
-int cmd_otr(void *data, struct t_gui_buffer *buffer, int argc, char **word,
-	    char **word_eol)
-{
-	const char *own_nick = weechat_buffer_get_string(buffer,
-							 "localvar_nick");
-	const char *server = weechat_buffer_get_string(buffer,
-						       "localvar_server");
-	char *target = (char*)weechat_buffer_get_string(buffer, "short_name");
-	IRC_CTX ircctxs = {
-		.nick = (char*)own_nick,
-		.address = (char*)server
-	},
-	*ircctx = &ircctxs;
-
-	word++;
-	word_eol++;
-	argc--;
-
-	cmd_generic(ioustate, ircctx, argc, word, word_eol, target);
-
-	return WEECHAT_RC_OK;
-}
-
-/*
- * otr status bar
- */
-char* otr_statusbar_callback(void *data,
-			     struct t_gui_bar_item *item,
-			     struct t_gui_window *window)
-{
-	const char *target;
-	IRC_CTX ircctx;
-	int formatnum;
-	struct t_gui_buffer *buffer =
-		weechat_window_get_pointer(window, "buffer");
-	const char *type = weechat_buffer_get_string(buffer, "localvar_type");
-
-	if (!type || strcmp(type, "private") != 0)
-		return strdup("");
-
-	ircctx.nick = (char*)weechat_buffer_get_string(buffer,
-						       "localvar_nick");
-	ircctx.address = (char*)weechat_buffer_get_string(buffer,
-							  "localvar_server");
-	target = weechat_buffer_get_string(buffer, "short_name");
-
-	formatnum = otr_getstatus_format(&ircctx, target);
-
-	return strdup(formats[formatnum].def);
-}
-
-
-void otr_status_change(IRC_CTX *ircctx, const char *nick, int event)
-{
-	char signalname[128];
-	char servernick[256];
-
-	sprintf(signalname, "OTR_%s", otr_status_txt[event]);
-	sprintf(servernick, "%s,%s", ircctx->address, nick);
-
-	weechat_hook_signal_send(signalname,
-				 WEECHAT_HOOK_SIGNAL_STRING,
-				 servernick);
-
-	weechat_bar_item_update("otr");
-}
-
-int weechat_plugin_init(struct t_weechat_plugin *plugin, int argc,
-			char *argv[])
-{
-	weechat_plugin = plugin;
-
-	weechat_hook_modifier("irc_in_privmsg", &wc_modifier_privmsg_in, NULL);
-	weechat_hook_modifier("irc_out_privmsg", &wc_modifier_privmsg_out,
-			      NULL);
-
-	if (otrlib_init())
-		return WEECHAT_RC_ERROR;
-
-	ioustate = otr_init_user("one to rule them all");
-
-	otr_setpolicies(ioustate, IO_DEFAULT_POLICY, FALSE);
-	otr_setpolicies(ioustate, IO_DEFAULT_POLICY_KNOWN, TRUE);
-
-#ifdef HAVE_GREGEX_H
-	if (regex_nickignore)
-		g_regex_unref(regex_nickignore);
-	regex_nickignore = g_regex_new(IO_DEFAULT_IGNORE, 0, 0, NULL);
-#endif
-
-	weechat_hook_command("otr",
-			     N_("Control the OTR module"),
-			     N_("[text]"),
-			     N_("text: write this text"),
-			     "",
-			     &cmd_otr, NULL);
-
-	cmds[CMDCOUNT].name = "set";
-	cmds[CMDCOUNT].cmdfunc = cmd_set;
-
-	otr_statusbar = weechat_bar_item_new("otr", &otr_statusbar_callback,
-					     NULL);
-	weechat_bar_item_update("otr");
-
-	return WEECHAT_RC_OK;
-}
-
-int weechat_plugin_end(struct t_weechat_plugin *plugin)
-{
-	weechat_bar_item_remove(otr_statusbar);
-
-	otr_deinit_user(ioustate);
-
-	otrlib_deinit();
-
-	return WEECHAT_RC_OK;
-}
diff --git a/weechat/weechat_otr.h b/weechat/weechat_otr.h
deleted file mode 100644
index c97623e..0000000
--- a/weechat/weechat_otr.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2009  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "weechat-plugin.h"
-
-extern struct t_weechat_plugin *weechat_otr_plugin;
-#define weechat_plugin weechat_otr_plugin
-
-#define MAX_FORMAT_PARAMS 10
-
-struct _IRC_CTX {
-	char *nick;
-	char *address;
-};
-
-typedef struct _IRC_CTX IRC_CTX;
-struct _FORMAT_REC {
-	char *tag;
-	char *def;
-
-	int params;
-	int paramtypes[MAX_FORMAT_PARAMS];
-};
-
-typedef struct _FORMAT_REC FORMAT_REC;
-
-enum { MSGLEVEL_CRAP, MSGLEVEL_MSGS } lvls;
-
-/* stuff from io_set.c */
-extern char set_policy[512];
-extern char set_policy_known[512];
-extern char set_ignore[512];
-extern int set_finishonunload;
-void cmd_set(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc, char *argv[],
-	     char *argv_eol[],
-	     char *target);
-
-#define get_client_config_dir() weechat_info_get("weechat_dir", NULL)
-
-void printformat(IRC_CTX *ircctx, const char *nick, int lvl, int fnum, ...);
-
-#define otr_noticest(formatnum, ...) \
-	printformat(NULL, NULL, MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__)
-
-#define otr_notice(server, nick, formatnum, ...) \
-	printformat(server, nick, MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__)
-
-#define otr_infost(formatnum, ...) \
-	printformat(NULL, NULL, MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
-
-#define otr_info(server, nick, formatnum, ...) \
-	printformat(server, nick, MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
-
-#define otr_debug(server, nick, formatnum, ...) { \
-		if (debug) \
-			printformat(server, nick, \
-				    MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__); \
-}
-
-static IRC_CTX *IRCCTX_DUP(IRC_CTX *ircctx) __attribute__ ((unused));
-static void IRCCTX_FREE(IRC_CTX *ircctx) __attribute__ ((unused));
-
-static IRC_CTX *IRCCTX_DUP(IRC_CTX *ircctx)
-{
-	IRC_CTX *nctx = g_memdup(ircctx, sizeof(IRC_CTX));
-
-	nctx->nick = strdup(ircctx->nick);
-	nctx->address = strdup(ircctx->address);
-
-	return nctx;
-}
-
-#define IRCCTX_ADDR(ircctx) ircctx->address
-#define IRCCTX_NICK(ircctx) ircctx->nick
-static void IRCCTX_FREE(IRC_CTX *ircctx)
-{
-	free(ircctx->nick);
-	free(ircctx->address);
-	free(ircctx);
-}
-
-#define IRCCTX_ACCNAME(accname, ircctx) sprintf(accname, "%s@%s", \
-						ircctx->nick, \
-						ircctx->address)
-#define IRCCTX_IO_US(ircctx) (&ioustate_uniq)
-#define IO_CREATE_US(user) (&ioustate_uniq)
-
-/* Don't look beyond this point. Ugly temporary hack. */
-
-#define g_io_add_watch(pid, a, func, b) gioaddwatchfake(pid, func)
-
-#define g_child_watch_add(pid, func, dunno) gchildwatchaddfake(pid, dunno)
-#define g_io_channel_shutdown(channel, FALSE, NULL) \
-	close(g_io_channel_unix_get_fd(channel))
-
-#define g_source_remove(a) gsourceremovefake(a)
-#define guint  struct t_hook *
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-static void *gchildwatchaddfake(int pid, void *doit) __attribute__ ((unused));
-static void *gchildwatchaddfake(int pid, void *doit)
-{
-	if (doit)
-		waitpid(pid, NULL, 0);
-	return NULL;
-}
-
-static void gsourceremovefake(struct t_hook *hook) __attribute__ ((unused));
-static void gsourceremovefake(struct t_hook *hook)
-{
-	if (hook)
-		weechat_unhook(hook);
-}
-
-gboolean keygen_complete(GIOChannel *source, GIOCondition condition,
-			 gpointer data);
-
-static int cb(void *data)
-{
-	keygen_complete(NULL, 0, NULL);
-	return TRUE;
-}
-
-static struct t_hook *gioaddwatchfake(GIOChannel *source, int (*func)(
-					      GIOChannel *source,
-					      GIOCondition
-					      condition,
-					      gpointer
-					      data))
-__attribute__ ((unused));
-
-static struct t_hook *gioaddwatchfake(GIOChannel *source, int (*func)(
-					      GIOChannel *source,
-					      GIOCondition
-					      condition,
-					      gpointer data))
-{
-	return weechat_hook_fd(g_io_channel_unix_get_fd(
-				       source), TRUE, FALSE, FALSE, cb, NULL);
-}
diff --git a/xchat/CMakeLists.txt b/xchat/CMakeLists.txt
deleted file mode 100644
index e235d7f..0000000
--- a/xchat/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-IF(NOT XCHAT_INCLUDE_DIR)
-  MESSAGE(FATAL_ERROR "*** no xchat found. If you don't want this plugin set the
-  appropriate option to OFF, use for instance 'ccmake .' ***")
-ENDIF(NOT XCHAT_INCLUDE_DIR)
-
-MESSAGE(STATUS "*** building for xchat ***")
-
-SET(XCHATOTR_INCLUDE_DIRS
-  ${XCHAT_INCLUDE_DIR}/xchat
-  ${PROJECT_SOURCE_DIR}/xchat)
-
-INCLUDE_DIRECTORIES(${XCHATOTR_INCLUDE_DIRS})
-
-ADD_LIBRARY(xchatotr SHARED xchat_otr.c ../otr_util.c ../otr_ops.c ../otr_key.c ../io_util.c ../io_set.c ${PROJECT_BINARY_DIR}/xchat-formats.c)
-TARGET_LINK_LIBRARIES(xchatotr ${GLIB_LIBRARIES} ${LIBOTR_LIBRARIES})
-SET_TARGET_PROPERTIES(xchatotr PROPERTIES 
-  COMPILE_FLAGS -DTARGET_XCHAT
-  OUTPUT_NAME "xchatotr"
-  LINK_FLAGS "${MAIN_LDFLAGS}")
-
-add_dependencies(xchatotr otrformats)
-set_source_files_properties(${CMAKE_BINARY_DIR}/xchat-formats.c PROPERTIES GENERATED TRUE)
-
-IF(APPLE)
-  SET_TARGET_PROPERTIES(xchatotr PROPERTIES SUFFIX ".so")
-ENDIF(APPLE)
-
-# docdir
-
-IF(NOT DOCDIR)
-  SET(DOCDIR share/doc/xchat-otr)
-ENDIF(NOT DOCDIR)
-
-INSTALL(TARGETS xchatotr DESTINATION lib${LIB_SUFFIX}/xchat/plugins)
-INSTALL(FILES README LICENSE DESTINATION ${DOCDIR})
diff --git a/xchat/xchat_otr.c b/xchat/xchat_otr.c
deleted file mode 100644
index 91c25fa..0000000
--- a/xchat/xchat_otr.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2009  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "otr.h"
-
-int debug = 0;
-
-#ifdef HAVE_GREGEX_H
-GRegex *regex_nickignore = NULL;
-#endif
-
-static IOUSTATE *ioustate;
-
-xchat_plugin *ph;
-
-void irc_send_message(IRC_CTX *ircctx, const char *recipient, char *msg)
-{
-	xchat_commandf(ph, "PRIVMSG %s :%s", recipient, msg);
-}
-
-int cmd_otr(char *word[], char *word_eol[], void *userdata)
-{
-	const char *own_nick = xchat_get_info(ph, "nick");
-	char *target = (char*)xchat_get_info(ph, "channel");
-	const char *server = xchat_get_info(ph, "server");
-	IRC_CTX ircctxs = {
-		.nick = (char*)own_nick,
-		.address = (char*)server
-	},
-	*ircctx = &ircctxs;
-	int argc = 0;
-
-	word += 3;
-	word_eol += 3;
-
-	while (word[argc] && *word[argc])
-		argc++;
-
-	cmd_generic(ioustate, ircctx, argc, word, word_eol, target);
-
-	return XCHAT_EAT_ALL;
-}
-
-int hook_outgoing(char *word[], char *word_eol[], void *userdata)
-{
-	const char *own_nick = xchat_get_info(ph, "nick");
-	const char *channel = xchat_get_info(ph, "channel");
-	const char *server = xchat_get_info(ph, "server");
-	char newmsg[512];
-	char *otrmsg;
-	IRC_CTX ircctx = {
-		.nick = (char*)own_nick,
-		.address = (char*)server
-	};
-
-	if ((*channel == '&') || (*channel == '#'))
-		return XCHAT_EAT_NONE;
-
-#ifdef HAVE_GREGEX_H
-	if (g_regex_match(regex_nickignore, channel, 0, NULL))
-		return XCHAT_EAT_NONE;
-#endif
-	otrmsg = otr_send(&ircctx, word_eol[1], channel);
-
-	if (otrmsg == word_eol[1])
-		return XCHAT_EAT_NONE;
-
-	xchat_emit_print(ph, "Your Message", own_nick, word_eol[1], NULL,
-			 NULL);
-
-	if (!otrmsg)
-		return XCHAT_EAT_ALL;
-
-	snprintf(newmsg, 511, "PRIVMSG %s :%s", channel, otrmsg);
-
-	otrl_message_free(otrmsg);
-	xchat_command(ph, newmsg);
-
-	return XCHAT_EAT_ALL;
-}
-
-int hook_privmsg(char *word[], char *word_eol[], void *userdata)
-{
-	char nick[256];
-	char *newmsg;
-	const char *server = xchat_get_info(ph, "server");
-	const char *own_nick = xchat_get_info(ph, "nick");
-	IRC_CTX ircctx = {
-		.nick = (char*)own_nick,
-		.address = (char*)server
-	};
-	xchat_context *query_ctx;
-
-	if (!extract_nick(nick, word[1]))
-		return XCHAT_EAT_NONE;
-
-#ifdef HAVE_GREGEX_H
-	if (g_regex_match(regex_nickignore, nick, 0, NULL))
-		return XCHAT_EAT_NONE;
-#endif
-
-	newmsg = otr_receive(&ircctx, word_eol[2], nick);
-
-	if (!newmsg) {
-		return XCHAT_EAT_ALL;
-	}
-
-	if (newmsg == word_eol[2]) {
-		return XCHAT_EAT_NONE;
-	}
-
-	query_ctx = xchat_find_context(ph, server, nick);
-
-	if (query_ctx)
-		xchat_set_context(ph, query_ctx);
-
-	xchat_emit_print(ph, "Private Message", nick, newmsg, NULL, NULL);
-
-	otrl_message_free(newmsg);
-
-	return XCHAT_EAT_ALL;
-}
-
-void xchat_plugin_get_info(char **name, char **desc, char **version,
-			   void **reserved)
-{
-	*name = PNAME;
-	*desc = PDESC;
-	*version = PVERSION;
-}
-
-int xchat_plugin_init(xchat_plugin *plugin_handle,
-		      char **plugin_name,
-		      char **plugin_desc,
-		      char **plugin_version,
-		      char *arg)
-{
-	ph = plugin_handle;
-
-	*plugin_name = PNAME;
-	*plugin_desc = PDESC;
-	*plugin_version = PVERSION;
-
-	if (otrlib_init())
-		return 0;
-
-	ioustate = otr_init_user("one to rule them all");
-
-	xchat_hook_server(ph, "PRIVMSG", XCHAT_PRI_NORM, hook_privmsg, 0);
-	xchat_hook_command(ph, "", XCHAT_PRI_NORM, hook_outgoing, 0, 0);
-	xchat_hook_command(ph, "otr", XCHAT_PRI_NORM, cmd_otr, 0, 0);
-
-	otr_setpolicies(ioustate, IO_DEFAULT_POLICY, FALSE);
-	otr_setpolicies(ioustate, IO_DEFAULT_POLICY_KNOWN, TRUE);
-
-#ifdef HAVE_GREGEX_H
-	if (regex_nickignore)
-		g_regex_unref(regex_nickignore);
-	regex_nickignore = g_regex_new(IO_DEFAULT_IGNORE, 0, 0, NULL);
-#endif
-
-	xchat_print(ph, "xchat-otr loaded successfully!\n");
-
-	cmds[CMDCOUNT].name = "set";
-	cmds[CMDCOUNT].cmdfunc = cmd_set;
-
-	return 1;
-}
-
-int xchat_plugin_deinit()
-{
-#ifdef HAVE_GREGEX_H
-	g_regex_unref(regex_nickignore);
-#endif
-
-	if (set_finishonunload)
-		otr_finishall(ioustate);
-
-	otr_deinit_user(ioustate);
-
-	otrlib_deinit();
-
-	return 1;
-}
-
-void printformat(IRC_CTX *ircctx, const char *nick, int lvl, int fnum, ...)
-{
-	va_list params;
-	va_start(params, fnum);
-	char msg[LOGMAX], *s = msg;
-	xchat_context *find_query_ctx;
-	char *server = NULL;
-
-	if (ircctx)
-		server = ircctx->address;
-
-	if (server && nick) {
-		find_query_ctx = xchat_find_context(ph, server, nick);
-		if (find_query_ctx == NULL) {
-			// no query window yet, let's open one
-			xchat_commandf(ph, "query %s", nick);
-			find_query_ctx = xchat_find_context(ph, server, nick);
-		}
-	} else {
-		find_query_ctx = xchat_find_context(ph,
-						    NULL,
-						    xchat_get_info(ph,
-								   "network")
-						    ?
-						    :
-						    xchat_get_info(ph,
-								   "server"));
-	}
-
-	xchat_set_context(ph, find_query_ctx);
-
-	if (vsnprintf(s, LOGMAX, formats[fnum].def, params) < 0)
-		sprintf(s, "internal error parsing error string (BUG)");
-	va_end(params);
-	xchat_printf(ph, "OTR: %s", s);
-}
-
-IRC_CTX *server_find_address(char *address)
-{
-	static IRC_CTX ircctx;
-
-	ircctx.address = address;
-
-	return &ircctx;
-}
diff --git a/xchat/xchat_otr.h b/xchat/xchat_otr.h
deleted file mode 100644
index d2295a9..0000000
--- a/xchat/xchat_otr.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Off-the-Record Messaging (OTR) modules for IRC
- * Copyright (C) 2009  Uli Meis <a.sporto+bee at gmail.com>
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
- */
-
-#include "xchat-plugin.h"
-
-#define PNAME "xchat-otr"
-#define PDESC "Off-The-Record Messaging for xchat"
-#define PVERSION IRCOTR_VERSION
-
-#define MAX_FORMAT_PARAMS 10
-
-
-struct _IRC_CTX {
-	char *nick;
-	char *address;
-};
-
-typedef struct _IRC_CTX IRC_CTX;
-struct _FORMAT_REC {
-	char *tag;
-	char *def;
-
-	int params;
-	int paramtypes[MAX_FORMAT_PARAMS];
-};
-
-typedef struct _FORMAT_REC FORMAT_REC;
-
-enum { MSGLEVEL_CRAP, MSGLEVEL_MSGS } lvls;
-
-extern xchat_plugin *ph;   /* plugin handle */
-
-/* stuff from io_set.c */
-extern char set_policy[512];
-extern char set_policy_known[512];
-extern char set_ignore[512];
-extern int set_finishonunload;
-void cmd_set(IOUSTATE *ioustate, IRC_CTX *ircctx, int argc,
-	     char *argv[], char *argv_eol[], char *target);
-
-#define get_client_config_dir() xchat_get_info(ph, "xchatdir")
-
-void printformat(IRC_CTX *ircctx, const char *nick, int lvl, int fnum, ...);
-
-#define otr_noticest(formatnum, ...) \
-	printformat(NULL, NULL, MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__)
-
-#define otr_notice(server, nick, formatnum, ...) \
-	printformat(server, nick, MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__)
-
-#define otr_infost(formatnum, ...) \
-	printformat(NULL, NULL, MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
-
-#define otr_info(server, nick, formatnum, ...) \
-	printformat(server, nick, MSGLEVEL_CRAP, formatnum, ## __VA_ARGS__)
-
-#define otr_debug(server, nick, formatnum, ...) { \
-		if (debug) \
-			printformat(server, nick, \
-				    MSGLEVEL_MSGS, formatnum, ## __VA_ARGS__); \
-}
-#define IRCCTX_DUP(ircctx) g_memdup(ircctx, sizeof(IRC_CTX));
-#define IRCCTX_ADDR(ircctx) ircctx->address
-#define IRCCTX_NICK(ircctx) ircctx->nick
-#define IRCCTX_FREE(ircctx) g_free(ircctx)
-#define IRCCTX_ACCNAME(accname, ircctx) sprintf(accname, "%s@%s", \
-						ircctx->nick, \
-						ircctx->address)
-#define IRCCTX_IO_US(ircctx) (&ioustate_uniq)
-#define IO_CREATE_US(user) (&ioustate_uniq)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/irssi-plugin-otr.git



More information about the Pkg-privacy-commits mailing list