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
|
||||
banner_cmd(unit * u, struct order * ord)
|
||||
{
|
||||
|
@ -2123,28 +2108,6 @@ password_cmd(unit * u, struct order * ord)
|
|||
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
|
||||
send_cmd(unit * u, struct order * ord)
|
||||
{
|
||||
|
@ -2225,10 +2188,6 @@ set_passw(void)
|
|||
if (password_cmd(u, ord)!=0) ord = NULL;
|
||||
break;
|
||||
|
||||
case K_REPORT:
|
||||
if (report_cmd(u, ord)!=0) ord = NULL;
|
||||
break;
|
||||
|
||||
case K_SEND:
|
||||
if (send_cmd(u, ord)!=0) ord = NULL;
|
||||
break;
|
||||
|
|
|
@ -585,24 +585,24 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
|
|||
static void
|
||||
rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent, boolean categorized)
|
||||
{
|
||||
messageclass * category;
|
||||
nrsection * section;
|
||||
if (!msgs) return;
|
||||
for (category=msgclasses; category; category=category->next) {
|
||||
for (section = sections; section; section=section->next) {
|
||||
int k = 0;
|
||||
struct mlist * m = msgs->begin;
|
||||
while (m) {
|
||||
/* 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];
|
||||
|
||||
if (!k && categorized) {
|
||||
const char * category_title;
|
||||
const char * section_title;
|
||||
char cat_identifier[24];
|
||||
|
||||
rnl(F);
|
||||
sprintf(cat_identifier, "section_%s", category->name);
|
||||
category_title = LOC(viewer->locale, cat_identifier);
|
||||
centre(F, category_title, true);
|
||||
sprintf(cat_identifier, "section_%s", section->name);
|
||||
section_title = LOC(viewer->locale, cat_identifier);
|
||||
centre(F, section_title, true);
|
||||
rnl(F);
|
||||
k = 1;
|
||||
}
|
||||
|
|
|
@ -381,7 +381,6 @@ const char *keywords[MAXKEYWORDS] =
|
|||
"ZERSTOEREN",
|
||||
"ZUECHTEN",
|
||||
"DEFAULT",
|
||||
"REPORT",
|
||||
"URSPRUNG",
|
||||
"EMAIL",
|
||||
"MEINUNG",
|
||||
|
|
|
@ -403,7 +403,6 @@ enum {
|
|||
K_DESTROY,
|
||||
K_BREED,
|
||||
K_DEFAULT,
|
||||
K_REPORT,
|
||||
K_URSPRUNG,
|
||||
K_EMAIL,
|
||||
K_VOTE,
|
||||
|
|
|
@ -58,37 +58,6 @@ typedef struct msg_setting {
|
|||
#include "region.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
|
||||
arg_set(variant args[], const message_type * mtype, const char * buffer, variant v)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,6 @@ extern "C" {
|
|||
#include <util/message.h>
|
||||
|
||||
struct message;
|
||||
struct messageclass;
|
||||
struct faction;
|
||||
struct msglevel;
|
||||
|
||||
|
@ -36,11 +35,6 @@ typedef struct message_list {
|
|||
|
||||
extern void free_messagelist(message_list * msgs);
|
||||
|
||||
typedef struct messageclass {
|
||||
struct messageclass * next;
|
||||
const char * name;
|
||||
} messageclass;
|
||||
|
||||
typedef struct msglevel {
|
||||
/* used to set specialized msg-levels */
|
||||
struct msglevel *next;
|
||||
|
@ -53,11 +47,6 @@ extern struct message * msg_feedback(const struct unit *, struct order *cmd,
|
|||
const char * name, const char* sig, ...);
|
||||
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); } }
|
||||
|
||||
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");
|
||||
if (section==NULL) section = BAD_CAST default_section;
|
||||
mc_add((const char*)section);
|
||||
|
||||
/* strings */
|
||||
xpath->node = node;
|
||||
|
|
|
@ -61,6 +61,37 @@ nrt_find(const struct locale * lang, const struct message_type * mtype)
|
|||
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
|
||||
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->next = messagetypes[hash];
|
||||
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;
|
||||
messagetypes[hash] = nrt;
|
||||
assert(string && *string);
|
||||
|
|
|
@ -21,6 +21,13 @@ struct message;
|
|||
struct message_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,
|
||||
const struct locale * lang, const char * script,
|
||||
int level, const char * section);
|
||||
|
|
|
@ -674,7 +674,10 @@
|
|||
|
||||
<!--Meldungssektionen -->
|
||||
<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 name="section_errors">
|
||||
<text locale="de">Warnungen und Fehler</text>
|
||||
|
|
|
@ -257,8 +257,11 @@
|
|||
<text locale="en">an unknown unit</text>
|
||||
</string>
|
||||
|
||||
<string name="section_mail">
|
||||
<text locale="en">Dispatches</text>
|
||||
</string>
|
||||
<string name="section_events">
|
||||
<text locale="en">Messages and Events</text>
|
||||
<text locale="en">Events</text>
|
||||
</string>
|
||||
<string name="section_errors">
|
||||
<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="en">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) do not give things away."</text>
|
||||
</message>
|
||||
<message name="regionmessage" section="events">
|
||||
<message name="regionmessage" section="mail">
|
||||
<type>
|
||||
<arg name="sender" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
|
@ -620,7 +620,7 @@
|
|||
<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>
|
||||
</message>
|
||||
<message name="unitmessage" section="events">
|
||||
<message name="unitmessage" section="mail">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
|
|
Loading…
Reference in New Issue