# Path: pyxmpp/all.py

# 
# Path: pyxmpp/jabber/all.py



import libxml2
import time
import sys
import traceback
import socket
import logging
from pyxmpp.all import JID,Iq,Presence,Message,StreamError
from pyxmpp.jabber.all import LegacyClientStream
                self.welcome()
                return
            self.set_iq_set_handler("session","urn:ietf:params:xml:ns:xmpp-session",
                                    self.set_session)

    def set_session(self,stanza):
        fr=stanza.get_from()
        if fr and fr!=self.peer:
            iq=stanza.make_error_response("forbidden")
            self.send(iq)
        else:
            iq=stanza.make_result_response()
            iq.set_to(None)
            self.send(iq)
            self.welcome()
        iq.free()

    def welcome(self):
        m=Message(type="chat",to=self.peer,
                body="You have authenticated with: %r" % (self.auth_method_used))
        self.send(m)
        m=Message(type="chat",to=self.peer,body="You will be disconnected in 1 minute.")
        self.send(m)
        m=Message(type="chat",to=self.peer,body="Thank you for testing.")
        self.send(m)
        self.set_message_handler('chat',self.echo_message)
        self.set_message_handler('normal',self.echo_message)

    def echo_message(self,message):
        typ=message.get_type()

# Path: pyxmpp/all.py

# 
# Path: pyxmpp/jabber/all.py



# Path: examples/server_c2s.py
import libxml2
import time
import sys
import traceback
import socket
import logging
from pyxmpp.all import JID,Iq,Presence,Message,StreamError
from pyxmpp.jabber.all import LegacyClientStream

                self.welcome()
                return
            self.set_iq_set_handler("session","urn:ietf:params:xml:ns:xmpp-session",
                                    self.set_session)

    def set_session(self,stanza):
        fr=stanza.get_from()
        if fr and fr!=self.peer:
            iq=stanza.make_error_response("forbidden")
            self.send(iq)
        else:
            iq=stanza.make_result_response()
            iq.set_to(None)
            self.send(iq)
            self.welcome()
        iq.free()

    def welcome(self):
        m=Message(type="chat",to=self.peer,
                body="You have authenticated with: %r" % (self.auth_method_used))
        self.send(m)
        m=Message(type="chat",to=self.peer,body="You will be disconnected in 1 minute.")
        self.send(m)
        m=Message(type="chat",to=self.peer,body="Thank you for testing.")
        self.send(m)
        self.set_message_handler('chat',self.echo_message)
        self.set_message_handler('normal',self.echo_message)

    def echo_message(self,message):
        typ=message.get_type()

        body=message.get_body()