git » msnlib » commit c053861

Add commands to show the list with realnicks.

author Alberto Bertogli
2005-11-09 20:59:14 UTC
committer Alberto Bertogli
2005-11-09 20:59:14 UTC
parent d88c01b96643a273c5be2465e8d742a07252325c

Add commands to show the list with realnicks.

Based on a patch by Ben Clifford.

msn +15 -4

diff --git a/msn b/msn
index 5da3c94..f2769ec 100644
--- a/msn
+++ b/msn
@@ -39,11 +39,13 @@ status [mode]	Shows the current status, or changes it to "mode", which can
 q		Quits the program
 w		Prints your entire contact list
 ww		Prints your entire contact list, including email addresses
+wn		Prints your entire contact list, including real nicks
+wr		Prints your reverse contact list
 wd		Prints the differences between your forward and reverse lists
 e		Prints your online contacts
 ee		Prints your online contacts, including email addresses
 eg		Prints your online contacts with the groups
-wr		Prints your reverse contact list
+en		Prints your online contacts, including real nicks
 h		Shows your incoming message history
 add e [n] [g] 	Adds the user "e" with the nick "n" to the group "g"
 del nick	Deletes the user with nick "nick"
@@ -118,9 +120,9 @@ c = color_classes['default']()
 
 # command list for tab-completion purposes
 command_list = [ 'a', 'add', 'block', 'close', 'color', 'config', 'del', 'e',
-	'ee', 'eg', 'g', 'gadd', 'gdel', 'green', 'h', 'help', 'info',
+	'ee', 'eg', 'en', 'g', 'gadd', 'gdel', 'green', 'h', 'help', 'info',
 	'invite', 'lignore', 'luignore', 'm', 'nick', 'privacy', 'q', 'r',
-	'ren', 'status', 'unblock', 'w', 'wd', 'wr', 'ww' ]
+	'ren', 'status', 'unblock', 'w', 'wn', 'wd', 'wr', 'ww' ]
 
 
 #
@@ -160,7 +162,8 @@ def pexc(line):
 	safe_write('\n')
 	safe_flush()
 
-def print_list(md, only_online = 0, userlist = None, include_emails = 0):
+def print_list(md, only_online = 0, userlist = None, include_emails = 0,
+		include_realnicks = 0):
 	"Prints the user list"
 	if not userlist:
 		userlist = md.users
@@ -177,6 +180,8 @@ def print_list(md, only_online = 0, userlist = None, include_emails = 0):
 		printl('%7.7s :: %s' % (status, u.nick), bold = hl)
 		if include_emails:
 			printl(' (%s)' % (email), bold = hl)
+		if include_realnicks:
+			printl(' (%s)' % (u.realnick), bold = hl)
 		if 'B' in u.lists:
 			printl(' [!]')
 		if email not in md.reverse.keys():
@@ -957,6 +962,9 @@ def parse_cmd(cmd):
 	elif cmd == 'ww':		# list, include emails
 		print_grouped_list(m, include_emails = 1)
 
+	elif cmd == 'wn':		# list, include real nicks
+		print_list(m, include_realnicks = 1)
+
 	elif cmd == 'wr':		# reverse list
 		print_list(m, userlist = m.reverse, include_emails = 1)
 
@@ -972,6 +980,9 @@ def parse_cmd(cmd):
 	elif cmd == 'ee':
 		print_grouped_list(m, only_online = 1, include_emails = 1)
 
+	elif cmd == 'en':
+		print_list(m, only_online = 1, include_realnicks = 1)
+
 	elif cmd == 'g':		# list groups
 		print_group_list(m)