=== modified file 'twyt/commands.py'
--- twyt/commands.py	2009-11-19 22:12:25 +0000
+++ twyt/commands.py	2009-12-03 16:33:09 +0000
@@ -548,6 +548,7 @@
 			results.reverse()
 		for result in results:
 			base.config.name_cache_add(result.user.screen_name)
+			base.config.id_cache_add(result.id)
 			base.output(result)
 
 		if len(results) > 0 and catchup:
@@ -613,6 +614,7 @@
 			results.reverse()
 		for result in results:
 			base.config.name_cache_add(result.user.screen_name)
+			base.config.id_cache_add(result.id)
 			base.output(result)
 
 		if len(results) > 0 and catchup:
@@ -1040,6 +1042,30 @@
 			for n in base.config.name_cache_list():
 				base.output(n)
 
+class IDCacheCommand(Command):
+	def __str__(self):
+		return "idcache"
+
+	def get_options(self):
+		self.options.append(make_option("-c", "--clear",
+			default=False, action="store_true",
+			help="Clear the id cache."))
+		return self.options
+
+	def get_usage(self):
+		return "%prog [options]"
+
+	def get_help(self):
+		return "Access and manipulate the tweet id cache."
+
+	def do_command(self, options, args, base):
+		if options.clear:
+			base.config.id_cache_clear()
+			return
+		else:
+			for n in base.config.id_cache_list():
+				base.output(n)
+
 class IPLimitCommand(Command):
 	def __str__(self):
 		return "iplimit"

=== modified file 'twyt/config.py'
--- twyt/config.py	2009-11-19 21:48:45 +0000
+++ twyt/config.py	2009-12-03 16:35:28 +0000
@@ -72,6 +72,10 @@
 			self.config['names'] = []
 			self.dirty = True
 
+		if not self.config.has_key('ids'):
+			self.config['ids'] = []
+			self.dirty = True
+
 		# Backwards compat code
 		if type(self.config['names']) == dict:
 			self.config['names'] = self.config['names'].keys()
@@ -202,7 +206,7 @@
 			return self.config['stamps'][str(timeline)][user]
 		except KeyError:
 			return None
-	
+
 	def name_cache_add(self, name):
 		"""
 		Adds a name to the name cache.
@@ -217,13 +221,36 @@
 		if len(self.config['names']) > 0:
 			del self.config['names'][:]
 			self.dirty = True
-	
+
 	def name_cache_list(self):
 		"""
 		Returns a list of all names in the name cache.
 		"""
 		return self.config['names']
 
+	def id_cache_add(self, id):
+		"""
+		Adds a id to the id cache, retaining only the last 20.
+		"""
+		if id not in self.config['ids']:
+			self.config['ids'].append(id)
+		if len(self.config['ids']) > 20:
+			self.config['ids'] = self.config['ids'][-20:]
+
+	def id_cache_clear(self):
+		"""
+		Clears the id cache.
+		"""
+		if len(self.config['ids']) > 0:
+			del self.config['ids'][:]
+			self.dirty = True
+
+	def id_cache_list(self):
+		"""
+		Returns a list of all ids in the id cache.
+		"""
+		return self.config['ids']
+
 	def dirty_writeback(self):
 		"""
 		Writes the configuration back to the config file if dirty.

=== modified file 'twyt/twyt.py'
--- twyt/twyt.py	2009-11-19 21:48:45 +0000
+++ twyt/twyt.py	2009-12-03 15:57:44 +0000
@@ -53,6 +53,7 @@
 	cmds.register_command(commands.UnblockCommand())
 	cmds.register_command(commands.UserCommand())
 	cmds.register_command(commands.NameCacheCommand())
+	cmds.register_command(commands.IDCacheCommand())
 	cmds.register_command(commands.SingCommand())
 	cmds.register_command(commands.IPLimitCommand())
 	cmds.register_command(commands.AccountLimitCommand())


