@ -7,6 +7,8 @@ pub enum StatusCommand { 
			
		
	
		
			
				
					     Ignore ,  
			
		
	
		
			
				
					     /// Boost the previous post in the thread
  
			
		
	
		
			
				
					     Boost ,  
			
		
	
		
			
				
					     /// Un-reblog parent post, or delete an announcement
  
			
		
	
		
			
				
					     Undo ,  
			
		
	
		
			
				
					     /// Admin: Ban a user
  
			
		
	
		
			
				
					     BanUser ( String ) ,  
			
		
	
		
			
				
					     /// Admin: Un-ban a server
  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -80,6 +82,8 @@ macro_rules! command { 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_BOOST : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"b(?:oost)?" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_UNDO : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"undo" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_IGNORE : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"i(?:g(?:n(?:ore)?)?)?" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_BAN_USER : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"ban\s+" ,   p_user ! ( ) ) ) ;  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -90,13 +94,13 @@ static RE_BAN_SERVER: once_cell::sync::Lazy<Regex> = Lazy::new(|| command!(r"ban 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_UNBAN_SERVER : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"unban\s+" ,   p_server ! ( ) ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_ADD_MEMBER : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?: add) \s+" ,   p_user ! ( ) ) ) ;  
			
		
	
		
			
				
					static   RE_ADD_MEMBER : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"add\s+" ,   p_user ! ( ) ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_REMOVE_MEMBER : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?:kick|remove)\s+" ,   p_user ! ( ) ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_ADD_TAG : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?: add) \s+" ,   p_hashtag ! ( ) ) ) ;  
			
		
	
		
			
				
					static   RE_ADD_TAG : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"add\s+" ,   p_hashtag ! ( ) ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_REMOVE_TAG : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?: remove) \s+" ,   p_hashtag ! ( ) ) ) ;  
			
		
	
		
			
				
					static   RE_REMOVE_TAG : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"remove\s+" ,   p_hashtag ! ( ) ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_GRANT_ADMIN : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?:op|admin)\s+" ,   p_user ! ( ) ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -108,15 +112,15 @@ static RE_CLOSE_GROUP: once_cell::sync::Lazy<Regex> = Lazy::new(|| command!(r"cl 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_HELP : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"help" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_MEMBERS : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?:members|who)" ) ) ;  
			
		
	
		
			
				
					static   RE_MEMBERS : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?:members|who|admins )" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_TAGS : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?:hashtags|tags)" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_LEAVE : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?: leave) " ) ) ;  
			
		
	
		
			
				
					static   RE_LEAVE : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"leave" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_JOIN : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?: join) " ) ) ;  
			
		
	
		
			
				
					static   RE_JOIN : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"join" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_PING : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"(?: ping) " ) ) ;  
			
		
	
		
			
				
					static   RE_PING : once_cell ::sync ::Lazy < Regex >   =   Lazy ::new ( | |   command ! ( r"ping" ) ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					static   RE_ANNOUNCE : once_cell ::sync ::Lazy < Regex >   =  
			
		
	
		
			
				
					     Lazy ::new ( | |   Regex ::new ( concat! ( r"(?:^|\s|>|\n)[\\/]announce\s+(.*)$" ) ) . unwrap ( ) ) ;  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -167,6 +171,11 @@ pub fn parse_slash_commands(content: &str) -> Vec<StatusCommand> { 
			
		
	
		
			
				
					         return   vec! [ StatusCommand ::Help ] ;  
			
		
	
		
			
				
					     }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					     if   RE_UNDO . is_match ( & content )   {  
			
		
	
		
			
				
					         debug ! ( "UNDO" ) ;  
			
		
	
		
			
				
					         return   vec! [ StatusCommand ::Undo ] ;  
			
		
	
		
			
				
					     }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					     // additive commands
  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					     let   mut   commands   =   vec! [ ] ;  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -310,11 +319,11 @@ pub fn parse_slash_commands(content: &str) -> Vec<StatusCommand> { 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					#[ cfg(test) ]  
			
		
	
		
			
				
					mod  test   {  
			
		
	
		
			
				
					     use   crate ::command ::{ parse_slash_commands ,   StatusCommand ,   RE_JOIN ,   RE_ADD_TAG ,   RE_A_HASHTAG  } ;  
			
		
	
		
			
				
					     use   crate ::command ::{ parse_slash_commands ,   RE_A_HASHTAG ,   RE_ADD_TAG ,   RE_JOIN ,   StatusCommand  } ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					     use   super ::{  
			
		
	
		
			
				
					         RE_ADD_MEMBER ,   RE_ANNOUNCE ,   RE_BAN_SERVER ,   RE_BAN_USER ,   RE_BOOST ,   RE_CLOSE_GROUP ,   RE_GRANT_ADMIN ,   RE_HELP ,  
			
		
	
		
			
				
					         RE_IGNORE ,   RE_LEAVE ,   RE_MEMBERS ,   RE_TAGS ,   RE_ OPEN_GROUP ,   RE_REMOVE_MEMBER ,   RE_REVOKE_ADMIN ,  
			
		
	
		
			
				
					         RE_IGNORE ,   RE_LEAVE ,   RE_MEMBERS ,   RE_OPEN_GROUP ,   RE_REMOVE_MEMBER ,   RE_REVOKE_ADMIN ,   RE_TAGS ,   RE_UNDO ,  
			
		
	
		
			
				
					     } ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					     #[ test ]  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -512,6 +521,7 @@ mod test { 
			
		
	
		
			
				
					         assert! ( ! RE_MEMBERS . is_match ( "/admin lain@pleroma.soykaf.com" ) ) ;  
			
		
	
		
			
				
					         assert! ( RE_MEMBERS . is_match ( "/members" ) ) ;  
			
		
	
		
			
				
					         assert! ( RE_MEMBERS . is_match ( "/who" ) ) ;  
			
		
	
		
			
				
					         assert! ( RE_MEMBERS . is_match ( "/admins" ) ) ;  
			
		
	
		
			
				
					     }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					     #[ test ]  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -532,11 +542,9 @@ mod test { 
			
		
	
		
			
				
					         for   ( i ,   c )   in   RE_A_HASHTAG . captures_iter ( "foo #banana #χαλβάς #ласточка" ) . enumerate ( )   {  
			
		
	
		
			
				
					             if   i   = =   0   {  
			
		
	
		
			
				
					                 assert_eq! ( c . get ( 1 ) . unwrap ( ) . as_str ( ) ,   "banana" ) ;  
			
		
	
		
			
				
					             }  
			
		
	
		
			
				
					             else   if   i   = =   1   {  
			
		
	
		
			
				
					             }   else   if   i   = =   1   {  
			
		
	
		
			
				
					                 assert_eq! ( c . get ( 1 ) . unwrap ( ) . as_str ( ) ,   "χαλβάς" ) ;  
			
		
	
		
			
				
					             }  
			
		
	
		
			
				
					             else   if   i   = =   2   {  
			
		
	
		
			
				
					             }   else   if   i   = =   2   {  
			
		
	
		
			
				
					                 assert_eq! ( c . get ( 1 ) . unwrap ( ) . as_str ( ) ,   "ласточка" ) ;  
			
		
	
		
			
				
					             }  
			
		
	
		
			
				
					         }  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -551,6 +559,15 @@ mod test { 
			
		
	
		
			
				
					         assert! ( RE_LEAVE . is_match ( "/leave z" ) ) ;  
			
		
	
		
			
				
					     }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					     #[ test ]  
			
		
	
		
			
				
					     fn  test_undo ( )   {  
			
		
	
		
			
				
					         assert! ( ! RE_UNDO . is_match ( "/list" ) ) ;  
			
		
	
		
			
				
					         assert! ( RE_UNDO . is_match ( "/undo" ) ) ;  
			
		
	
		
			
				
					         assert! ( RE_UNDO . is_match ( "/undo" ) ) ;  
			
		
	
		
			
				
					         assert! ( RE_UNDO . is_match ( "x /undo" ) ) ;  
			
		
	
		
			
				
					         assert! ( RE_UNDO . is_match ( "/undo z" ) ) ;  
			
		
	
		
			
				
					     }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					     #[ test ]  
			
		
	
		
			
				
					     fn  test_join ( )   {  
			
		
	
		
			
				
					         assert! ( ! RE_JOIN . is_match ( "/list" ) ) ;  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -595,7 +612,7 @@ mod test { 
			
		
	
		
			
				
					             vec! [  
			
		
	
		
			
				
					                 StatusCommand ::BanUser ( "lain" . to_string ( ) ) ,  
			
		
	
		
			
				
					                 StatusCommand ::BanUser ( "piggo@piggo.space" . to_string ( ) ) ,  
			
		
	
		
			
				
					                 StatusCommand ::BanServer ( "soykaf.com" . to_string ( ) )  
			
		
	
		
			
				
					                 StatusCommand ::BanServer ( "soykaf.com" . to_string ( ) ) ,  
			
		
	
		
			
				
					             ] ,  
			
		
	
		
			
				
					             parse_slash_commands ( "let's /ban @lain! /ban @piggo@piggo.space and also /ban soykaf.com" )  
			
		
	
		
			
				
					         ) ;