struct ChanNode *chan = chanuser->chan;
struct UserNode *user = chanuser->user;
struct ModeBuffer *modeBuf;
+ int with_halfops = get_int_field("General.have_halfop");
MYSQL_RES *res;
MYSQL_ROW row, chanuserrow, defaultrow = NULL;
- printf_mysql_query("SELECT `channel_maxusers`, `channel_greeting`, `channel_usergreeting`, `channel_getop`, `channel_getvoice`, `channel_userinfo`, `channel_dynlimit` FROM `channels` WHERE `channel_id` = '%d'", chan->channel_id);
+ printf_mysql_query("SELECT `channel_maxusers`, `channel_greeting`, `channel_usergreeting`, `channel_getop`, `channel_getvoice`, `channel_userinfo`, `channel_dynlimit`, `channel_gethalfop` FROM `channels` WHERE `channel_id` = '%d'", chan->channel_id);
res = mysql_use();
if ((row = mysql_fetch_row(res)) == NULL) return;
- if(!row[3] || !row[4] || !row[5]) {
- printf_mysql_query("SELECT `channel_getop`, `channel_getvoice`, `channel_userinfo` FROM `channels` WHERE `channel_name` = 'defaults'");
+ if(!row[3] || !row[4] || !row[5] || (!row[7] && with_halfops)) {
+ printf_mysql_query("SELECT `channel_getop`, `channel_getvoice`, `channel_userinfo`, `channel_gethalfop` FROM `channels` WHERE `channel_name` = 'defaults'");
res = mysql_use();
defaultrow = mysql_fetch_row(res);
}
//USER RIGHTS
if(!(userflags & DB_CHANUSER_NOAUTOOP)) {
int getop = atoi((row[3] ? row[3] : defaultrow[0]));
+ int gethalfop = (with_halfops ? atoi((row[7] ? row[7] : defaultrow[3])) : 0);
int getvoice = atoi((row[4] ? row[4] : defaultrow[1]));
modeBuf = initModeBuffer(client, chan);
if(uaccess >= getop && uaccess != 0) { //we disallow auto op for all users
modeBufferOp(modeBuf, user->nick);
+ } else if(with_halfops && uaccess >= gethalfop) {
+ modeBufferHalfop(modeBuf, user->nick);
} else if(uaccess >= getvoice) {
modeBufferVoice(modeBuf, user->nick);
}