[Pkg-privacy-commits] [irssi-plugin-otr] 19/267: New /otr finish behavior plus build changes.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:41:23 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 32ba158cc6fcf6692617f746d7aee0896f6e5259
Author: Uli Meis <a.sporto+bee at gmail.com>
Date: Thu Jun 12 01:05:57 2008 +0200
New /otr finish behavior plus build changes.
/otr finish now changes policy to not-sending-whitespace. Will change back to
opportunistic when the query window is closed.
---
CMakeLists.txt | 27 ++++++++++++++++++++-------
HOWTO_PACKAGE | 2 +-
INSTALL | 10 ++++++----
Packaging-RPM.cmake | 1 +
Packaging.cmake | 16 ++++++++--------
README | 13 ++++++++++---
formats.txt | 2 +-
otr.h | 1 +
otr_ops.c | 6 +++++-
otrutil.c | 7 +++++++
10 files changed, 60 insertions(+), 25 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 593f645..b72e113 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,9 @@
PROJECT(irssi-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/
@@ -33,6 +36,13 @@ INCLUDE(CheckIncludeFile)
# get version from git
IF(NOT IRSSIOTR_VERSION)
+ IF(NOT EXISTS "${PROJECT_SOURCE_DIR}/.git")
+ MESSAGE(FATAL_ERROR "Cannot determine the irssi-otr version since this is "
+ "not a git checkout. Please set IRSSIOTR_VERSION, e.g.
+ cmake -DIRSSIOTR_VERSION=mydistro-0.1
+ or
+ cmake -DIRSSIOTR_VERSION=mydistro-git-<git-commit>")
+ ENDIF(NOT EXISTS "${PROJECT_SOURCE_DIR}/.git")
FIND_GIT_TAGORCOMMIT(${PROJECT_SOURCE_DIR} IRSSIOTR_VERSION)
IF(NOT IRSSIOTR_VERSION)
MESSAGE(FATAL_ERROR
@@ -97,7 +107,8 @@ ENDIF(NOT IRSSI_INCLUDE_DIR)
# Bad hack for irssi private headers
-IF (NOT EXISTS "mainwindows.h")
+IF (NOT EXISTS "mainwindows.h" AND
+ NOT EXISTS "${PROJECT_SOURCE_DIR}/mainwindows.h")
MESSAGE(STATUS "Need to fetch and patch irssi private headers "
"mainwindows.h,statusbar.h,term.h from SVN (see irssi FS#535)")
EXECUTE_PROCESS(COMMAND "bash" "-c"
@@ -110,7 +121,8 @@ IF (NOT EXISTS "mainwindows.h")
IF(NOT IIPRIV_RET EQUAL 0)
MESSAGE(FATAL_ERROR "Couldn't check out irssi private headers from SVN")
ENDIF(NOT IIPRIV_RET EQUAL 0)
-ENDIF (NOT EXISTS "mainwindows.h")
+ENDIF (NOT EXISTS "mainwindows.h" AND
+ NOT EXISTS "${PROJECT_SOURCE_DIR}/mainwindows.h")
# includes
@@ -173,10 +185,11 @@ ADD_CSCOPE_TARGET("${CSANDHS}" "${IRSSIOTR_INCLUDE_DIRS}")
# Install / CPack
-IF(CMAKE_BUILD_TYPE MATCHES "package-.*")
+IF(CMAKE_INSTALL_TYPE MATCHES "package-.*")
INCLUDE(Packaging.cmake)
-ELSE(CMAKE_BUILD_TYPE MATCHES "package-.*")
- INSTALL(SCRIPT cmake-extensions/InstallAsUser.cmake)
- INSTALL(TARGETS otr DESTINATION modules/)
+ELSEIF(CMAKE_INSTALL_TYPE MATCHES "home")
+ INSTALL(TARGETS otr DESTINATION "$ENV{HOME}/.irssi/modules")
+ELSE(CMAKE_INSTALL_TYPE MATCHES "package-.*")
+ INSTALL(TARGETS otr DESTINATION lib/irssi/modules)
INSTALL(FILES README LICENSE DESTINATION share/doc/${CMAKE_PROJECT_NAME}-${IRSSIOTR_VERSION})
-ENDIF(CMAKE_BUILD_TYPE MATCHES "package-.*")
+ENDIF(CMAKE_INSTALL_TYPE MATCHES "package-.*")
diff --git a/HOWTO_PACKAGE b/HOWTO_PACKAGE
index 382748f..6addcdf 100644
--- a/HOWTO_PACKAGE
+++ b/HOWTO_PACKAGE
@@ -2,7 +2,7 @@ Thanks for helping me with packaging.
You'll need cmake >= 2.6. In theory, all you should have to do is:
- $ cmake -DCMAKE_BUILD_TYPE=package-deb /path/to/src
+ $ 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.
diff --git a/INSTALL b/INSTALL
index 0e451c5..96d5ae1 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,12 +4,14 @@ Usually the following will do:
$ cmake /path/to/src
$ make
- $ make install
+ $ sudo make install
-"make install" will install libotr.so either
+If you want to install libotr.so into your home folder
+(~/.irssi/modules/libotr.so) run
-1. into the system wide irssi modules folder if you're root or
-2. into ~/.irssi/modules if you're not root
+ $ cmake -DCMAKE_INSTALL_TYPE=home /path/to/src
+
+instead.
---------- RUNTIME DEPENDENCIES ----------
diff --git a/Packaging-RPM.cmake b/Packaging-RPM.cmake
index 7186046..31ac36d 100644
--- a/Packaging-RPM.cmake
+++ b/Packaging-RPM.cmake
@@ -20,3 +20,4 @@ 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
index 28f10b6..582c39c 100644
--- a/Packaging.cmake
+++ b/Packaging.cmake
@@ -14,23 +14,23 @@ SET(CPACK_GENERATOR TGZ)
SET(CPACK_PACKAGE_VERSION ${IRSSIOTR_VERSION})
-IF(CMAKE_BUILD_TYPE STREQUAL "package-rpm")
+IF(CMAKE_INSTALL_TYPE STREQUAL "package-rpm")
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
INCLUDE(Packaging-RPM.cmake)
-ELSEIF(CMAKE_BUILD_TYPE STREQUAL "package-deb")
+ELSEIF(CMAKE_INSTALL_TYPE STREQUAL "package-deb")
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
INCLUDE(Packaging-DEB.cmake)
-ELSEIF(CMAKE_BUILD_TYPE STREQUAL "package-tgz")
+ELSEIF(CMAKE_INSTALL_TYPE STREQUAL "package-tgz")
INSTALL(TARGETS otr DESTINATION irssi/lib/modules)
INSTALL(FILES README LICENSE DESTINATION share/doc/${CMAKE_PROJECT_NAME}-${IRSSIOTR_VERSION})
-ELSE(CMAKE_BUILD_TYPE STREQUAL "package-rpm")
- MESSAGE(FATAL_ERROR "Unknown build type '${CMAKE_BUILD_TYPE}'")
-ENDIF(CMAKE_BUILD_TYPE STREQUAL "package-rpm")
+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_BUILD_TYPE STREQUAL "package-tgz")
-#ENDIF(CMAKE_BUILD_TYPE STREQUAL "package-deb")
+#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")
diff --git a/README b/README
index 5bb7665..23c8803 100644
--- a/README
+++ b/README
@@ -14,13 +14,20 @@ currently only the responder will be able to authenticate this way. You'll have
to switch roles and do this twice - sry.
I also strongly recommend to do "/statusbar window add otr" so you're informed
-about what's going on. Status of "manual" means manual authentication was
-performed, "smp" means the above protocol was used (the thing's called
-"socialist millionaire protocol").
+about what's going on.
In "~/.irssi/otr/otr.{key,fp}" you'll find the fingerprints and your private
keys(should you at any point be interested).
+The standard OTR policy is opportunistic, meaning we'll send some whitespace
+after messages and we'll also look for it from our peer. Should we see the magic
+whitespace from our peer we'll start a handshake. If at any point you enter
+"/otr finish" then the policy is changed so as not to send whitespace anymore.
+Therefore, if your peer has the same behaviour, OTR will not start again. This
+is however reset once you close the query window. When you open a new query
+window OTR will start sending whitespace again which might cause your peer to
+start an OTR session.
+
Commands:
/otr genkey nick at irc.server.com
diff --git a/formats.txt b/formats.txt
index fae1b38..c026989 100644
--- a/formats.txt
+++ b/formats.txt
@@ -42,7 +42,7 @@ 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 %s, acc=%s, from=%s
+receive_ignore ignoring protocol message of length %d, acc=%s, from=%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.
diff --git a/otr.h b/otr.h
index b81c92d..951f1d8 100644
--- a/otr.h
+++ b/otr.h
@@ -79,6 +79,7 @@ struct co_info {
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 */
};
extern int debug;
diff --git a/otr_ops.c b/otr_ops.c
index 1a85d86..290edb8 100644
--- a/otr_ops.c
+++ b/otr_ops.c
@@ -27,7 +27,11 @@ extern OtrlUserState otr_state;
*/
OtrlPolicy ops_policy(void *opdata, ConnContext *context)
{
- return OTRL_POLICY_DEFAULT;
+ struct co_info *coi = context->app_data;
+
+ return coi && coi->finished ?
+ OTRL_POLICY_MANUAL|OTRL_POLICY_WHITESPACE_START_AKE :
+ OTRL_POLICY_DEFAULT;
}
/*
diff --git a/otrutil.c b/otrutil.c
index 2b07c8e..747f23c 100644
--- a/otrutil.c
+++ b/otrutil.c
@@ -275,6 +275,7 @@ void otr_finish(SERVER_REC *server, char *nick, int inquery)
{
ConnContext *co;
char accname[128];
+ struct co_info *coi;
sprintf(accname, "%s@%s", server->nick, server->connrec->address);
@@ -291,6 +292,12 @@ void otr_finish(SERVER_REC *server, char *nick, int inquery)
otr_notice(inquery ? server : NULL,
inquery ? nick : NULL,
TXT_CMD_FINISH,nick);
+
+ coi = co->app_data;
+
+ /* finish if /otr finish has been issued. Reset if
+ * we're called cause the query window has been closed. */
+ coi->finished = inquery;
}
/*
--
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