Jelajahi Sumber

Feat: cumulative update

dzp 1 tahun lalu
induk
melakukan
564ac284cd
9 mengubah file dengan 117 tambahan dan 27 penghapusan
  1. 47 2
      SCRIPTS
  2. 14 0
      TODO
  3. 5 1
      src/buffer.c
  4. 10 10
      src/chat.c
  5. 4 2
      src/help.c
  6. 17 8
      src/mapper.c
  7. 5 0
      src/parse.c
  8. 11 3
      src/regex.c
  9. 4 1
      src/text.c

+ 47 - 2
SCRIPTS

@@ -964,9 +964,9 @@
 
 #config mouse on
 
-#event {MAP SHORT-CLICKED MOUSE BUTTON ONE}
+#event {MAP ROOM SHORT-CLICKED MOUSE BUTTON ONE}
 {
-	#map run {%0} 0.25
+	#map run {%4} 0.25
 }
 
 #nop -------------------------------------------------------------------------
@@ -993,6 +993,51 @@
 	}
 }
 
+#nop -------------------------------------------------------------------------
+#nop Digitalize a spoken number, example: wton one hundred and thirty-six
+#nop -------------------------------------------------------------------------
+
+#alias {wton}
+{
+	#var wton {%0};
+	#replace wton {-} {};
+	#replace wton { and } {};
+
+	#replace wton {ninety} {+90};
+	#replace wton {eighty} {+80};
+	#replace wton {seventy} {+70};
+	#replace wton {sixty} {+60};
+	#replace wton {fifty} {+50};
+	#replace wton {forty} {+40};
+	#replace wton {thirty} {+30};
+	#replace wton {twenty} {+20};
+	#replace wton {twelve} {+12};
+	#replace wton {eleven} {+11};
+	#replace wton {teen} {+10};
+	#replace wton {ten} {+10};
+	#replace wton {nine} {+9};
+	#replace wton {eight} {+8};
+	#replace wton {eigh} {+8};
+	#replace wton {seven} {+7};
+	#replace wton {six} {+6};
+	#replace wton {five} {+5};
+	#replace wton {fif} {+5};
+	#replace wton {four} {+4};
+	#replace wton {three} {+3};
+	#replace wton {thir} {+3};
+	#replace wton {two} {+2};
+	#replace wton {one} {+1};
+
+	#replace wton {%S billion} {+ (&1) * 1000000000};
+	#replace wton {%S million} {+ (&1) * 1000000};
+	#replace wton {%S thousand} {+ (&1) * 1000};
+	#replace wton {%S hundred} {+ (&1) * 100};
+
+	#math wton $wton;
+
+	#line ignore #showme <118>wton %0 = $wton
+}
+
 #nop -------------------------------------------------------------------------
 #nop 
 #nop -------------------------------------------------------------------------

+ 14 - 0
TODO

@@ -1,7 +1,21 @@
+- Update script's --time-style=full-iso doesn't work on Mac.
+
+- Investigate: #var bla {{test};{tost};{tust}};#showme {--$bla[t%*]}
+
+- Add an example #edit script to SCRIPTS
+
+- #map offset 10 10 doesn't generate an error
+
+- strip [ ] from auto tab completion
+
 - #draw tile 1 1 1 1 {\x7B}
 
+- #screen scroll 10 1 -3 -1;#showme {bla} {-2}
+
 #draw RED ROUNDED BOX {1 1 2 2} gives a poor error message
 
+- #var foo {{}{aaa}} creates no assignment
+
 - With internet down, #session reconnect events might fail
 
 - Write an example script that makes tintin mimic Discord, with soft enters, emoticons, etc.

+ 5 - 1
src/buffer.c

@@ -175,7 +175,11 @@ void add_line_buffer(struct session *ses, char *line, int prompt)
 	temp = str_alloc_stack(0);
 
 	SET_BIT(gtd->flags, TINTIN_FLAG_SESSIONUPDATE);
-	SET_BIT(ses->flags, SES_FLAG_BUFFERUPDATE);
+
+	if (gtd->level->ignore == 0)
+	{
+		SET_BIT(ses->flags, SES_FLAG_BUFFERUPDATE);
+	}
 
 	if (HAS_BIT(ses->config_flags, CONFIG_FLAG_CONVERTMETA))
 	{

+ 10 - 10
src/chat.c

@@ -153,7 +153,7 @@ DO_CHAT(chat_initialize)
 		syserr_printf(gtd->ses, "chat_initialize: setsockopt");
 	}
 
-	ld.l_onoff  = 0;
+	ld.l_onoff  = 0; 
 	ld.l_linger = 100;
 
 	setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *) &ld, sizeof(ld));
@@ -742,9 +742,9 @@ int process_chat_input(struct chat_data *buddy)
 		else
 		{
 			chat_socket_printf(buddy, "%c\n%s has refused your connection due to an invalid handshake. (%s)\n%c", CHAT_MESSAGE, gtd->chat->name, buf, CHAT_END_OF_COMMAND);
-
+			
 			chat_printf("Refusing connection from %.21s:%d, invalid handshake.", buddy->ip, buddy->port);
-
+			
 			pop_call();
 			return -1;
 		}
@@ -1480,7 +1480,7 @@ DO_CHAT(chat_paste)
 			if ((buddy = find_buddy(name)) != NULL)
 			{
 				chat_printf("You paste to %s:\n%s", buddy->name, gtd->chat->paste_buf);
-
+	
 				chat_socket_printf(buddy, "%c\n%s pastes to you:\n%s\n%c", CHAT_TEXT_EVERYBODY, gtd->chat->name, gtd->chat->paste_buf, CHAT_END_OF_COMMAND);
 			}
 			else if (find_group(name) != NULL)
@@ -1656,12 +1656,12 @@ DO_CHAT(chat_serve)
 	if (HAS_BIT(buddy->flags, CHAT_FLAG_SERVE))
 	{
 		chat_printf("You are now chat serving %s.", buddy->name);
-		chat_socket_printf(buddy, "%c\n%s is now chat serving you.\n%c", CHAT_MESSAGE, gtd->chat->name, CHAT_END_OF_COMMAND);
+		chat_socket_printf(buddy, "%c\n%s is now chat serving you.\n%c", CHAT_MESSAGE, gtd->chat->name, CHAT_END_OF_COMMAND); 
 	}
 	else
 	{
 		chat_printf("You are no longer chat serving %s.", buddy->name);
-		chat_socket_printf(buddy, "%c\n%s is no longer chat serving you.\n%c", CHAT_MESSAGE, gtd->chat->name, CHAT_END_OF_COMMAND);
+		chat_socket_printf(buddy, "%c\n%s is no longer chat serving you.\n%c", CHAT_MESSAGE, gtd->chat->name, CHAT_END_OF_COMMAND); 
 	}
 }
 
@@ -1920,7 +1920,7 @@ void chat_receive_file(char *arg, struct chat_data *buddy)
 		deny_file(buddy, "\nFile protocol error. (no file size was transmitted)\n");
 
 		pop_call();
-		return;
+		return;	
 	}
 	*comma = 0;
 
@@ -2114,7 +2114,7 @@ void file_cleanup(struct chat_data *buddy)
 	if (buddy->file_name)
 	{
 		free(buddy->file_name);
-
+		
 		buddy->file_name = NULL;
 	}
 }
@@ -2360,7 +2360,7 @@ DO_CHAT(chat_private)
 			{
 				chat_socket_printf(buddy, "%c\n%s marked your connection private.\n%c", CHAT_MESSAGE, gtd->chat->name, CHAT_END_OF_COMMAND);
 
-				chat_printf("Your connection with %s is now private.", buddy->name);
+				chat_printf("Your connection with %s is now private.", buddy->name);				
 
 				SET_BIT(buddy->flags, CHAT_FLAG_PRIVATE);
 			}
@@ -2398,7 +2398,7 @@ DO_CHAT(chat_public)
 			{
 				chat_socket_printf(buddy, "%c\n%s marked your connection public.\n%c", CHAT_MESSAGE, gtd->chat->name, CHAT_END_OF_COMMAND);
 
-				chat_printf("Your connection with %s is now public.", buddy->name);
+				chat_printf("Your connection with %s is now public.", buddy->name);				
 
 				DEL_BIT(buddy->flags, CHAT_FLAG_PRIVATE);
 			}

+ 4 - 2
src/help.c

@@ -3015,8 +3015,10 @@ struct help_type help_table[] =
 		TOKEN_TYPE_COMMAND,
 		"<178>Command<278>: #log <178>{<278>option<178>} {<278>argument<178>}\n"
 		"\n"
-		"<278>         The log command allows logging session output to file. You can set the\n"
-		"<278>         data type to either plain, raw, or html with the config command.\n"
+		"<278>         The log command allows logging session output to file.\n"
+		"\n"
+		"<278>         <178>#config log_mode <html|plain|raw>\n"
+		"<278>           Set the log's data type to either html, plain, or raw.\n"
 		"\n"
 		"<278>         <178>#log append <filename>\n"
 		"<278>           Start logging to the given file, if the file already exists it won't\n"

+ 17 - 8
src/mapper.c

@@ -6022,10 +6022,10 @@ DO_MAP(map_exitflag)
 
 	if (*arg2 == 0)
 	{
-		tintin_printf2(ses, "#MAP: AVOID FLAG IS SET TO %s.", HAS_BIT(exit->flags, EXIT_FLAG_AVOID) ? "ON" : "OFF");
-		tintin_printf2(ses, "#MAP: HIDE FLAG IS SET TO %s.", HAS_BIT(exit->flags, EXIT_FLAG_HIDE) ? "ON" : "OFF");
-		tintin_printf2(ses, "#MAP: INVIS FLAG IS SET TO %s.", HAS_BIT(exit->flags, EXIT_FLAG_INVIS) ? "ON" : "OFF");
-		tintin_printf2(ses, "#MAP: BLOCK FLAG IS SET TO %s.", HAS_BIT(exit->flags, EXIT_FLAG_BLOCK) ? "ON" : "OFF");
+		tintin_printf2(ses, "#MAP: AVOID FLAG IS SET TO %s. (%d)", HAS_BIT(exit->flags, EXIT_FLAG_AVOID) ? "ON" : "OFF", EXIT_FLAG_AVOID);
+		tintin_printf2(ses, "#MAP: BLOCK FLAG IS SET TO %s. (%d)", HAS_BIT(exit->flags, EXIT_FLAG_BLOCK) ? "ON" : "OFF", EXIT_FLAG_BLOCK);
+		tintin_printf2(ses, "#MAP: HIDE FLAG IS SET TO %s.  (%d)",  HAS_BIT(exit->flags, EXIT_FLAG_HIDE) ? "ON" : "OFF", EXIT_FLAG_HIDE);
+		tintin_printf2(ses, "#MAP: INVIS FLAG IS SET TO %s. (%d)", HAS_BIT(exit->flags, EXIT_FLAG_INVIS) ? "ON" : "OFF", EXIT_FLAG_INVIS);
 
 		return;
 	}
@@ -7625,10 +7625,19 @@ DO_MAP(map_offset)
 		arg = sub_arg_in_braces(ses, arg, arg3, GET_ONE, SUB_VAR|SUB_FUN);
 		arg = sub_arg_in_braces(ses, arg, arg4, GET_ONE, SUB_VAR|SUB_FUN);
 
-		ses->map->sav_top_row = get_number(ses, arg1);
-		ses->map->sav_top_col = get_number(ses, arg2);
-		ses->map->sav_bot_row = get_number(ses, arg3);
-		ses->map->sav_bot_col = get_number(ses, arg4);
+		if (*arg1 && *arg2 && *arg3 && *arg4)
+		{
+			ses->map->sav_top_row = get_number(ses, arg1);
+			ses->map->sav_top_col = get_number(ses, arg2);
+			ses->map->sav_bot_row = get_number(ses, arg3);
+			ses->map->sav_bot_col = get_number(ses, arg4);
+		}
+		else
+		{
+			show_error(ses, LIST_COMMAND, "#MAP OFFSET: THIS COMMAND REQUIRES 4 ARGUMENTS.");
+
+			return;
+		}
 	}
 
 	show_vtmap(ses, 1);

+ 5 - 0
src/parse.c

@@ -486,6 +486,11 @@ struct session *parse_tintin_command(struct session *ses, char *input)
 		return ses;
 	}
 
+	if (check_all_events(ses, EVENT_FLAG_GAG, 0, 1, "GAG UNKNOWN COMMAND", line))
+	{
+		return ses;
+	}
+
 	if (!strcasecmp(line, "exit") || !strcasecmp(line, "quit"))
 	{
 		tintin_printf2(ses, "#ERROR: UNKNOWN TINTIN COMMAND '%s'. SUGGESTION: 'end' OR 'zap'.", line);

+ 11 - 3
src/regex.c

@@ -235,7 +235,7 @@ int check_one_regexp(struct session *ses, struct listnode *node, char *line, cha
 	else
 	{
 		str = line;
-	}
+	}	
 
 	return tintin_regexp(ses, node->regex, str, exp, comp_option, REGEX_FLAG_ARG);
 }
@@ -899,6 +899,10 @@ pcre *tintin_regexp_compile(struct session *ses, struct listnode *node, char *ex
 							return NULL;
 						}
 					}
+					if (pto[0] == '\\' && pto[1] == 'n')
+					{
+						SET_BIT(node->flags, NODE_FLAG_MULTI);
+					}
 					pto++;
 				}
 				*pto++ = ')';
@@ -927,7 +931,7 @@ pcre *tintin_regexp_compile(struct session *ses, struct listnode *node, char *ex
 				}
 				{
 					int i = 1;
-
+	
 					while (pti[i] == '$') i++;
 
 					if (pti[i])
@@ -1009,7 +1013,7 @@ pcre *tintin_regexp_compile(struct session *ses, struct listnode *node, char *ex
 						pti += 2;
 						pto += sprintf(pto, "%s", *pti == 0 ? "([^\\x20-\\xfe]*)" : "([^\\x20-\\xfe]*?)");
 						break;
-
+						
 					case 's':
 						pti += 2;
 						pto += sprintf(pto, "%s", *pti == 0 ? "(\\s*)" : "(\\s*?)");
@@ -1151,6 +1155,10 @@ pcre *tintin_regexp_compile(struct session *ses, struct listnode *node, char *ex
 											return NULL;
 										}
 									}
+									if (pto[0] == '\\' && pto[1] == 'n')
+									{
+										SET_BIT(node->flags, NODE_FLAG_MULTI);
+									}
 									pto++;
 								}
 								break;

+ 4 - 1
src/text.c

@@ -111,7 +111,10 @@ void print_stdout(int row, int col, char *format, ...)
 	}
 	else
 	{
-		SET_BIT(gtd->flags, TINTIN_FLAG_DISPLAYUPDATE);
+		if (gtd->level->ignore == 0)
+		{
+			SET_BIT(gtd->flags, TINTIN_FLAG_DISPLAYUPDATE);
+		}
 
 		fputs(buffer, stdout);
 //		printf("%s", buffer);