From 4891e4a80b01b049cb80df71cf18cacd85cf2137 Mon Sep 17 00:00:00 2001 From: Maxim Sobolev Date: Thu, 19 Aug 2004 10:12:20 +0000 Subject: Add jit 1.1.6, jabber ICQ Transport. PR: ports/69349 Submitted by: Alexander Timoshenko --- net/jit/Makefile | 36 +++++ net/jit/distinfo | 2 + net/jit/files/patch-Makefile | 10 ++ net/jit/files/patch-disco-sg2 | 243 ++++++++++++++++++++++++++++ net/jit/files/patch-jabberd::mio_xml.c | 24 +++ net/jit/files/patch-jabberd::mtq.c | 11 ++ net/jit/files/patch-jit::jabber-icq.example | 48 ++++++ net/jit/files/patch-jit::jit.sh | 16 ++ net/jit/files/patch-jit::jit::wp_client.cpp | 12 ++ net/jit/pkg-deinstall | 19 +++ net/jit/pkg-descr | 5 + net/jit/pkg-install | 41 +++++ net/jit/pkg-plist | 6 + 13 files changed, 473 insertions(+) create mode 100644 net/jit/Makefile create mode 100644 net/jit/distinfo create mode 100644 net/jit/files/patch-Makefile create mode 100644 net/jit/files/patch-disco-sg2 create mode 100644 net/jit/files/patch-jabberd::mio_xml.c create mode 100644 net/jit/files/patch-jabberd::mtq.c create mode 100644 net/jit/files/patch-jit::jabber-icq.example create mode 100644 net/jit/files/patch-jit::jit.sh create mode 100644 net/jit/files/patch-jit::jit::wp_client.cpp create mode 100644 net/jit/pkg-deinstall create mode 100644 net/jit/pkg-descr create mode 100644 net/jit/pkg-install create mode 100644 net/jit/pkg-plist (limited to 'net/jit') diff --git a/net/jit/Makefile b/net/jit/Makefile new file mode 100644 index 000000000000..b7c2de007448 --- /dev/null +++ b/net/jit/Makefile @@ -0,0 +1,36 @@ +# New ports collection makefile for: jit +# Date created: 20 July 2004 +# Whom: Alexander Timoshenko +# +# $FreeBSD$ +# + +PORTNAME= jit +PORTVERSION= 1.1.6 +CATEGORIES= net +MASTER_SITES= http://www.jabberstudio.org/files/jit/ +DIST_SUBDIR= jabber + +MAINTAINER= gonzo@univ.kiev.ua +COMMENT= Jabber ICQ Transport + +USE_GMAKE= yes +USE_REINPLACE= yes +HAS_CONFIGURE= yes + +post-patch: + @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \ + ${WRKSRC}/jit/jabber-icq.example ${WRKSRC}/jit/jit.sh + +do-install: + @${MKDIR} ${PREFIX}/lib/jabber/jit + @${INSTALL_DATA} ${WRKSRC}/jit/jit.so ${PREFIX}/lib/jabber/jit + @${INSTALL_DATA} ${WRKSRC}/xdb_file/xdb_file.so ${PREFIX}/lib/jabber/jit + @${INSTALL_PROGRAM} ${WRKSRC}/jabberd/jabberd ${PREFIX}/sbin/jit + @${INSTALL_DATA} ${WRKSRC}/jit/jabber-icq.example ${PREFIX}/etc + @${INSTALL_SCRIPT} ${WRKSRC}/jit/jit.sh ${PREFIX}/etc/rc.d + +post-install: + @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + +.include diff --git a/net/jit/distinfo b/net/jit/distinfo new file mode 100644 index 000000000000..0d7e9a931092 --- /dev/null +++ b/net/jit/distinfo @@ -0,0 +1,2 @@ +MD5 (jabber/jit-1.1.6.tar.gz) = 950f6b82ab5e0542535108fd54409363 +SIZE (jabber/jit-1.1.6.tar.gz) = 275246 diff --git a/net/jit/files/patch-Makefile b/net/jit/files/patch-Makefile new file mode 100644 index 000000000000..d7e40364b070 --- /dev/null +++ b/net/jit/files/patch-Makefile @@ -0,0 +1,10 @@ +--- Makefile.orig Tue Jul 6 19:11:02 2004 ++++ Makefile Tue Jul 6 19:10:53 2004 +@@ -2,6 +2,7 @@ + all: + (cd jit && $(MAKE)) + (cd jabberd && $(MAKE)) ++ (cd xdb_file && $(MAKE)) + + clean: + (cd jit && $(MAKE) clean) diff --git a/net/jit/files/patch-disco-sg2 b/net/jit/files/patch-disco-sg2 new file mode 100644 index 000000000000..b3b843beb0cf --- /dev/null +++ b/net/jit/files/patch-disco-sg2 @@ -0,0 +1,243 @@ +diff -ru jabber.orig/lib/lib.h jabberd/lib/lib.h +--- jabber.orig/lib/lib.h 2003-05-30 16:10:24.000000000 +0400 ++++ jabberd/lib/lib.h 2003-12-11 22:48:04.000000000 +0300 +@@ -654,6 +654,9 @@ + #define NS_XDBGINSERT "jabber:xdb:ginsert" + #define NS_XDBNSLIST "jabber:xdb:nslist" + ++#define NS_DISCO_INFO "http://jabber.org/protocol/disco#info" ++#define NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items" ++ + + /* --------------------------------------------------------- */ + /* */ +diff -ru jit.orig/jit/icqtransport.h jit/jit/icqtransport.h +--- jit.orig/jit/icqtransport.h 2003-06-02 14:06:51.000000000 +0400 ++++ jit/jit/icqtransport.h 2003-12-12 13:14:40.000000000 +0300 +@@ -20,7 +20,7 @@ + #include "utils/english.h" + #endif + +-#define MOD_VERSION "1.1.6" ++#define MOD_VERSION "1.1.6-sg2" + #define DEFAULT_CHARSET "iso-8859-1" + + typedef unsigned long UIN_t; +@@ -290,6 +290,10 @@ + void it_iq_gateway_set(session s, jpacket jp); + void it_iq_browse_server(iti ti, jpacket jp); + void it_iq_browse_user(session s, jpacket jp); ++void it_iq_disco_info_server(iti ti, jpacket jp); ++void it_iq_disco_info_user(session s, jpacket jp); ++void it_iq_disco_items_server(iti ti, jpacket jp); ++void it_iq_disco_items_user(session s, jpacket jp); + + + void it_save_contacts(session s); +diff -ru jit.orig/jit/iq.c jit/jit/iq.c +--- jit.orig/jit/iq.c 2003-04-29 15:03:53.000000000 +0400 ++++ jit/jit/iq.c 2003-12-11 22:48:04.000000000 +0300 +@@ -29,6 +29,10 @@ + void it_iq_gateway_set(session s, jpacket jp); + void it_iq_browse_server(iti ti, jpacket jp); + void it_iq_browse_user(session s, jpacket jp); ++void it_iq_disco_info_server(iti ti, jpacket jp); ++void it_iq_disco_info_user(session s, jpacket jp); ++void it_iq_disco_items_server(iti ti, jpacket jp); ++void it_iq_disco_items_user(session s, jpacket jp); + + void SendSearchUINRequest(session s,UIN_t uin); + void SendSearchUsersRequest(session s, +@@ -73,6 +77,10 @@ + it_iq_gateway_get(s,jp); + else if (j_strcmp(ns,NS_BROWSE) == 0) + jp->to->user ? it_iq_browse_user(s,jp) : it_iq_browse_server(s->ti,jp); ++ else if (j_strcmp(ns,NS_DISCO_INFO) == 0) ++ jp->to->user ? it_iq_disco_info_user(s,jp) : it_iq_disco_info_server(s->ti,jp); ++ else if (j_strcmp(ns,NS_DISCO_ITEMS) == 0) ++ jp->to->user ? it_iq_disco_items_user(s,jp) : it_iq_disco_items_server(s->ti,jp); + else if (j_strcmp(ns,NS_VCARD) == 0) + jp->to->user ? it_iq_vcard(s,jp) : it_iq_vcard_server(s->ti,jp); + else if (j_strcmp(ns,NS_LAST) == 0) +@@ -503,6 +511,8 @@ + xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_REGISTER,-1); + xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_SEARCH,-1); + xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_GATEWAY,-1); ++ xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_DISCO_INFO,-1); ++ xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_DISCO_ITEMS,-1); + + it_deliver(ti,jp->x); + } +@@ -538,6 +548,131 @@ + it_deliver(s->ti,jp->x); + } + ++/** Service Discovery support (JEP-0030) */ ++/** Info */ ++ ++void it_iq_disco_info_server(iti ti, jpacket jp) ++{ ++ xmlnode q, x; ++ ++ if(xmlnode_get_attrib(xmlnode_get_tag(jp->x, "query"),"node") != NULL) ++ { ++ jutil_error(jp->x,TERROR_NOTALLOWED); ++ it_deliver(ti,jp->x); ++ return; ++ } ++ ++ q = xmlnode_insert_tag(jutil_iqresult(jp->x),"query"); ++ xmlnode_put_attrib(q,"xmlns",NS_DISCO_INFO); ++ ++ x = xmlnode_insert_tag(q,"identity"); ++ xmlnode_put_attrib(x,"category","gateway"); ++ xmlnode_put_attrib(x,"type","icq"); ++ xmlnode_put_attrib(x,"name",xmlnode_get_tag_data(ti->vcard,"FN")); ++ ++ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_REGISTER); ++ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_SEARCH); ++ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_VERSION); ++ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_TIME); ++ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_LAST); ++ ++ it_deliver(ti,jp->x); ++} ++ ++void it_iq_disco_info_user(session s, jpacket jp) ++{ ++ xmlnode q, x; ++ ++ if (s->type == stype_register) ++ { ++ queue_elem queue; ++ ++ queue = pmalloco(jp->p,sizeof(_queue_elem)); ++ queue->elem = (void *)jp; ++ ++ QUEUE_PUT(s->queue,s->queue_last,queue); ++ return; ++ } ++ ++ if (it_jid2uin(jp->from) == 0) ++ { ++ jutil_error(jp->x,TERROR_BAD); ++ it_deliver(s->ti,jp->x); ++ return; ++ } ++ ++ if(xmlnode_get_attrib(xmlnode_get_tag(jp->x, "query"),"node") != NULL) ++ { ++ jutil_error(jp->x,TERROR_NOTALLOWED); ++ it_deliver(s->ti,jp->x); ++ return; ++ } ++ ++ q = xmlnode_insert_tag(jutil_iqresult(jp->x),"query"); ++ xmlnode_put_attrib(q,"xmlns",NS_DISCO_INFO); ++ x = xmlnode_insert_tag(q,"identity"); ++ xmlnode_put_attrib(x,"category","user"); ++ xmlnode_put_attrib(x,"type","client"); ++ xmlnode_put_attrib(x,"name", jp->to->user); ++ ++ it_deliver(s->ti,jp->x); ++} ++ ++/** Service Discovery support (JEP-0030) */ ++/** Items */ ++ ++void it_iq_disco_items_server(iti ti, jpacket jp) ++{ ++ xmlnode q; ++ ++ if(xmlnode_get_attrib(xmlnode_get_tag(jp->x, "query"),"node") != NULL) ++ { ++ jutil_error(jp->x,TERROR_NOTALLOWED); ++ it_deliver(ti,jp->x); ++ return; ++ } ++ ++ q = xmlnode_insert_tag(jutil_iqresult(jp->x),"query"); ++ xmlnode_put_attrib(q,"xmlns",NS_DISCO_ITEMS); ++ ++ it_deliver(ti,jp->x); ++} ++ ++void it_iq_disco_items_user(session s, jpacket jp) ++{ ++ xmlnode q; ++ ++ if (s->type == stype_register) ++ { ++ queue_elem queue; ++ ++ queue = pmalloco(jp->p,sizeof(_queue_elem)); ++ queue->elem = (void *)jp; ++ ++ QUEUE_PUT(s->queue,s->queue_last,queue); ++ return; ++ } ++ ++ if (it_jid2uin(jp->from) == 0) ++ { ++ jutil_error(jp->x,TERROR_BAD); ++ it_deliver(s->ti,jp->x); ++ return; ++ } ++ ++ if(xmlnode_get_attrib(xmlnode_get_tag(jp->x, "query"),"node") != NULL) ++ { ++ jutil_error(jp->x,TERROR_NOTALLOWED); ++ it_deliver(s->ti,jp->x); ++ return; ++ } ++ ++ q = xmlnode_insert_tag(jutil_iqresult(jp->x),"query"); ++ xmlnode_put_attrib(q,"xmlns",NS_DISCO_ITEMS); ++ ++ it_deliver(s->ti,jp->x); ++} ++ + /** Send reply to a version inquiry to Jabber */ + void it_iq_version(iti ti, jpacket jp) + { +diff -ru jit.orig/jit/session.c jit/jit/session.c +--- jit.orig/jit/session.c 2003-05-12 15:07:53.000000000 +0400 ++++ jit/jit/session.c 2003-12-12 12:59:30.000000000 +0300 +@@ -429,6 +429,11 @@ + time(NULL)-s->start_time); + } + ++ if ((s->ti->own_roster)&&(s->roster_changed)) { ++ it_save_contacts(s); ++ s->roster_changed = 0; ++ } ++ + /* remove from hash */ + SEM_LOCK(s->ti->sessions_sem); + wpxhash_zap(s->ti->sessions,jid_full(s->id)); +@@ -468,6 +473,11 @@ + else + it_session_regerr(s,e); + ++ if ((s->ti->own_roster)&&(s->roster_changed)) { ++ it_save_contacts(s); ++ s->roster_changed = 0; ++ } ++ + /* remove from hash */ + SEM_LOCK(s->ti->sessions_sem); + wpxhash_zap(s->ti->sessions,jid_full(s->id)); +diff -ru jit.orig/jit/unknown.c jit/jit/unknown.c +--- jit.orig/jit/unknown.c 2003-04-29 14:19:42.000000000 +0400 ++++ jit/jit/unknown.c 2003-12-11 22:48:04.000000000 +0300 +@@ -84,6 +84,10 @@ + } + else if (j_strcmp(ns,NS_BROWSE) == 0) + it_iq_browse_server(ti,jp); ++ else if (j_strcmp(ns,NS_DISCO_INFO) == 0) ++ it_iq_disco_info_server(ti,jp); ++ else if (j_strcmp(ns,NS_DISCO_ITEMS) == 0) ++ it_iq_disco_items_server(ti,jp); + else if (j_strcmp(ns,NS_VERSION) == 0) + it_iq_version(ti,jp); + else if (j_strcmp(ns,NS_TIME) == 0) diff --git a/net/jit/files/patch-jabberd::mio_xml.c b/net/jit/files/patch-jabberd::mio_xml.c new file mode 100644 index 000000000000..b747648bd84d --- /dev/null +++ b/net/jit/files/patch-jabberd::mio_xml.c @@ -0,0 +1,24 @@ +--- jabberd/mio_xml.c.orig Tue Jul 6 19:06:24 2004 ++++ jabberd/mio_xml.c Tue Jul 6 19:07:34 2004 +@@ -142,14 +142,13 @@ + nul += 4; + bufsz = bufsz - (nul - buf); + buf = nul; +- mio_write(m,NULL,"HTTP/1.0 200 Ok +-Server: jabber/xmlstream-hack-0.1 +-Expires: Fri, 10 Oct 1997 10:10:10 GMT +-Pragma: no-cache +-Cache-control: private +-Connection: close +- +-",-1); ++ mio_write(m,NULL,"HTTP/1.0 200 Ok\n" \ ++"Server: jabber/xmlstream-hack-0.1\n" \ ++"Expires: Fri, 10 Oct 1997 10:10:10 GMT\n" \ ++"Pragma: no-cache\n" \ ++"Cache-control: private\n" \ ++"Connection: close\n" \ ++"\n", -1); + m->type = type_NORMAL; + } + diff --git a/net/jit/files/patch-jabberd::mtq.c b/net/jit/files/patch-jabberd::mtq.c new file mode 100644 index 000000000000..3fdeed4a6db2 --- /dev/null +++ b/net/jit/files/patch-jabberd::mtq.c @@ -0,0 +1,11 @@ +--- jabberd/mtq.c.orig Tue Jul 6 19:18:05 2004 ++++ jabberd/mtq.c Tue Jul 6 19:18:29 2004 +@@ -127,7 +127,7 @@ + while(1) { + + if (t->mtq->last == NULL ) { +- Sleep(1); ++ Sleep(500); + } + + diff --git a/net/jit/files/patch-jit::jabber-icq.example b/net/jit/files/patch-jit::jabber-icq.example new file mode 100644 index 000000000000..805d414362ae --- /dev/null +++ b/net/jit/files/patch-jit::jabber-icq.example @@ -0,0 +1,48 @@ +--- jit/jabber-icq.example.orig Tue Jul 20 16:54:23 2004 ++++ jit/jabber-icq.example Tue Jul 20 16:59:10 2004 +@@ -23,16 +23,16 @@ + XDB requests. This is strongly recommended if + you use xdb_ldap, xdb_sql or other non-file XDB + implementations, too. +- See xdb_file directory for more information. ++ See xdb_file directory for more information. --> + + + +- xdb_file/xdb_file.so ++ %%PREFIX%%/lib/jabber/jit/xdb_file.so + + + ./spool + +- --> ++ + + +- windows-1252 ++ windows-1251 + + + +- 205.188.179.233 +- 64.12.200.89 ++ login.icq.com + + + + + + +- jit/jit.so ++ %%PREFIX%%/lib/jabber/jit/jit.so + + + diff --git a/net/jit/files/patch-jit::jit.sh b/net/jit/files/patch-jit::jit.sh new file mode 100644 index 000000000000..ce4c03742062 --- /dev/null +++ b/net/jit/files/patch-jit::jit.sh @@ -0,0 +1,16 @@ +--- jit/jit.sh.orig Tue Jul 20 17:09:59 2004 ++++ jit/jit.sh Tue Jul 20 17:10:47 2004 +@@ -0,0 +1,13 @@ ++#!/bin/sh ++ ++PREFIX=%%PREFIX%% ++USER="jabber" ++ ++echo -n " jit" ++case ${1:-start} in ++start) ++ su -f -m ${USER} -c "$PREFIX/sbin/jit -c $PREFIX/etc/jabber-icq.xml -d " ;; ++ ++stop) ++ killall -SIGKILL -u ${USER} jit; ++esac diff --git a/net/jit/files/patch-jit::jit::wp_client.cpp b/net/jit/files/patch-jit::jit::wp_client.cpp new file mode 100644 index 000000000000..ad907a1d23a5 --- /dev/null +++ b/net/jit/files/patch-jit::jit::wp_client.cpp @@ -0,0 +1,12 @@ +--- jit/jit/wp_client.cpp Tue Jul 6 18:58:45 2004 ++++ jit/jit/wp_client.cpp Tue Jul 6 18:55:31 2004 +@@ -146,7 +146,8 @@ + } + + void WPclient::SignalDisconnected(DisconnectedEvent *ev) { +- terror e = (terror){0,""}; ++ terror e; ++ e = (terror){0,""}; + + switch(ev->getReason()){ + case DisconnectedEvent::FAILED_BADUSERNAME: diff --git a/net/jit/pkg-deinstall b/net/jit/pkg-deinstall new file mode 100644 index 000000000000..fc6eddb5899c --- /dev/null +++ b/net/jit/pkg-deinstall @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ "$2" != "POST-DEINSTALL" ]; then + exit 0 +fi + +USER=jabber + +if pw usershow "${USER}" 2>/dev/null 1>&2; then + echo "To delete Jabber user permanently, use 'pw userdel ${USER}'" +fi + +if pw groupshow "${USER}" 2>/dev/null 1>&2; then + echo "To delete Jabber group permanently, use 'pw groupdel ${USER}'" +fi + +echo "If you wish to delete jit data files, remove '/var/spool/jit' directory." + +exit 0 diff --git a/net/jit/pkg-descr b/net/jit/pkg-descr new file mode 100644 index 000000000000..506e6985f30f --- /dev/null +++ b/net/jit/pkg-descr @@ -0,0 +1,5 @@ +JIT - Jabber ICQ Transport - is a working and stable Jabber +transport which provides interoperability between ICQ and +Jabber IM systems. + +WWW: http://jit.jabberstudio.org/ diff --git a/net/jit/pkg-install b/net/jit/pkg-install new file mode 100644 index 000000000000..490beedf25d2 --- /dev/null +++ b/net/jit/pkg-install @@ -0,0 +1,41 @@ +#!/bin/sh + +if [ "$2" != "POST-INSTALL" ]; then + exit 0 +fi + +USER=jabber +GROUP=${USER} +UID=93 +GID=${UID} +SPOOLDIR="/var/spool/jit" + +if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi +fi + +if ! pw usershow "${USER}" 2>/dev/null 1>&2; then + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -s "/sbin/nologin" -d "/nonexistent" \ + -c "Jabber Daemon"; \ + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi +fi + +if [ ! -d ${SPOOLDIR} ]; then + echo "Creating \"${SPOOLDIR}\"." + mkdir -p ${SPOOLDIR} +fi + +echo "Fixing ownerships and modes in \"${SPOOLDIR}\"." +chown -R ${USER}:${GROUP} ${SPOOLDIR} +chmod -R go= ${SPOOLDIR} diff --git a/net/jit/pkg-plist b/net/jit/pkg-plist new file mode 100644 index 000000000000..86a46584d327 --- /dev/null +++ b/net/jit/pkg-plist @@ -0,0 +1,6 @@ +lib/jabber/jit/jit.so +lib/jabber/jit/xdb_file.so +sbin/jit +etc/jabber-icq.example +etc/rc.d/jit.sh +@dirrm lib/jabber/jit -- cgit v1.2.3