1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 00:16:39 +02:00

BUILD : 1.7.4 (210) BUGS : N/A NOTES : Changed strcasecmp to stricmp

git-svn-id: svn://svn.anope.org/anope/trunk@210 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@152 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b
2004-06-22 17:55:12 +00:00
parent 6f8139e131
commit 2188f7af30
7 changed files with 161 additions and 19 deletions
+1
View File
@@ -1,6 +1,7 @@
Anope Version S V N
-------------------
Provided by Anope Dev. <dev@anope.org> - 2004
06/22 F Changed strcasecmp to stricmp as it should be [ #00]
06/20 F PTLink server support [ #00]
06/18 A Added proper Bahamut1.8 support. [ #55]
+1 -1
View File
@@ -1457,7 +1457,7 @@ static void del_exception(Channel * chan, char *mask)
int reset = 0;
for (i = 0; i < chan->exceptcount; i++) {
if ((!reset) && (strcasecmp(chan->excepts[i], mask) == 0)) {
if ((!reset) && (stricmp(chan->excepts[i], mask) == 0)) {
free(chan->excepts[i]);
reset = 1;
}
Vendored
+6
View File
@@ -710,6 +710,12 @@ if [ "$USE_MODULES" = "USE_MODULES" ] ; then
ok=1
fi
fi
if [ ! -d "$INPUT/data/" ] ; then
if mkdir -p $INPUT/data/ ; then
ok=1
fi
fi
done
MODULE_PATH=$INPUT
echo ""
+140 -16
View File
@@ -185,7 +185,7 @@ int addModule(Module * m)
index = CMD_HASH(m->name);
for (current = MODULE_HASH[index]; current; current = current->next) {
if (strcasecmp(m->name, current->name) == 0)
if (stricmp(m->name, current->name) == 0)
return MOD_ERR_EXISTS;
lastHash = current;
}
@@ -223,7 +223,7 @@ int delModule(Module * m)
index = CMD_HASH(m->name);
for (current = MODULE_HASH[index]; current; current = current->next) {
if (strcasecmp(m->name, current->name) == 0) {
if (stricmp(m->name, current->name) == 0) {
if (!lastHash) {
MODULE_HASH[index] = current->next;
} else {
@@ -749,7 +749,7 @@ int moduleDelCommand(CommandHash * cmdTable[], char *name)
for (cmd = c; cmd; cmd = cmd->next) {
if (cmd->mod_name
&& strcasecmp(cmd->mod_name, mod_current_module->name) == 0) {
&& stricmp(cmd->mod_name, mod_current_module->name) == 0) {
if (debug) {
displayCommandFromHash(cmdTable, name);
}
@@ -778,7 +778,7 @@ int displayCommandFromHash(CommandHash * cmdTable[], char *name)
alog("trying to display command %s", name);
}
for (current = cmdTable[index]; current; current = current->next) {
if (strcasecmp(name, current->name) == 0) {
if (stricmp(name, current->name) == 0) {
displayCommand(current->c);
}
}
@@ -822,7 +822,7 @@ int displayMessageFromHash(char *name)
alog("trying to display message %s", name);
}
for (current = IRCD[index]; current; current = current->next) {
if (strcasecmp(name, current->name) == 0) {
if (stricmp(name, current->name) == 0) {
displayMessage(current->m);
}
}
@@ -881,7 +881,7 @@ int addCommand(CommandHash * cmdTable[], Command * c, int pos)
&& (!strcmp(c->service, current->c->service) == 0)) {
continue;
}
if ((strcasecmp(c->name, current->name) == 0)) { /* the cmd exist's we are a addHead */
if ((stricmp(c->name, current->name) == 0)) { /* the cmd exist's we are a addHead */
if (pos == 1) {
c->next = current->c;
current->c = c;
@@ -940,7 +940,7 @@ int delCommand(CommandHash * cmdTable[], Command * c, char *mod_name)
index = CMD_HASH(c->name);
for (current = cmdTable[index]; current; current = current->next) {
if (strcasecmp(c->name, current->name) == 0) {
if (stricmp(c->name, current->name) == 0) {
if (!lastHash) {
tail = current->c;
if (tail->next) {
@@ -1089,7 +1089,7 @@ int addMessage(MessageHash * msgTable[], Message * m, int pos)
index = CMD_HASH(m->name);
for (current = msgTable[index]; current; current = current->next) {
if (strcasecmp(m->name, current->name) == 0) { /* the msg exist's we are a addHead */
if (stricmp(m->name, current->name) == 0) { /* the msg exist's we are a addHead */
if (pos == 1) {
m->next = current->m;
current->m = m;
@@ -1220,7 +1220,7 @@ int delMessage(MessageHash * msgTable[], Message * m, char *mod_name)
index = CMD_HASH(m->name);
for (current = msgTable[index]; current; current = current->next) {
if (strcasecmp(m->name, current->name) == 0) {
if (stricmp(m->name, current->name) == 0) {
if (!lastHash) {
tail = current->m;
if (tail->next) {
@@ -1755,13 +1755,17 @@ void moduleDisplayHelp(int service, User * u)
/**
* Add module data to a struct.
* This allows module coders to add data to an existing struct
* This actaully adds the request data to the moduleData structs, this should not be called directly from modules.
* @param md The module data for the struct to be used
* @param key The Key for the key/value pair
* @param value The value for the key/value pair, this is what will be stored for you
* @param persistant Should the key/value pair be persistant?
* @return MOD_ERR_OK will be returned on success
* @see moduleAddData
* @see moduleAddPersistantData
**/
int moduleAddData(ModuleData * md[], char *key, char *value)
int moduleAddDataValue(ModuleData * md[], char *key, char *value,
int persistant)
{
char *mod_name = sstrdup(mod_current_module_name);
@@ -1780,7 +1784,7 @@ int moduleAddData(ModuleData * md[], char *key, char *value)
}
for (current = md[index]; current; current = current->next) {
if (strcasecmp(current->moduleName, mod_name) == 0)
if (stricmp(current->moduleName, mod_name) == 0)
lastHash = current;
}
@@ -1801,7 +1805,7 @@ int moduleAddData(ModuleData * md[], char *key, char *value)
**/
for (itemCurrent = lastHash->di; itemCurrent;
itemCurrent = itemCurrent->next) {
if (strcasecmp(itemCurrent->key, key) == 0) {
if (stricmp(itemCurrent->key, key) == 0) {
item = itemCurrent;
}
lastItem = itemCurrent;
@@ -1813,6 +1817,7 @@ int moduleAddData(ModuleData * md[], char *key, char *value)
}
item->next = NULL;
item->key = strdup(key);
item->persistant = persistant;
item->value = strdup(value);
if (lastItem)
lastItem->next = item;
@@ -1829,6 +1834,32 @@ int moduleAddData(ModuleData * md[], char *key, char *value)
}
/**
* Add persistant module data to a struct.
* This allows module coders to add data to an existing struct, and have anope take care of loading/saving it!
* @param md The module data for the struct to be used
* @param key The Key for the key/value pair
* @param value The value for the key/value pair, this is what will be stored for you
* @return MOD_ERR_OK will be returned on success
**/
int moduleAddPersistantData(ModuleData * md[], char *key, char *value)
{
return moduleAddDataValue(md, key, value, 1);
}
/**
* Add module data to a struct.
* This allows module coders to add data to an existing struct
* @param md The module data for the struct to be used
* @param key The Key for the key/value pair
* @param value The value for the key/value pair, this is what will be stored for you
* @return MOD_ERR_OK will be returned on success
**/
int moduleAddData(ModuleData * md[], char *key, char *value)
{
return moduleAddDataValue(md, key, value, 0);
}
/**
* Returns the value from a key/value pair set.
* This allows module coders to retrive any data they have previuosly stored in any given struct
@@ -1847,7 +1878,7 @@ char *moduleGetData(ModuleData * md[], char *key)
index = CMD_HASH(mod_name);
for (current = md[index]; current; current = current->next) {
if (strcasecmp(current->moduleName, mod_name) == 0)
if (stricmp(current->moduleName, mod_name) == 0)
lastHash = current;
}
@@ -1882,7 +1913,7 @@ void moduleDelData(ModuleData * md[], char *key)
index = CMD_HASH(mod_name);
for (current = md[index]; current; current = current->next) {
if (strcasecmp(current->moduleName, mod_name) == 0)
if (stricmp(current->moduleName, mod_name) == 0)
lastHash = current;
}
if (lastHash) {
@@ -1925,7 +1956,7 @@ void moduleDelAllData(ModuleData * md[])
index = CMD_HASH(mod_name);
for (current = md[index]; current; current = current->next) {
if (strcasecmp(current->moduleName, mod_name) == 0)
if (stricmp(current->moduleName, mod_name) == 0)
lastHash = current;
}
if (lastHash) {
@@ -2026,4 +2057,97 @@ void moduleCleanStruct(ModuleData * moduleData[])
}
}
/**
* Load any data relevant for this module
* @param m The module to Load the data for
**/
void moduleLoadAllData(Module * m)
{
FILE *in;
char buffer[2000]; /* will _never_ be this big thanks to the 512 limit of a message */
char filename[4096];
char *key = NULL;
char *value = NULL;
char *service = NULL;
char *str_key = NULL;
int len;
enum MODULE_DATA_TYPE struc;
NickCore *nc;
NickAlias *na;
Channel *c;
strncpy(filename, MODULE_PATH, 4095);
len = strlen(filename);
strncat(filename, "data/", 4095 - len);
len = strlen(filename);
strncat(filename, m->name, 4095 - len);
len = strlen(filename);
strncat(filename, ".db", 4095 - len);
if ((in = fopen(filename, "r")) == NULL) {
alog("unable to open module data file [%s] for reading, module data will not be loaded", filename);
} else {
while (!feof(in)) {
fgets(buffer, 1500, in);
service = myStrGetToken(buffer, ' ', 0);
str_key = myStrGetToken(buffer, ' ', 1);
key = myStrGetToken(buffer, ' ', 2);
value = myStrGetTokenRemainder(buffer, ' ', 3);
if (service) {
struc = atoi(service);
if (str_key) {
if (key) {
if (value) {
switch (struc) {
case MD_NICK_CORE:
nc = findcore(str_key);
if (nc) {
moduleAddPersistantData(nc->moduleData,
key, value);
}
break;
case MD_NICK_ALIAS:
na = findnick(str_key);
if (na) {
moduleAddPersistantData(na->moduleData,
key, value);
}
break;
case MD_NICK_MEMO:
break;
case MD_CHAN_MEMO:
break;
case MD_CHAN_INFO:
c = findchan(name);
if (c && c->ci) {
moduleAddPersistantData(c->ci->
moduleData,
key, value);
}
break;
}
free(value);
}
free(key);
}
free(str_key);
}
free(service);
}
}
}
}
/**
* Save any data relevant for this module
* @param m The module to Save the data for
**/
void moduleSaveAllData(Module * m)
{
}
/* EOF */
+6 -1
View File
@@ -74,6 +74,8 @@ extern CommandHash *HELPSERV[MAX_CMD_HASH];
extern CommandHash *OPERSERV[MAX_CMD_HASH];
extern MessageHash *IRCD[MAX_CMD_HASH];
enum MODULE_DATA_TYPE { MD_NICK_CORE = 1, MD_NICK_ALIAS = 2, MD_NICK_MEMO = 3, MD_CHAN_MEMO =4, MD_CHAN_INFO = 5};
struct Module_ {
char *name;
char *filename;
@@ -221,12 +223,15 @@ void moduleDelCallback(char *name);
void moduleCallBackRun(void);
char *moduleGetData(ModuleData *md[], char *key); /* Get the value for this key from this struct */
int moduleAddDataValue(ModuleData * md[], char *key, char *value,int persistant); /* Store the value in the struct */
int moduleAddPersistantData(ModuleData * md[], char *key, char *value); /* Set the value for this key for this struct to be saved*/
int moduleAddData(ModuleData *md[], char *key, char *value); /* Set the value for this key for this struct */
void moduleDelData(ModuleData *md[], char *key); /* Delete this key/value pair */
void moduleDelAllData(ModuleData *md[]); /* Delete all key/value pairs for this module for this struct */
void moduleCleanStruct(ModuleData * moduleData[]); /* Clean a moduleData hash */
void moduleDelAllDataMod(Module *m); /* remove all module data from all structs for this module */
void moduleLoadAllData(Module *m); /* Load any persistant module data settings */
void moduleSaveAllData(Module *m); /* Save any persistant module data settings */
/*************************************************************************/
#endif
+1
View File
@@ -424,6 +424,7 @@ struct ModuleDataItem_ {
char *key; /* The key */
char *value; /* The Value */
ModuleDataItem *next; /* The next ModuleDataItem in this list */
int persistant; /* Is this value persistant? */
};
struct ModuleData_ {
+6 -1
View File
@@ -8,10 +8,15 @@
VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="4"
VERSION_BUILD="209"
VERSION_BUILD="210"
# $Log$
#
# BUILD : 1.7.4 (210)
# BUGS : N/A
# NOTES : Changed strcasecmp to stricmp
#
#
# BUILD : 1.7.4 (209)
# BUGS : none
# NOTES : Fixed implementation for dynamic server /OS GLOBAL