Move IRCConnectEnabled to each network instead of a global user setting

This commit is contained in:
Kyle Fuller
2012-01-11 14:06:11 +00:00
parent 4abf3feae4
commit 3d7d1793aa
11 changed files with 60 additions and 44 deletions
+2 -11
View File
@@ -559,7 +559,6 @@ class CAdminMod : public CModule {
PutModule("Error: Cloning failed! [" + sError + "]");
return;
}
pNewUser->SetIRCConnectEnabled(false);
if (!CZNC::Get().AddUser(pNewUser, sError)) {
delete pNewUser;
@@ -730,8 +729,7 @@ class CAdminMod : public CModule {
}
// then reconnect
pUser->SetIRCConnectEnabled(true);
pNetwork->CheckIRCConnect();
pNetwork->SetIRCConnectEnabled(true);
PutModule("Queued user for a reconnect.");
}
@@ -757,14 +755,7 @@ class CAdminMod : public CModule {
return;
}
CIRCSock *pIRCSock = pNetwork->GetIRCSock();
if (pIRCSock && !pIRCSock->IsConnected())
pIRCSock->Close();
else if(pIRCSock)
pIRCSock->Quit();
pUser->SetIRCConnectEnabled(false);
pNetwork->SetIRCConnectEnabled(false);
PutModule("Closed user's IRC connection.");
}
+1 -8
View File
@@ -158,16 +158,9 @@ private:
// Disconnect all networks from irc
vector<CIRCNetwork*> vNetworks = pUser->GetNetworks();
for (vector<CIRCNetwork*>::iterator it2 = vNetworks.begin(); it2 != vNetworks.end(); ++it2) {
CIRCNetwork *pNetwork = *it2;
CIRCSock *pIRCSock = pNetwork->GetIRCSock();
if (pIRCSock) {
pIRCSock->Quit();
}
(*it2)->SetIRCConnectEnabled(false);
}
// ...and don't reconnect
pUser->SetIRCConnectEnabled(false);
SetNV(pUser->GetUserName(), "");
return true;
}
@@ -38,6 +38,12 @@
<div><input type="text" name="realname" value="<? VAR RealName ?>" class="full" maxlength="256" /></div>
</div>
<div class="subsection">
<div class="inputlabel">Active:</div>
<div class="checkbox"><input type="checkbox" name="doconnect" id="doconnect_checkbox"<? IF IRCConnectEnabled ?> checked="checked"<? ENDIF ?> />
<label for="doconnect_checkbox">Connect to IRC &amp; automatically re-connect</label></div>
</div>
<div class="subsection half">
<div class="inputlabel">Servers:</div>
<div><textarea name="servers" cols="70" rows="5"><? LOOP ServerLoop ?><? VAR Server ?>
@@ -98,14 +98,6 @@
<div><input type="text" name="quitmsg" value="<? VAR QuitMsg ?>" class="full" maxlength="256" /></div>
</div>
<div style="clear: both;"></div>
<div class="subsection">
<div class="inputlabel">Active:</div>
<div class="checkbox"><input type="checkbox" name="doconnect" id="doconnect_checkbox"<? IF IRCConnectEnabled ?> checked="checked"<? ENDIF ?> />
<label for="doconnect_checkbox">Connect to IRC &amp; automatically re-connect</label></div>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>
+5 -3
View File
@@ -232,7 +232,6 @@ public:
pNewUser->SetTimezoneOffset(WebSock.GetParam("timezoneoffset").ToDouble());
pNewUser->SetJoinTries(WebSock.GetParam("jointries").ToUInt());
pNewUser->SetMaxJoins(WebSock.GetParam("maxjoins").ToUInt());
pNewUser->SetIRCConnectEnabled(WebSock.GetParam("doconnect").ToBool());
if (spSession->IsAdmin()) {
pNewUser->SetDenyLoadMod(WebSock.GetParam("denyloadmod").ToBool());
@@ -674,6 +673,8 @@ public:
Tmpl["Ident"] = pNetwork->GetIdent();
Tmpl["RealName"] = pNetwork->GetRealName();
Tmpl["IRCConnectEnabled"] = CString(pNetwork->GetIRCConnectEnabled());
const vector<CServer*>& vServers = pNetwork->GetServers();
for (unsigned int a = 0; a < vServers.size(); a++) {
CTemplate& l = Tmpl.AddRow("ServerLoop");
@@ -701,6 +702,7 @@ public:
} else {
Tmpl["Action"] = "addnetwork";
Tmpl["Title"] = "Add Network for User [" + pUser->GetUserName() + "]";
Tmpl["IRCConnectEnabled"] = "true";
}
return true;
@@ -742,6 +744,8 @@ public:
pNetwork->SetRealName(sArg);
}
pNetwork->SetIRCConnectEnabled(WebSock.GetParam("doconnect").ToBool());
VCString vsArgs;
pNetwork->DelServers();
@@ -882,7 +886,6 @@ public:
Tmpl["TimezoneOffset"] = CString(pUser->GetTimezoneOffset());
Tmpl["JoinTries"] = CString(pUser->JoinTries());
Tmpl["MaxJoins"] = CString(pUser->MaxJoins());
Tmpl["IRCConnectEnabled"] = CString(pUser->GetIRCConnectEnabled());
const set<CString>& ssAllowedHosts = pUser->GetAllowedHosts();
for (set<CString>::const_iterator it = ssAllowedHosts.begin(); it != ssAllowedHosts.end(); ++it) {
@@ -906,7 +909,6 @@ public:
Tmpl["Action"] = "adduser";
Tmpl["Title"] = "Add User";
Tmpl["StatusPrefix"] = "*";
Tmpl["IRCConnectEnabled"] = "true";
}
// To change BindHosts be admin or don't have DenySetBindHost