projects
/
NeonServV5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updated cmd_version information
[NeonServV5.git]
/
src
/
modules
/
global.mod
/
cmd_global_setaccess.c
diff --git
a/src/modules/global.mod/cmd_global_setaccess.c
b/src/modules/global.mod/cmd_global_setaccess.c
index 0458bd660ebe4369dce177bc774fe1021b04ac95..8753cc30ac74442275e9b83c7a6daa4dfc057de0 100644
(file)
--- a/
src/modules/global.mod/cmd_global_setaccess.c
+++ b/
src/modules/global.mod/cmd_global_setaccess.c
@@
-1,4
+1,4
@@
-/* cmd_global_setaccess.c - NeonServ v5.
3
+/* cmd_global_setaccess.c - NeonServ v5.
6
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
@@
-39,13
+39,13
@@
CMD_BIND(global_cmd_setaccess) {
MYSQL_ROW row;
caccess = atoi(argv[1]);
if(caccess < 0 || caccess > 1000) {
MYSQL_ROW row;
caccess = atoi(argv[1]);
if(caccess < 0 || caccess > 1000) {
- reply(
getTextBot()
, user, "NS_INVALID_ACCESS", caccess);
+ reply(
textclient
, user, "NS_INVALID_ACCESS", caccess);
return;
}
printf_mysql_query("SELECT `user_access` FROM `users` WHERE `user_user` = '%s'", escape_string(user->auth));
res = mysql_use();
if ((row = mysql_fetch_row(res)) == NULL || atoi(row[0]) < caccess) {
return;
}
printf_mysql_query("SELECT `user_access` FROM `users` WHERE `user_user` = '%s'", escape_string(user->auth));
res = mysql_use();
if ((row = mysql_fetch_row(res)) == NULL || atoi(row[0]) < caccess) {
- reply(
getTextBot()
, user, "NS_ACCESS_OUTRANKED");
+ reply(
textclient
, user, "NS_ACCESS_OUTRANKED");
return;
}
if(argv[0][0] == '*') {
return;
}
if(argv[0][0] == '*') {
@@
-54,48
+54,48
@@
CMD_BIND(global_cmd_setaccess) {
printf_mysql_query("SELECT `user_user` FROM `users` WHERE `user_user` = '%s'", escape_string(argv[0]));
res = mysql_use();
if ((row = mysql_fetch_row(res)) != NULL) {
printf_mysql_query("SELECT `user_user` FROM `users` WHERE `user_user` = '%s'", escape_string(argv[0]));
res = mysql_use();
if ((row = mysql_fetch_row(res)) != NULL) {
- global_cmd_setaccess_async1(client,
getTextBot()
, user, event, argv[0], row[0], caccess);
+ global_cmd_setaccess_async1(client,
textclient
, user, event, argv[0], row[0], caccess);
} else {
//we need to create a new user...
//but first lookup the auth to check if it really exists
struct global_cmd_setaccess_cache *cache = malloc(sizeof(*cache));
if (!cache) {
} else {
//we need to create a new user...
//but first lookup the auth to check if it really exists
struct global_cmd_setaccess_cache *cache = malloc(sizeof(*cache));
if (!cache) {
- p
error("malloc() failed"
);
+ p
rintf_log("global", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__
);
return;
}
cache->client = client;
return;
}
cache->client = client;
- cache->textclient =
getTextBot()
;
+ cache->textclient =
textclient
;
cache->user = user;
cache->event = event;
cache->access = caccess;
cache->nick = strdup(argv[0]);
cache->user = user;
cache->event = event;
cache->access = caccess;
cache->nick = strdup(argv[0]);
- lookup_authname(argv[0], global_cmd_setaccess_auth_lookup, cache);
+ lookup_authname(argv[0],
module_id,
global_cmd_setaccess_auth_lookup, cache);
}
} else {
struct UserNode *cuser = getUserByNick(argv[0]);
if(!cuser) {
cuser = createTempUser(argv[0]);
if(!cuser) {
}
} else {
struct UserNode *cuser = getUserByNick(argv[0]);
if(!cuser) {
cuser = createTempUser(argv[0]);
if(!cuser) {
- reply(
getTextBot()
, user, "NS_USER_UNKNOWN", argv[0]);
+ reply(
textclient
, user, "NS_USER_UNKNOWN", argv[0]);
return;
}
cuser->flags |= USERFLAG_ISTMPUSER;
}
if(cuser->flags & USERFLAG_ISAUTHED) {
return;
}
cuser->flags |= USERFLAG_ISTMPUSER;
}
if(cuser->flags & USERFLAG_ISAUTHED) {
- global_cmd_setaccess_async1(client,
getTextBot()
, user, event, argv[0], cuser->auth, caccess);
+ global_cmd_setaccess_async1(client,
textclient
, user, event, argv[0], cuser->auth, caccess);
} else {
struct global_cmd_setaccess_cache *cache = malloc(sizeof(*cache));
if (!cache) {
} else {
struct global_cmd_setaccess_cache *cache = malloc(sizeof(*cache));
if (!cache) {
- p
error("malloc() failed"
);
+ p
rintf_log("global", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__
);
return;
}
cache->client = client;
return;
}
cache->client = client;
- cache->textclient =
getTextBot()
;
+ cache->textclient =
textclient
;
cache->user = user;
cache->event = event;
cache->access = caccess;
cache->nick = strdup(argv[0]);
cache->user = user;
cache->event = event;
cache->access = caccess;
cache->nick = strdup(argv[0]);
- get_userauth(cuser, global_cmd_setaccess_nick_lookup, cache);
+ get_userauth(cuser,
module_id,
global_cmd_setaccess_nick_lookup, cache);
}
}
}
}
}
}