Index: ejabberd-2.0.5/src/mod_roster.erl =================================================================== --- ejabberd-2.0.5.orig/src/mod_roster.erl +++ ejabberd-2.0.5/src/mod_roster.erl @@ -515,7 +515,7 @@ in_state_change(to, in, subscribed) in_state_change(to, in, unsubscribe) -> {to, none}; in_state_change(to, in, unsubscribed) -> {none, in}; in_state_change(from, none, subscribe) -> none; -in_state_change(from, none, subscribed) -> none; +in_state_change(from, none, subscribed) -> {both, none}; in_state_change(from, none, unsubscribe) -> {none, none}; in_state_change(from, none, unsubscribed) -> none; in_state_change(from, out, subscribe) -> none; @@ -544,7 +544,7 @@ out_state_change(none, both, subscribed) out_state_change(none, both, unsubscribe) -> {none, in}; out_state_change(none, both, unsubscribed) -> {none, out}; out_state_change(to, none, subscribe) -> none; -out_state_change(to, none, subscribed) -> none; +out_state_change(to, none, subscribed) -> {both, none}; out_state_change(to, none, unsubscribe) -> {none, none}; out_state_change(to, none, unsubscribed) -> none; out_state_change(to, in, subscribe) -> none; --- /usr/local/portage/net-im/ejabberd/files/ejabberd-2.confd 2010-02-18 03:47:00.000000000 +0300 +++ /etc/conf.d/ejabberd 2010-02-24 05:37:17.000000000 +0300 @@ -20,4 +20,6 @@ # default is non smp #HAVE_SMP=0 +PIDFILE="/var/run/jabber/ejabberd.pid" + --- /usr/local/portage/net-im/ejabberd/files/ejabberd-2.initd 2010-02-18 03:47:00.000000000 +0300 +++ /etc/init.d/ejabberd 2010-02-24 05:51:13.000000000 +0300 @@ -36,14 +36,25 @@ cd /var/lib/ejabberd start-stop-daemon --start --quiet --chuid jabber:jabber \ --name $BEAMNAME \ - --exec /usr/sbin/ejabberd -- -detached -noinput -smp $SMPOPT + --background \ + --pidfile "${PIDFILE}" \ + --make-pidfile \ + --exec /usr/sbin/ejabberd -- -noinput -smp $SMPOPT eend $? } stop() { ebegin "Stopping ejabberd" /usr/sbin/ejabberdctl stop - eend $? + local RETVAL=$? + if [ ${RETVAL} != 0 ]; then + eend ${RETVAL} + else + while [ $? != 1 ]; do + kill -0 `cat "${PIDFILE}"` 2> /dev/null + done + eend ${RETVAL} + fi } reload() {