mirror of
https://github.com/znc/znc.git
synced 2026-05-05 04:52:31 +02:00
Add a "swap" command to perform to change the order of commands
Patch by KiNgMaR, thanks. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1560 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "User.h"
|
||||
#include <algorithm>
|
||||
|
||||
class CPerform : public CModule {
|
||||
public:
|
||||
@@ -70,8 +71,19 @@ public:
|
||||
} else if (sCmdName == "execute") {
|
||||
OnIRCConnected();
|
||||
PutModule("perform commands sent");
|
||||
} else if (sCmdName == "swap") {
|
||||
u_int iNumA = sCommand.Token(1).ToUInt();
|
||||
u_int iNumB = sCommand.Token(2).ToUInt();
|
||||
|
||||
if (iNumA > m_vPerform.size() || iNumA <= 0 || iNumB > m_vPerform.size() || iNumB <= 0) {
|
||||
PutModule("Illegal # Requested");
|
||||
} else {
|
||||
std::iter_swap(m_vPerform.begin() + (iNumA - 1), m_vPerform.begin() + (iNumB - 1));
|
||||
PutModule("Commands Swapped.");
|
||||
Save();
|
||||
}
|
||||
} else {
|
||||
PutModule("Commands: add <command>, del <nr>, list, execute");
|
||||
PutModule("Commands: add <command>, del <nr>, list, execute, swap <nr> <nr>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user