1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 16:53:12 +02:00

Allow attaching metadata to nickrequests and storing it in the databases and fixed windows build

This commit is contained in:
Adam
2010-05-11 14:36:53 -04:00
committed by Adam
parent 631d11d6a8
commit e6263dba84
8 changed files with 47 additions and 15 deletions
+1 -3
View File
@@ -69,9 +69,7 @@ enum NickCoreFlag
NI_END
};
/** XXX: this really needs to die with fire and be merged with metadata into NickCore or something.
*/
class CoreExport NickRequest
class CoreExport NickRequest : public Extensible
{
public:
NickRequest(const std::string &nickname);
+4 -4
View File
@@ -7,10 +7,10 @@ extern CoreExport bool MailValidate(const std::string &email);
class MailThread : public Thread
{
private:
const std::string MailTo;
const std::string Addr;
const std::string Subject;
const std::string Message;
std::string MailTo;
std::string Addr;
std::string Subject;
std::string Message;
bool Success;
public:
+2 -2
View File
@@ -80,7 +80,7 @@ class CoreExport Mode
/* Class of mode this is */
ModeClass Class;
/* The mode name, as a string */
const std::string NameAsString;
std::string NameAsString;
/* Mode char for this */
char ModeChar;
/* Type of mode this is */
@@ -119,7 +119,7 @@ class CoreExport UserMode : public Mode
virtual ~UserMode();
};
class UserModeParam : public UserMode
class CoreExport UserModeParam : public UserMode
{
public:
/** Default constructor
+14 -1
View File
@@ -26,7 +26,6 @@
typedef HMODULE ano_module_t;
#define dlopen(file, unused) LoadLibrary(file)
E const char *dlerror();
#define dlsym(file, symbol) (HMODULE)GetProcAddress(file, symbol)
#define dlclose(file) FreeLibrary(file) ? 0 : 1
#define ano_modclearerr() SetLastError(0)
@@ -633,6 +632,14 @@ class CoreExport Module
*/
virtual EventReturn OnDatabaseReadMetadata(NickAlias *na, const std::string &key, const std::vector<std::string> &params) { return EVENT_CONTINUE; }
/** Called when nickrequest metadata is read from the database
* @param nr The nickrequest
* @parm key The metadata key
* @param params The params from the database
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
*/
virtual EventReturn OnDatabaseReadMetadata(NickRequest *nr, const std::string &key, const std::vector<std::string> &params) { return EVENT_CONTINUE; }
/** Called when botinfo metadata is read from the database
* @param bi The botinfo
* @param key The metadata key
@@ -661,6 +668,12 @@ class CoreExport Module
*/
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const std::string &, const std::string &), NickAlias *na) { }
/** Called when we are wrting metadata for a nickrequest
* @param WriteMetata A callback function used to insert the metadata
* @param nr The nick request
*/
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const std::string &, const std::string &), NickRequest *nr) { }
/** Called when we are writing metadata for a botinfo
* @param WriteMetata A callback function used to insert the metadata
* @param bi The botinfo
+1 -1
View File
@@ -71,7 +71,7 @@ enum ServerFlag
/** Class representing a server
*/
class Server : public Flags<ServerFlag>
class CoreExport Server : public Flags<ServerFlag>
{
private:
/* Server name */
+1
View File
@@ -91,6 +91,7 @@
# define inet_ntop inet_ntop_
# define MARK_DEPRECATED
extern CoreExport const char *dlerror();
extern CoreExport int inet_pton(int af, const char *src, void *dst);
extern CoreExport const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
+24
View File
@@ -24,6 +24,7 @@ enum MDType
MD_NONE,
MD_NC,
MD_NA,
MD_NR,
MD_BI,
MD_CH
};
@@ -99,6 +100,11 @@ static void ReadDatabase(Module *m = NULL)
na = findnick(params[2].c_str());
Type = MD_NA;
}
else if (params[0] == "NR")
{
nr = findrequestnick(params[1].c_str());
Type = MD_NR;
}
else if (params[0] == "BI")
{
bi = findbot(params[1]);
@@ -147,6 +153,22 @@ static void ReadDatabase(Module *m = NULL)
Alog() << "[db_plain]: " << ex.GetReason();
}
}
else if (Type == MD_NR && nr)
{
try
{
if (m)
m->OnDatabaseReadMetadata(nr, key, params);
else
{
FOREACH_RESULT(I_OnDatabaseReadMetadata, OnDatabaseReadMetadata(nr, key, params));
}
}
catch (DatabaseException& ex)
{
Alog() << "[db_plain]: " << ex.GetReason();
}
}
else if (Type == MD_BI && bi)
{
try
@@ -918,6 +940,8 @@ class DBPlain : public Module
for (NickRequest *nr = nrlists[i]; nr; nr = nr->next)
{
db << "NR " << nr->nick << " " << nr->passcode << " " << nr->password << " " << nr->email << " " << nr->requested << endl;
FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteMetadata, nr));
}
}
-4
View File
@@ -1113,11 +1113,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, "CMODE_NOKICK", 'Q'));
continue;
case 'R':
<<<<<<< HEAD
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
=======
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, "CMODE_REGISTEREDONLY", 'R'));
>>>>>>> modes
continue;
case 'S':
ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, "CMODE_STRIPCOLOR", 'S'));