twitname and twitsubj in random system groups

This commit is contained in:
Ianos Gnatiuc 2005-10-06 12:08:57 +00:00
parent fcf1b711ec
commit 3807deacff
7 changed files with 51 additions and 5 deletions

View File

@ -2303,6 +2303,8 @@ EndGroup
// Tearline
// Template
// TwitMode
// TwitName
// TwitSubj
// UseFwd
// UserName
// UseSoftCrxLat

View File

@ -10,6 +10,8 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
+ TwitName and TwitSubj now may be used in random system groups.
+ Win32-MSVC version: processor name will be used instead of "x86" in
@widepid and @osver macros.

View File

@ -282,14 +282,23 @@ void CfgTwitname() {
}
}
strxcpy(tn.name, val, sizeof(tn.name));
CFG->twitname.push_back(tn);
if(cfgingroup)
CFG->grp.AddItm(GRP_TWITNAME, &tn, sizeof(tn));
else
CFG->twitname.push_back(tn);
}
// ------------------------------------------------------------------
void CfgTwitsubj() {
void CfgTwitsubj()
{
std::string str = StripQuotes(val);
CFG->twitsubj.push_back(StripQuotes(val));
if(cfgingroup)
CFG->grp.AddItm(GRP_TWITSUBJ, str);
else
CFG->twitsubj.push_back(str);
}
// ------------------------------------------------------------------

View File

@ -174,6 +174,9 @@ void Area::InitData() {
strxcpy(adat->wtpl, CFG->wtpl.c_str(), sizeof(adat->wtpl));
adat->templatematch = CFG->templatematch;
adat->twitmode = CFG->twitmode;
adat->inittwit = true;
adat->twitname = CFG->twitname;
adat->twitsubj = CFG->twitsubj;
adat->usearea = CFG->usearea;
adat->usefwd = CFG->usefwd;
strcpy(adat->username.name, CFG->username.empty() ? "" : CFG->username[CFG->usernameno].name);
@ -360,6 +363,29 @@ void Area::RandomizeData(int mode) {
CFG->grp.GetItm(GRP_TEMPLATEMATCH, adat->templatematch);
CFG->grp.GetItm(GRP_TWITMODE, adat->twitmode);
if (adat->inittwit)
{
Node node;
std::string subj;
int i, nr = CFG->grp.GetItm(GRP_TWITNAME, &node, sizeof(node));
for (i = 0; i < nr; i++)
{
CFG->grp.GetItm(GRP_TWITNAME, &node, sizeof(node), i);
adat->twitname.push_back(node);
}
nr = CFG->grp.GetItm(GRP_TWITSUBJ, subj);
for (i = 0; i < nr; i++)
{
CFG->grp.GetItm(GRP_TWITSUBJ, subj, i);
adat->twitsubj.push_back(subj);
}
adat->inittwit = false;
}
CFG->grp.GetItm(GRP_USEAREA, adat->usearea);
CFG->grp.GetItm(GRP_USEFWD, adat->usefwd);

View File

@ -1055,7 +1055,8 @@ int MsgIsTwit(GMsg* msg, bool& istwitto, bool& istwitsubj) {
// Check for twit names
std::vector<Node>::iterator tn;
for(tn = CFG->twitname.begin(); tn != CFG->twitname.end(); tn++) {
for(tn = AA->adat->twitname.begin(); tn != AA->adat->twitname.end(); tn++)
{
if(msg->orig.match(tn->addr)) {
if(*tn->name == NUL or strwild(msg->By(), tn->name)) {
istwit = true;
@ -1076,7 +1077,8 @@ int MsgIsTwit(GMsg* msg, bool& istwitto, bool& istwitsubj) {
// Check for twit subjects
if(not istwit) {
gstrarray::iterator n;
for(n = CFG->twitsubj.begin(); n != CFG->twitsubj.end(); n++) {
for(n = AA->adat->twitsubj.begin(); n != AA->adat->twitsubj.end(); n++)
{
if(striinc(n->c_str(), msg->re)) {
istwitsubj = true;
istwit = true;

View File

@ -323,6 +323,9 @@ struct AreaData {
Path outputfile;
INam searchfor;
int twitmode;
bool inittwit;
std::vector<Node> twitname;
gstrarray twitsubj;
bool viewhidden;
bool viewkludge;
bool viewquote;

View File

@ -96,6 +96,8 @@ enum {
GRP_TEMPLATE,
GRP_TEMPLATEMATCH,
GRP_TWITMODE,
GRP_TWITNAME,
GRP_TWITSUBJ,
GRP_USEAREA,
GRP_USEFWD,
GRP_USERNAME,