mirror of
				https://github.com/MCV-Software/TWBlue.git
				synced 2025-11-04 13:57:05 +00:00 
			
		
		
		
	Don't get new items for people buffers
This commit is contained in:
		@@ -868,10 +868,10 @@ class peopleBufferController(baseBufferController):
 | 
				
			|||||||
  pub.sendMessage("execute-action", action="user_details")
 | 
					  pub.sendMessage("execute-action", action="user_details")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class searchBufferController(baseBufferController):
 | 
					class searchBufferController(baseBufferController):
 | 
				
			||||||
 def start_stream(self):
 | 
					 def start_stream(self, mandatory=False):
 | 
				
			||||||
  # starts stream every 3 minutes.
 | 
					  # starts stream every 3 minutes.
 | 
				
			||||||
  current_time = time.time()
 | 
					  current_time = time.time()
 | 
				
			||||||
  if self.execution_time == 0 or current_time-self.execution_time >= 180:
 | 
					  if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory==True:
 | 
				
			||||||
   self.execution_time = current_time
 | 
					   self.execution_time = current_time
 | 
				
			||||||
   log.debug("Starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
 | 
					   log.debug("Starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
 | 
				
			||||||
   log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
 | 
					   log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
 | 
				
			||||||
@@ -907,10 +907,10 @@ class searchPeopleBufferController(peopleBufferController):
 | 
				
			|||||||
  self.kwargs = kwargs
 | 
					  self.kwargs = kwargs
 | 
				
			||||||
  self.function = function
 | 
					  self.function = function
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 def start_stream(self):
 | 
					 def start_stream(self, mandatory=False):
 | 
				
			||||||
  # starts stream every 3 minutes.
 | 
					  # starts stream every 3 minutes.
 | 
				
			||||||
  current_time = time.time()
 | 
					  current_time = time.time()
 | 
				
			||||||
  if self.execution_time == 0 or current_time-self.execution_time >= 180:
 | 
					  if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory==True:
 | 
				
			||||||
   self.execution_time = current_time
 | 
					   self.execution_time = current_time
 | 
				
			||||||
   log.debug("starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
 | 
					   log.debug("starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
 | 
				
			||||||
   log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
 | 
					   log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -436,7 +436,7 @@ class Controller(object):
 | 
				
			|||||||
     return
 | 
					     return
 | 
				
			||||||
   elif dlg.get("users") == True:
 | 
					   elif dlg.get("users") == True:
 | 
				
			||||||
    search = buffersController.searchPeopleBufferController(self.view.nb, "search_users", "%s-searchUser" % (term,), buffer.session, buffer.session.db["user_name"], bufferType=None, q=term)
 | 
					    search = buffersController.searchPeopleBufferController(self.view.nb, "search_users", "%s-searchUser" % (term,), buffer.session, buffer.session.db["user_name"], bufferType=None, q=term)
 | 
				
			||||||
   search.start_stream()
 | 
					   search.start_stream(mandatory=True)
 | 
				
			||||||
   pos=self.view.search("searches", buffer.session.db["user_name"])
 | 
					   pos=self.view.search("searches", buffer.session.db["user_name"])
 | 
				
			||||||
   self.insert_buffer(search, pos)
 | 
					   self.insert_buffer(search, pos)
 | 
				
			||||||
   self.view.insert_buffer(search.buffer, name=_(u"Search for {}").format(term), pos=pos)
 | 
					   self.view.insert_buffer(search.buffer, name=_(u"Search for {}").format(term), pos=pos)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -279,8 +279,7 @@ class Session(object):
 | 
				
			|||||||
  tl = self.call_paged(function, sinze_id=last_id, *args, **kwargs)
 | 
					  tl = self.call_paged(function, sinze_id=last_id, *args, **kwargs)
 | 
				
			||||||
  self.order_buffer(name, tl)
 | 
					  self.order_buffer(name, tl)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# @_require_login
 | 
					 def get_cursored_stream(self, name, function, items="users", get_previous=False, *args, **kwargs):
 | 
				
			||||||
 def get_cursored_stream(self, name, function, items="users", *args, **kwargs):
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  """ Gets items for API calls that require using cursors to paginate the results.
 | 
					  """ Gets items for API calls that require using cursors to paginate the results.
 | 
				
			||||||
  name str: Name to save it in the database.
 | 
					  name str: Name to save it in the database.
 | 
				
			||||||
@@ -290,7 +289,7 @@ class Session(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  items_ = []
 | 
					  items_ = []
 | 
				
			||||||
  try:
 | 
					  try:
 | 
				
			||||||
   if self.db[name].has_key("cursor"):
 | 
					   if self.db[name].has_key("cursor") and get_previous:
 | 
				
			||||||
    cursor = self.db[name]["cursor"]
 | 
					    cursor = self.db[name]["cursor"]
 | 
				
			||||||
   else:
 | 
					   else:
 | 
				
			||||||
    cursor = -1
 | 
					    cursor = -1
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user