forked from github/server
Eigener Block für BOTSCHAFTen im NR Ausserdem den ungenutzten REPORT Befehl entfernt.
This commit is contained in:
parent
a04cb3efbd
commit
dda37aaee6
|
@ -2034,21 +2034,6 @@ mail_cmd(unit * u, struct order * ord)
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
|
||||||
report_option(unit * u, const char * sec, struct order * ord)
|
|
||||||
{
|
|
||||||
const messageclass * mc;
|
|
||||||
const char *s;
|
|
||||||
|
|
||||||
mc = mc_find(sec);
|
|
||||||
|
|
||||||
if (mc == NULL) {
|
|
||||||
cmistake(u, ord, 135, MSG_EVENT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
s = getstrtoken();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
banner_cmd(unit * u, struct order * ord)
|
banner_cmd(unit * u, struct order * ord)
|
||||||
{
|
{
|
||||||
|
@ -2123,28 +2108,6 @@ password_cmd(unit * u, struct order * ord)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
report_cmd(unit * u, struct order * ord)
|
|
||||||
{
|
|
||||||
const char * s;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
init_tokens(ord);
|
|
||||||
skip_token();
|
|
||||||
s = getstrtoken();
|
|
||||||
|
|
||||||
i = atoi(s);
|
|
||||||
sprintf(buf, "%d", i);
|
|
||||||
if (!strcmp(buf, s)) {
|
|
||||||
/* int level;
|
|
||||||
level = geti();
|
|
||||||
not implemented yet. set individual levels for f->msglevels */
|
|
||||||
} else {
|
|
||||||
report_option(u, s, ord);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
send_cmd(unit * u, struct order * ord)
|
send_cmd(unit * u, struct order * ord)
|
||||||
{
|
{
|
||||||
|
@ -2225,10 +2188,6 @@ set_passw(void)
|
||||||
if (password_cmd(u, ord)!=0) ord = NULL;
|
if (password_cmd(u, ord)!=0) ord = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case K_REPORT:
|
|
||||||
if (report_cmd(u, ord)!=0) ord = NULL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case K_SEND:
|
case K_SEND:
|
||||||
if (send_cmd(u, ord)!=0) ord = NULL;
|
if (send_cmd(u, ord)!=0) ord = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -585,24 +585,24 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
|
||||||
static void
|
static void
|
||||||
rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent, boolean categorized)
|
rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent, boolean categorized)
|
||||||
{
|
{
|
||||||
messageclass * category;
|
nrsection * section;
|
||||||
if (!msgs) return;
|
if (!msgs) return;
|
||||||
for (category=msgclasses; category; category=category->next) {
|
for (section = sections; section; section=section->next) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
struct mlist * m = msgs->begin;
|
struct mlist * m = msgs->begin;
|
||||||
while (m) {
|
while (m) {
|
||||||
/* messagetype * mt = m->type; */
|
/* messagetype * mt = m->type; */
|
||||||
if (strcmp(nr_section(m->msg), category->name)==0) {
|
if (strcmp(nr_section(m->msg), section->name)==0) {
|
||||||
char lbuf[8192];
|
char lbuf[8192];
|
||||||
|
|
||||||
if (!k && categorized) {
|
if (!k && categorized) {
|
||||||
const char * category_title;
|
const char * section_title;
|
||||||
char cat_identifier[24];
|
char cat_identifier[24];
|
||||||
|
|
||||||
rnl(F);
|
rnl(F);
|
||||||
sprintf(cat_identifier, "section_%s", category->name);
|
sprintf(cat_identifier, "section_%s", section->name);
|
||||||
category_title = LOC(viewer->locale, cat_identifier);
|
section_title = LOC(viewer->locale, cat_identifier);
|
||||||
centre(F, category_title, true);
|
centre(F, section_title, true);
|
||||||
rnl(F);
|
rnl(F);
|
||||||
k = 1;
|
k = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,6 @@ const char *keywords[MAXKEYWORDS] =
|
||||||
"ZERSTOEREN",
|
"ZERSTOEREN",
|
||||||
"ZUECHTEN",
|
"ZUECHTEN",
|
||||||
"DEFAULT",
|
"DEFAULT",
|
||||||
"REPORT",
|
|
||||||
"URSPRUNG",
|
"URSPRUNG",
|
||||||
"EMAIL",
|
"EMAIL",
|
||||||
"MEINUNG",
|
"MEINUNG",
|
||||||
|
|
|
@ -403,7 +403,6 @@ enum {
|
||||||
K_DESTROY,
|
K_DESTROY,
|
||||||
K_BREED,
|
K_BREED,
|
||||||
K_DEFAULT,
|
K_DEFAULT,
|
||||||
K_REPORT,
|
|
||||||
K_URSPRUNG,
|
K_URSPRUNG,
|
||||||
K_EMAIL,
|
K_EMAIL,
|
||||||
K_VOTE,
|
K_VOTE,
|
||||||
|
|
|
@ -58,37 +58,6 @@ typedef struct msg_setting {
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "eressea.h"
|
#include "eressea.h"
|
||||||
|
|
||||||
messageclass * msgclasses;
|
|
||||||
|
|
||||||
const messageclass *
|
|
||||||
mc_find(const char * name)
|
|
||||||
{
|
|
||||||
messageclass ** mcp = &msgclasses;
|
|
||||||
if (name==NULL) return NULL;
|
|
||||||
for (;*mcp;mcp=&(*mcp)->next) {
|
|
||||||
messageclass * mc = *mcp;
|
|
||||||
if (!strcmp(mc->name, name)) break;
|
|
||||||
}
|
|
||||||
return *mcp;
|
|
||||||
}
|
|
||||||
|
|
||||||
const messageclass *
|
|
||||||
mc_add(const char * name)
|
|
||||||
{
|
|
||||||
messageclass ** mcp = &msgclasses;
|
|
||||||
if (name==NULL) return NULL;
|
|
||||||
for (;*mcp;mcp=&(*mcp)->next) {
|
|
||||||
messageclass * mc = *mcp;
|
|
||||||
if (!strcmp(mc->name, name)) break;
|
|
||||||
}
|
|
||||||
if (!*mcp) {
|
|
||||||
messageclass * mc = calloc(sizeof(messageclass), 1);
|
|
||||||
mc->name = strdup(name);
|
|
||||||
*mcp = mc;
|
|
||||||
}
|
|
||||||
return *mcp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
arg_set(variant args[], const message_type * mtype, const char * buffer, variant v)
|
arg_set(variant args[], const message_type * mtype, const char * buffer, variant v)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,6 @@ extern "C" {
|
||||||
#include <util/message.h>
|
#include <util/message.h>
|
||||||
|
|
||||||
struct message;
|
struct message;
|
||||||
struct messageclass;
|
|
||||||
struct faction;
|
struct faction;
|
||||||
struct msglevel;
|
struct msglevel;
|
||||||
|
|
||||||
|
@ -36,11 +35,6 @@ typedef struct message_list {
|
||||||
|
|
||||||
extern void free_messagelist(message_list * msgs);
|
extern void free_messagelist(message_list * msgs);
|
||||||
|
|
||||||
typedef struct messageclass {
|
|
||||||
struct messageclass * next;
|
|
||||||
const char * name;
|
|
||||||
} messageclass;
|
|
||||||
|
|
||||||
typedef struct msglevel {
|
typedef struct msglevel {
|
||||||
/* used to set specialized msg-levels */
|
/* used to set specialized msg-levels */
|
||||||
struct msglevel *next;
|
struct msglevel *next;
|
||||||
|
@ -53,11 +47,6 @@ extern struct message * msg_feedback(const struct unit *, struct order *cmd,
|
||||||
const char * name, const char* sig, ...);
|
const char * name, const char* sig, ...);
|
||||||
extern struct message * add_message(struct message_list** pm, struct message * m);
|
extern struct message * add_message(struct message_list** pm, struct message * m);
|
||||||
|
|
||||||
/* message sections */
|
|
||||||
extern struct messageclass * msgclasses;
|
|
||||||
extern const struct messageclass * mc_add(const char * name);
|
|
||||||
extern const struct messageclass * mc_find(const char * name);
|
|
||||||
|
|
||||||
#define ADDMSG(msgs, mcreate) { message * m = mcreate; if (m) { assert(m->refcount>=1); add_message(msgs, m); msg_release(m); } }
|
#define ADDMSG(msgs, mcreate) { message * m = mcreate; if (m) { assert(m->refcount>=1); add_message(msgs, m); msg_release(m); } }
|
||||||
|
|
||||||
extern void cmistake(const struct unit * u, struct order *ord, int mno, int mtype);
|
extern void cmistake(const struct unit * u, struct order *ord, int mno, int mtype);
|
||||||
|
|
|
@ -1758,7 +1758,6 @@ parse_messages(xmlDocPtr doc)
|
||||||
|
|
||||||
section = xmlGetProp(node, BAD_CAST "section");
|
section = xmlGetProp(node, BAD_CAST "section");
|
||||||
if (section==NULL) section = BAD_CAST default_section;
|
if (section==NULL) section = BAD_CAST default_section;
|
||||||
mc_add((const char*)section);
|
|
||||||
|
|
||||||
/* strings */
|
/* strings */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
|
|
|
@ -61,6 +61,37 @@ nrt_find(const struct locale * lang, const struct message_type * mtype)
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nrsection * sections;
|
||||||
|
|
||||||
|
const nrsection *
|
||||||
|
section_find(const char * name)
|
||||||
|
{
|
||||||
|
nrsection ** mcp = §ions;
|
||||||
|
if (name==NULL) return NULL;
|
||||||
|
for (;*mcp;mcp=&(*mcp)->next) {
|
||||||
|
nrsection * mc = *mcp;
|
||||||
|
if (!strcmp(mc->name, name)) break;
|
||||||
|
}
|
||||||
|
return *mcp;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nrsection *
|
||||||
|
section_add(const char * name)
|
||||||
|
{
|
||||||
|
nrsection ** mcp = §ions;
|
||||||
|
if (name==NULL) return NULL;
|
||||||
|
for (;*mcp;mcp=&(*mcp)->next) {
|
||||||
|
nrsection * mc = *mcp;
|
||||||
|
if (!strcmp(mc->name, name)) break;
|
||||||
|
}
|
||||||
|
if (!*mcp) {
|
||||||
|
nrsection * mc = calloc(sizeof(nrsection), 1);
|
||||||
|
mc->name = strdup(name);
|
||||||
|
*mcp = mc;
|
||||||
|
}
|
||||||
|
return *mcp;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nrt_register(const struct message_type * mtype, const struct locale * lang, const char * string, int level, const char * section)
|
nrt_register(const struct message_type * mtype, const struct locale * lang, const char * string, int level, const char * section)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +109,13 @@ nrt_register(const struct message_type * mtype, const struct locale * lang, cons
|
||||||
nrt->mtype = mtype;
|
nrt->mtype = mtype;
|
||||||
nrt->next = messagetypes[hash];
|
nrt->next = messagetypes[hash];
|
||||||
nrt->level=level;
|
nrt->level=level;
|
||||||
if (section) nrt->section = strdup(section);
|
if (section) {
|
||||||
|
const nrsection * s = section_find(section);
|
||||||
|
if (s==NULL) {
|
||||||
|
s = section_add(section);
|
||||||
|
}
|
||||||
|
nrt->section = s->name;
|
||||||
|
}
|
||||||
else nrt->section = NULL;
|
else nrt->section = NULL;
|
||||||
messagetypes[hash] = nrt;
|
messagetypes[hash] = nrt;
|
||||||
assert(string && *string);
|
assert(string && *string);
|
||||||
|
|
|
@ -21,6 +21,13 @@ struct message;
|
||||||
struct message_type;
|
struct message_type;
|
||||||
struct nrmessage_type;
|
struct nrmessage_type;
|
||||||
|
|
||||||
|
typedef struct nrsection {
|
||||||
|
char * name;
|
||||||
|
struct nrsection * next;
|
||||||
|
} nrsection;
|
||||||
|
|
||||||
|
extern nrsection * sections;
|
||||||
|
|
||||||
extern void nrt_register(const struct message_type * mtype,
|
extern void nrt_register(const struct message_type * mtype,
|
||||||
const struct locale * lang, const char * script,
|
const struct locale * lang, const char * script,
|
||||||
int level, const char * section);
|
int level, const char * section);
|
||||||
|
|
|
@ -674,7 +674,10 @@
|
||||||
|
|
||||||
<!--Meldungssektionen -->
|
<!--Meldungssektionen -->
|
||||||
<string name="section_events">
|
<string name="section_events">
|
||||||
<text locale="de">Meldungen und Ereignisse</text>
|
<text locale="de">Ereignisse</text>
|
||||||
|
</string>
|
||||||
|
<string name="section_mail">
|
||||||
|
<text locale="de">Botschaften</text>
|
||||||
</string>
|
</string>
|
||||||
<string name="section_errors">
|
<string name="section_errors">
|
||||||
<text locale="de">Warnungen und Fehler</text>
|
<text locale="de">Warnungen und Fehler</text>
|
||||||
|
|
|
@ -257,8 +257,11 @@
|
||||||
<text locale="en">an unknown unit</text>
|
<text locale="en">an unknown unit</text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<string name="section_mail">
|
||||||
|
<text locale="en">Dispatches</text>
|
||||||
|
</string>
|
||||||
<string name="section_events">
|
<string name="section_events">
|
||||||
<text locale="en">Messages and Events</text>
|
<text locale="en">Events</text>
|
||||||
</string>
|
</string>
|
||||||
<string name="section_errors">
|
<string name="section_errors">
|
||||||
<text locale="en">Warnings and Errors</text>
|
<text locale="en">Warnings and Errors</text>
|
||||||
|
|
|
@ -611,7 +611,7 @@
|
||||||
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) do not give things away."</text>
|
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) do not give things away."</text>
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) do not give things away."</text>
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) do not give things away."</text>
|
||||||
</message>
|
</message>
|
||||||
<message name="regionmessage" section="events">
|
<message name="regionmessage" section="mail">
|
||||||
<type>
|
<type>
|
||||||
<arg name="sender" type="unit"/>
|
<arg name="sender" type="unit"/>
|
||||||
<arg name="region" type="region"/>
|
<arg name="region" type="region"/>
|
||||||
|
@ -620,7 +620,7 @@
|
||||||
<text locale="de">"Eine Botschaft von $unit($sender) aus $region($region): '$string'"</text>
|
<text locale="de">"Eine Botschaft von $unit($sender) aus $region($region): '$string'"</text>
|
||||||
<text locale="en">"A message by $unit($sender) from $region($region): '$string'"</text>
|
<text locale="en">"A message by $unit($sender) from $region($region): '$string'"</text>
|
||||||
</message>
|
</message>
|
||||||
<message name="unitmessage" section="events">
|
<message name="unitmessage" section="mail">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
<arg name="region" type="region"/>
|
<arg name="region" type="region"/>
|
||||||
|
|
Loading…
Reference in New Issue