Permalink
Browse files

Update autoop.cpp

Set it so that when you remove all hostmasks of a user, the user is also deleted
  • Loading branch information...
orchid-hybrid committed Jun 8, 2014
1 parent 9189e4d commit baf14adf0ce03b484aadcdd5b9c0ea9da9fce2b1
Showing with 10 additions and 4 deletions.
  1. +10 −4 modules/autoop.cpp
View
@@ -89,13 +89,15 @@ class CAutoOpUser {
return CString(" ").Join(m_ssChans.begin(), m_ssChans.end());
}
- void DelHostmasks(const CString& sHostmasks) {
+ bool DelHostmasks(const CString& sHostmasks) {
VCString vsHostmasks;
sHostmasks.Split(",", vsHostmasks);
for (unsigned int a = 0; a < vsHostmasks.size(); a++) {
m_ssHostmasks.erase(vsHostmasks[a]);
}
+
+ return m_ssHostmasks.empty();
}
void AddHostmasks(const CString& sHostmasks) {
@@ -330,11 +332,15 @@ class CAutoOpMod : public CModule {
pUser->AddHostmasks(sHostmasks);
PutModule("Hostmasks(s) added to user [" + pUser->GetUsername() + "]");
} else {
- pUser->DelHostmasks(sHostmasks);
+ if (pUser->DelHostmasks(sHostmasks)) {
+ PutModule("Removed user [" + pUser->GetUsername() + "]");
+ DelUser(sUser);
+ DelNV(sUser);
+ } else {
PutModule("Hostmasks(s) Removed from user [" + pUser->GetUsername() + "]");
+ SetNV(pUser->GetUsername(), pUser->ToString());
+ }
}
-
- SetNV(pUser->GetUsername(), pUser->ToString());
} else {
PutModule("Unknown command, try HELP");
}

0 comments on commit baf14ad

Please sign in to comment.