Example #1
0
 def __init__(self):
     self.que_cities = queue.Queue()
     self.que_city_html = queue.Queue()
     self.que_city_list = queue.Queue()
     self.que_hotel_list = queue.Queue()
     self.que_hotel_info = queue.Queue()
     self.que_room_info = queue.Queue()
     self.session = makeSession()
     self.spyder = ctrip_spyder()
     self.pipeline = Ctrip_pipe()
     self.lock = threading.Lock()
     #调用,还是用成员变量,不用函数
     self.do_get_code = False
     self.do_get_city_info = False
     self.do_get_hotel_list = False
     self.do_get_htl_and_rm_info = False
			toj = internJID(to)
		except Exception, e:
			LogEvent(WARN, msg="Failed stringprep")
			return

		if self.sessions.has_key(froj.userhost()):
			self.sessions[froj.userhost()].onPresence(el)
		else:
			ulang = utils.getLang(el)
			ptype = el.getAttribute("type")
			if to.find('@') < 0:
				# If the presence packet is to the transport (not a user) and there isn't already a session
				if not ptype: # Don't create a session unless they're sending available presence
					if self.serviceplugins['Statistics'].stats["OnlineSessions"] < 1000:
						LogEvent(INFO, msg="Attempting to create a new session")
						s = session.makeSession(self, froj.userhost(), ulang, toj)
						if s:
							self.sessions[froj.userhost()] = s
							LogEvent(INFO, msg="New session created")
							# Send the first presence
							s.onPresence(el)
						else:
							LogEvent(INFO, msg="Failed to create session")
							jabw.sendMessage(self, to=froj.userhost(), fro=config.jid, body=lang.get("notregistered", ulang))
					else:
						LogEvent(INFO, msg="Max sessions limit reached")
						jabw.sendMessage(self, to=froj.userhost(), fro=config.jid, body=lang.get("sessionslimit", ulang))
				
				elif ptype != "error":
					LogEvent(INFO, msg="Sending unavailable presence to non-logged in user")
					pres = Element((None, "presence"))
Example #3
0
            froj = internJID(fro)
            toj = internJID(to)
        except Exception, e:
            LogEvent(WARN, msg="Failed stringprep")
            return

        if self.sessions.has_key(froj.userhost()):
            self.sessions[froj.userhost()].onPresence(el)
        else:
            ulang = utils.getLang(el)
            ptype = el.getAttribute("type")
            if to.find('@') < 0:
                # If the presence packet is to the transport (not a user) and there isn't already a session
                if not ptype:  # Don't create a session unless they're sending available presence
                    LogEvent(INFO, msg="Attempting to create a new session")
                    s = session.makeSession(self, froj.userhost(), ulang, toj)
                    if s:
                        self.sessions[froj.userhost()] = s
                        LogEvent(INFO, msg="New session created")
                        # Send the first presence
                        s.onPresence(el)
                    else:
                        LogEvent(INFO, msg="Failed to create session")
                        jabw.sendMessage(self,
                                         to=froj.userhost(),
                                         fro=config.jid,
                                         body=lang.get("notregistered", ulang))

                elif ptype != "error":
                    LogEvent(
                        INFO,
Example #4
0
 def __init__(self):
     self.CHECK = True
     self.response = makeSession()
     self.esp = Elong_spyder()