#NEWLINE# def on_line( self , line ) : #NEWLINE# #INDENT# ' This is where we process commands.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# m = re . match ( '^join (\\S+)$' , line ) #NEWLINE# if m : #NEWLINE# #INDENT# ( room_name , ) = m . groups ( ) #NEWLINE# self . print_line ( ( '%s joining %s' % ( room_name . user , room_name ) ) ) #NEWLINE# self . server . join_room ( room_name , self . user , self . user ) #NEWLINE# return #NEWLINE# #UNINDENT# m = re . match ( '^invite (\\S+) (\\S+)$' , line ) #NEWLINE# if m : #NEWLINE# #INDENT# ( room_name , invitee ) = m . groups ( ) #NEWLINE# self . print_line ( ( '%s invited to %s' % ( invitee , room_name ) ) ) #NEWLINE# self . server . invite_to_room ( room_name , self . user , invitee ) #NEWLINE# return #NEWLINE# #UNINDENT# m = re . match ( '^send (\\S+) (.*)$' , line ) #NEWLINE# if m : #NEWLINE# #INDENT# ( room_name , body ) = m . groups ( ) #NEWLINE# self . print_line ( ( '%s send to %s' % ( self . user , room_name ) ) ) #NEWLINE# self . server . send_message ( room_name , self . user , body ) #NEWLINE# return #NEWLINE# #UNINDENT# m = re . match ( '^backfill (\\S+)$' , line ) #NEWLINE# if m : #NEWLINE# #INDENT# ( room_name , ) = m . groups ( ) #NEWLINE# self . print_line ( ( 'backfill %s' % room_name ) ) #NEWLINE# self . server . backfill ( room_name ) #NEWLINE# return #NEWLINE# #UNINDENT# self . print_line ( 'Unrecognized command' ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# logger . exception ( e )