Exemple #1
0
	def ev_unsubscribe(self, pres):
		"""User has forced us to remove them from our list."""
		if self.hook(const.LOC_EV_UNSUBSCRIBE, pres):
			return

		user = user.getStripped()
		# User removed us from their list
		# So remove them from ours.
		log(user, "unsubscribing:", pres.getStatus())
		self.removeUser(user)
		# Remove us from their list
		self.rejectUser(user)
		self.refreshRoster()
Exemple #2
0
	def ev_subscribe(self, pres):
		if self.hook(const.LOC_EV_SUBSCRIBE, pres):
			return

		#FIXME: Currently getjid can only rebuild JID's with gmail.com domains,
		# so we need to reject not gmail.com users.
		if not user.get_domain() == server.domain:
			self.removeUser(user)
			return

		user = user.getStripped()
		# User added us to their list, so add them to ours
		log(user, "subscribing:", pres.getStatus())
		self.addUser(user)
		self.acceptUser(user)
		self.refreshRoster()