Jabberd-MSN

From YobiWiki
Revision as of 21:38, 24 November 2010 by <bdi>PhilippeTeuwen</bdi> (talk | contribs) (Reverted edits by Etegohy (Talk) to last revision by PhilippeTeuwen)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

http://msn-transport.jabberstudio.org/ : use

 <servers>
   <ip>messenger.hotmail.com</ip>
 </servers>

in the <msntrans> section of your MSN-t config file if you encounter problems with the transport.
Note there are memory leaks in MSN-t so run it in a seperate process and restart it from time to time until this gets fixed.

apt-get install libcurl2-ssl libcurl-ssl-dev
cd jabberd/jabber-1.4.2a
wget http://msn-transport.jabberstudio.org/msn-transport-1.2.8rc1.tar.gz
tar -xzvf msn-transport-1.2.8rc1.tar.gz
cd msn-transport-1.2.8rc1
./configure --with-jabberd=/home/hellea/installations/jabber/compilation/jabber-1.4.2a/jabberd
make
mkdir /var/lib/jabber/msn
cp src/msntrans.so /var/lib/jabber/msn

On va lancer le service MSN dans un process a part car il est assez foireux (mem leakages, etc) Ajouter dans /etc/jabber/jabber.xml, section <browse>:

       <service type="msn" jid="msn.reseaucitoyen.be" name="Passerelle vers MSN">
         <ns>jabber:iq:gateway</ns>
         <ns>jabber:iq:register</ns>
       </service>

Ajouter dans /etc/jabber/jabber.xml, dans la liste des <service>:

 <service id="linker-msn">
   <host>msn.reseaucitoyen.be</host><host>conference.msn.reseaucitoyen.be</host>
   <accept>
     <ip>127.0.0.1</ip>
     <port>5224</port>
     <secret>msnkey</secret>
   </accept>
 </service>

Créer /etc/jabber/transport-msn.xml:

<jabber>

 <log id='elogger'>
   <host/>
   <logtype/>
   <format>%d: [%t] (%h): %s</format>
   <file>/var/log/jabber/msn-error.log</file>
 </log>

 <log id='rlogger'>
   <host/>
   <logtype>record</logtype>
   <format>%d %h %s</format>
   <file>/var/log/jabber/msn-record.log</file>
 </log>


 <service id="msn.reseaucitoyen.be">
   <msntrans xmlns="jabber:config:msntrans">
    <instructions>Entrez votre login MSN Messenger et password. Example: user1@hotmail.com.  Nickname optionnel.</instructions>

     <vCard>
       <FN>Passerelle vers MSN</FN>
       <DESC>Ce service fournit une passerelle pour communiquer avec le reseau MSN</DESC>
       <URL>http://msn-transport.jabberstudio.org/</URL>
     </vCard>

     <conference id="conference.msn.reseaucitoyen.be">

       <invite>Plus d'un user participe a cette discussion.  Joignez-vous a cette chatroom pour passer en mode groupchat.</invite>
       <notice>
         <join> est maintenant en ligne</join>
         <leave> est parti</leave>
       </notice>

     </conference>

     <headlines/>

     <curl>
     </curl>
   </msntrans>
   <load>
     <msntrans>/var/lib/jabber/msn/msntrans.so</msntrans>
   </load>
 </service>

 <service id="linker-msn">
   <uplink/>
   <connect>
     <ip>127.0.0.1</ip>
     <port>5224</port>
     <secret>msnkey</secret>
   </connect>
 </service>

 <pidfile>/var/run/jabber/jabber-msn.pid</pidfile>

</jabber>

Créer /etc/init.d/jabber-msn:

#! /bin/sh
#
# jabber	init script to start jabber daemon
#
#		Created from Bernd Eckenfels <ecki@lina.inka.de>
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	@(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
#
# This file was automatically customized by dh-make on Sun, 21 May:31:20 +0200

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/jabberd
NAME=jabber-msn
DESC=jabber-msn
CONF=/etc/jabber/transport-msn.xml
PID=/var/run/jabber/jabber-msn.pid
CMDLINE=""

test -f $DAEMON -a -f $CONF || exit 0

# set some parameters like JABBER_HOSTNAME
if test -x /etc/jabber/jabber.cfg; then
 . /etc/jabber/jabber.cfg
fi

if [ x"$JABBER_HOSTNAME" != x"" ]; then
	CMDLINE="$CMDLINE -h $JABBER_HOSTNAME"
fi
if [ x"$JABBER_SPOOL" != x"" ]; then
	CMDLINE="$CMDLINE -s $JABBER_SPOOL"
fi
if [ x"$CONF" != x"" ]; then
	CMDLINE="$CMDLINE -c $CONF"
fi
if [ x"$CMDLINE" != x"" ]; then
	CMDLINE="-- $CMDLINE"
fi

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	cd /usr/lib/jabber/
	start-stop-daemon -b -c daemon --start --quiet --pidfile $PID --startas $DAEMON $CMDLINE ||  echo -n "<Failed> "
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --quiet --pidfile $PID || echo -n "<Failed> "
	echo "$NAME."
	;;
  reload)
	echo "Reloading $DESC configuration files."
	start-stop-daemon --stop --signal 1 --quiet \
		--pidfile $PID --exec $DAEMON
  ;;
  restart|force-reload)
	#
	#	If the "reload" option is implemented, move the "force-reload"
	#	option to the "reload" entry above. If not, "force-reload" is
	#	just the same as "restart".
	#
	echo -n "Restarting $DESC: "
	$0 stop
	sleep 1
	$0 start
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
update-rc.d jabber-msn defaults 21 19

Ajouter également à /etc/init.d/jabber:

case "$1" in
  start)
        echo -n "Starting $DESC: "
        cd /usr/lib/jabber/
        start-stop-daemon -b -c daemon --start --quiet --exec $DAEMON $CMDLINE || echo -n "<Failed>
        echo "$NAME."
+       echo "Don't forget to start also jabber-msn"
        ;;
  stop)
+       /etc/init.d/jabber-msn stop
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --quiet --exec $DAEMON || echo -n "<Failed> "
        echo "$NAME."
        ;;

Cela est fait tel que:

/etc/init.d/jabber start     -> lance le jabberd principal
/etc/init.d/jabber-msn start -> lance le service MSN
/etc/init.d/jabber-msn stop  -> arrete le service MSN
/etc/init.d/jabber stop      -> arrete le jabberd principal ET le service MSN

Créer /etc/cron.weekly/jabber-msn:

#! /bin/sh

# Restart this f** MSN service
test -f /etc/jabber/msntrans.xml || exit 0

/etc/init.d/jabber-msn stop >/dev/null
rm -f /var/run/jabber/jabber-msn.pid
sleep 5
/etc/init.d/jabber-msn start >/dev/null

Rem: si on vient d'une version < 1.2.8.pre6 il faut convertir les noms de fichier de la XDB (dans /var/lib/jabber/msn.reseaucitoyen.be) en minuscules:

for i in *.xml; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done

voir aussi le "next-generation MSN transport"