comparison idavoll/idavoll.py @ 76:66fac7cd9edc

Added -v (--verbose) flag to print out all traffic.
author Ralph Meijer <ralphm@ik.nu>
date Mon, 08 Nov 2004 14:06:54 +0000
parents 1f7b8b6b8ce9
children a7196ca7cefd
comparison
equal deleted inserted replaced
75:1f7b8b6b8ce9 76:66fac7cd9edc
107 if iq.handled == True: 107 if iq.handled == True:
108 return 108 return
109 109
110 self.send(xmpp_error.error_from_iq(iq, 'service-unavailable')) 110 self.send(xmpp_error.error_from_iq(iq, 'service-unavailable'))
111 111
112 class LogService(component.Service):
113
114 def transportConnected(self, xmlstream):
115 xmlstream.rawDataInFn = self.rawDataIn
116 xmlstream.rawDataOutFn = self.rawDataOut
117
118 def rawDataIn(self, buf):
119 print "RECV: %s" % buf.encode('ascii', 'replace')
120
121 def rawDataOut(self, buf):
122 print "SEND: %s" % buf.encode('ascii', 'replace')
123
112 def makeService(config): 124 def makeService(config):
113 serviceCollection = service.MultiService() 125 serviceCollection = service.MultiService()
114 126
115 # set up Jabber Component 127 # set up Jabber Component
116 sm = component.buildServiceManager(config["jid"], config["secret"], 128 sm = component.buildServiceManager(config["jid"], config["secret"],
117 ("tcp:%s:%s" % (config["rhost"], config["rport"]))) 129 ("tcp:%s:%s" % (config["rhost"], config["rport"])))
130
131 if config["verbose"]:
132 LogService().setServiceParent(sm)
118 133
119 if config['backend'] == 'pgsql': 134 if config['backend'] == 'pgsql':
120 import pgsql_backend as b 135 import pgsql_backend as b
121 st = b.Storage(user=config['dbuser'], database=config['dbname']) 136 st = b.Storage(user=config['dbuser'], database=config['dbname'])
122 elif config['backend'] == 'memory': 137 elif config['backend'] == 'memory':