Patch-Source: https://github.com/cdidier/irssi-xmpp/pull/53.patch
Patch-Source: https://github.com/cdidier/irssi-xmpp/pull/55.patch


From 4032363d8ee59ce4125ffb29a859b8a50a90e280 Mon Sep 17 00:00:00 2001
From: Ailin Nemui <ailin@z30a.localdomain>
Date: Thu, 12 Mar 2020 16:44:14 +0100
Subject: [PATCH 1/4] autodetect irssi path for irssi 1.3

---
 config.mk | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/config.mk b/config.mk
index 5acae70..2cfd80f 100644
--- a/config.mk
+++ b/config.mk
@@ -1,10 +1,27 @@
 # paths
 PREFIX ?= /usr/local
 
-# where are the sources of irssi?
+# where are the sources of irssi? lets ask pkg-config first
+irssi_incdirs_pc != pkg-config --cflags-only-I irssi-1 2>/dev/null
+ifneq (,$(irssi_incdirs_pc))
+IRSSI_INCLUDE ?= `pkg-config --cflags-only-I irssi-1`
+irssi_incdirs = ${IRSSI_INCLUDE}
+else
 IRSSI_INCLUDE ?= ${PREFIX}/include/irssi
+irssi_incdirs = \
+	-I${IRSSI_INCLUDE} \
+	-I${IRSSI_INCLUDE}/src \
+	-I${IRSSI_INCLUDE}/src/core \
+	-I$(IRSSI_INCLUDE)/src/fe-common/core \
+	-I$(IRSSI_INCLUDE)/src/fe-text
+endif
 # where should be installed the module?
+irssi_libdir_pc != pkg-config --variable=libdir irssi-1 2>/dev/null
+ifneq (,$(irssi_libdir_pc))
+IRSSI_LIB ?= ${irssi_libdir_pc}/irssi
+else
 IRSSI_LIB ?= ${PREFIX}/lib/irssi
+endif
 # where should be installed the documentation?
 IRSSI_DOC ?= ${PREFIX}/share/doc/irssi
 # where should be installed the help for commands ?
@@ -13,11 +31,8 @@ IRSSI_HELP ?= ${PREFIX}/share/irssi/help
 # includes and libs
 INCS =	${LIB_INCS} \
 	-I../../src/core \
-	-I${IRSSI_INCLUDE} \
-	-I${IRSSI_INCLUDE}/src \
-	-I${IRSSI_INCLUDE}/src/core \
-	-I$(IRSSI_INCLUDE)/src/fe-common/core \
-	-I$(IRSSI_INCLUDE)/src/fe-text \
+	${irssi_incdirs} \
+ 	`pkg-config --cflags glib-2.0` \
 	`pkg-config --cflags loudmouth-1.0`
 LIBS =	${LIB_LIBS}

From 982ce9ac561f91c6dd5cd2d8364f8eb7e7e9d755 Mon Sep 17 00:00:00 2001
From: Ailin Nemui <ailin@z30a.localdomain>
Date: Sun, 29 Dec 2019 20:25:49 +0100
Subject: [PATCH 2/4] use full paths to irssi includes

this is in parallel to the change irssi/irssi#1040 for irssi 1.3
---
 config.mk                           |  1 +
 src/core/module.h                   |  4 ++--
 src/core/protocol.c                 |  2 +-
 src/core/rosters.c                  |  2 +-
 src/core/stanzas.c                  |  4 ++--
 src/core/tools.c                    |  6 +++---
 src/core/xep/chatstates.c           |  2 +-
 src/core/xep/composing.c            |  2 +-
 src/core/xep/delay.c                |  2 +-
 src/core/xep/disco.c                |  2 +-
 src/core/xep/muc-commands.c         |  6 +++---
 src/core/xep/muc-events.c           |  8 ++++----
 src/core/xep/muc-nicklist.c         |  2 +-
 src/core/xep/muc-nicklist.h         |  4 ++--
 src/core/xep/muc-reconnect.c        |  4 ++--
 src/core/xep/muc.c                  |  6 +++---
 src/core/xep/muc.h                  |  6 +++---
 src/core/xep/oob.c                  |  2 +-
 src/core/xep/ping.c                 |  6 +++---
 src/core/xep/registration.c         |  4 ++--
 src/core/xep/vcard.c                |  4 ++--
 src/core/xep/version.c              |  6 +++---
 src/core/xmpp-commands.c            | 12 ++++++------
 src/core/xmpp-commands.h            |  2 +-
 src/core/xmpp-core.c                | 14 +++++++-------
 src/core/xmpp-queries.c             |  6 +++---
 src/core/xmpp-queries.h             |  4 ++--
 src/core/xmpp-servers-reconnect.c   |  2 +-
 src/core/xmpp-servers.c             |  8 ++++----
 src/core/xmpp-servers.h             |  8 ++++----
 src/core/xmpp-settings.c            |  4 ++--
 src/fe-common/fe-rosters.c          |  8 ++++----
 src/fe-common/fe-stanzas.c          | 10 +++++-----
 src/fe-common/fe-xmpp-core.c        | 14 +++++++-------
 src/fe-common/fe-xmpp-messages.c    | 26 +++++++++++++-------------
 src/fe-common/fe-xmpp-queries.c     |  8 ++++----
 src/fe-common/fe-xmpp-status.c      | 10 +++++-----
 src/fe-common/fe-xmpp-windows.c     |  6 +++---
 src/fe-common/module-formats.c      |  2 +-
 src/fe-common/module-formats.h      |  2 +-
 src/fe-common/module.h              |  4 ++--
 src/fe-common/xep/fe-composing.c    |  8 ++++----
 src/fe-common/xep/fe-delay.c        | 20 ++++++++++----------
 src/fe-common/xep/fe-muc.c          | 14 +++++++-------
 src/fe-common/xep/fe-ping.c         |  8 ++++----
 src/fe-common/xep/fe-registration.c | 12 ++++++------
 src/fe-common/xep/fe-vcard.c        |  6 +++---
 src/fe-common/xep/fe-version.c      |  6 +++---
 src/fe-common/xmpp-completion.c     | 12 ++++++------
 src/fe-common/xmpp-formats.c        |  4 ++--
 src/fe-text/module.h                |  4 ++--
 src/fe-text/text-xmpp-core.c        |  2 +-
 src/fe-text/xep/text-composing.c    |  7 +++----
 src/fe-text/xep/text-muc.c          |  8 ++++----
 54 files changed, 173 insertions(+), 173 deletions(-)

diff --git a/config.mk b/config.mk
index 2cfd80f..3d17552 100644
--- a/config.mk
+++ b/config.mk
@@ -9,6 +9,7 @@ irssi_incdirs = ${IRSSI_INCLUDE}
 else
 IRSSI_INCLUDE ?= ${PREFIX}/include/irssi
 irssi_incdirs = \
+	-I${IRSSI_INCLUDE}/.. \
 	-I${IRSSI_INCLUDE} \
 	-I${IRSSI_INCLUDE}/src \
 	-I${IRSSI_INCLUDE}/src/core \
diff --git a/src/core/module.h b/src/core/module.h
index 3793623..414a539 100644
--- a/src/core/module.h
+++ b/src/core/module.h
@@ -1,5 +1,5 @@
 #define MODULE_NAME "xmpp/core"
 
-#include "irssi-config.h"
-#include "common.h"
+#include <irssi/irssi-config.h>
+#include <irssi/src/common.h>
 #include "xmpp.h"
diff --git a/src/core/protocol.c b/src/core/protocol.c
index 717e022..5a5826c 100644
--- a/src/core/protocol.c
+++ b/src/core/protocol.c
@@ -16,7 +16,7 @@
  */
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "rosters-tools.h"
diff --git a/src/core/rosters.c b/src/core/rosters.c
index 135bd3b..00b68a4 100644
--- a/src/core/rosters.c
+++ b/src/core/rosters.c
@@ -19,7 +19,7 @@
 #include <string.h>
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "rosters-tools.h"
diff --git a/src/core/stanzas.c b/src/core/stanzas.c
index a731b00..748f64d 100644
--- a/src/core/stanzas.c
+++ b/src/core/stanzas.c
@@ -16,8 +16,8 @@
  */
 
 #include "module.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "tools.h"
diff --git a/src/core/tools.c b/src/core/tools.c
index e179aad..4f5aa50 100644
--- a/src/core/tools.c
+++ b/src/core/tools.c
@@ -18,9 +18,9 @@
 #include <string.h>
 
 #include "module.h"
-#include "recode.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/recode.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #define XMPP_PRIORITY_MIN -128
 #define XMPP_PRIORITY_MAX 127
diff --git a/src/core/xep/chatstates.c b/src/core/xep/chatstates.c
index 8a71418..88905d1 100644
--- a/src/core/xep/chatstates.c
+++ b/src/core/xep/chatstates.c
@@ -20,7 +20,7 @@
  */
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "disco.h"
diff --git a/src/core/xep/composing.c b/src/core/xep/composing.c
index f115f18..bc1e20f 100644
--- a/src/core/xep/composing.c
+++ b/src/core/xep/composing.c
@@ -22,7 +22,7 @@
 #include <string.h>
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-queries.h"
diff --git a/src/core/xep/delay.c b/src/core/xep/delay.c
index e5a2403..6a3aaad 100644
--- a/src/core/xep/delay.c
+++ b/src/core/xep/delay.c
@@ -20,7 +20,7 @@
  */
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "tools.h"
diff --git a/src/core/xep/disco.c b/src/core/xep/disco.c
index 885f5b7..81a6197 100644
--- a/src/core/xep/disco.c
+++ b/src/core/xep/disco.c
@@ -20,7 +20,7 @@
 #include <string.h>
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "tools.h"
diff --git a/src/core/xep/muc-commands.c b/src/core/xep/muc-commands.c
index cf61b35..7e39609 100644
--- a/src/core/xep/muc-commands.c
+++ b/src/core/xep/muc-commands.c
@@ -18,9 +18,9 @@
 #include <stdlib.h>
 
 #include "module.h"
-#include "settings.h"
-#include "signals.h"
-#include "window-item-def.h"
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/core/window-item-def.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-commands.h"
diff --git a/src/core/xep/muc-events.c b/src/core/xep/muc-events.c
index 63575c0..092b691 100644
--- a/src/core/xep/muc-events.c
+++ b/src/core/xep/muc-events.c
@@ -23,10 +23,10 @@
 #include <string.h>
 
 #include "module.h"
-#include "commands.h"
-#include "misc.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/commands.h>
+#include <irssi/src/core/misc.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #include "rosters-tools.h"
 #include "tools.h"
diff --git a/src/core/xep/muc-nicklist.c b/src/core/xep/muc-nicklist.c
index 56e3621..50f64b3 100644
--- a/src/core/xep/muc-nicklist.c
+++ b/src/core/xep/muc-nicklist.c
@@ -18,7 +18,7 @@
 #include <string.h>
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "rosters.h"
 #include "muc-affiliation.h"
diff --git a/src/core/xep/muc-nicklist.h b/src/core/xep/muc-nicklist.h
index 3c072f2..dbc0102 100644
--- a/src/core/xep/muc-nicklist.h
+++ b/src/core/xep/muc-nicklist.h
@@ -1,7 +1,7 @@
 #ifndef __MUC_NICKLIST_H
 #define __MUC_NICKLIST_H
 
-#include "nicklist.h"
+#include <irssi/src/core/nicklist.h>
 #include "muc.h"
 
 /* Returns XMPP_NICK_REC if it's XMPP channel, NULL if it isn't. */
@@ -16,7 +16,7 @@
 
 
 struct _XMPP_NICK_REC {
-	#include "nick-rec.h"
+	#include <irssi/src/core/nick-rec.h>
 
 	int 	 show;
 	char 	*status;
diff --git a/src/core/xep/muc-reconnect.c b/src/core/xep/muc-reconnect.c
index 7e43c24..36adbc5 100644
--- a/src/core/xep/muc-reconnect.c
+++ b/src/core/xep/muc-reconnect.c
@@ -16,8 +16,8 @@
  */
 
 #include "module.h"
-#include "servers-reconnect.h"
-#include "signals.h"
+#include <irssi/src/core/servers-reconnect.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "muc.h"
diff --git a/src/core/xep/muc.c b/src/core/xep/muc.c
index 5e5a419..19db411 100644
--- a/src/core/xep/muc.c
+++ b/src/core/xep/muc.c
@@ -22,9 +22,9 @@
 #include <string.h>
 
 #include "module.h"
-#include "commands.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/commands.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #include "rosters-tools.h"
 #include "tools.h"
diff --git a/src/core/xep/muc.h b/src/core/xep/muc.h
index 50440f8..b9a1322 100644
--- a/src/core/xep/muc.h
+++ b/src/core/xep/muc.h
@@ -1,8 +1,8 @@
 #ifndef __MUC_H
 #define __MUC_H
 
-#include "channels.h"
-#include "channels-setup.h"
+#include <irssi/src/core/channels.h>
+#include <irssi/src/core/channels-setup.h>
 #include "xmpp-servers.h"
 #include "tools.h"
 
@@ -34,7 +34,7 @@
 
 #define STRUCT_SERVER_REC XMPP_SERVER_REC
 struct _MUC_REC {
-	#include "channel-rec.h"
+	#include <irssi/src/core/channel-rec.h>
 
 	char	*nick;
 };
diff --git a/src/core/xep/oob.c b/src/core/xep/oob.c
index 16fdafb..5d61b48 100644
--- a/src/core/xep/oob.c
+++ b/src/core/xep/oob.c
@@ -20,7 +20,7 @@
  */
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "tools.h"
diff --git a/src/core/xep/ping.c b/src/core/xep/ping.c
index 7d9f32a..d51930a 100644
--- a/src/core/xep/ping.c
+++ b/src/core/xep/ping.c
@@ -24,9 +24,9 @@
 #include <time.h>
 
 #include "module.h"
-#include "misc.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/misc.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-commands.h"
diff --git a/src/core/xep/registration.c b/src/core/xep/registration.c
index a049af4..2043939 100644
--- a/src/core/xep/registration.c
+++ b/src/core/xep/registration.c
@@ -23,8 +23,8 @@
 #include <string.h>
 
 #include "module.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 #include "tools.h"
 
 #include "xmpp-servers.h"
diff --git a/src/core/xep/vcard.c b/src/core/xep/vcard.c
index 00db5e9..06052fc 100644
--- a/src/core/xep/vcard.c
+++ b/src/core/xep/vcard.c
@@ -16,8 +16,8 @@
  */
 
 #include "module.h"
-#include "queries.h"
-#include "signals.h"
+#include <irssi/src/core/queries.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-commands.h"
diff --git a/src/core/xep/version.c b/src/core/xep/version.c
index ff248ab..6c95bb7 100644
--- a/src/core/xep/version.c
+++ b/src/core/xep/version.c
@@ -23,9 +23,9 @@
 #include <string.h>
 
 #include "module.h"
-#include "queries.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/queries.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-commands.h"
diff --git a/src/core/xmpp-commands.c b/src/core/xmpp-commands.c
index e8c6a31..85bb7e9 100644
--- a/src/core/xmpp-commands.c
+++ b/src/core/xmpp-commands.c
@@ -18,12 +18,12 @@
 #include <stdlib.h>
 
 #include "module.h"
-#include "channels.h"
-#include "nicklist.h"
-#include "recode.h"
-#include "settings.h"
-#include "signals.h"
-#include "window-item-def.h"
+#include <irssi/src/core/channels.h>
+#include <irssi/src/core/nicklist.h>
+#include <irssi/src/core/recode.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/core/window-item-def.h>
 
 #include "xmpp-commands.h"
 #include "xmpp-queries.h"
diff --git a/src/core/xmpp-commands.h b/src/core/xmpp-commands.h
index 2939810..9685181 100644
--- a/src/core/xmpp-commands.h
+++ b/src/core/xmpp-commands.h
@@ -1,7 +1,7 @@
 #ifndef __XMPP_COMMANDS_H
 #define __XMPP_COMMANDS_H
 
-#include "commands.h"
+#include <irssi/src/core/commands.h>
 
 enum {
 	XMPP_COMMAND_AWAY,
diff --git a/src/core/xmpp-core.c b/src/core/xmpp-core.c
index f1960a8..54a53b1 100644
--- a/src/core/xmpp-core.c
+++ b/src/core/xmpp-core.c
@@ -16,13 +16,13 @@
  */
 
 #include "module.h"
-#include "signals.h"
-#include "channels.h"
-#include "channels-setup.h"
-#include "chat-protocols.h"
-#include "chatnets.h"
-#include "servers-setup.h"
-#include "settings.h"
+#include <irssi/src/core/signals.h>
+#include <irssi/src/core/channels.h>
+#include <irssi/src/core/channels-setup.h>
+#include <irssi/src/core/chat-protocols.h>
+#include <irssi/src/core/chatnets.h>
+#include <irssi/src/core/servers-setup.h>
+#include <irssi/src/core/settings.h>
 
 #include "xmpp-commands.h"
 #include "xmpp-queries.h"
diff --git a/src/core/xmpp-queries.c b/src/core/xmpp-queries.c
index 9bfb583..00c59a8 100644
--- a/src/core/xmpp-queries.c
+++ b/src/core/xmpp-queries.c
@@ -18,9 +18,9 @@
 #include <string.h>
 
 #include "module.h"
-#include "channels.h"
-#include "nicklist.h"
-#include "signals.h"
+#include <irssi/src/core/channels.h>
+#include <irssi/src/core/nicklist.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-queries.h"
 #include "rosters-tools.h"
diff --git a/src/core/xmpp-queries.h b/src/core/xmpp-queries.h
index 972519a..9b29e8b 100644
--- a/src/core/xmpp-queries.h
+++ b/src/core/xmpp-queries.h
@@ -1,7 +1,7 @@
 #ifndef __XMPP_QUERIES_H
 #define __XMPP_QUERIES_H
 
-#include "queries.h"
+#include <irssi/src/core/queries.h>
 #include "xmpp-servers.h"
 
 /* Returns XMPP_QUERY_REC if it's XMPP query, NULL if it isn't. */
@@ -16,7 +16,7 @@
 
 #define STRUCT_SERVER_REC XMPP_SERVER_REC
 struct _XMPP_QUERY_REC {
-	#include "query-rec.h"
+	#include <irssi/src/core/query-rec.h>
 
 	time_t		composing_time;
 	gboolean	composing_visible;
diff --git a/src/core/xmpp-servers-reconnect.c b/src/core/xmpp-servers-reconnect.c
index 09488f5..85ffe09 100644
--- a/src/core/xmpp-servers-reconnect.c
+++ b/src/core/xmpp-servers-reconnect.c
@@ -16,7 +16,7 @@
  */
 
 #include "module.h"
-#include "signals.h"
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 
diff --git a/src/core/xmpp-servers.c b/src/core/xmpp-servers.c
index 7be48b9..afc2ffb 100644
--- a/src/core/xmpp-servers.c
+++ b/src/core/xmpp-servers.c
@@ -22,10 +22,10 @@
 #include <termios.h>
 
 #include "module.h"
-#include "network.h"
-#include "recode.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/network.h>
+#include <irssi/src/core/recode.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "protocol.h"
diff --git a/src/core/xmpp-servers.h b/src/core/xmpp-servers.h
index 6d946c5..b56d841 100644
--- a/src/core/xmpp-servers.h
+++ b/src/core/xmpp-servers.h
@@ -1,8 +1,8 @@
 #ifndef __XMPP_SERVERS_H
 #define __XMPP_SERVERS_H
 
-#include "chat-protocols.h"
-#include "servers.h"
+#include <irssi/src/core/chat-protocols.h>
+#include <irssi/src/core/servers.h>
 
 #include "loudmouth/loudmouth.h"
 #include "loudmouth-tools.h"
@@ -24,7 +24,7 @@
 	(XMPP_SERVER_CONNECT(conn) ? TRUE : FALSE) 
 
 struct _XMPP_SERVER_CONNECT_REC {
-	#include "server-connect-rec.h"
+	#include <irssi/src/core/server-connect-rec.h>
 
 	GSList		*channels_list;
 	int		 show;
@@ -35,7 +35,7 @@ struct _XMPP_SERVER_CONNECT_REC {
 
 #define STRUCT_SERVER_CONNECT_REC XMPP_SERVER_CONNECT_REC
 struct _XMPP_SERVER_REC {
-	#include "server-rec.h"
+	#include <irssi/src/core/server-rec.h>
 
 	char		*jid;
 	char		*user;
diff --git a/src/core/xmpp-settings.c b/src/core/xmpp-settings.c
index a8a58b4..d39c827 100644
--- a/src/core/xmpp-settings.c
+++ b/src/core/xmpp-settings.c
@@ -18,8 +18,8 @@
 #include <string.h>
 
 #include "module.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "rosters.h"
diff --git a/src/fe-common/fe-rosters.c b/src/fe-common/fe-rosters.c
index 8dc28a2..f82a0ba 100644
--- a/src/fe-common/fe-rosters.c
+++ b/src/fe-common/fe-rosters.c
@@ -18,11 +18,11 @@
 #include <string.h>
 
 #include "module.h"
-#include "levels.h"
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "printtext.h"
-#include "settings.h"
-#include "signals.h"
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "rosters-tools.h"
diff --git a/src/fe-common/fe-stanzas.c b/src/fe-common/fe-stanzas.c
index 904ec70..b54b2cf 100644
--- a/src/fe-common/fe-stanzas.c
+++ b/src/fe-common/fe-stanzas.c
@@ -18,12 +18,12 @@
 #include <string.h>
 
 #include "module.h"
-#include "levels.h"
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "printtext.h"
-#include "settings.h"
-#include "signals.h"
-#include "window-items.h"
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/window-items.h>
 
 #include "xmpp-servers.h"
 
diff --git a/src/fe-common/fe-xmpp-core.c b/src/fe-common/fe-xmpp-core.c
index 4450dcd..7c2e4ce 100644
--- a/src/fe-common/fe-xmpp-core.c
+++ b/src/fe-common/fe-xmpp-core.c
@@ -16,14 +16,14 @@
  */
 
 #include "module.h"
-#include "core.h"
-#include "levels.h"
+#include <irssi/src/core/core.h>
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "printtext.h"
-#include "servers-setup.h"
-#include "settings.h"
-#include "signals.h"
-#include "themes.h"
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/servers-setup.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/themes.h>
 
 #include "fe-xmpp-messages.h"
 #include "fe-xmpp-queries.h"
diff --git a/src/fe-common/fe-xmpp-messages.c b/src/fe-common/fe-xmpp-messages.c
index df293f3..641bc7f 100644
--- a/src/fe-common/fe-xmpp-messages.c
+++ b/src/fe-common/fe-xmpp-messages.c
@@ -18,20 +18,20 @@
 #include <string.h>
 
 #include "module.h"
-#include "channels.h"
-#include "levels.h"
+#include <irssi/src/core/channels.h>
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "nicklist.h"
-#include "printtext.h"
-#include "recode.h"
-#include "settings.h"
-#include "signals.h"
-#include "window-items.h"
-#include "fe-queries.h"
-#include "fe-common/core/module-formats.h"
-#include "fe-common/core/fe-messages.h"
-#include "fe-common/irc/module-formats.h"
-#include "irssi-version.h"
+#include <irssi/src/core/nicklist.h>
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/recode.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/window-items.h>
+#include <irssi/src/fe-common/core/fe-queries.h>
+#include <irssi/src/fe-common/core/module-formats.h>
+#include <irssi/src/fe-common/core/fe-messages.h>
+#include <irssi/src/fe-common/irc/module-formats.h>
+#include <irssi/irssi-version.h>
 
 #include "xmpp-servers.h"
 
diff --git a/src/fe-common/fe-xmpp-queries.c b/src/fe-common/fe-xmpp-queries.c
index 63b9d50..af0e253 100644
--- a/src/fe-common/fe-xmpp-queries.c
+++ b/src/fe-common/fe-xmpp-queries.c
@@ -16,11 +16,11 @@
  */		 
 
 #include "module.h"
-#include "levels.h"
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "printtext.h"
-#include "signals.h"
-#include "window-items.h"
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/window-items.h>
 
 #include "xmpp-queries.h"
 #include "rosters-tools.h"
diff --git a/src/fe-common/fe-xmpp-status.c b/src/fe-common/fe-xmpp-status.c
index 46012af..61c9e83 100644
--- a/src/fe-common/fe-xmpp-status.c
+++ b/src/fe-common/fe-xmpp-status.c
@@ -18,12 +18,12 @@
 #include <string.h>
 
 #include "module.h"
-#include "levels.h"
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "printtext.h"
-#include "settings.h"
-#include "signals.h"
-#include "window-items.h"
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/window-items.h>
 
 #include "xmpp-servers.h"
 #include "rosters-tools.h"
diff --git a/src/fe-common/fe-xmpp-windows.c b/src/fe-common/fe-xmpp-windows.c
index 4de0220..2c6e45b 100644
--- a/src/fe-common/fe-xmpp-windows.c
+++ b/src/fe-common/fe-xmpp-windows.c
@@ -16,9 +16,9 @@
  */		 
 
 #include "module.h"
-#include "channels.h"
-#include "signals.h"
-#include "window-items.h"
+#include <irssi/src/core/channels.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/window-items.h>
 
 #include "xmpp-servers.h"
 
diff --git a/src/fe-common/module-formats.c b/src/fe-common/module-formats.c
index 148c1f1..ce85fb2 100644
--- a/src/fe-common/module-formats.c
+++ b/src/fe-common/module-formats.c
@@ -16,7 +16,7 @@
  */
 
 #include "module.h"
-#include "formats.h"
+#include <irssi/src/fe-common/core/formats.h>
 
 FORMAT_REC fecommon_xmpp_formats[] = {
 	{ MODULE_NAME, "XMPP", 0, { 0 } },
diff --git a/src/fe-common/module-formats.h b/src/fe-common/module-formats.h
index e4e53c5..947876f 100644
--- a/src/fe-common/module-formats.h
+++ b/src/fe-common/module-formats.h
@@ -1,4 +1,4 @@
-#include "formats.h"
+#include <irssi/src/fe-common/core/formats.h>
 
 enum {
 	XMPPTXT_MODULE_NAME,
diff --git a/src/fe-common/module.h b/src/fe-common/module.h
index e41c292..579f613 100644
--- a/src/fe-common/module.h
+++ b/src/fe-common/module.h
@@ -3,6 +3,6 @@
 #define CORE_MODULE_NAME "fe-common/core"
 #define IRC_MODULE_NAME "fe-common/irc"
 
-#include "irssi-config.h"
-#include "common.h"
+#include <irssi/irssi-config.h>
+#include <irssi/src/common.h>
 #include "xmpp.h"
diff --git a/src/fe-common/xep/fe-composing.c b/src/fe-common/xep/fe-composing.c
index b342114..11b83dd 100644
--- a/src/fe-common/xep/fe-composing.c
+++ b/src/fe-common/xep/fe-composing.c
@@ -18,10 +18,10 @@
 #include <string.h>
 
 #include "module.h"
-#include "settings.h"
-#include "signals.h"
-#include "special-vars.h"
-#include "window-items.h"
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/core/special-vars.h>
+#include <irssi/src/fe-common/core/window-items.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-queries.h"
diff --git a/src/fe-common/xep/fe-delay.c b/src/fe-common/xep/fe-delay.c
index 33cef7e..09a40c2 100644
--- a/src/fe-common/xep/fe-delay.c
+++ b/src/fe-common/xep/fe-delay.c
@@ -16,17 +16,17 @@
  */		 
 
 #include "module.h"
-#include "levels.h"
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "printtext.h"
-#include "settings.h"
-#include "signals.h"
-#include "window-items.h"
-#include "fe-messages.h"
-#include "fe-queries.h"
-#include "fe-common/core/module-formats.h"
-#include "fe-common/core/fe-messages.h"
-#include "fe-common/irc/module-formats.h"
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/window-items.h>
+#include <irssi/src/fe-common/core/fe-messages.h>
+#include <irssi/src/fe-common/core/fe-queries.h>
+#include <irssi/src/fe-common/core/module-formats.h>
+#include <irssi/src/fe-common/core/fe-messages.h>
+#include <irssi/src/fe-common/irc/module-formats.h>
 
 #include "xmpp-servers.h"
 #include "rosters-tools.h"
diff --git a/src/fe-common/xep/fe-muc.c b/src/fe-common/xep/fe-muc.c
index c2df9ed..0747efb 100644
--- a/src/fe-common/xep/fe-muc.c
+++ b/src/fe-common/xep/fe-muc.c
@@ -16,14 +16,14 @@
  */
 
 #include "module.h"
-#include "ignore.h"
-#include "levels.h"
+#include <irssi/src/core/ignore.h>
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "printtext.h"
-#include "signals.h"
-#include "window-items.h"
-#include "fe-common/core/module-formats.h"
-#include "fe-common/irc/module-formats.h"
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/window-items.h>
+#include <irssi/src/fe-common/core/module-formats.h>
+#include <irssi/src/fe-common/irc/module-formats.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-commands.h"
diff --git a/src/fe-common/xep/fe-ping.c b/src/fe-common/xep/fe-ping.c
index 4ac2515..e2dbc6f 100644
--- a/src/fe-common/xep/fe-ping.c
+++ b/src/fe-common/xep/fe-ping.c
@@ -16,10 +16,10 @@
  */		 
 
 #include "module.h"
-#include "levels.h"
-#include "printtext.h"
-#include "signals.h"
-#include "fe-common/irc/module-formats.h"
+#include <irssi/src/core/levels.h>
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/irc/module-formats.h>
 
 #include "xmpp-servers.h"
 #include "rosters-tools.h"
diff --git a/src/fe-common/xep/fe-registration.c b/src/fe-common/xep/fe-registration.c
index cff905a..985ac6d 100644
--- a/src/fe-common/xep/fe-registration.c
+++ b/src/fe-common/xep/fe-registration.c
@@ -16,13 +16,13 @@
  */
 
 #include "module.h"
-#include "ignore.h"
-#include "levels.h"
+#include <irssi/src/core/ignore.h>
+#include <irssi/src/core/levels.h>
 #include "module-formats.h"
-#include "printtext.h"
-#include "signals.h"
-#include "fe-common/core/module-formats.h"
-#include "fe-common/irc/module-formats.h"
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/module-formats.h>
+#include <irssi/src/fe-common/irc/module-formats.h>
 
 #include "xmpp-servers.h"
 #include "xep/registration.h"
diff --git a/src/fe-common/xep/fe-vcard.c b/src/fe-common/xep/fe-vcard.c
index 5682d31..1d6c190 100644
--- a/src/fe-common/xep/fe-vcard.c
+++ b/src/fe-common/xep/fe-vcard.c
@@ -16,9 +16,9 @@
  */		 
 
 #include "module.h"
-#include "levels.h"
-#include "printtext.h"
-#include "signals.h"
+#include <irssi/src/core/levels.h>
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "rosters-tools.h"
diff --git a/src/fe-common/xep/fe-version.c b/src/fe-common/xep/fe-version.c
index 9e135a3..0d3c290 100644
--- a/src/fe-common/xep/fe-version.c
+++ b/src/fe-common/xep/fe-version.c
@@ -16,9 +16,9 @@
  */		 
 
 #include "module.h"
-#include "levels.h"
-#include "printtext.h"
-#include "signals.h"
+#include <irssi/src/core/levels.h>
+#include <irssi/src/fe-common/core/printtext.h>
+#include <irssi/src/core/signals.h>
 
 #include "xmpp-servers.h"
 #include "rosters-tools.h"
diff --git a/src/fe-common/xmpp-completion.c b/src/fe-common/xmpp-completion.c
index 4e562a1..bf206f5 100644
--- a/src/fe-common/xmpp-completion.c
+++ b/src/fe-common/xmpp-completion.c
@@ -18,12 +18,12 @@
 #include <string.h>
 
 #include "module.h"
-#include "channels.h"
-#include "channels-setup.h"
-#include "misc.h"
-#include "settings.h"
-#include "signals.h"
-#include "window-items.h"
+#include <irssi/src/core/channels.h>
+#include <irssi/src/core/channels-setup.h>
+#include <irssi/src/core/misc.h>
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-common/core/window-items.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-commands.h"
diff --git a/src/fe-common/xmpp-formats.c b/src/fe-common/xmpp-formats.c
index a781379..f4a1c4a 100644
--- a/src/fe-common/xmpp-formats.c
+++ b/src/fe-common/xmpp-formats.c
@@ -16,8 +16,8 @@
  */
 
 #include "module.h"
-#include "formats.h"
-#include "signals.h"
+#include <irssi/src/fe-common/core/formats.h>
+#include <irssi/src/core/signals.h>
 
 static void
 sig_strip_codes(const char *in, const char **out)
diff --git a/src/fe-text/module.h b/src/fe-text/module.h
index 3caacfb..d9696ba 100644
--- a/src/fe-text/module.h
+++ b/src/fe-text/module.h
@@ -1,5 +1,5 @@
 #define MODULE_NAME "xmpp/text"
 
-#include "irssi-config.h"
-#include "common.h"
+#include <irssi/irssi-config.h>
+#include <irssi/src/common.h>
 #include "xmpp.h"
diff --git a/src/fe-text/text-xmpp-core.c b/src/fe-text/text-xmpp-core.c
index 05cdba5..beb539e 100644
--- a/src/fe-text/text-xmpp-core.c
+++ b/src/fe-text/text-xmpp-core.c
@@ -16,7 +16,7 @@
  */
 
 #include "module.h"
-#include "modules.h"
+#include <irssi/src/core/modules.h>
 
 #include "xep/text-xep.h"
 
diff --git a/src/fe-text/xep/text-composing.c b/src/fe-text/xep/text-composing.c
index 79dbb09..641302e 100644
--- a/src/fe-text/xep/text-composing.c
+++ b/src/fe-text/xep/text-composing.c
@@ -18,10 +18,9 @@
 #include <string.h>
 
 #include "module.h"
-#include "module-formats.h"
-#include "signals.h"
-#include "statusbar-item.h"
-#include "window-items.h"
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-text/statusbar-item.h>
+#include <irssi/src/fe-common/core/window-items.h>
 
 #include "xmpp-servers.h"
 #include "xmpp-queries.h"
diff --git a/src/fe-text/xep/text-muc.c b/src/fe-text/xep/text-muc.c
index b8c1345..4cf8969 100644
--- a/src/fe-text/xep/text-muc.c
+++ b/src/fe-text/xep/text-muc.c
@@ -16,10 +16,10 @@
  */
 
 #include "module.h"
-#include "settings.h"
-#include "signals.h"
-#include "statusbar-item.h"
-#include "window-items.h"
+#include <irssi/src/core/settings.h>
+#include <irssi/src/core/signals.h>
+#include <irssi/src/fe-text/statusbar-item.h>
+#include <irssi/src/fe-common/core/window-items.h>
 
 #include "xmpp-servers.h"
 #include "xep/muc.h"

From c7728ea5aa2f4e584159b3d12ad815294c44ca6a Mon Sep 17 00:00:00 2001
From: Ailin Nemui <ailin@z30a.localdomain>
Date: Tue, 17 Mar 2020 14:32:52 +0100
Subject: [PATCH 3/4] add compatibility code to GTimeVal -> gint64 transition

this is for irssi/irssi#1145
---
 src/core/xep/ping.c | 50 +++++++++++++++++++++++++++++++++------------
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/src/core/xep/ping.c b/src/core/xep/ping.c
index d51930a..7b811cb 100644
--- a/src/core/xep/ping.c
+++ b/src/core/xep/ping.c
@@ -36,15 +36,40 @@
 
 #define XMLNS_PING "urn:xmpp:ping"
 
+#if defined(IRSSI_ABI_VERSION) && IRSSI_ABI_VERSION >= 25
+#define NO_TIMEVAL
+#define TimeType gint64
+#else
+#define TimeType GTimeVal
+#endif
+
 struct ping_data {
-	char	 *id;
-	GTimeVal  time;
+	char    *id;
+	TimeType time;
 };
 
 static int	 timeout_tag;
 static GSList	*supported_servers;
 static DATALIST *pings;
 
+#ifdef NO_TIMEVAL
+
+#define set_current_time(var)   (var) = g_get_real_time()
+#define clear_time(var)         (var) = 0
+#define has_time(var)           ((var) != 0)
+#define get_time_sec(var)       ((var) / G_TIME_SPAN_SECOND)
+#define get_time_diff(to, from) (to) - (from)
+
+#else
+
+#define set_current_time(var)   g_get_current_time(&(var))
+#define clear_time(var)         memset(&(var), 0, sizeof((var)))
+#define has_time(var)           ((var).tv_sec != 0)
+#define get_time_sec(var)       ((var).tv_sec)
+#define get_time_diff(to, from) (int) get_timeval_diff(&(to), &(from))
+
+#endif
+
 static void
 request_ping(XMPP_SERVER_REC *server, const char *dest)
 {
@@ -63,13 +88,13 @@ request_ping(XMPP_SERVER_REC *server, const char *dest)
 		g_free(server->ping_id);
 		server->ping_id =
 		    g_strdup(lm_message_node_get_attribute(lmsg->node, "id"));
-		g_get_current_time(&server->lag_sent);
+		set_current_time(server->lag_sent);
 		server->lag_last_check = time(NULL);
 	} else {
 		pd = g_new0(struct ping_data, 1);
 		pd->id =
 		    g_strdup(lm_message_node_get_attribute(lmsg->node, "id"));
-		g_get_current_time(&pd->time);
+		set_current_time(pd->time);
 		datalist_add(pings, server, dest, pd);
 	}
 	signal_emit("xmpp send iq", 2, server, lmsg);
@@ -98,7 +123,7 @@ sig_recv_iq(XMPP_SERVER_REC *server, LmMessage *lmsg, const int type,
 {
 	DATALIST_REC *rec;
 	LmMessageNode *node;
-	GTimeVal now;
+	TimeType now;
 	struct ping_data *pd;
 
 	if (type == LM_MESSAGE_SUB_TYPE_RESULT) {
@@ -106,19 +131,18 @@ sig_recv_iq(XMPP_SERVER_REC *server, LmMessage *lmsg, const int type,
 		if (server->ping_id != NULL
 		    && (*from == '\0' || strcmp(from, server->domain) == 0)
 	    	    && strcmp(id, server->ping_id) == 0) {
-			g_get_current_time(&now);
-			server->lag =
-			    (int)get_timeval_diff(&now, &server->lag_sent);
-			memset(&server->lag_sent, 0, sizeof(server->lag_sent));
+			set_current_time(now);
+			server->lag = get_time_diff(now, server->lag_sent);
+			clear_time(server->lag_sent);
 			g_free_and_null(server->ping_id);
 			signal_emit("server lag", 1, server);
 		} else if (lmsg->node->children == NULL
 		    && (rec = datalist_find(pings, server, from)) != NULL) {
 			pd = rec->data;
 			if (strcmp(id, pd->id) == 0) {
-				g_get_current_time(&now);
+				set_current_time(now);
 				signal_emit("xmpp ping", 3, server, from,
-				    get_timeval_diff(&now, &pd->time));
+				    get_time_diff(now, pd->time));
 			}
 		}
 	} else if (type == LM_MESSAGE_SUB_TYPE_GET) {
@@ -166,10 +190,10 @@ check_ping_func(void)
 	now = time(NULL);
 	for (tmp = supported_servers; tmp != NULL; tmp = tmp->next) {
 		server = XMPP_SERVER(tmp->data);
-		if (server->lag_sent.tv_sec != 0) {
+		if (has_time(server->lag_sent)) {
 			/* waiting for lag reply */
 			if (max_lag > 1 &&
-			    (now - server->lag_sent.tv_sec) > max_lag) {
+			    (now - get_time_sec(server->lag_sent)) > max_lag) {
 				/* too much lag - disconnect */
 				signal_emit("server lag disconnect", 1,
 				    server);

From 676acc67c387361f5656090bc1043f43cd0e850f Mon Sep 17 00:00:00 2001
From: Ailin Nemui <ailin@d5401s.localdomain>
Date: Thu, 8 Apr 2021 21:36:24 +0200
Subject: [PATCH 4/4] restore compatibility with fixed Irssi prefixes

this is for irssi/irssi#1246 and irssi/irssi#1264

Fixes build with Irssi 1.3
---
 src/fe-common/xmpp-completion.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/fe-common/xmpp-completion.c b/src/fe-common/xmpp-completion.c
index 4e562a1..b4cbf82 100644
--- a/src/fe-common/xmpp-completion.c
+++ b/src/fe-common/xmpp-completion.c
@@ -30,6 +30,10 @@
 #include "rosters-tools.h"
 #include "tools.h"
 
+#if !defined(IRSSI_ABI_VERSION) || IRSSI_ABI_VERSION < 33
+#  define i_list_find_string glist_find_string
+#endif
+
 static char *
 quoted_if_space(const char *name, const char *res)
 {
@@ -287,7 +291,7 @@ get_channels(XMPP_SERVER_REC *server, const char *word)
 		    chat_type, XMPP_PROTOCOL_NAME)
 		    || *channel_setup->name != '#')
 		    && g_ascii_strncasecmp(channel_setup->name, word, len) == 0
-		    && glist_find_string(list, channel_setup->name) == NULL)
+		    && i_list_find_string(list, channel_setup->name) == NULL)
 			list = g_list_append(list,
 			    g_strdup(channel_setup->name));
 	}
