Skip to content
Snippets Groups Projects
Commit 309c1a24 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add LANG ARS keyword e.g. "LANG=ES" or "LANG ES" to check for Spanish language

This makes ctrl/modopts/*.ini more useful for multiple language support
parent ec8b40d1
No related branches found
No related tags found
No related merge requests found
...@@ -353,6 +353,10 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -353,6 +353,10 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
artype = AR_TERM; artype = AR_TERM;
i += 3; i += 3;
} }
else if (!strnicmp(str + i, "LANG", 4)) {
artype = AR_LANG;
i += 3;
}
else if (!strnicmp(str + i, "COLS", 4)) { else if (!strnicmp(str + i, "COLS", 4)) {
artype = AR_COLS; artype = AR_COLS;
i += 3; i += 3;
...@@ -611,6 +615,7 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ...@@ -611,6 +615,7 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
case AR_HOST: case AR_HOST:
case AR_IP: case AR_IP:
case AR_TERM: case AR_TERM:
case AR_LANG:
case AR_USERNAME: case AR_USERNAME:
/* String argument */ /* String argument */
for (n = 0; n < maxlen for (n = 0; n < maxlen
...@@ -1128,6 +1133,7 @@ char *decompile_ars(uchar *ars, int len) ...@@ -1128,6 +1133,7 @@ char *decompile_ars(uchar *ars, int len)
case AR_HOST: case AR_HOST:
case AR_IP: case AR_IP:
case AR_TERM: case AR_TERM:
case AR_LANG:
case AR_USERNAME: case AR_USERNAME:
if (not) if (not)
*(out++) = '!'; *(out++) = '!';
......
...@@ -116,6 +116,7 @@ enum { /* Access requirement binaries */ ...@@ -116,6 +116,7 @@ enum { /* Access requirement binaries */
, AR_UTF8 , AR_UTF8
, AR_CP437 , AR_CP437
, AR_USERNAME , AR_USERNAME
, AR_LANG
}; };
enum ar_type { enum ar_type {
...@@ -156,6 +157,7 @@ static inline enum ar_type ar_type(int artype) ...@@ -156,6 +157,7 @@ static inline enum ar_type ar_type(int artype)
case AR_HOST: case AR_HOST:
case AR_IP: case AR_IP:
case AR_USERNAME: case AR_USERNAME:
case AR_LANG:
return AR_STRING; return AR_STRING;
} }
return AR_NUM; return AR_NUM;
......
...@@ -694,6 +694,18 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) ...@@ -694,6 +694,18 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client)
noaccess_val = 0; noaccess_val = 0;
} }
break; break;
case AR_LANG:
if (!findstr_in_string(user->lang, (char*)*ptrptr))
result = _not;
else
result = !_not;
while (*(*ptrptr))
(*ptrptr)++;
if (!result) {
noaccess_str = text[NoAccessUser];
noaccess_val = 0;
}
break;
case AR_COLS: case AR_COLS:
if ((equal && cols != (long)n) || (!equal && cols < (long)n)) if ((equal && cols != (long)n) || (!equal && cols < (long)n))
result = _not; result = _not;
......
...@@ -2641,6 +2641,14 @@ static bool ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client) ...@@ -2641,6 +2641,14 @@ static bool ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client)
while (*(*ptrptr)) while (*(*ptrptr))
(*ptrptr)++; (*ptrptr)++;
break; break;
case AR_LANG:
if (user != NULL && matchusername(cfg, user->lang, (char *)*ptrptr))
result = !not;
else
result = not;
while (*(*ptrptr))
(*ptrptr)++;
break;
case AR_ROWS: case AR_ROWS:
case AR_COLS: case AR_COLS:
result = !not; result = !not;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment