/[LeafOK_CVS]/lbbs/src/lml.c
ViewVC logotype

Diff of /lbbs/src/lml.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.22 by sysadm, Sat Oct 18 12:06:10 2025 UTC Revision 1.24 by sysadm, Wed Oct 22 05:50:13 2025 UTC
# Line 103  static int lml_tag_disable_filter(const Line 103  static int lml_tag_disable_filter(const
103  {  {
104          lml_tag_disabled = 1;          lml_tag_disabled = 1;
105    
106          return snprintf(tag_output_buf, tag_output_buf_len, "%s", (quote_mode ? "" : "[plain]"));          return snprintf(tag_output_buf, tag_output_buf_len, "%s", (quote_mode ? "[plain]" : ""));
107  }  }
108    
109  typedef struct lml_tag_def_t  typedef struct lml_tag_def_t
# Line 151  const LML_TAG_DEF lml_tag_def[] = { Line 151  const LML_TAG_DEF lml_tag_def[] = {
151          {"bwf", "\033[1;31m****\033[m", "", "****", NULL},          {"bwf", "\033[1;31m****\033[m", "", "****", NULL},
152  };  };
153    
154  #define LML_TAG_COUNT 32  #define LML_TAG_COUNT (sizeof(lml_tag_def) / sizeof(LML_TAG_DEF))
155    
156  static int lml_tag_name_len[LML_TAG_COUNT];  static int lml_tag_name_len[LML_TAG_COUNT];
157  static int lml_ready = 0;  static int lml_ready = 0;
# Line 193  int lml_render(const char *str_in, char Line 193  int lml_render(const char *str_in, char
193    
194          for (i = 0; str_in[i] != '\0'; i++)          for (i = 0; str_in[i] != '\0'; i++)
195          {          {
196                  if (quote_mode && !lml_tag_disabled && new_line)                  if (!quote_mode && !lml_tag_disabled && new_line)
197                  {                  {
198                          if (fb_quote_level > 0)                          if (fb_quote_level > 0)
199                          {                          {
# Line 308  int lml_render(const char *str_in, char Line 308  int lml_render(const char *str_in, char
308                                                                  strncpy(tag_param_buf, lml_tag_def[k].default_param, LML_TAG_PARAM_BUF_LEN - 1);                                                                  strncpy(tag_param_buf, lml_tag_def[k].default_param, LML_TAG_PARAM_BUF_LEN - 1);
309                                                                  tag_param_buf[LML_TAG_PARAM_BUF_LEN - 1] = '\0';                                                                  tag_param_buf[LML_TAG_PARAM_BUF_LEN - 1] = '\0';
310                                                          }                                                          }
311                                                          if (quote_mode)                                                          if (!quote_mode)
312                                                          {                                                          {
313                                                                  if (lml_tag_def[k].tag_output != NULL)                                                                  if (lml_tag_def[k].tag_output != NULL)
314                                                                  {                                                                  {
315                                                                          tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, lml_tag_def[k].tag_output, tag_param_buf);                                                                          tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, lml_tag_def[k].tag_output, tag_param_buf);
316                                                                  }                                                                  }
317                                                                  else                                                                  else if (lml_tag_def[k].tag_filter_cb != NULL)
318                                                                  {                                                                  {
319                                                                          tag_output_len = lml_tag_def[k].tag_filter_cb(                                                                          tag_output_len = lml_tag_def[k].tag_filter_cb(
320                                                                                  lml_tag_def[k].tag_name, tag_param_buf, tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, quote_mode);                                                                                  lml_tag_def[k].tag_name, tag_param_buf, tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, 0);
321                                                                    }
322                                                                    else
323                                                                    {
324                                                                            tag_output_len = 0;
325                                                                  }                                                                  }
326                                                          }                                                          }
327                                                          else                                                          else // quote mode
328                                                          {                                                          {
329                                                                  if (lml_tag_def[k].quote_mode_output != NULL)                                                                  if (lml_tag_def[k].quote_mode_output != NULL)
330                                                                  {                                                                  {
331                                                                          tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, lml_tag_def[k].quote_mode_output, tag_param_buf);                                                                          tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, lml_tag_def[k].quote_mode_output, tag_param_buf);
332                                                                  }                                                                  }
333                                                                  else                                                                  else if (lml_tag_def[k].tag_filter_cb != NULL)
334                                                                  {                                                                  {
335                                                                          tag_output_len = lml_tag_def[k].tag_filter_cb(                                                                          tag_output_len = lml_tag_def[k].tag_filter_cb(
336                                                                                  lml_tag_def[k].tag_name, tag_param_buf, tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, quote_mode);                                                                                  lml_tag_def[k].tag_name, tag_param_buf, tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, 1);
337                                                                    }
338                                                                    else
339                                                                    {
340                                                                            tag_output_len = 0;
341                                                                  }                                                                  }
342                                                          }                                                          }
343                                                          if (j + tag_output_len >= buf_len)                                                          if (j + tag_output_len >= buf_len)
# Line 389  int lml_render(const char *str_in, char Line 397  int lml_render(const char *str_in, char
397                  }                  }
398          }          }
399    
400          if (quote_mode && !lml_tag_disabled && lml_tag_quote_level > 0)          if (!quote_mode && !lml_tag_disabled && lml_tag_quote_level > 0)
401          {          {
402                  tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, "\033[m");                  tag_output_len = snprintf(tag_output_buf, LML_TAG_OUTPUT_BUF_LEN, "\033[m");
403                  if (j + tag_output_len >= buf_len)                  if (j + tag_output_len >= buf_len)


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1