Date: Tue, 20 Jul 2004 20:17:44 +0300 From: Alexander Timoshenko <gonzo@univ.kiev.ua> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/69349: New port: net/jit jabber icq transport Message-ID: <E1BmyFM-000DA3-CD@expo.ukrweb.net> Resent-Message-ID: <200407201720.i6KHKFiE079679@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 69349 >Category: ports >Synopsis: New port: net/jit jabber icq transport >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jul 20 17:20:15 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Alexander Timoshenko >Release: FreeBSD 5.2.1-RELEASE-p1 i386 >Organization: >Environment: System: FreeBSD expo.ukrweb.net 5.2.1-RELEASE-p1 FreeBSD 5.2.1-RELEASE-p1 #2: Thu Mar 18 17:45:54 EET 2004 levsha@expo.ukrweb.net:/usr/obj/usr/src/sys/EXPO i386 >Description: >How-To-Repeat: >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # jit # jit/files # jit/files/patch-jit::jit::wp_client.cpp # jit/files/patch-jabberd::mio_xml.c # jit/files/patch-Makefile # jit/files/patch-jabberd::mtq.c # jit/files/patch-jit::jabber-icq.example # jit/files/patch-jit::jit.sh # jit/files/patch-disco-sg2 # jit/Makefile # jit/distinfo # jit/pkg-descr # jit/pkg-plist # jit/pkg-install # jit/pkg-deinstall # echo c - jit mkdir -p jit > /dev/null 2>&1 echo c - jit/files mkdir -p jit/files > /dev/null 2>&1 echo x - jit/files/patch-jit::jit::wp_client.cpp sed 's/^X//' >jit/files/patch-jit::jit::wp_client.cpp << 'END-of-jit/files/patch-jit::jit::wp_client.cpp' X--- jit/jit/wp_client.cpp Tue Jul 6 18:58:45 2004 X+++ jit/jit/wp_client.cpp Tue Jul 6 18:55:31 2004 X@@ -146,7 +146,8 @@ X } X X void WPclient::SignalDisconnected(DisconnectedEvent *ev) { X- terror e = (terror){0,""}; X+ terror e; X+ e = (terror){0,""}; X X switch(ev->getReason()){ X case DisconnectedEvent::FAILED_BADUSERNAME: END-of-jit/files/patch-jit::jit::wp_client.cpp echo x - jit/files/patch-jabberd::mio_xml.c sed 's/^X//' >jit/files/patch-jabberd::mio_xml.c << 'END-of-jit/files/patch-jabberd::mio_xml.c' X--- jabberd/mio_xml.c.orig Tue Jul 6 19:06:24 2004 X+++ jabberd/mio_xml.c Tue Jul 6 19:07:34 2004 X@@ -142,14 +142,13 @@ X nul += 4; X bufsz = bufsz - (nul - buf); X buf = nul; X- mio_write(m,NULL,"HTTP/1.0 200 Ok X-Server: jabber/xmlstream-hack-0.1 X-Expires: Fri, 10 Oct 1997 10:10:10 GMT X-Pragma: no-cache X-Cache-control: private X-Connection: close X- X-",-1); X+ mio_write(m,NULL,"HTTP/1.0 200 Ok\n" \ X+"Server: jabber/xmlstream-hack-0.1\n" \ X+"Expires: Fri, 10 Oct 1997 10:10:10 GMT\n" \ X+"Pragma: no-cache\n" \ X+"Cache-control: private\n" \ X+"Connection: close\n" \ X+"\n", -1); X m->type = type_NORMAL; X } X END-of-jit/files/patch-jabberd::mio_xml.c echo x - jit/files/patch-Makefile sed 's/^X//' >jit/files/patch-Makefile << 'END-of-jit/files/patch-Makefile' X--- Makefile.orig Tue Jul 6 19:11:02 2004 X+++ Makefile Tue Jul 6 19:10:53 2004 X@@ -2,6 +2,7 @@ X all: X (cd jit && $(MAKE)) X (cd jabberd && $(MAKE)) X+ (cd xdb_file && $(MAKE)) X X clean: X (cd jit && $(MAKE) clean) END-of-jit/files/patch-Makefile echo x - jit/files/patch-jabberd::mtq.c sed 's/^X//' >jit/files/patch-jabberd::mtq.c << 'END-of-jit/files/patch-jabberd::mtq.c' X--- jabberd/mtq.c.orig Tue Jul 6 19:18:05 2004 X+++ jabberd/mtq.c Tue Jul 6 19:18:29 2004 X@@ -127,7 +127,7 @@ X while(1) { X X if (t->mtq->last == NULL ) { X- Sleep(1); X+ Sleep(500); X } X X END-of-jit/files/patch-jabberd::mtq.c echo x - jit/files/patch-jit::jabber-icq.example sed 's/^X//' >jit/files/patch-jit::jabber-icq.example << 'END-of-jit/files/patch-jit::jabber-icq.example' X--- jit/jabber-icq.example.orig Tue Jul 20 16:54:23 2004 X+++ jit/jabber-icq.example Tue Jul 20 16:59:10 2004 X@@ -23,16 +23,16 @@ X XDB requests. This is strongly recommended if X you use xdb_ldap, xdb_sql or other non-file XDB X implementations, too. X- See xdb_file directory for more information. X+ See xdb_file directory for more information. --> X <xdb id="xdb"> X <host/> X <load> X- <xdb_file>xdb_file/xdb_file.so</xdb_file> X+ <xdb_file>%%PREFIX%%/lib/jabber/jit/xdb_file.so</xdb_file> X </load> X <xdb_file xmlns="jabber:config:xdb_file"> X <spool><jabberd:cmdline flag='s'>./spool</jabberd:cmdline></spool> X </xdb_file> X- </xdb> --> X+ </xdb> X X <!-- X localhost is your jabber host. X@@ -102,22 +102,21 @@ X <session_timeout>18000</session_timeout> X X <!-- Charset --> X- <charset>windows-1252</charset> X+ <charset>windows-1251</charset> X X <!-- These IP is login.icq.com X Use only IPs here, no host names. X You can use hostnames but this will slow down JIT due to DNS resoling X --> X <server> X- <host port="5190">205.188.179.233</host> X- <host port="5190">64.12.200.89</host> X+ <host port="5190">login.icq.com</host> X </server> X X </icqtrans> X X <!-- JIT module --> X <load> X- <icqtrans>jit/jit.so</icqtrans> X+ <icqtrans>%%PREFIX%%/lib/jabber/jit/jit.so</icqtrans> X </load> X X </service> END-of-jit/files/patch-jit::jabber-icq.example echo x - jit/files/patch-jit::jit.sh sed 's/^X//' >jit/files/patch-jit::jit.sh << 'END-of-jit/files/patch-jit::jit.sh' X--- jit/jit.sh.orig Tue Jul 20 17:09:59 2004 X+++ jit/jit.sh Tue Jul 20 17:10:47 2004 X@@ -0,0 +1,13 @@ X+#!/bin/sh X+ X+PREFIX=%%PREFIX%% X+USER="jabber" X+ X+echo -n " jit" X+case ${1:-start} in X+start) X+ su -f -m ${USER} -c "$PREFIX/sbin/jit -c $PREFIX/etc/jabber-icq.xml -d " ;; X+ X+stop) X+ killall -SIGKILL -u ${USER} jit; X+esac END-of-jit/files/patch-jit::jit.sh echo x - jit/files/patch-disco-sg2 sed 's/^X//' >jit/files/patch-disco-sg2 << 'END-of-jit/files/patch-disco-sg2' Xdiff -ru jabber.orig/lib/lib.h jabberd/lib/lib.h X--- jabber.orig/lib/lib.h 2003-05-30 16:10:24.000000000 +0400 X+++ jabberd/lib/lib.h 2003-12-11 22:48:04.000000000 +0300 X@@ -654,6 +654,9 @@ X #define NS_XDBGINSERT "jabber:xdb:ginsert" X #define NS_XDBNSLIST "jabber:xdb:nslist" X X+#define NS_DISCO_INFO "http://jabber.org/protocol/disco#info" X+#define NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items" X+ X X /* --------------------------------------------------------- */ X /* */ Xdiff -ru jit.orig/jit/icqtransport.h jit/jit/icqtransport.h X--- jit.orig/jit/icqtransport.h 2003-06-02 14:06:51.000000000 +0400 X+++ jit/jit/icqtransport.h 2003-12-12 13:14:40.000000000 +0300 X@@ -20,7 +20,7 @@ X #include "utils/english.h" X #endif X X-#define MOD_VERSION "1.1.6" X+#define MOD_VERSION "1.1.6-sg2" X #define DEFAULT_CHARSET "iso-8859-1" X X typedef unsigned long UIN_t; X@@ -290,6 +290,10 @@ X void it_iq_gateway_set(session s, jpacket jp); X void it_iq_browse_server(iti ti, jpacket jp); X void it_iq_browse_user(session s, jpacket jp); X+void it_iq_disco_info_server(iti ti, jpacket jp); X+void it_iq_disco_info_user(session s, jpacket jp); X+void it_iq_disco_items_server(iti ti, jpacket jp); X+void it_iq_disco_items_user(session s, jpacket jp); X X X void it_save_contacts(session s); Xdiff -ru jit.orig/jit/iq.c jit/jit/iq.c X--- jit.orig/jit/iq.c 2003-04-29 15:03:53.000000000 +0400 X+++ jit/jit/iq.c 2003-12-11 22:48:04.000000000 +0300 X@@ -29,6 +29,10 @@ X void it_iq_gateway_set(session s, jpacket jp); X void it_iq_browse_server(iti ti, jpacket jp); X void it_iq_browse_user(session s, jpacket jp); X+void it_iq_disco_info_server(iti ti, jpacket jp); X+void it_iq_disco_info_user(session s, jpacket jp); X+void it_iq_disco_items_server(iti ti, jpacket jp); X+void it_iq_disco_items_user(session s, jpacket jp); X X void SendSearchUINRequest(session s,UIN_t uin); X void SendSearchUsersRequest(session s, X@@ -73,6 +77,10 @@ X it_iq_gateway_get(s,jp); X else if (j_strcmp(ns,NS_BROWSE) == 0) X jp->to->user ? it_iq_browse_user(s,jp) : it_iq_browse_server(s->ti,jp); X+ else if (j_strcmp(ns,NS_DISCO_INFO) == 0) X+ jp->to->user ? it_iq_disco_info_user(s,jp) : it_iq_disco_info_server(s->ti,jp); X+ else if (j_strcmp(ns,NS_DISCO_ITEMS) == 0) X+ jp->to->user ? it_iq_disco_items_user(s,jp) : it_iq_disco_items_server(s->ti,jp); X else if (j_strcmp(ns,NS_VCARD) == 0) X jp->to->user ? it_iq_vcard(s,jp) : it_iq_vcard_server(s->ti,jp); X else if (j_strcmp(ns,NS_LAST) == 0) X@@ -503,6 +511,8 @@ X xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_REGISTER,-1); X xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_SEARCH,-1); X xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_GATEWAY,-1); X+ xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_DISCO_INFO,-1); X+ xmlnode_insert_cdata(xmlnode_insert_tag(q,"ns"),NS_DISCO_ITEMS,-1); X X it_deliver(ti,jp->x); X } X@@ -538,6 +548,131 @@ X it_deliver(s->ti,jp->x); X } X X+/** Service Discovery support (JEP-0030) */ X+/** Info */ X+ X+void it_iq_disco_info_server(iti ti, jpacket jp) X+{ X+ xmlnode q, x; X+ X+ if(xmlnode_get_attrib(xmlnode_get_tag(jp->x, "query"),"node") != NULL) X+ { X+ jutil_error(jp->x,TERROR_NOTALLOWED); X+ it_deliver(ti,jp->x); X+ return; X+ } X+ X+ q = xmlnode_insert_tag(jutil_iqresult(jp->x),"query"); X+ xmlnode_put_attrib(q,"xmlns",NS_DISCO_INFO); X+ X+ x = xmlnode_insert_tag(q,"identity"); X+ xmlnode_put_attrib(x,"category","gateway"); X+ xmlnode_put_attrib(x,"type","icq"); X+ xmlnode_put_attrib(x,"name",xmlnode_get_tag_data(ti->vcard,"FN")); X+ X+ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_REGISTER); X+ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_SEARCH); X+ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_VERSION); X+ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_TIME); X+ xmlnode_put_attrib(xmlnode_insert_tag(q,"feature"),"var",NS_LAST); X+ X+ it_deliver(ti,jp->x); X+} X+ X+void it_iq_disco_info_user(session s, jpacket jp) X+{ X+ xmlnode q, x; X+ X+ if (s->type == stype_register) X+ { X+ queue_elem queue; X+ X+ queue = pmalloco(jp->p,sizeof(_queue_elem)); X+ queue->elem = (void *)jp; X+ X+ QUEUE_PUT(s->queue,s->queue_last,queue); X+ return; X+ } X+ X+ if (it_jid2uin(jp->from) == 0) X+ { X+ jutil_error(jp->x,TERROR_BAD); X+ it_deliver(s->ti,jp->x); X+ return; X+ } X+ X+ if(xmlnode_get_attrib(xmlnode_get_tag(jp->x, "query"),"node") != NULL) X+ { X+ jutil_error(jp->x,TERROR_NOTALLOWED); X+ it_deliver(s->ti,jp->x); X+ return; X+ } X+ X+ q = xmlnode_insert_tag(jutil_iqresult(jp->x),"query"); X+ xmlnode_put_attrib(q,"xmlns",NS_DISCO_INFO); X+ x = xmlnode_insert_tag(q,"identity"); X+ xmlnode_put_attrib(x,"category","user"); X+ xmlnode_put_attrib(x,"type","client"); X+ xmlnode_put_attrib(x,"name", jp->to->user); X+ X+ it_deliver(s->ti,jp->x); X+} X+ X+/** Service Discovery support (JEP-0030) */ X+/** Items */ X+ X+void it_iq_disco_items_server(iti ti, jpacket jp) X+{ X+ xmlnode q; X+ X+ if(xmlnode_get_attrib(xmlnode_get_tag(jp->x, "query"),"node") != NULL) X+ { X+ jutil_error(jp->x,TERROR_NOTALLOWED); X+ it_deliver(ti,jp->x); X+ return; X+ } X+ X+ q = xmlnode_insert_tag(jutil_iqresult(jp->x),"query"); X+ xmlnode_put_attrib(q,"xmlns",NS_DISCO_ITEMS); X+ X+ it_deliver(ti,jp->x); X+} X+ X+void it_iq_disco_items_user(session s, jpacket jp) X+{ X+ xmlnode q; X+ X+ if (s->type == stype_register) X+ { X+ queue_elem queue; X+ X+ queue = pmalloco(jp->p,sizeof(_queue_elem)); X+ queue->elem = (void *)jp; X+ X+ QUEUE_PUT(s->queue,s->queue_last,queue); X+ return; X+ } X+ X+ if (it_jid2uin(jp->from) == 0) X+ { X+ jutil_error(jp->x,TERROR_BAD); X+ it_deliver(s->ti,jp->x); X+ return; X+ } X+ X+ if(xmlnode_get_attrib(xmlnode_get_tag(jp->x, "query"),"node") != NULL) X+ { X+ jutil_error(jp->x,TERROR_NOTALLOWED); X+ it_deliver(s->ti,jp->x); X+ return; X+ } X+ X+ q = xmlnode_insert_tag(jutil_iqresult(jp->x),"query"); X+ xmlnode_put_attrib(q,"xmlns",NS_DISCO_ITEMS); X+ X+ it_deliver(s->ti,jp->x); X+} X+ X /** Send reply to a version inquiry to Jabber */ X void it_iq_version(iti ti, jpacket jp) X { Xdiff -ru jit.orig/jit/session.c jit/jit/session.c X--- jit.orig/jit/session.c 2003-05-12 15:07:53.000000000 +0400 X+++ jit/jit/session.c 2003-12-12 12:59:30.000000000 +0300 X@@ -429,6 +429,11 @@ X time(NULL)-s->start_time); X } X X+ if ((s->ti->own_roster)&&(s->roster_changed)) { X+ it_save_contacts(s); X+ s->roster_changed = 0; X+ } X+ X /* remove from hash */ X SEM_LOCK(s->ti->sessions_sem); X wpxhash_zap(s->ti->sessions,jid_full(s->id)); X@@ -468,6 +473,11 @@ X else X it_session_regerr(s,e); X X+ if ((s->ti->own_roster)&&(s->roster_changed)) { X+ it_save_contacts(s); X+ s->roster_changed = 0; X+ } X+ X /* remove from hash */ X SEM_LOCK(s->ti->sessions_sem); X wpxhash_zap(s->ti->sessions,jid_full(s->id)); Xdiff -ru jit.orig/jit/unknown.c jit/jit/unknown.c X--- jit.orig/jit/unknown.c 2003-04-29 14:19:42.000000000 +0400 X+++ jit/jit/unknown.c 2003-12-11 22:48:04.000000000 +0300 X@@ -84,6 +84,10 @@ X } X else if (j_strcmp(ns,NS_BROWSE) == 0) X it_iq_browse_server(ti,jp); X+ else if (j_strcmp(ns,NS_DISCO_INFO) == 0) X+ it_iq_disco_info_server(ti,jp); X+ else if (j_strcmp(ns,NS_DISCO_ITEMS) == 0) X+ it_iq_disco_items_server(ti,jp); X else if (j_strcmp(ns,NS_VERSION) == 0) X it_iq_version(ti,jp); X else if (j_strcmp(ns,NS_TIME) == 0) END-of-jit/files/patch-disco-sg2 echo x - jit/Makefile sed 's/^X//' >jit/Makefile << 'END-of-jit/Makefile' X# New ports collection makefile for: jit X# Date created: 20 July 2004 X# Whom: Alexander Timoshenko <gonzo@univ.kiev.ua> X# X# $FreeBSD$ X# X XPORTNAME= jit XPORTVERSION= 1.1.6 XCATEGORIES= net XMASTER_SITES= http://www.jabberstudio.org/files/jit/ XDIST_SUBDIR= jabber X XMAINTAINER= gonzo@univ.kiev.ua XCOMMENT= Jabber ICQ Transport X XUSE_GMAKE= yes XUSE_REINPLACE= yes XHAS_CONFIGURE= yes X Xpost-patch: X @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \ X ${WRKSRC}/jit/jabber-icq.example ${WRKSRC}/jit/jit.sh X Xdo-install: X @${MKDIR} ${PREFIX}/lib/jabber/jit X @${INSTALL_DATA} ${WRKSRC}/jit/jit.so ${PREFIX}/lib/jabber/jit X @${INSTALL_DATA} ${WRKSRC}/xdb_file/xdb_file.so ${PREFIX}/lib/jabber/jit X @${INSTALL_PROGRAM} ${WRKSRC}/jabberd/jabberd ${PREFIX}/sbin/jit X @${INSTALL_DATA} ${WRKSRC}/jit/jabber-icq.example ${PREFIX}/etc X @${INSTALL_SCRIPT} ${WRKSRC}/jit/jit.sh ${PREFIX}/etc/rc.d X Xpost-install: X @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL X X.include <bsd.port.mk> END-of-jit/Makefile echo x - jit/distinfo sed 's/^X//' >jit/distinfo << 'END-of-jit/distinfo' XMD5 (jabber/jit-1.1.6.tar.gz) = 950f6b82ab5e0542535108fd54409363 XSIZE (jabber/jit-1.1.6.tar.gz) = 275246 END-of-jit/distinfo echo x - jit/pkg-descr sed 's/^X//' >jit/pkg-descr << 'END-of-jit/pkg-descr' XJIT - Jabber ICQ Transport - is a working and stable Jabber Xtransport which provides interoperability between ICQ and XJabber IM systems. X XWWW: http://jit.jabberstudio.org/ END-of-jit/pkg-descr echo x - jit/pkg-plist sed 's/^X//' >jit/pkg-plist << 'END-of-jit/pkg-plist' Xlib/jabber/jit/jit.so Xlib/jabber/jit/xdb_file.so Xsbin/jit Xetc/jabber-icq.example Xetc/rc.d/jit.sh X@dirrm lib/jabber/jit END-of-jit/pkg-plist echo x - jit/pkg-install sed 's/^X//' >jit/pkg-install << 'END-of-jit/pkg-install' X#!/bin/sh X Xif [ "$2" != "POST-INSTALL" ]; then X exit 0 Xfi X XUSER=jabber XGROUP=${USER} XUID=93 XGID=${UID} XSPOOLDIR="/var/spool/jit" X Xif ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then X if pw groupadd ${GROUP} -g ${GID}; then X echo "Added group \"${GROUP}\"." X else X echo "Adding group \"${GROUP}\" failed..." X exit 1 X fi Xfi X Xif ! pw usershow "${USER}" 2>/dev/null 1>&2; then X if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ X -s "/sbin/nologin" -d "/nonexistent" \ X -c "Jabber Daemon"; \ X then X echo "Added user \"${USER}\"." X else X echo "Adding user \"${USER}\" failed..." X exit 1 X fi Xfi X Xif [ ! -d ${SPOOLDIR} ]; then X echo "Creating \"${SPOOLDIR}\"." X mkdir -p ${SPOOLDIR} Xfi X Xecho "Fixing ownerships and modes in \"${SPOOLDIR}\"." Xchown -R ${USER}:${GROUP} ${SPOOLDIR} Xchmod -R go= ${SPOOLDIR} END-of-jit/pkg-install echo x - jit/pkg-deinstall sed 's/^X//' >jit/pkg-deinstall << 'END-of-jit/pkg-deinstall' X#!/bin/sh X Xif [ "$2" != "POST-DEINSTALL" ]; then X exit 0 Xfi X XUSER=jabber X Xif pw usershow "${USER}" 2>/dev/null 1>&2; then X echo "To delete Jabber user permanently, use 'pw userdel ${USER}'" Xfi X Xif pw groupshow "${USER}" 2>/dev/null 1>&2; then X echo "To delete Jabber group permanently, use 'pw groupdel ${USER}'" Xfi X Xecho "If you wish to delete jit data files, remove '/var/spool/jit' directory." X Xexit 0 END-of-jit/pkg-deinstall exit >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1BmyFM-000DA3-CD>