From: <ps...@us...> - 2008-08-24 12:50:56
|
Revision: 1169 http://znc.svn.sourceforge.net/znc/?rev=1169&view=rev Author: psychon Date: 2008-08-24 12:51:04 +0000 (Sun, 24 Aug 2008) Log Message: ----------- Use the new CModule::PutModule(const CTable&) in various modules Modified Paths: -------------- trunk/modules/autoattach.cpp trunk/modules/autoop.cpp trunk/modules/crypt.cpp trunk/modules/email.cpp trunk/modules/partyline.cpp trunk/modules/schat.cpp trunk/modules/watch.cpp Modified: trunk/modules/autoattach.cpp =================================================================== --- trunk/modules/autoattach.cpp 2008-08-24 12:49:40 UTC (rev 1168) +++ trunk/modules/autoattach.cpp 2008-08-24 12:51:04 UTC (rev 1169) @@ -90,12 +90,7 @@ } if (Table.size()) { - unsigned int uTableIdx = 0; - CString sTmp; - - while (Table.GetLine(uTableIdx++, sTmp)) { - PutModule(sTmp); - } + PutModule(Table); } else { PutModule("You have no entries."); } @@ -117,12 +112,7 @@ Table.SetCell("Description", "List all entries"); if (Table.size()) { - unsigned int uTableIdx = 0; - CString sTmp; - - while (Table.GetLine(uTableIdx++, sTmp)) { - PutModule(sTmp); - } + PutModule(Table); } else { PutModule("You have no entries."); } Modified: trunk/modules/autoop.cpp =================================================================== --- trunk/modules/autoop.cpp 2008-08-24 12:49:40 UTC (rev 1168) +++ trunk/modules/autoop.cpp 2008-08-24 12:51:04 UTC (rev 1169) @@ -257,12 +257,7 @@ Table.SetCell("Channels", it->second->GetChannels()); } - CString sTmp; - unsigned int uTableIdx = 0; - - while (Table.GetLine(uTableIdx++, sTmp)) { - PutModule(sTmp); - } + PutModule(Table); } else if (sCommand.CaseCmp("ADDCHANS") == 0 || sCommand.CaseCmp("DELCHANS") == 0) { CString sUser = sLine.Token(1); CString sChans = sLine.Token(2, true); Modified: trunk/modules/crypt.cpp =================================================================== --- trunk/modules/crypt.cpp 2008-08-24 12:49:40 UTC (rev 1168) +++ trunk/modules/crypt.cpp 2008-08-24 12:51:04 UTC (rev 1169) @@ -132,14 +132,7 @@ Table.SetCell("Key", it->second); } - if (Table.size()) { - unsigned int uTableIdx = 0; - CString sLine; - - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); - } - } + PutModule(Table); } } else if (sCmd.CaseCmp("HELP") == 0) { PutModule("Try: SetKey, DelKey, ListKeys"); Modified: trunk/modules/email.cpp =================================================================== --- trunk/modules/email.cpp 2008-08-24 12:49:40 UTC (rev 1168) +++ trunk/modules/email.cpp 2008-08-24 12:51:04 UTC (rev 1169) @@ -122,11 +122,7 @@ m_ssUidls = ssUidls; // keep the list in synch if (Table.size()) { - unsigned int uTableIdx = 0; - CString sLine; - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); - } + PutModule(Table); stringstream s; s << "You have " << vEmails.size() << " emails."; Modified: trunk/modules/partyline.cpp =================================================================== --- trunk/modules/partyline.cpp 2008-08-24 12:49:40 UTC (rev 1168) +++ trunk/modules/partyline.cpp 2008-08-24 12:51:04 UTC (rev 1169) @@ -427,12 +427,7 @@ Table.SetCell("Arguments", "<channel>"); Table.SetCell("Description", "Show which users can not part this channel"); - unsigned int uTableIdx = 0; - CString sTmp; - - while (Table.GetLine(uTableIdx++, sTmp)) { - PutModule(sTmp); - } + PutModule(Table); } else if (sCommand.CaseCmp("LIST") == 0) { if (!m_ssChannels.size()) { PutModule("There are no open channels."); @@ -451,12 +446,7 @@ Table.SetCell("Users", CString((*a)->GetNicks().size())); } - unsigned int uTableIdx = 0; - CString sTmp; - - while (Table.GetLine(uTableIdx++, sTmp)) { - PutModule(sTmp); - } + PutModule(Table); } else if (sCommand.CaseCmp("ADDFIXCHAN") == 0) { if (!m_pUser->IsAdmin()) { PutModule("Access denied"); Modified: trunk/modules/schat.cpp =================================================================== --- trunk/modules/schat.cpp 2008-08-24 12:49:40 UTC (rev 1168) +++ trunk/modules/schat.cpp 2008-08-24 12:51:04 UTC (rev 1169) @@ -265,12 +265,8 @@ Table.SetCell("Port", CString(pSock->GetLocalPort())); } } - if (Table.size()) - { - unsigned int uTableIdx = 0; - CString sLine; - while (Table.GetLine(uTableIdx++, sLine)) - PutModule(sLine); + if (Table.size()) { + PutModule(Table); } else PutModule("No SDCCs currently in session"); @@ -342,12 +338,8 @@ } } if (Table.size()) - { - unsigned int uTableIdx = 0; - CString sLine; - while (Table.GetLine(uTableIdx++, sLine)) - PutModule(sLine); - } else + PutModule(Table); + else PutModule("Error Finding Sockets"); } else if (sCom.CaseCmp("help") == 0) Modified: trunk/modules/watch.cpp =================================================================== --- trunk/modules/watch.cpp 2008-08-24 12:49:40 UTC (rev 1168) +++ trunk/modules/watch.cpp 2008-08-24 12:51:04 UTC (rev 1169) @@ -336,12 +336,7 @@ } if (Table.size()) { - unsigned int uTableIdx = 0; - CString sLine; - - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); - } + PutModule(Table); } else { PutModule("You have no entries."); } @@ -451,14 +446,7 @@ Table.SetCell("Command", "Help"); Table.SetCell("Description", "This help."); - if (Table.size()) { - unsigned int uTableIdx = 0; - CString sLine; - - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); - } - } + PutModule(Table); } void Watch(const CString& sHostMask, const CString& sTarget, const CString& sPattern, bool bNotice = false) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2008-09-03 14:28:15
|
Revision: 1187 http://znc.svn.sourceforge.net/znc/?rev=1187&view=rev Author: psychon Date: 2008-09-03 14:28:18 +0000 (Wed, 03 Sep 2008) Log Message: ----------- Add JoinTries and MaxJoins config options to webadmin This also changes the layout of the default skin a little, because it was a little messed up. I still don't like the result, but meh, send patches! Modified Paths: -------------- trunk/modules/webadmin/skins/default/UserPage.tmpl trunk/modules/webadmin/skins/graphiX/UserPage.tmpl trunk/modules/webadmin/skins/ice/UserPage.tmpl trunk/modules/webadmin.cpp Modified: trunk/modules/webadmin/skins/default/UserPage.tmpl =================================================================== --- trunk/modules/webadmin/skins/default/UserPage.tmpl 2008-09-02 17:25:37 UTC (rev 1186) +++ trunk/modules/webadmin/skins/default/UserPage.tmpl 2008-09-03 14:28:18 UTC (rev 1187) @@ -178,17 +178,25 @@ <div class="sectionbg"> <div class="sectionbody"> <div class="subsection"> + <div class="inputlabel">Timestamp Format:</div> + <div><input type="text" name="timestampformat" value="<? VAR TimestampFormat ESC=HTML ?>" class="full" /></div> + </div> + <div class="subsection"> <div class="inputlabel">Playback Buffer Size:</div> <div><input type="text" name="bufsize" value="<? VAR BufferCount ESC=HTML ?>" class="third" maxlength="9" /></div> </div> <div class="subsection"> - <div class="inputlabel">Timestamp Format:</div> - <div><input type="text" name="timestampformat" value="<? VAR TimestampFormat ESC=HTML ?>" class="half" /></div> - </div> - <div class="subsection"> <div class="inputlabel">Timezone offset:</div> <div><input type="text" name="timezoneoffset" value="<? VAR TimezoneOffset ESC=HTML ?>" class="third" /></div> </div> + <div class="subsection"> + <div class="inputlabel">Join Tries:</div> + <div><input type="text" name="jointries" value="<? VAR JoinTries ESC=HTML ?>" class="third" /></div> + </div> + <div class="subsection"> + <div class="inputlabel">Max Joins:</div> + <div><input type="text" name="maxjoins" value="<? VAR MaxJoins ESC=HTML ?>" class="third" /></div> + </div> <div style="clear: both;"></div> <div style="margin-bottom: 10px;"> Modified: trunk/modules/webadmin/skins/graphiX/UserPage.tmpl =================================================================== --- trunk/modules/webadmin/skins/graphiX/UserPage.tmpl 2008-09-02 17:25:37 UTC (rev 1186) +++ trunk/modules/webadmin/skins/graphiX/UserPage.tmpl 2008-09-03 14:28:18 UTC (rev 1187) @@ -273,6 +273,26 @@ <tr> <td class="mainleft"> + Join Tries: + </td> + + <td class="mainright"> + <input style="width: 100%;" type="text" name="jointries" value="<? VAR JoinTries ESC=HTML ?>" size="32"> + </td> + </tr> + + <tr> + <td class="mainleft"> + Max Joins: + </td> + + <td class="mainright"> + <input style="width: 100%;" type="text" name="maxjoins" value="<? VAR MaxJoins ESC=HTML ?>" size="32"> + </td> + </tr> + + <tr> + <td class="mainleft"> Options: </td> Modified: trunk/modules/webadmin/skins/ice/UserPage.tmpl =================================================================== --- trunk/modules/webadmin/skins/ice/UserPage.tmpl 2008-09-02 17:25:37 UTC (rev 1186) +++ trunk/modules/webadmin/skins/ice/UserPage.tmpl 2008-09-03 14:28:18 UTC (rev 1187) @@ -188,6 +188,15 @@ <div class="inputlabel">Timezone offset:</div> <div><input type="text" name="timezoneoffset" value="<? VAR TimezoneOffset ESC=HTML ?>" class="third" /></div> </div> + <div class="subsection"> + <div class="inputlabel">Join Tries:</div> + <div><input type="text" name="jointries" value="<? VAR JoinTries ESC=HTML ?>" class="third" /></div> + </div> + <div class="subsection"> + <div class="inputlabel">Max Joins:</div> + <div><input type="text" name="maxjoins" value="<? VAR MaxJoins ESC=HTML ?>" class="third" /></div> + </div> + <div style="clear: both;"></div> <div class="subsection"> Modified: trunk/modules/webadmin.cpp =================================================================== --- trunk/modules/webadmin.cpp 2008-09-02 17:25:37 UTC (rev 1186) +++ trunk/modules/webadmin.cpp 2008-09-03 14:28:18 UTC (rev 1187) @@ -789,6 +789,8 @@ m_Template["BufferCount"] = CString(pUser->GetBufferCount()); m_Template["TimestampFormat"] = pUser->GetTimestampFormat(); m_Template["TimezoneOffset"] = CString(pUser->GetTimezoneOffset()); + m_Template["JoinTries"] = CString(pUser->JoinTries()); + m_Template["MaxJoins"] = CString(pUser->MaxJoins()); const set<CString>& ssAllowedHosts = pUser->GetAllowedHosts(); for (set<CString>::const_iterator it = ssAllowedHosts.begin(); it != ssAllowedHosts.end(); it++) { @@ -1115,6 +1117,8 @@ pNewUser->SetTimestampAppend(GetParam("appendtimestamp").ToBool()); pNewUser->SetTimestampPrepend(GetParam("prependtimestamp").ToBool()); pNewUser->SetTimezoneOffset(GetParam("timezoneoffset").ToDouble()); + pNewUser->SetJoinTries(GetParam("jointries").ToUInt()); + pNewUser->SetMaxJoins(GetParam("maxjoins").ToUInt()); if (IsAdmin()) { pNewUser->SetDenyLoadMod(GetParam("denyloadmod").ToBool()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2009-02-20 19:15:38
|
Revision: 1388 http://znc.svn.sourceforge.net/znc/?rev=1388&view=rev Author: psychon Date: 2009-02-20 19:15:31 +0000 (Fri, 20 Feb 2009) Log Message: ----------- Don't ever ask for a password via stdin in away and savebuff Modified Paths: -------------- trunk/modules/away.cpp trunk/modules/savebuff.cpp Modified: trunk/modules/away.cpp =================================================================== --- trunk/modules/away.cpp 2009-02-20 05:50:36 UTC (rev 1387) +++ trunk/modules/away.cpp 2009-02-20 19:15:31 UTC (rev 1388) @@ -62,28 +62,20 @@ if (!sMyArgs.empty()) { m_sPassword = CBlowfish::MD5(sMyArgs); + } else { + sMessage = "This module needs as an argument a keyphrase used for encryption"; + return false; } - return true; - } - - virtual bool OnBoot() - { - if (m_sPassword.empty()) - { - CString sTmp = CUtils::GetPass("Enter Encryption Key for away.so: "); - - if (!sTmp.empty()) - m_sPassword = CBlowfish::MD5(sTmp); - } - if (!BootStrap()) { + sMessage = "Failed to decrypt your saved messages - " + "Did you give the right encryption key as an argument to this module?"; m_bBootError = true; - return(false); + return false; } - return(true); + return true; } virtual void OnIRCConnected() Modified: trunk/modules/savebuff.cpp =================================================================== --- trunk/modules/savebuff.cpp 2009-02-20 05:50:36 UTC (rev 1387) +++ trunk/modules/savebuff.cpp 2009-02-20 19:15:31 UTC (rev 1388) @@ -58,26 +58,16 @@ virtual bool OnLoad(const CString& sArgs, CString& sMessage) { - if (!sArgs.empty()) - { - m_sPassword = CBlowfish::MD5(sArgs); - return(OnBoot()); - } + const vector<CChan *>& vChans = m_pUser->GetChans(); - return true; - } - - virtual bool OnBoot() - { - if (m_sPassword.empty()) + if (sArgs.empty()) { - CString sTmp = CUtils::GetPass("Enter Encryption Key for " + GetModName() + ".so"); - - if (!sTmp.empty()) - m_sPassword = CBlowfish::MD5(sTmp); + sMessage = "This module needs as an argument a keyphrase used for encryption"; + return false; } - const vector<CChan *>& vChans = m_pUser->GetChans(); + m_sPassword = CBlowfish::MD5(sArgs); + for (u_int a = 0; a < vChans.size(); a++) { if (!vChans[a]->KeepBuffer()) @@ -85,6 +75,8 @@ if (!BootStrap(vChans[a])) { + sMessage = "Failed to decrypt your saved messages - " + "Did you give the right encryption key as an argument to this module?"; m_bBootError = true; return(false); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2009-04-06 16:00:32
|
Revision: 1481 http://znc.svn.sourceforge.net/znc/?rev=1481&view=rev Author: psychon Date: 2009-04-06 16:00:23 +0000 (Mon, 06 Apr 2009) Log Message: ----------- Webadmin: Make this work with the browser cache This moves all static webadmin files (images, css) to the data/ subdirectory of the skin dir. The webadmin module is changed to redirect requests to /<skin name>/ to that data directory. The skins are changed to use the new URL when linking to their stuff. (I only needed to change the path to the main.css file in each Header.tmpl. Since the .css and the images are now in the same directory, relative URLs work just fine). This means that we now generate different URLs after changing the webadmin skins and the browser cache can do its thing. Modified Paths: -------------- trunk/modules/webadmin/skins/dark-clouds/Header.tmpl trunk/modules/webadmin/skins/default/Header.tmpl trunk/modules/webadmin/skins/graphiX/Header.tmpl trunk/modules/webadmin/skins/ice/Header.tmpl trunk/modules/webadmin.cpp Added Paths: ----------- trunk/modules/webadmin/skins/dark-clouds/data/ trunk/modules/webadmin/skins/dark-clouds/data/clouds-header.jpg trunk/modules/webadmin/skins/dark-clouds/data/favicon.ico trunk/modules/webadmin/skins/dark-clouds/data/main.css trunk/modules/webadmin/skins/default/data/ trunk/modules/webadmin/skins/default/data/favicon.ico trunk/modules/webadmin/skins/default/data/main.css trunk/modules/webadmin/skins/graphiX/data/ trunk/modules/webadmin/skins/graphiX/data/favicon.ico trunk/modules/webadmin/skins/graphiX/data/graphix_bg.jpg trunk/modules/webadmin/skins/graphiX/data/graphix_header.jpg trunk/modules/webadmin/skins/graphiX/data/main.css trunk/modules/webadmin/skins/ice/data/ trunk/modules/webadmin/skins/ice/data/favicon.ico trunk/modules/webadmin/skins/ice/data/linkbg.jpg trunk/modules/webadmin/skins/ice/data/main.css trunk/modules/webadmin/skins/ice/data/pagebg.gif Removed Paths: ------------- trunk/modules/webadmin/skins/dark-clouds/css/main.css trunk/modules/webadmin/skins/dark-clouds/img/clouds-header.jpg trunk/modules/webadmin/skins/dark-clouds/img/favicon.ico trunk/modules/webadmin/skins/default/css/main.css trunk/modules/webadmin/skins/default/img/favicon.ico trunk/modules/webadmin/skins/graphiX/css/main.css trunk/modules/webadmin/skins/graphiX/img/favicon.ico trunk/modules/webadmin/skins/graphiX/img/graphix_bg.jpg trunk/modules/webadmin/skins/graphiX/img/graphix_header.jpg trunk/modules/webadmin/skins/ice/css/main.css trunk/modules/webadmin/skins/ice/img/favicon.ico trunk/modules/webadmin/skins/ice/img/linkbg.jpg trunk/modules/webadmin/skins/ice/img/pagebg.gif Modified: trunk/modules/webadmin/skins/dark-clouds/Header.tmpl =================================================================== --- trunk/modules/webadmin/skins/dark-clouds/Header.tmpl 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin/skins/dark-clouds/Header.tmpl 2009-04-06 16:00:23 UTC (rev 1481) @@ -4,7 +4,7 @@ <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>ZNC - Webadmin module - <?VAR Title ESC=HTML?></title> - <link rel="stylesheet" type="text/css" href="css/main.css"> + <link rel="stylesheet" type="text/css" href="<?VAR Skin ESC=URL?>/main.css"> </head> <body> Deleted: trunk/modules/webadmin/skins/dark-clouds/css/main.css =================================================================== --- trunk/modules/webadmin/skins/dark-clouds/css/main.css 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin/skins/dark-clouds/css/main.css 2009-04-06 16:00:23 UTC (rev 1481) @@ -1,221 +0,0 @@ -body { - background: #555; - margin-top: 10px; - background: #444; -} - -td { - font-family: verdana; - font-size: 12px; - color: white; -} - -input, select, textarea { - font-family: verdana; - font-size: 12px; - color: #000000; - border: 1px solid #000000; - background-color: #999; -} - -a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #E9630A; - text-decoration: none; -} - -a:hover { - font-family: verdana; - font-size: 12px; - color: #E9A640; - text-decoration: underline; -} - -.header { - background-image: url('../img/clouds-header.jpg'); - padding: 10px; - border: 1px solid #000000; - height: 100px; - width: 800px; - vertical-align: bottom; - text-align: right; - font-weight: bold; - font-size: 13px; -} - -.loginbar { - border-left: 1px solid #000000; - border-bottom: 1px solid #000000; - border-right: 1px solid #000000; - background-color: #444; - height: 20px; -} - -.switchuser { - border-left: 1px solid #000000; - text-align: center; - vertical-align: middle; - width: 150px; -} - -.switchuser a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: white; - text-decoration: none; -} - -.switchuser a:hover { - font-family: verdana; - font-size: 12px; - color: white; - text-decoration: underline; -} - -.menu { - width: 160px; - background-color: #333; - border-left: 1px solid #000000; - vertical-align: top; - padding-bottom: 20px; -} - -.menuactive { - vertical-align: middle; - text-align: center; - height: 30px; - background-color: #D49712; - font-weight: bold; - border-bottom: 1px solid #000000; -} - -.menuinactive { - vertical-align: middle; - text-align: center; - height: 30px; - background-color: #777; - border-right: 1px solid #000000; - border-bottom: 1px solid #000000; -} - -.menuactive a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: none; -} - -.menuactive a:hover { - font-family: verdana; - font-size: 12px; - color: #3B98F5; - text-decoration: underline; -} - -.menuinactive a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: none; -} - -.menuinactive a:hover { - font-family: verdana; - font-size: 12px; - color: #FFFFFF; - text-decoration: underline; -} - -.main { - width: 640px; - vertical-align: top; - padding: 15px; - background-color: #444; - border-right: 1px solid #000000; -} - -.cbar { - border: 1px solid #000000; - background-color: #D49712; - height: 20px; - text-align: right; - padding-right: 5px; -} - -.cbar a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: none; -} - -.cbar a:hover { - font-family: verdana; - font-size: 12px; - color: #FFFFFF; - text-decoration: underline; -} - -.maintitle { - height: 20px; - background-color: #D49712; - color: #000000; - font-weight: bold; - padding-left: 5px; - border: 1px solid #000000; -} - -.mainalone { - padding: 10px; - border-bottom: 1px solid #000000; - border-left: 1px solid #000000; - border-right: 1px solid #000000; -} - -.mainleft { - height: 30px; - padding: 5px; - font-weight: bold; - border-bottom: 1px solid #000000; - border-left: 1px solid #000000; - border-right: 1px solid #000000; -} - -.mainright { - padding: 5px; - border-bottom: 1px solid #000000; - border-right: 1px solid #000000; -} - -.mainrow { - padding: 5px; - border-right: 1px solid #000000; -} - -.main2title { - height: 20px; - background-color: #EC8E00; - color: #000000; - font-weight: bold; - padding-left: 2px; -} - -.oddrow { - height: 20px; -} - -.oddrow td { - padding: 2px; - border-right: 1px solid #000000; -} - -.evenrow { - height: 20px; - background-color: #777; -} - -.evenrow td { - padding: 2px; - border-right: 1px solid #000000; -} Copied: trunk/modules/webadmin/skins/dark-clouds/data/clouds-header.jpg (from rev 1480, trunk/modules/webadmin/skins/dark-clouds/img/clouds-header.jpg) =================================================================== (Binary files differ) Copied: trunk/modules/webadmin/skins/dark-clouds/data/favicon.ico (from rev 1480, trunk/modules/webadmin/skins/dark-clouds/img/favicon.ico) =================================================================== (Binary files differ) Copied: trunk/modules/webadmin/skins/dark-clouds/data/main.css (from rev 1480, trunk/modules/webadmin/skins/dark-clouds/css/main.css) =================================================================== --- trunk/modules/webadmin/skins/dark-clouds/data/main.css (rev 0) +++ trunk/modules/webadmin/skins/dark-clouds/data/main.css 2009-04-06 16:00:23 UTC (rev 1481) @@ -0,0 +1,221 @@ +body { + background: #555; + margin-top: 10px; + background: #444; +} + +td { + font-family: verdana; + font-size: 12px; + color: white; +} + +input, select, textarea { + font-family: verdana; + font-size: 12px; + color: #000000; + border: 1px solid #000000; + background-color: #999; +} + +a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #E9630A; + text-decoration: none; +} + +a:hover { + font-family: verdana; + font-size: 12px; + color: #E9A640; + text-decoration: underline; +} + +.header { + background-image: url('clouds-header.jpg'); + padding: 10px; + border: 1px solid #000000; + height: 100px; + width: 800px; + vertical-align: bottom; + text-align: right; + font-weight: bold; + font-size: 13px; +} + +.loginbar { + border-left: 1px solid #000000; + border-bottom: 1px solid #000000; + border-right: 1px solid #000000; + background-color: #444; + height: 20px; +} + +.switchuser { + border-left: 1px solid #000000; + text-align: center; + vertical-align: middle; + width: 150px; +} + +.switchuser a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: white; + text-decoration: none; +} + +.switchuser a:hover { + font-family: verdana; + font-size: 12px; + color: white; + text-decoration: underline; +} + +.menu { + width: 160px; + background-color: #333; + border-left: 1px solid #000000; + vertical-align: top; + padding-bottom: 20px; +} + +.menuactive { + vertical-align: middle; + text-align: center; + height: 30px; + background-color: #D49712; + font-weight: bold; + border-bottom: 1px solid #000000; +} + +.menuinactive { + vertical-align: middle; + text-align: center; + height: 30px; + background-color: #777; + border-right: 1px solid #000000; + border-bottom: 1px solid #000000; +} + +.menuactive a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: none; +} + +.menuactive a:hover { + font-family: verdana; + font-size: 12px; + color: #3B98F5; + text-decoration: underline; +} + +.menuinactive a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: none; +} + +.menuinactive a:hover { + font-family: verdana; + font-size: 12px; + color: #FFFFFF; + text-decoration: underline; +} + +.main { + width: 640px; + vertical-align: top; + padding: 15px; + background-color: #444; + border-right: 1px solid #000000; +} + +.cbar { + border: 1px solid #000000; + background-color: #D49712; + height: 20px; + text-align: right; + padding-right: 5px; +} + +.cbar a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: none; +} + +.cbar a:hover { + font-family: verdana; + font-size: 12px; + color: #FFFFFF; + text-decoration: underline; +} + +.maintitle { + height: 20px; + background-color: #D49712; + color: #000000; + font-weight: bold; + padding-left: 5px; + border: 1px solid #000000; +} + +.mainalone { + padding: 10px; + border-bottom: 1px solid #000000; + border-left: 1px solid #000000; + border-right: 1px solid #000000; +} + +.mainleft { + height: 30px; + padding: 5px; + font-weight: bold; + border-bottom: 1px solid #000000; + border-left: 1px solid #000000; + border-right: 1px solid #000000; +} + +.mainright { + padding: 5px; + border-bottom: 1px solid #000000; + border-right: 1px solid #000000; +} + +.mainrow { + padding: 5px; + border-right: 1px solid #000000; +} + +.main2title { + height: 20px; + background-color: #EC8E00; + color: #000000; + font-weight: bold; + padding-left: 2px; +} + +.oddrow { + height: 20px; +} + +.oddrow td { + padding: 2px; + border-right: 1px solid #000000; +} + +.evenrow { + height: 20px; + background-color: #777; +} + +.evenrow td { + padding: 2px; + border-right: 1px solid #000000; +} Deleted: trunk/modules/webadmin/skins/dark-clouds/img/clouds-header.jpg =================================================================== (Binary files differ) Deleted: trunk/modules/webadmin/skins/dark-clouds/img/favicon.ico =================================================================== (Binary files differ) Modified: trunk/modules/webadmin/skins/default/Header.tmpl =================================================================== --- trunk/modules/webadmin/skins/default/Header.tmpl 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin/skins/default/Header.tmpl 2009-04-06 16:00:23 UTC (rev 1481) @@ -3,7 +3,7 @@ <head> <title>ZNC - <?VAR Title ESC=HTML?></title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> - <link rel="stylesheet" type="text/css" href="css/main.css" /> + <link rel="stylesheet" type="text/css" href="<?VAR Skin ESC=URL?>/main.css" /> </head> <body> Deleted: trunk/modules/webadmin/skins/default/css/main.css =================================================================== --- trunk/modules/webadmin/skins/default/css/main.css 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin/skins/default/css/main.css 2009-04-06 16:00:23 UTC (rev 1481) @@ -1,138 +0,0 @@ -body { - background-color: #fff; - color: #000; - width: 800px; -} - -a:visited { color: #000; } -a:hover { color: #000; } -a, a:active { color: #000; } - -.nowrap { white-space: nowrap; } -.clear { clear: both; } - -table a, table a:visited, table a:hover, table a:active { color: #000; } - -table { - color: #000; - border-collapse: collapse; - border: 2px solid #000; - padding: 0px; - margin: 0px; -} - -table td { - border: 1px solid #000; - padding: 4px; - margin: 0px; -} - -table thead { - border-bottom: 2px solid #000; - background-color: #ff9; - font-weight: bold; -} - -input.full, textarea.full { - width: 620px; -} - -input.half, textarea.half { - width: 300px; -} - -input.third, textarea.third { - width: 150px; -} - -textarea { - height: 90px; -} - -#banner { - border-bottom: 2px solid #000; - text-align: center; -} - -#ident { - float: left; - font-weight: bold; - text-align: right; -} - -#sidebar { - border-right: 1px solid #000; - height: 500px; - width: 100px; - float: left; -} - -#main { - margin: 5px 0px 20px 5px; - float: left; - width: 670px; -} - -#tag { - font-weight: bold; - text-align: right; -} - -.oddrow { - background-color: #ffc; -} - -.evenrow { - background-color: #cc9; -} - -.inputlabel { - font-size: small; - font-weight: bold; - color: #000; -} - -ul.nav, ul.nav ul { - cursor: default; - margin: 0px 0px 0px 0px; - padding: 5px 5px 5px 5px; -} - -ul.nav li { - list-style-type: none; - padding: 0px 2px 1px 2px; - margin: 2px 0px 2px 0px; -} - -.section { - padding-bottom: 20px; -} - -.subsection { - float: left; - margin-right: 10px; - margin-bottom: 10px; -} - -.sectiontitle { - float: left; - white-space: nowrap; - background-color: #ff9; - color: #000; - font-weight: bold; - border: 1px solid #000; - padding: 0px 5px 0px 5px; - margin: 0px 15px -10px 8px; -} - -.sectionbg { - clear: both; - background-color: #cc9; - color: #000; - border: 2px solid #000; - padding: 0px; -} - -.sectionbody { - margin: 15px 5px 5px 15px; -} Copied: trunk/modules/webadmin/skins/default/data/favicon.ico (from rev 1480, trunk/modules/webadmin/skins/default/img/favicon.ico) =================================================================== (Binary files differ) Copied: trunk/modules/webadmin/skins/default/data/main.css (from rev 1480, trunk/modules/webadmin/skins/default/css/main.css) =================================================================== --- trunk/modules/webadmin/skins/default/data/main.css (rev 0) +++ trunk/modules/webadmin/skins/default/data/main.css 2009-04-06 16:00:23 UTC (rev 1481) @@ -0,0 +1,138 @@ +body { + background-color: #fff; + color: #000; + width: 800px; +} + +a:visited { color: #000; } +a:hover { color: #000; } +a, a:active { color: #000; } + +.nowrap { white-space: nowrap; } +.clear { clear: both; } + +table a, table a:visited, table a:hover, table a:active { color: #000; } + +table { + color: #000; + border-collapse: collapse; + border: 2px solid #000; + padding: 0px; + margin: 0px; +} + +table td { + border: 1px solid #000; + padding: 4px; + margin: 0px; +} + +table thead { + border-bottom: 2px solid #000; + background-color: #ff9; + font-weight: bold; +} + +input.full, textarea.full { + width: 620px; +} + +input.half, textarea.half { + width: 300px; +} + +input.third, textarea.third { + width: 150px; +} + +textarea { + height: 90px; +} + +#banner { + border-bottom: 2px solid #000; + text-align: center; +} + +#ident { + float: left; + font-weight: bold; + text-align: right; +} + +#sidebar { + border-right: 1px solid #000; + height: 500px; + width: 100px; + float: left; +} + +#main { + margin: 5px 0px 20px 5px; + float: left; + width: 670px; +} + +#tag { + font-weight: bold; + text-align: right; +} + +.oddrow { + background-color: #ffc; +} + +.evenrow { + background-color: #cc9; +} + +.inputlabel { + font-size: small; + font-weight: bold; + color: #000; +} + +ul.nav, ul.nav ul { + cursor: default; + margin: 0px 0px 0px 0px; + padding: 5px 5px 5px 5px; +} + +ul.nav li { + list-style-type: none; + padding: 0px 2px 1px 2px; + margin: 2px 0px 2px 0px; +} + +.section { + padding-bottom: 20px; +} + +.subsection { + float: left; + margin-right: 10px; + margin-bottom: 10px; +} + +.sectiontitle { + float: left; + white-space: nowrap; + background-color: #ff9; + color: #000; + font-weight: bold; + border: 1px solid #000; + padding: 0px 5px 0px 5px; + margin: 0px 15px -10px 8px; +} + +.sectionbg { + clear: both; + background-color: #cc9; + color: #000; + border: 2px solid #000; + padding: 0px; +} + +.sectionbody { + margin: 15px 5px 5px 15px; +} Deleted: trunk/modules/webadmin/skins/default/img/favicon.ico =================================================================== (Binary files differ) Modified: trunk/modules/webadmin/skins/graphiX/Header.tmpl =================================================================== --- trunk/modules/webadmin/skins/graphiX/Header.tmpl 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin/skins/graphiX/Header.tmpl 2009-04-06 16:00:23 UTC (rev 1481) @@ -4,7 +4,7 @@ <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>ZNC - Webadmin module - <?VAR Title ESC=HTML?></title> - <link rel="stylesheet" type="text/css" href="css/main.css"> + <link rel="stylesheet" type="text/css" href="<?VAR Skin ESC=URL?>/main.css"> </head> <body> Deleted: trunk/modules/webadmin/skins/graphiX/css/main.css =================================================================== --- trunk/modules/webadmin/skins/graphiX/css/main.css 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin/skins/graphiX/css/main.css 2009-04-06 16:00:23 UTC (rev 1481) @@ -1,220 +0,0 @@ -body { - background-image: url('../img/graphix_bg.jpg'); - margin-top: 10px; -} - -td { - font-family: verdana; - font-size: 12px; - color: #000000; -} - -input, select, textarea { - font-family: verdana; - font-size: 12px; - color: #000000; - border: 1px solid #000000; - background-color: #C8EAFC; -} - -a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: none; -} - -a:hover { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: underline; -} - -.header { - background-image: url('../img/graphix_header.jpg'); - padding: 10px; - border: 1px solid #000000; - height: 100px; - width: 800px; - vertical-align: bottom; - text-align: right; - font-weight: bold; - font-size: 13px; -} - -.loginbar { - border-left: 1px solid #000000; - border-bottom: 1px solid #000000; - border-right: 1px solid #000000; - background-color: #3B98F5; - height: 20px; -} - -.switchuser { - border-left: 1px solid #000000; - text-align: center; - vertical-align: middle; - width: 150px; -} - -.switchuser a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: none; -} - -.switchuser a:hover { - font-family: verdana; - font-size: 12px; - color: #FFFFFF; - text-decoration: underline; -} - -.menu { - width: 160px; - background-color: #B4D8FC; - border-left: 1px solid #000000; - vertical-align: top; - padding-bottom: 20px; -} - -.menuactive { - vertical-align: middle; - text-align: center; - height: 30px; - background-color: #FFFFFF; - font-weight: bold; - border-bottom: 1px solid #000000; -} - -.menuinactive { - vertical-align: middle; - text-align: center; - height: 30px; - background-color: #3B98F5; - border-right: 1px solid #000000; - border-bottom: 1px solid #000000; -} - -.menuactive a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: none; -} - -.menuactive a:hover { - font-family: verdana; - font-size: 12px; - color: #3B98F5; - text-decoration: underline; -} - -.menuinactive a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: none; -} - -.menuinactive a:hover { - font-family: verdana; - font-size: 12px; - color: #FFFFFF; - text-decoration: underline; -} - -.main { - width: 640px; - vertical-align: top; - padding: 15px; - background-color: #FFFFFF; - border-right: 1px solid #000000; -} - -.cbar { - border: 1px solid #000000; - background-color: #3B98F5; - height: 20px; - text-align: right; - padding-right: 5px; -} - -.cbar a:link, a:active, a:visited { - font-family: verdana; - font-size: 12px; - color: #000000; - text-decoration: none; -} - -.cbar a:hover { - font-family: verdana; - font-size: 12px; - color: #FFFFFF; - text-decoration: underline; -} - -.maintitle { - height: 20px; - background-color: #3B98F5; - color: #000000; - font-weight: bold; - padding-left: 5px; - border: 1px solid #000000; -} - -.mainalone { - padding: 10px; - border-bottom: 1px solid #000000; - border-left: 1px solid #000000; - border-right: 1px solid #000000; -} - -.mainleft { - height: 30px; - padding: 5px; - font-weight: bold; - border-bottom: 1px solid #000000; - border-left: 1px solid #000000; - border-right: 1px solid #000000; -} - -.mainright { - padding: 5px; - border-bottom: 1px solid #000000; - border-right: 1px solid #000000; -} - -.mainrow { - padding: 5px; - border-right: 1px solid #000000; -} - -.main2title { - height: 20px; - background-color: #3B98F5; - color: #000000; - font-weight: bold; - padding-left: 2px; -} - -.oddrow { - height: 20px; -} - -.oddrow td { - padding: 2px; - border-right: 1px solid #000000; -} - -.evenrow { - height: 20px; - background-color: #C8EAFC; -} - -.evenrow td { - padding: 2px; - border-right: 1px solid #000000; -} Copied: trunk/modules/webadmin/skins/graphiX/data/favicon.ico (from rev 1480, trunk/modules/webadmin/skins/graphiX/img/favicon.ico) =================================================================== (Binary files differ) Copied: trunk/modules/webadmin/skins/graphiX/data/graphix_bg.jpg (from rev 1480, trunk/modules/webadmin/skins/graphiX/img/graphix_bg.jpg) =================================================================== (Binary files differ) Copied: trunk/modules/webadmin/skins/graphiX/data/graphix_header.jpg (from rev 1480, trunk/modules/webadmin/skins/graphiX/img/graphix_header.jpg) =================================================================== (Binary files differ) Copied: trunk/modules/webadmin/skins/graphiX/data/main.css (from rev 1480, trunk/modules/webadmin/skins/graphiX/css/main.css) =================================================================== --- trunk/modules/webadmin/skins/graphiX/data/main.css (rev 0) +++ trunk/modules/webadmin/skins/graphiX/data/main.css 2009-04-06 16:00:23 UTC (rev 1481) @@ -0,0 +1,220 @@ +body { + background-image: url('graphix_bg.jpg'); + margin-top: 10px; +} + +td { + font-family: verdana; + font-size: 12px; + color: #000000; +} + +input, select, textarea { + font-family: verdana; + font-size: 12px; + color: #000000; + border: 1px solid #000000; + background-color: #C8EAFC; +} + +a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: none; +} + +a:hover { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: underline; +} + +.header { + background-image: url('graphix_header.jpg'); + padding: 10px; + border: 1px solid #000000; + height: 100px; + width: 800px; + vertical-align: bottom; + text-align: right; + font-weight: bold; + font-size: 13px; +} + +.loginbar { + border-left: 1px solid #000000; + border-bottom: 1px solid #000000; + border-right: 1px solid #000000; + background-color: #3B98F5; + height: 20px; +} + +.switchuser { + border-left: 1px solid #000000; + text-align: center; + vertical-align: middle; + width: 150px; +} + +.switchuser a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: none; +} + +.switchuser a:hover { + font-family: verdana; + font-size: 12px; + color: #FFFFFF; + text-decoration: underline; +} + +.menu { + width: 160px; + background-color: #B4D8FC; + border-left: 1px solid #000000; + vertical-align: top; + padding-bottom: 20px; +} + +.menuactive { + vertical-align: middle; + text-align: center; + height: 30px; + background-color: #FFFFFF; + font-weight: bold; + border-bottom: 1px solid #000000; +} + +.menuinactive { + vertical-align: middle; + text-align: center; + height: 30px; + background-color: #3B98F5; + border-right: 1px solid #000000; + border-bottom: 1px solid #000000; +} + +.menuactive a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: none; +} + +.menuactive a:hover { + font-family: verdana; + font-size: 12px; + color: #3B98F5; + text-decoration: underline; +} + +.menuinactive a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: none; +} + +.menuinactive a:hover { + font-family: verdana; + font-size: 12px; + color: #FFFFFF; + text-decoration: underline; +} + +.main { + width: 640px; + vertical-align: top; + padding: 15px; + background-color: #FFFFFF; + border-right: 1px solid #000000; +} + +.cbar { + border: 1px solid #000000; + background-color: #3B98F5; + height: 20px; + text-align: right; + padding-right: 5px; +} + +.cbar a:link, a:active, a:visited { + font-family: verdana; + font-size: 12px; + color: #000000; + text-decoration: none; +} + +.cbar a:hover { + font-family: verdana; + font-size: 12px; + color: #FFFFFF; + text-decoration: underline; +} + +.maintitle { + height: 20px; + background-color: #3B98F5; + color: #000000; + font-weight: bold; + padding-left: 5px; + border: 1px solid #000000; +} + +.mainalone { + padding: 10px; + border-bottom: 1px solid #000000; + border-left: 1px solid #000000; + border-right: 1px solid #000000; +} + +.mainleft { + height: 30px; + padding: 5px; + font-weight: bold; + border-bottom: 1px solid #000000; + border-left: 1px solid #000000; + border-right: 1px solid #000000; +} + +.mainright { + padding: 5px; + border-bottom: 1px solid #000000; + border-right: 1px solid #000000; +} + +.mainrow { + padding: 5px; + border-right: 1px solid #000000; +} + +.main2title { + height: 20px; + background-color: #3B98F5; + color: #000000; + font-weight: bold; + padding-left: 2px; +} + +.oddrow { + height: 20px; +} + +.oddrow td { + padding: 2px; + border-right: 1px solid #000000; +} + +.evenrow { + height: 20px; + background-color: #C8EAFC; +} + +.evenrow td { + padding: 2px; + border-right: 1px solid #000000; +} Deleted: trunk/modules/webadmin/skins/graphiX/img/favicon.ico =================================================================== (Binary files differ) Deleted: trunk/modules/webadmin/skins/graphiX/img/graphix_bg.jpg =================================================================== (Binary files differ) Deleted: trunk/modules/webadmin/skins/graphiX/img/graphix_header.jpg =================================================================== (Binary files differ) Modified: trunk/modules/webadmin/skins/ice/Header.tmpl =================================================================== --- trunk/modules/webadmin/skins/ice/Header.tmpl 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin/skins/ice/Header.tmpl 2009-04-06 16:00:23 UTC (rev 1481) @@ -3,7 +3,7 @@ <head> <title>ZNC - <?VAR Title ESC=HTML?></title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> - <link rel="stylesheet" type="text/css" href="css/main.css" /> + <link rel="stylesheet" type="text/css" href="<?VAR Skin ESC=URL?>/main.css" /> </head> <body> Deleted: trunk/modules/webadmin/skins/ice/css/main.css =================================================================== --- trunk/modules/webadmin/skins/ice/css/main.css 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin/skins/ice/css/main.css 2009-04-06 16:00:23 UTC (rev 1481) @@ -1,196 +0,0 @@ -body { - background: url(../img/pagebg.gif) top repeat-x #0C1833 fixed; - color: #fff; - margin: 0px auto; -} - -#wrapper { - margin: 0px auto; - padding: 0px; - width: 700px; - background-color: #4C688A; -} - -h2 { - margin: 0px 0px 10px 0px; - padding: 0px; -} - -a:hover { - text-decoration: underline; -} - -.nowrap { white-space: nowrap; } -.clear { clear: both; } - -table a, table a:visited, table a:hover, table a:active { color: #000; } - -table { - color: #000; - border-collapse: collapse; - border: 2px solid #000; - padding: 0px; - margin: 10px; -} - -table td { - border: 1px solid #000; - padding: 4px; - margin: 0px; -} - -table thead { - border-bottom: 2px solid #000; - background: url(../img/linkbg.jpg) 0px -30px repeat-x #369; - color: #fff; - font-weight: bold; -} - -.oddrow { - background-color: #ddd; -} - -.evenrow { - background-color: #bbb; -} - -input.full, textarea.full { - width: 620px; -} - -input.half, textarea.half { - width: 300px; -} - -input.third, textarea.third { - width: 150px; -} - -textarea { - height: 90px; -} - -#main { - width: 680px; - clear: both; - padding: 10px; -} - -#banner { - text-align: center; - padding: 0px 10px; -} - -#tag { - font-size: 14px; - color: #f90; - font-weight: bold; - text-align: right; -} - -#ident { - font-weight: bold; - text-align: right; -} - -.inputlabel { - font-size: small; - font-weight: bold; - color: #000; -} - -.section { - padding-bottom: 20px; - width: 680px; -} - -.subsection { - float: left; - margin: 5px 10px; -} - -.sectiontitle { - float: left; - white-space: nowrap; - background: url(../img/linkbg.jpg) 0px 0px repeat-x #336; - color: #eee; - font-size: 14px; - font-weight: bold; - border: 1px solid #000; - padding: 0px 5px 0px 5px; - margin: 0px 15px -10px 8px; -} - -.sectionbg { - clear: both; - background-color: #ccc; - color: #000; - border: 2px solid #000; - padding: 0px; -} - -.sectionbody { - margin-top: 15px; - margin-bottom: 10px; -} - -#gnav { - width: 700px; - border-top: 1px solid #000; - border-bottom: 1px solid #000; - float: left; - background: url(../img/linkbg.jpg) repeat-x; - margin-bottom: 10px; -} - -#gnav #menu { - width: 690px; - float: left; -} - -#gnav ul { - margin: 0px; - padding: 0px; -} - -#gnav li { - display: block; -} - -#gnav a { - font-size: 11px; - font-weight: bold; - height: 30px; - float: left; - display: block; - color: #fff; - padding: 0px 10px; - text-decoration: none; - background: url(../img/linkbg.jpg) 0px 0px repeat-x; -} - -#gnav a:hover { - background-position: 0px -30px; - text-decoration: none; -} - -#gnav .on a { - background-position: 0px -30px; -} - -#gnav #nav { - float: left; - border-left: 1px solid #000; - display: inline; -} - -#nav { - margin-left: 10px; -} - -#gnav li { - height: 30px; - line-height: 30px; - border-right: 1px solid #000; - float: left; -} Copied: trunk/modules/webadmin/skins/ice/data/favicon.ico (from rev 1480, trunk/modules/webadmin/skins/ice/img/favicon.ico) =================================================================== (Binary files differ) Copied: trunk/modules/webadmin/skins/ice/data/linkbg.jpg (from rev 1480, trunk/modules/webadmin/skins/ice/img/linkbg.jpg) =================================================================== (Binary files differ) Copied: trunk/modules/webadmin/skins/ice/data/main.css (from rev 1480, trunk/modules/webadmin/skins/ice/css/main.css) =================================================================== --- trunk/modules/webadmin/skins/ice/data/main.css (rev 0) +++ trunk/modules/webadmin/skins/ice/data/main.css 2009-04-06 16:00:23 UTC (rev 1481) @@ -0,0 +1,196 @@ +body { + background: url(pagebg.gif) top repeat-x #0C1833 fixed; + color: #fff; + margin: 0px auto; +} + +#wrapper { + margin: 0px auto; + padding: 0px; + width: 700px; + background-color: #4C688A; +} + +h2 { + margin: 0px 0px 10px 0px; + padding: 0px; +} + +a:hover { + text-decoration: underline; +} + +.nowrap { white-space: nowrap; } +.clear { clear: both; } + +table a, table a:visited, table a:hover, table a:active { color: #000; } + +table { + color: #000; + border-collapse: collapse; + border: 2px solid #000; + padding: 0px; + margin: 10px; +} + +table td { + border: 1px solid #000; + padding: 4px; + margin: 0px; +} + +table thead { + border-bottom: 2px solid #000; + background: url(linkbg.jpg) 0px -30px repeat-x #369; + color: #fff; + font-weight: bold; +} + +.oddrow { + background-color: #ddd; +} + +.evenrow { + background-color: #bbb; +} + +input.full, textarea.full { + width: 620px; +} + +input.half, textarea.half { + width: 300px; +} + +input.third, textarea.third { + width: 150px; +} + +textarea { + height: 90px; +} + +#main { + width: 680px; + clear: both; + padding: 10px; +} + +#banner { + text-align: center; + padding: 0px 10px; +} + +#tag { + font-size: 14px; + color: #f90; + font-weight: bold; + text-align: right; +} + +#ident { + font-weight: bold; + text-align: right; +} + +.inputlabel { + font-size: small; + font-weight: bold; + color: #000; +} + +.section { + padding-bottom: 20px; + width: 680px; +} + +.subsection { + float: left; + margin: 5px 10px; +} + +.sectiontitle { + float: left; + white-space: nowrap; + background: url(linkbg.jpg) 0px 0px repeat-x #336; + color: #eee; + font-size: 14px; + font-weight: bold; + border: 1px solid #000; + padding: 0px 5px 0px 5px; + margin: 0px 15px -10px 8px; +} + +.sectionbg { + clear: both; + background-color: #ccc; + color: #000; + border: 2px solid #000; + padding: 0px; +} + +.sectionbody { + margin-top: 15px; + margin-bottom: 10px; +} + +#gnav { + width: 700px; + border-top: 1px solid #000; + border-bottom: 1px solid #000; + float: left; + background: url(linkbg.jpg) repeat-x; + margin-bottom: 10px; +} + +#gnav #menu { + width: 690px; + float: left; +} + +#gnav ul { + margin: 0px; + padding: 0px; +} + +#gnav li { + display: block; +} + +#gnav a { + font-size: 11px; + font-weight: bold; + height: 30px; + float: left; + display: block; + color: #fff; + padding: 0px 10px; + text-decoration: none; + background: url(linkbg.jpg) 0px 0px repeat-x; +} + +#gnav a:hover { + background-position: 0px -30px; + text-decoration: none; +} + +#gnav .on a { + background-position: 0px -30px; +} + +#gnav #nav { + float: left; + border-left: 1px solid #000; + display: inline; +} + +#nav { + margin-left: 10px; +} + +#gnav li { + height: 30px; + line-height: 30px; + border-right: 1px solid #000; + float: left; +} Copied: trunk/modules/webadmin/skins/ice/data/pagebg.gif (from rev 1480, trunk/modules/webadmin/skins/ice/img/pagebg.gif) =================================================================== (Binary files differ) Deleted: trunk/modules/webadmin/skins/ice/img/favicon.ico =================================================================== (Binary files differ) Deleted: trunk/modules/webadmin/skins/ice/img/linkbg.jpg =================================================================== (Binary files differ) Deleted: trunk/modules/webadmin/skins/ice/img/pagebg.gif =================================================================== (Binary files differ) Modified: trunk/modules/webadmin.cpp =================================================================== --- trunk/modules/webadmin.cpp 2009-04-06 06:45:19 UTC (rev 1480) +++ trunk/modules/webadmin.cpp 2009-04-06 16:00:23 UTC (rev 1481) @@ -367,9 +367,13 @@ return false; } + const CString& sSkin = GetModule()->GetSkinName(); + CString sTmp = sURI; + m_Template["SessionUser"] = GetUser(); m_Template["SessionIP"] = GetRemoteIP(); m_Template["Tag"] = CZNC::GetTag(); + m_Template["Skin"] = sSkin; if (IsAdmin()) { m_Template["IsAdmin"] = "true"; @@ -384,18 +388,10 @@ m_Template["Title"] = "Main Page"; m_Template["Action"] = "home"; PrintPage(sPageRet, "Main.tmpl"); - } else if (sURI.Equals("/css/", false, 5)) { - SetDocRoot(GetSkinDir() + "/css"); - PrintFile(sURI.substr(5), "text/css"); + } else if (sTmp.TrimPrefix("/" + sSkin + "/")) { + SetDocRoot(GetSkinDir() + "/data"); + PrintFile(sTmp); return false; - } else if (sURI.Equals("/img/", false, 5)) { - SetDocRoot(GetSkinDir() + "/img"); - PrintFile(sURI.substr(5)); - return false; - } else if (sURI.Equals("/js/", false, 4)) { - SetDocRoot(GetSkinDir() + "/js"); - PrintFile(sURI.substr(4), "application/x-javascript"); - return false; } else if (sURI == "/home") { m_Template["Title"] = "Main Page"; m_Template["Action"] = "home"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2009-09-04 12:25:29
|
Revision: 1616 http://znc.svn.sourceforge.net/znc/?rev=1616&view=rev Author: psychon Date: 2009-09-04 12:25:05 +0000 (Fri, 04 Sep 2009) Log Message: ----------- savebuff: Honour the KeepBuffer setting Before this, savebuff also added messages if a client was connected and a channel had KeepBuffer = false which is obviously wrong. Thanks to _marix for reporting this. Modified Paths: -------------- trunk/modules/buffextras.cpp trunk/modules/savebuff.cpp Modified: trunk/modules/buffextras.cpp =================================================================== --- trunk/modules/buffextras.cpp 2009-09-02 17:26:06 UTC (rev 1615) +++ trunk/modules/buffextras.cpp 2009-09-04 12:25:05 UTC (rev 1616) @@ -17,7 +17,7 @@ virtual ~CBuffExtras() {} void AddBuffer(CChan& Channel, const CString& sMessage) { - // If they have keep buffer disabled, only add messages if a client is connected + // If they have keep buffer disabled, only add messages if no client is connected if (!Channel.KeepBuffer() && m_pUser->IsUserAttached()) return; Modified: trunk/modules/savebuff.cpp =================================================================== --- trunk/modules/savebuff.cpp 2009-09-02 17:26:06 UTC (rev 1615) +++ trunk/modules/savebuff.cpp 2009-09-04 12:25:05 UTC (rev 1616) @@ -223,15 +223,23 @@ return(sReturn); } + void AddBuffer(CChan& chan, const CString &sLine) + { + // If they have keep buffer disabled, only add messages if no client is connected + if (!chan.KeepBuffer() && m_pUser->IsUserAttached()) + return; + chan.AddBuffer(sLine); + } + virtual void OnRawMode(const CNick& cOpNick, CChan& cChannel, const CString& sModes, const CString& sArgs) { - cChannel.AddBuffer(SpoofChanMsg(cChannel.GetName(), cOpNick.GetNickMask() + " MODE " + sModes + " " + sArgs)); + AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), cOpNick.GetNickMask() + " MODE " + sModes + " " + sArgs)); } virtual void OnQuit(const CNick& cNick, const CString& sMessage, const vector<CChan*>& vChans) { for (u_int a = 0; a < vChans.size(); a++) { - vChans[a]->AddBuffer(SpoofChanMsg(vChans[a]->GetName(), cNick.GetNickMask() + " QUIT " + sMessage)); + AddBuffer(*vChans[a], SpoofChanMsg(vChans[a]->GetName(), cNick.GetNickMask() + " QUIT " + sMessage)); } if (cNick.GetNick().Equals(m_pUser->GetNick())) SaveBufferToDisk(); // need to force a save here to see this! @@ -241,12 +249,12 @@ { for (u_int a = 0; a < vChans.size(); a++) { - vChans[a]->AddBuffer(SpoofChanMsg(vChans[a]->GetName(), cNick.GetNickMask() + " NICK " + sNewNick)); + AddBuffer(*vChans[a], SpoofChanMsg(vChans[a]->GetName(), cNick.GetNickMask() + " NICK " + sNewNick)); } } virtual void OnKick(const CNick& cNick, const CString& sOpNick, CChan& cChannel, const CString& sMessage) { - cChannel.AddBuffer(SpoofChanMsg(cChannel.GetName(), sOpNick + " KICK " + cNick.GetNickMask() + " " + sMessage)); + AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), sOpNick + " KICK " + cNick.GetNickMask() + " " + sMessage)); } virtual void OnJoin(const CNick& cNick, CChan& cChannel) { @@ -256,11 +264,11 @@ if (!cChannel.GetBuffer().empty()) Replay(cChannel.GetName()); } - cChannel.AddBuffer(SpoofChanMsg(cChannel.GetName(), cNick.GetNickMask() + " JOIN")); + AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), cNick.GetNickMask() + " JOIN")); } virtual void OnPart(const CNick& cNick, CChan& cChannel) { - cChannel.AddBuffer(SpoofChanMsg(cChannel.GetName(), cNick.GetNickMask() + " PART")); + AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), cNick.GetNickMask() + " PART")); if (cNick.GetNick().Equals(m_pUser->GetNick())) SaveBufferToDisk(); // need to force a save here to see this! } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2009-09-14 13:22:32
|
Revision: 1626 http://znc.svn.sourceforge.net/znc/?rev=1626&view=rev Author: psychon Date: 2009-09-14 12:17:17 +0000 (Mon, 14 Sep 2009) Log Message: ----------- Move saslauth into modules/extra/ Modified Paths: -------------- trunk/modules/Makefile.in Added Paths: ----------- trunk/modules/extra/saslauth.cpp Removed Paths: ------------- trunk/modules/saslauth.cpp Modified: trunk/modules/Makefile.in =================================================================== --- trunk/modules/Makefile.in 2009-09-11 12:46:40 UTC (rev 1625) +++ trunk/modules/Makefile.in 2009-09-14 12:17:17 UTC (rev 1626) @@ -58,12 +58,12 @@ endif ifeq "@SASL@" "" -FILES := $(shell echo $(FILES) | sed -e "s/saslauth//") +FILES := $(shell echo $(FILES) | sed -e "s:extra/saslauth::") endif saslauthFLAGS := -lsasl2 ifeq "$(TCL_FLAGS)" "" -FILES := $(shell echo $(FILES) | sed -e "s:extra/modtcl::g") +FILES := $(shell echo $(FILES) | sed -e "s:extra/modtcl::") else TCLHOOK := modtcl_install endif Copied: trunk/modules/extra/saslauth.cpp (from rev 1625, trunk/modules/saslauth.cpp) =================================================================== --- trunk/modules/extra/saslauth.cpp (rev 0) +++ trunk/modules/extra/saslauth.cpp 2009-09-14 12:17:17 UTC (rev 1626) @@ -0,0 +1,105 @@ +/** + * Copyright (C) 2008 Heiko Hund <he...@is...> + * Copyright (C) 2008-2009 See the AUTHORS file for details. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * @class CSASLAuthMod + * @author Heiko Hund <he...@is...> + * @brief SASL authentication module for znc. + */ + +#include "Modules.h" +#include "znc.h" +#include <sasl/sasl.h> + +class CSASLAuthMod : public CGlobalModule { +public: + GLOBALMODCONSTRUCTOR(CSASLAuthMod) { + m_Cache.SetTTL(60000/*ms*/); + } + virtual ~CSASLAuthMod() {} + + virtual bool OnBoot() { + return true; + } + + virtual bool OnLoad(const CString& sArgs, CString& sMessage) { + int i(0); + CString arg(sArgs.Token(i)); + + while (!arg.empty()) { + if (arg.StrCmp("saslauthd") || arg.StrCmp("auxprop")) { + method += arg + " "; + } + else { + CUtils::PrintError("Ignoring invalid SASL pwcheck method: " + arg); + } + arg = sArgs.Token(++i); + } + method.TrimRight(); + + if (sasl_server_init(NULL, NULL) != SASL_OK){ + CUtils::PrintError("SASL Could Not Be Initialized - Halting Startup"); + return false; + } + + return true; + } + + virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { + CString const user(Auth->GetUsername()); + CString const pass(Auth->GetPassword()); + CUser* pUser(CZNC::Get().FindUser(user)); + sasl_conn_t *sasl_conn(0); + + if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future + Auth->RefuseLogin("Invalid User - Halting SASL Authentication"); + return HALT; + } + + CString const key(CString(user + ":" + pass).MD5()); + if (m_Cache.HasItem(key)) { + Auth->AcceptLogin(*pUser); + DEBUG("+++ Found in cache"); + } + else if (sasl_server_new("znc", NULL, NULL, NULL, NULL, cbs, 0, &sasl_conn) == SASL_OK && + sasl_checkpass(sasl_conn, user.c_str(), user.size(), pass.c_str(), pass.size()) == SASL_OK) { + Auth->AcceptLogin(*pUser); + m_Cache.AddItem(key); + DEBUG("+++ Successful SASL password check"); + } + else { + Auth->RefuseLogin("SASL Authentication failed"); + DEBUG("--- FAILED SASL password check"); + } + + sasl_dispose(&sasl_conn); + return HALT; + } + +private: + TCacheMap<CString> m_Cache; + + static sasl_callback_t cbs[]; + static CString method; + + static int getopt(void *context, const char *plugin_name, const char *option, const char **result, unsigned *len) { + if (!method.empty() && strcmp(option, "pwcheck_method") == 0) { + *result = method.c_str(); + return SASL_OK; + } + return SASL_CONTINUE; + } +}; + +sasl_callback_t CSASLAuthMod::cbs[] = { + { SASL_CB_GETOPT, reinterpret_cast<int(*)()>(CSASLAuthMod::getopt), NULL }, + { SASL_CB_LIST_END, NULL, NULL } +}; + +CString CSASLAuthMod::method; + +GLOBALMODULEDEFS(CSASLAuthMod, "Allow users to authenticate via SASL password verification method") Deleted: trunk/modules/saslauth.cpp =================================================================== --- trunk/modules/saslauth.cpp 2009-09-11 12:46:40 UTC (rev 1625) +++ trunk/modules/saslauth.cpp 2009-09-14 12:17:17 UTC (rev 1626) @@ -1,105 +0,0 @@ -/** - * Copyright (C) 2008 Heiko Hund <he...@is...> - * Copyright (C) 2008-2009 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - * @class CSASLAuthMod - * @author Heiko Hund <he...@is...> - * @brief SASL authentication module for znc. - */ - -#include "Modules.h" -#include "znc.h" -#include <sasl/sasl.h> - -class CSASLAuthMod : public CGlobalModule { -public: - GLOBALMODCONSTRUCTOR(CSASLAuthMod) { - m_Cache.SetTTL(60000/*ms*/); - } - virtual ~CSASLAuthMod() {} - - virtual bool OnBoot() { - return true; - } - - virtual bool OnLoad(const CString& sArgs, CString& sMessage) { - int i(0); - CString arg(sArgs.Token(i)); - - while (!arg.empty()) { - if (arg.StrCmp("saslauthd") || arg.StrCmp("auxprop")) { - method += arg + " "; - } - else { - CUtils::PrintError("Ignoring invalid SASL pwcheck method: " + arg); - } - arg = sArgs.Token(++i); - } - method.TrimRight(); - - if (sasl_server_init(NULL, NULL) != SASL_OK){ - CUtils::PrintError("SASL Could Not Be Initialized - Halting Startup"); - return false; - } - - return true; - } - - virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { - CString const user(Auth->GetUsername()); - CString const pass(Auth->GetPassword()); - CUser* pUser(CZNC::Get().FindUser(user)); - sasl_conn_t *sasl_conn(0); - - if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future - Auth->RefuseLogin("Invalid User - Halting SASL Authentication"); - return HALT; - } - - CString const key(CString(user + ":" + pass).MD5()); - if (m_Cache.HasItem(key)) { - Auth->AcceptLogin(*pUser); - DEBUG("+++ Found in cache"); - } - else if (sasl_server_new("znc", NULL, NULL, NULL, NULL, cbs, 0, &sasl_conn) == SASL_OK && - sasl_checkpass(sasl_conn, user.c_str(), user.size(), pass.c_str(), pass.size()) == SASL_OK) { - Auth->AcceptLogin(*pUser); - m_Cache.AddItem(key); - DEBUG("+++ Successful SASL password check"); - } - else { - Auth->RefuseLogin("SASL Authentication failed"); - DEBUG("--- FAILED SASL password check"); - } - - sasl_dispose(&sasl_conn); - return HALT; - } - -private: - TCacheMap<CString> m_Cache; - - static sasl_callback_t cbs[]; - static CString method; - - static int getopt(void *context, const char *plugin_name, const char *option, const char **result, unsigned *len) { - if (!method.empty() && strcmp(option, "pwcheck_method") == 0) { - *result = method.c_str(); - return SASL_OK; - } - return SASL_CONTINUE; - } -}; - -sasl_callback_t CSASLAuthMod::cbs[] = { - { SASL_CB_GETOPT, reinterpret_cast<int(*)()>(CSASLAuthMod::getopt), NULL }, - { SASL_CB_LIST_END, NULL, NULL } -}; - -CString CSASLAuthMod::method; - -GLOBALMODULEDEFS(CSASLAuthMod, "Allow users to authenticate via SASL password verification method") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cf...@us...> - 2010-01-25 21:55:23
|
Revision: 1722 http://znc.svn.sourceforge.net/znc/?rev=1722&view=rev Author: cflakes Date: 2010-01-25 21:54:55 +0000 (Mon, 25 Jan 2010) Log Message: ----------- Removed default-checked yet quite useless and annoying "[add ]your current ip" checkbox from webadmin's edit user page. The new default skin never had it, this completely removes it from the other skins and from the module. Modified Paths: -------------- trunk/modules/webadmin/skins/dark-clouds/UserPage.tmpl trunk/modules/webadmin/skins/graphiX/UserPage.tmpl trunk/modules/webadmin/skins/ice/UserPage.tmpl trunk/modules/webadmin.cpp Modified: trunk/modules/webadmin/skins/dark-clouds/UserPage.tmpl =================================================================== --- trunk/modules/webadmin/skins/dark-clouds/UserPage.tmpl 2010-01-24 17:50:32 UTC (rev 1721) +++ trunk/modules/webadmin/skins/dark-clouds/UserPage.tmpl 2010-01-25 21:54:55 UTC (rev 1722) @@ -52,10 +52,6 @@ <textarea style="width: 100%;" name="allowedips" cols="40" rows="5"><? LOOP AllowedHostLoop ?><? VAR Host ESC=HTML ?> <? ENDLOOP ?> </textarea> - - <? IF OwnIP ?> - <br><br><input type="checkbox" id="ownip" name="ownip" value="<? VAR OwnIP ESC=HTML ?>" checked="checked"><label for="ownip"> <? VAR OwnIP ESC=HTML ?> (your current ip)</label> - <? ENDIF ?> </td> </tr> </table> Modified: trunk/modules/webadmin/skins/graphiX/UserPage.tmpl =================================================================== --- trunk/modules/webadmin/skins/graphiX/UserPage.tmpl 2010-01-24 17:50:32 UTC (rev 1721) +++ trunk/modules/webadmin/skins/graphiX/UserPage.tmpl 2010-01-25 21:54:55 UTC (rev 1722) @@ -52,10 +52,6 @@ <textarea style="width: 100%;" name="allowedips" cols="40" rows="5"><? LOOP AllowedHostLoop ?><? VAR Host ESC=HTML ?> <? ENDLOOP ?> </textarea> - - <? IF OwnIP ?> - <br><br><input type="checkbox" id="ownip" name="ownip" value="<? VAR OwnIP ESC=HTML ?>" checked="checked"><label for="ownip"> <? VAR OwnIP ESC=HTML ?> (your current ip)</label> - <? ENDIF ?> </td> </tr> </table> Modified: trunk/modules/webadmin/skins/ice/UserPage.tmpl =================================================================== --- trunk/modules/webadmin/skins/ice/UserPage.tmpl 2010-01-24 17:50:32 UTC (rev 1721) +++ trunk/modules/webadmin/skins/ice/UserPage.tmpl 2010-01-25 21:54:55 UTC (rev 1722) @@ -28,11 +28,6 @@ <textarea name="allowedips" class="half"><? LOOP AllowedHostLoop ?><? VAR Host ESC=HTML ?> <? ENDLOOP ?> </textarea> - <? IF OwnIP ?> - <div class="subsection"> - <span style="white-space: nowrap;"><input type="checkbox" name="ownip" id="ownip" value="<? VAR OwnIP ESC=HTML ?>" checked="checked" /><label for="ownip"> <? VAR OwnIP ESC=HTML ?> (your current ip)</label></span> - </div> - <? ENDIF ?> </div> <div style="clear: both;"></div> </div> Modified: trunk/modules/webadmin.cpp =================================================================== --- trunk/modules/webadmin.cpp 2010-01-24 17:50:32 UTC (rev 1721) +++ trunk/modules/webadmin.cpp 2010-01-25 21:54:55 UTC (rev 1722) @@ -830,14 +830,6 @@ l["CTCP"] = it2->first + " " + it2->second; } - if (pUser == CZNC::Get().FindUser(GetUser())) { - CString sIP = GetRemoteIP(); - - if (!sIP.empty()) { - m_Template["OwnIP"] = sIP.Token(0, false, ".") + "." + sIP.Token(1, false, ".") + "." + sIP.Token(2, false, ".") + ".*"; - } - } - const vector<CChan*>& Channels = pUser->GetChans(); for (unsigned int c = 0; c < Channels.size(); c++) { CChan* pChan = Channels[c]; @@ -1060,10 +1052,6 @@ pNewUser->AddAllowedHost("*"); } - if (HasParam("ownip")) { - pNewUser->AddAllowedHost(GetParam("ownip")); - } - GetRawParam("ctcpreplies").Split("\n", vsArgs); for (a = 0; a < vsArgs.size(); a++) { CString sReply = vsArgs[a].TrimRight_n("\r"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cf...@us...> - 2010-04-04 16:58:53
|
Revision: 1880 http://znc.svn.sourceforge.net/znc/?rev=1880&view=rev Author: cflakes Date: 2010-04-04 16:58:47 +0000 (Sun, 04 Apr 2010) Log Message: ----------- WebMod-enabled the lastseen module. Especially useful for setups with many users, makes finding inactive accounts easy. Modified Paths: -------------- trunk/modules/extra/lastseen.cpp Added Paths: ----------- trunk/modules/www/lastseen/ trunk/modules/www/lastseen/index.tmpl Modified: trunk/modules/extra/lastseen.cpp =================================================================== --- trunk/modules/extra/lastseen.cpp 2010-04-04 16:22:58 UTC (rev 1879) +++ trunk/modules/extra/lastseen.cpp 2010-04-04 16:58:47 UTC (rev 1880) @@ -7,30 +7,34 @@ */ #include "User.h" +#include "Chan.h" #include "znc.h" using std::map; +using std::pair; +using std::multimap; class CLastSeenMod : public CGlobalModule { +private: + time_t GetTime(const CUser *pUser) { + return GetNV(pUser->GetUserName()).ToULong(); + } + + void SetTime(const CUser *pUser) { + SetNV(pUser->GetUserName(), CString(time(NULL))); + } + + typedef multimap<time_t, CUser*> MTimeMulti; + typedef map<CString, CUser*> MUsers; public: - GLOBALMODCONSTRUCTOR(CLastSeenMod) - { + GLOBALMODCONSTRUCTOR(CLastSeenMod) { } virtual ~CLastSeenMod() {} - time_t GetTime(CUser *pUser) - { - return GetNV(pUser->GetUserName()).ToULong(); - } + // IRC stuff: - void SetTime(CUser *pUser) - { - SetNV(pUser->GetUserName(), CString(time(NULL))); - } - - virtual void OnModCommand(const CString& sLine) - { + virtual void OnModCommand(const CString& sLine) { const CString sCommand = sLine.Token(0).AsLower(); if (!GetUser()->IsAdmin()) { @@ -40,8 +44,8 @@ if (sCommand == "show") { char buf[1024]; - const map<CString, CUser*>& mUsers = CZNC::Get().GetUserMap(); - map<CString, CUser*>::const_iterator it; + const MUsers& mUsers = CZNC::Get().GetUserMap(); + MUsers::const_iterator it; CTable Table; Table.AddColumn("User"); @@ -68,17 +72,68 @@ } } - virtual void OnClientLogin() - { + // Event stuff: + + virtual void OnClientLogin() { SetTime(GetUser()); } - virtual void OnClientDisconnect() - { + virtual void OnClientDisconnect() { SetTime(GetUser()); } -private: + virtual EModRet OnDeleteUser(CUser& User) { + DelNV(User.GetUserName()); + return CONTINUE; + } + + // Web stuff: + + virtual bool WebRequiresLogin() { return true; } + virtual bool WebRequiresAdmin() { return false; } + virtual CString GetWebMenuTitle() { return "Last Seen"; } + + virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { + if (sPageName.empty() || sPageName == "index") { + MTimeMulti mmSorted; + const MUsers& mUsers = CZNC::Get().GetUserMap(); + + for (MUsers::const_iterator uit = mUsers.begin(); uit != mUsers.end(); ++uit) { + mmSorted.insert(pair<time_t, CUser*>(GetTime(uit->second), uit->second)); + } + + char buf[1024] = {0}; + + for (MTimeMulti::const_iterator it = mmSorted.begin(); it != mmSorted.end(); ++it) { + CUser *pUser = it->second; + CTemplate& Row = Tmpl.AddRow("UserLoop"); + + Row["Username"] = pUser->GetUserName(); + Row["IsSelf"] = CString(pUser == WebSock.GetSession()->GetUser()); + + if(it->first > 0) { + strftime(buf, sizeof(buf), "%c", localtime(&it->first)); + Row["LastSeen"] = buf; + } + + Row["Info"] = CString(pUser->GetClients().size()) + " client(s)"; + if(!pUser->GetCurrentServer()) { + Row["Info"] += ", not connected to IRC"; + } else { + unsigned int uChans = 0; + const vector<CChan*>& vChans = pUser->GetChans(); + for (unsigned int a = 0; a < vChans.size(); a++) { + if (vChans[a]->IsOn()) uChans++; + } + Row["Info"] += ", joined to " + CString(uChans) + " channel(s)"; + } + } + + return true; + } + + return false; + } }; GLOBALMODULEDEFS(CLastSeenMod, "Collects data about when a user last logged in") Added: trunk/modules/www/lastseen/index.tmpl =================================================================== --- trunk/modules/www/lastseen/index.tmpl (rev 0) +++ trunk/modules/www/lastseen/index.tmpl 2010-04-04 16:58:47 UTC (rev 1880) @@ -0,0 +1,28 @@ +<? INC Header.tmpl ?> + +<table class="data"> + <thead> + <tr> + <td>User</td> + <td>Last Seen</td> + <td>Info</td> + <td>Action</td> + </tr> + </thead> + <tbody> + <? LOOP UserLoop ?> + <tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>"> + <td><? VAR Username ?></td> + <td><? VAR LastSeen DEFAULT="- unknown -" ?></td> + <td><? VAR Info ?></td> + <td><span class="nowrap"> + [<a href="/mods/webadmin/edituser?user=<?VAR Username ESC=URL?>">Edit</a>] + <? IF !IsSelf ?>[<a href="/mods/webadmin/deluser?user=<?VAR Username ESC=URL?>" onclick="return confirm('Do you really wish to remove this user?');">Delete</a>]<? ENDIF ?> + </span></td> + </tr> + <? ENDLOOP ?> + </tbody> +</table> +<? ENDIF ?> + +<? INC Footer.tmpl ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cf...@us...> - 2010-04-15 14:11:04
|
Revision: 1918 http://znc.svn.sourceforge.net/znc/?rev=1918&view=rev Author: cflakes Date: 2010-04-15 14:10:56 +0000 (Thu, 15 Apr 2010) Log Message: ----------- Web-enabled the stickychan module. You can now stick+unstick channels from the web. Modified Paths: -------------- trunk/modules/stickychan.cpp Added Paths: ----------- trunk/modules/www/stickychan/ trunk/modules/www/stickychan/index.tmpl Modified: trunk/modules/stickychan.cpp =================================================================== --- trunk/modules/stickychan.cpp 2010-04-15 12:31:31 UTC (rev 1917) +++ trunk/modules/stickychan.cpp 2010-04-15 14:10:56 UTC (rev 1918) @@ -100,8 +100,47 @@ } } } -private: + virtual bool WebRequiresLogin() { return true; } + virtual bool WebRequiresAdmin() { return false; } + virtual CString GetWebMenuTitle() { return "Sticky Chans"; } + + virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { + if (sPageName.empty() || sPageName == "index") { + bool bSubmitted = (WebSock.GetParam("submitted").ToInt() != 0); + + const vector<CChan*>& Channels = m_pUser->GetChans(); + for (unsigned int c = 0; c < Channels.size(); c++) { + const CString sChan = Channels[c]->GetName(); + bool bStick = FindNV(sChan) != EndNV(); + + if(bSubmitted) { + bool bNewStick = WebSock.GetParam("stick_" + sChan).ToBool(); + if(bNewStick && !bStick) + SetNV(sChan, ""); // no password support for now unless chansaver is active too + else if(!bNewStick && bStick) { + MCString::iterator it = FindNV(sChan); + if(it != EndNV()) + DelNV(it); + } + bStick = bNewStick; + } + + CTemplate& Row = Tmpl.AddRow("ChannelLoop"); + Row["Name"] = sChan; + Row["Sticky"] = CString(bStick); + } + + if(bSubmitted) { + WebSock.GetSession()->AddSuccess("Changes have been saved!"); + } + + return true; + } + + return false; + } + }; Added: trunk/modules/www/stickychan/index.tmpl =================================================================== --- trunk/modules/www/stickychan/index.tmpl (rev 0) +++ trunk/modules/www/stickychan/index.tmpl 2010-04-15 14:10:56 UTC (rev 1918) @@ -0,0 +1,27 @@ +<? INC Header.tmpl ?> + +<form action="" method="post"> + <table class="data"> + <thead> + <tr> + <td>Name</td> + <td>Sticky</td> + </tr> + </thead> + <tbody> + <? LOOP ChannelLoop ?> + <tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>"> + <td><? VAR Name ?></td> + <td><input type="checkbox" name="stick_<? VAR Name ?>"<? IF Sticky ?> checked="checked"<? ENDIF ?> /></td> + </tr> + <? ENDLOOP ?> + </tbody> + </table> + + <div class="submitline"> + <input type="hidden" name="submitted" value="1" /> + <input type="submit" value="Save" /> + </div> +</form> + +<? INC Footer.tmpl ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cf...@us...> - 2010-04-15 14:46:20
|
Revision: 1919 http://znc.svn.sourceforge.net/znc/?rev=1919&view=rev Author: cflakes Date: 2010-04-15 14:46:14 +0000 (Thu, 15 Apr 2010) Log Message: ----------- Move the dangerous shell module to "extra". Added Paths: ----------- trunk/modules/extra/shell.cpp Removed Paths: ------------- trunk/modules/shell.cpp Copied: trunk/modules/extra/shell.cpp (from rev 1911, trunk/modules/shell.cpp) =================================================================== --- trunk/modules/extra/shell.cpp (rev 0) +++ trunk/modules/extra/shell.cpp 2010-04-15 14:46:14 UTC (rev 1919) @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2004-2010 See the AUTHORS file for details. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include "User.h" +#include "znc.h" + +// Forward Declaration +class CShellMod; + +class CShellSock : public CExecSock { +public: + CShellSock(CShellMod* pShellMod, CClient* pClient, const CString& sExec) : CExecSock() { + EnableReadLine(); + m_pParent = pShellMod; + m_pClient = pClient; + + if (Execute(sExec) == -1) { + CString s = "Failed to execute: "; + s += strerror(errno); + ReadLine(s); + return; + } + + // Get rid of that write fd, we aren't going to use it + // (And clients expecting input will fail this way). + close(GetWSock()); + SetWSock(open("/dev/null", O_WRONLY)); + } + // These next two function's bodies are at the bottom of the file since they reference CShellMod + virtual void ReadLine(const CString& sData); + virtual void Disconnected(); + + CShellMod* m_pParent; + +private: + CClient* m_pClient; +}; + +class CShellMod : public CModule { +public: + MODCONSTRUCTOR(CShellMod) { + m_sPath = CZNC::Get().GetHomePath(); + } + + virtual ~CShellMod() { + vector<CZNCSock*> vSocks = m_pManager->FindSocksByName("SHELL"); + + for (unsigned int a = 0; a < vSocks.size(); a++) { + m_pManager->DelSockByAddr(vSocks[a]); + } + } + + virtual bool OnLoad(const CString& sArgs, CString& sMessage) + { +#ifndef MOD_SHELL_ALLOW_EVERYONE + if (!m_pUser->IsAdmin()) { + sMessage = "You must be admin to use the shell module"; + return false; + } +#endif + + return true; + } + + virtual void OnModCommand(const CString& sLine) { + CString sCommand = sLine.Token(0); + if (sCommand.Equals("cd")) { + CString sArg = sLine.Token(1, true); + CString sPath = CDir::ChangeDir(m_sPath, (sArg.empty() ? CString(CZNC::Get().GetHomePath()) : sArg), CZNC::Get().GetHomePath()); + CFile Dir(sPath); + + if (Dir.IsDir()) { + m_sPath = sPath; + } else if (Dir.Exists()) { + PutShell("cd: not a directory [" + sPath + "]"); + } else { + PutShell("cd: no such directory [" + sPath + "]"); + } + + PutShell("znc$"); + } else if (sCommand.Equals("SEND")) { + CString sToNick = sLine.Token(1); + CString sFile = sLine.Token(2); + + if ((sToNick.empty()) || (sFile.empty())) { + PutShell("usage: Send <nick> <file>"); + } else { + sFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath()); + + if (!CFile::Exists(sFile)) { + PutShell("get: no such file [" + sFile + "]"); + } else if (!CFile::IsReg(sFile)) { + PutShell("get: not a file [" + sFile + "]"); + } else { + m_pUser->SendFile(sToNick, sFile, GetModName()); + } + } + } else if (sCommand.Equals("GET")) { + CString sFile = sLine.Token(1); + + if (sFile.empty()) { + PutShell("usage: Get <file>"); + } else { + sFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath()); + + if (!CFile::Exists(sFile)) { + PutShell("get: no such file [" + sFile + "]"); + } else if (!CFile::IsReg(sFile)) { + PutShell("get: not a file [" + sFile + "]"); + } else { + m_pUser->SendFile(m_pUser->GetCurNick(), sFile, GetModName()); + } + } + } else { + RunCommand(sLine); + } + } + + virtual EModRet OnStatusCommand(CString& sCommand) { + if (sCommand.Equals("SHELL")) { + PutShell("-- ZNC Shell Service --"); + return HALT; + } + + return CONTINUE; + } + + virtual EModRet OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize) { + if (RemoteNick.GetNick().Equals(GetModNick())) { + CString sLocalFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath()); + + m_pUser->GetFile(m_pUser->GetCurNick(), CUtils::GetIP(uLongIP), uPort, sLocalFile, uFileSize, GetModName()); + + return HALT; + } + + return CONTINUE; + } + + void PutShell(const CString& sLine) { + CString sPath = m_sPath; + + CString::size_type a = sPath.find(' '); + while (a != CString::npos) { + sPath.replace(a, 1, "_"); + a = sPath.find(' '); + } + + PutModule(sLine, "shell", sPath); + } + + void RunCommand(const CString& sCommand) { + m_pManager->AddSock(new CShellSock(this, m_pClient, "cd " + m_sPath + " && " + sCommand), "SHELL"); + } +private: + CString m_sPath; +}; + +void CShellSock::ReadLine(const CString& sData) { + CString sLine = sData; + + sLine.TrimRight("\r\n"); + sLine.Replace("\t", " "); + + m_pParent->SetClient(m_pClient); + m_pParent->PutShell(sLine); + m_pParent->SetClient(NULL); +} + +void CShellSock::Disconnected() { + // If there is some incomplete line in the buffer, read it + // (e.g. echo echo -n "hi" triggered this) + CString &sBuffer = GetInternalReadBuffer(); + if (!sBuffer.empty()) + ReadLine(sBuffer); + + m_pParent->SetClient(m_pClient); + m_pParent->PutShell("znc$"); + m_pParent->SetClient(NULL); +} + +MODULEDEFS(CShellMod, "Gives shell access") + Deleted: trunk/modules/shell.cpp =================================================================== --- trunk/modules/shell.cpp 2010-04-15 14:10:56 UTC (rev 1918) +++ trunk/modules/shell.cpp 2010-04-15 14:46:14 UTC (rev 1919) @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2004-2010 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include "User.h" -#include "znc.h" - -// Forward Declaration -class CShellMod; - -class CShellSock : public CExecSock { -public: - CShellSock(CShellMod* pShellMod, CClient* pClient, const CString& sExec) : CExecSock() { - EnableReadLine(); - m_pParent = pShellMod; - m_pClient = pClient; - - if (Execute(sExec) == -1) { - CString s = "Failed to execute: "; - s += strerror(errno); - ReadLine(s); - return; - } - - // Get rid of that write fd, we aren't going to use it - // (And clients expecting input will fail this way). - close(GetWSock()); - SetWSock(open("/dev/null", O_WRONLY)); - } - // These next two function's bodies are at the bottom of the file since they reference CShellMod - virtual void ReadLine(const CString& sData); - virtual void Disconnected(); - - CShellMod* m_pParent; - -private: - CClient* m_pClient; -}; - -class CShellMod : public CModule { -public: - MODCONSTRUCTOR(CShellMod) { - m_sPath = CZNC::Get().GetHomePath(); - } - - virtual ~CShellMod() { - vector<CZNCSock*> vSocks = m_pManager->FindSocksByName("SHELL"); - - for (unsigned int a = 0; a < vSocks.size(); a++) { - m_pManager->DelSockByAddr(vSocks[a]); - } - } - - virtual bool OnLoad(const CString& sArgs, CString& sMessage) - { -#ifndef MOD_SHELL_ALLOW_EVERYONE - if (!m_pUser->IsAdmin()) { - sMessage = "You must be admin to use the shell module"; - return false; - } -#endif - - return true; - } - - virtual void OnModCommand(const CString& sLine) { - CString sCommand = sLine.Token(0); - if (sCommand.Equals("cd")) { - CString sArg = sLine.Token(1, true); - CString sPath = CDir::ChangeDir(m_sPath, (sArg.empty() ? CString(CZNC::Get().GetHomePath()) : sArg), CZNC::Get().GetHomePath()); - CFile Dir(sPath); - - if (Dir.IsDir()) { - m_sPath = sPath; - } else if (Dir.Exists()) { - PutShell("cd: not a directory [" + sPath + "]"); - } else { - PutShell("cd: no such directory [" + sPath + "]"); - } - - PutShell("znc$"); - } else if (sCommand.Equals("SEND")) { - CString sToNick = sLine.Token(1); - CString sFile = sLine.Token(2); - - if ((sToNick.empty()) || (sFile.empty())) { - PutShell("usage: Send <nick> <file>"); - } else { - sFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath()); - - if (!CFile::Exists(sFile)) { - PutShell("get: no such file [" + sFile + "]"); - } else if (!CFile::IsReg(sFile)) { - PutShell("get: not a file [" + sFile + "]"); - } else { - m_pUser->SendFile(sToNick, sFile, GetModName()); - } - } - } else if (sCommand.Equals("GET")) { - CString sFile = sLine.Token(1); - - if (sFile.empty()) { - PutShell("usage: Get <file>"); - } else { - sFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath()); - - if (!CFile::Exists(sFile)) { - PutShell("get: no such file [" + sFile + "]"); - } else if (!CFile::IsReg(sFile)) { - PutShell("get: not a file [" + sFile + "]"); - } else { - m_pUser->SendFile(m_pUser->GetCurNick(), sFile, GetModName()); - } - } - } else { - RunCommand(sLine); - } - } - - virtual EModRet OnStatusCommand(CString& sCommand) { - if (sCommand.Equals("SHELL")) { - PutShell("-- ZNC Shell Service --"); - return HALT; - } - - return CONTINUE; - } - - virtual EModRet OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize) { - if (RemoteNick.GetNick().Equals(GetModNick())) { - CString sLocalFile = CDir::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath()); - - m_pUser->GetFile(m_pUser->GetCurNick(), CUtils::GetIP(uLongIP), uPort, sLocalFile, uFileSize, GetModName()); - - return HALT; - } - - return CONTINUE; - } - - void PutShell(const CString& sLine) { - CString sPath = m_sPath; - - CString::size_type a = sPath.find(' '); - while (a != CString::npos) { - sPath.replace(a, 1, "_"); - a = sPath.find(' '); - } - - PutModule(sLine, "shell", sPath); - } - - void RunCommand(const CString& sCommand) { - m_pManager->AddSock(new CShellSock(this, m_pClient, "cd " + m_sPath + " && " + sCommand), "SHELL"); - } -private: - CString m_sPath; -}; - -void CShellSock::ReadLine(const CString& sData) { - CString sLine = sData; - - sLine.TrimRight("\r\n"); - sLine.Replace("\t", " "); - - m_pParent->SetClient(m_pClient); - m_pParent->PutShell(sLine); - m_pParent->SetClient(NULL); -} - -void CShellSock::Disconnected() { - // If there is some incomplete line in the buffer, read it - // (e.g. echo echo -n "hi" triggered this) - CString &sBuffer = GetInternalReadBuffer(); - if (!sBuffer.empty()) - ReadLine(sBuffer); - - m_pParent->SetClient(m_pClient); - m_pParent->PutShell("znc$"); - m_pParent->SetClient(NULL); -} - -MODULEDEFS(CShellMod, "Gives shell access") - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cf...@us...> - 2010-04-15 14:56:53
|
Revision: 1920 http://znc.svn.sourceforge.net/znc/?rev=1920&view=rev Author: cflakes Date: 2010-04-15 14:56:44 +0000 (Thu, 15 Apr 2010) Log Message: ----------- Remove some superfluous WebRequiresLogin and WebRequiresAdmin implementations from modules. Thanks to psychon for noticing. Modified Paths: -------------- trunk/modules/extra/lastseen.cpp trunk/modules/notes.cpp trunk/modules/stickychan.cpp trunk/modules/webadmin.cpp Modified: trunk/modules/extra/lastseen.cpp =================================================================== --- trunk/modules/extra/lastseen.cpp 2010-04-15 14:46:14 UTC (rev 1919) +++ trunk/modules/extra/lastseen.cpp 2010-04-15 14:56:44 UTC (rev 1920) @@ -89,7 +89,6 @@ // Web stuff: - virtual bool WebRequiresLogin() { return true; } virtual bool WebRequiresAdmin() { return true; } virtual CString GetWebMenuTitle() { return "Last Seen"; } Modified: trunk/modules/notes.cpp =================================================================== --- trunk/modules/notes.cpp 2010-04-15 14:46:14 UTC (rev 1919) +++ trunk/modules/notes.cpp 2010-04-15 14:56:44 UTC (rev 1920) @@ -29,8 +29,6 @@ return true; } - virtual bool WebRequiresLogin() { return true; } - virtual bool WebRequiresAdmin() { return false; } virtual CString GetWebMenuTitle() { return "Notes"; } virtual void OnClientLogin() { Modified: trunk/modules/stickychan.cpp =================================================================== --- trunk/modules/stickychan.cpp 2010-04-15 14:46:14 UTC (rev 1919) +++ trunk/modules/stickychan.cpp 2010-04-15 14:56:44 UTC (rev 1920) @@ -101,8 +101,6 @@ } } - virtual bool WebRequiresLogin() { return true; } - virtual bool WebRequiresAdmin() { return false; } virtual CString GetWebMenuTitle() { return "Sticky Chans"; } virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { Modified: trunk/modules/webadmin.cpp =================================================================== --- trunk/modules/webadmin.cpp 2010-04-15 14:46:14 UTC (rev 1919) +++ trunk/modules/webadmin.cpp 2010-04-15 14:56:44 UTC (rev 1920) @@ -222,8 +222,6 @@ return pNewUser; } - virtual bool WebRequiresLogin() { return true; } - virtual bool WebRequiresAdmin() { return false; } virtual CString GetWebMenuTitle() { return "webadmin"; } virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { CSmartPtr<CWebSession> spSession = WebSock.GetSession(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2010-04-15 15:36:56
|
Revision: 1922 http://znc.svn.sourceforge.net/znc/?rev=1922&view=rev Author: psychon Date: 2010-04-15 15:36:50 +0000 (Thu, 15 Apr 2010) Log Message: ----------- Move imapauth and email to extra/, remove webchat webchat will come back later in more shiny and with more blinky-blink! Added Paths: ----------- trunk/modules/extra/email.cpp trunk/modules/extra/imapauth.cpp Removed Paths: ------------- trunk/modules/email.cpp trunk/modules/imapauth.cpp trunk/modules/webchat.cpp trunk/modules/www/webchat/chan.tmpl trunk/modules/www/webchat/index.tmpl Deleted: trunk/modules/email.cpp =================================================================== --- trunk/modules/email.cpp 2010-04-15 14:58:00 UTC (rev 1921) +++ trunk/modules/email.cpp 2010-04-15 15:36:50 UTC (rev 1922) @@ -1,254 +0,0 @@ -/* - * Copyright (C) 2004-2010 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - * Email Monitor / Retrieval - * Author: imaginos <ima...@im...> - */ - -#include "MD5.h" -#include "User.h" -#include "znc.h" -#include <sstream> - -using std::stringstream; - -struct EmailST -{ - CString sFrom; - CString sSubject; - CString sUidl; - u_int iSize; -}; - -class CEmailJob : public CTimer -{ -public: - CEmailJob(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription) - : CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {} - - virtual ~CEmailJob() {} - -protected: - virtual void RunJob(); -}; - -class CEmail : public CModule -{ -public: - MODCONSTRUCTOR(CEmail) - { - m_iLastCheck = 0; - m_bInitialized = false; - } - - virtual ~CEmail() {} - - virtual bool OnLoad(const CString & sArgs, CString& sMessage) { - m_sMailPath = sArgs; - - StartParser(); - if (m_pUser->IsUserAttached()) - StartTimer(); - - return true; - } - - virtual void OnClientLogin() - { - stringstream s; - s << "You have " << m_ssUidls.size() << " emails."; - PutModule(s.str()); - StartTimer(); - } - virtual void OnClientDisconnect() - { - RemTimer("EMAIL::" + m_pUser->GetUserName()); - } - - void StartTimer() - { - if (!FindTimer("EMAIL::" + m_pUser->GetUserName())) - { - CEmailJob *p = new CEmailJob(this, 60, 0, "EmailMonitor", "Monitors email activity"); - AddTimer(p); - } - } - - virtual void OnModCommand(const CString& sCommand); - void StartParser(); - - void ParseEmails(const vector<EmailST> & vEmails) - { - if (!m_bInitialized) - { - m_bInitialized = true; - for (u_int a = 0; a < vEmails.size(); a++) - m_ssUidls.insert(vEmails[a].sUidl); - - stringstream s; - s << "You have " << vEmails.size() << " emails."; - PutModule(s.str()); - } else - { - set<CString> ssUidls; - - CTable Table; - Table.AddColumn("From"); - Table.AddColumn("Size"); - Table.AddColumn("Subject"); - - for (u_int a = 0; a < vEmails.size(); a++) - { - if (m_ssUidls.find(vEmails[a].sUidl) == m_ssUidls.end()) - { - //PutModule("------------------- New Email -------------------"); - Table.AddRow(); - Table.SetCell("From", vEmails[a].sFrom.Ellipsize(32)); - Table.SetCell("Size", CString(vEmails[a].iSize)); - Table.SetCell("Subject", vEmails[a].sSubject.Ellipsize(64)); - } - ssUidls.insert(vEmails[a].sUidl); - } - - m_ssUidls = ssUidls; // keep the list in synch - - if (Table.size()) { - PutModule(Table); - - stringstream s; - s << "You have " << vEmails.size() << " emails."; - PutModule(s.str()); - } - } - } - -private: - CString m_sMailPath; - time_t m_iLastCheck; - set<CString> m_ssUidls; - bool m_bInitialized; -}; - -class CEmailFolder : public CSocket -{ -public: - CEmailFolder(CEmail *pModule, const CString & sMailbox) : CSocket(pModule) - { - m_pModule = pModule; - m_sMailbox = sMailbox; - EnableReadLine(); - } - - virtual ~CEmailFolder() - { - if (!m_sMailBuffer.empty()) - ProcessMail(); // get the last one - - if (!m_vEmails.empty()) - m_pModule->ParseEmails(m_vEmails); - } - - virtual void ReadLine(const CS_STRING & sLine) - { - if (sLine.substr(0, 5) == "From ") - { - if (!m_sMailBuffer.empty()) - { - ProcessMail(); - m_sMailBuffer.clear(); - } - } - m_sMailBuffer += sLine; - } - - void ProcessMail() - { - EmailST tmp; - tmp.sUidl = (char *)CMD5(m_sMailBuffer.substr(0, 255)); - VCString vsLines; - VCString::iterator it; - - m_sMailBuffer.Split("\n", vsLines); - - for (it = vsLines.begin(); it != vsLines.end(); it++) { - CString sLine(*it); - sLine.Trim(); - if (sLine.empty()) - break; // out of the headers - - if (sLine.Equals("From: ", false, 6)) - tmp.sFrom = sLine.substr(6, CString::npos); - else if (sLine.Equals("Subject: ", false, 9)) - tmp.sSubject = sLine.substr(9, CString::npos); - - if ((!tmp.sFrom.empty()) && (!tmp.sSubject.empty())) - break; - } - tmp.iSize = m_sMailBuffer.length(); - m_vEmails.push_back(tmp); - } -private: - CEmail *m_pModule; - CString m_sMailbox; - CString m_sMailBuffer; - vector<EmailST> m_vEmails; -}; - -void CEmail::OnModCommand(const CString& sCommand) -{ - CString::size_type iPos = sCommand.find(" "); - CString sCom, sArgs; - if (iPos == CString::npos) - sCom = sCommand; - else - { - sCom = sCommand.substr(0, iPos); - sArgs = sCommand.substr(iPos + 1, CString::npos); - } - - if (sCom == "timers") - { - ListTimers(); - } else - PutModule("Error, no such command [" + sCom + "]"); -} - -void CEmail::StartParser() -{ - CString sParserName = "EMAIL::" + m_pUser->GetUserName(); - - if (m_pManager->FindSockByName(sParserName)) - return; // one at a time sucker - - CFile cFile(m_sMailPath); - if ((!cFile.Exists()) || (cFile.GetSize() == 0)) - { - m_bInitialized = true; - return; // der - } - - if (cFile.GetMTime() <= m_iLastCheck) - return; // only check if modified - - int iFD = open(m_sMailPath.c_str(), O_RDONLY); - if (iFD >= 0) - { - m_iLastCheck = time(NULL); - CEmailFolder *p = new CEmailFolder(this, m_sMailPath); - p->SetRSock(iFD); - p->SetWSock(iFD); - m_pManager->AddSock(p, "EMAIL::" + m_pUser->GetUserName()); - } -} - -void CEmailJob::RunJob() -{ - CEmail *p = (CEmail *)m_pModule; - p->StartParser(); -} -MODULEDEFS(CEmail, "Monitors Email activity on local disk /var/mail/user") - Copied: trunk/modules/extra/email.cpp (from rev 1921, trunk/modules/email.cpp) =================================================================== --- trunk/modules/extra/email.cpp (rev 0) +++ trunk/modules/extra/email.cpp 2010-04-15 15:36:50 UTC (rev 1922) @@ -0,0 +1,254 @@ +/* + * Copyright (C) 2004-2010 See the AUTHORS file for details. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * Email Monitor / Retrieval + * Author: imaginos <ima...@im...> + */ + +#include "MD5.h" +#include "User.h" +#include "znc.h" +#include <sstream> + +using std::stringstream; + +struct EmailST +{ + CString sFrom; + CString sSubject; + CString sUidl; + u_int iSize; +}; + +class CEmailJob : public CTimer +{ +public: + CEmailJob(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription) + : CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {} + + virtual ~CEmailJob() {} + +protected: + virtual void RunJob(); +}; + +class CEmail : public CModule +{ +public: + MODCONSTRUCTOR(CEmail) + { + m_iLastCheck = 0; + m_bInitialized = false; + } + + virtual ~CEmail() {} + + virtual bool OnLoad(const CString & sArgs, CString& sMessage) { + m_sMailPath = sArgs; + + StartParser(); + if (m_pUser->IsUserAttached()) + StartTimer(); + + return true; + } + + virtual void OnClientLogin() + { + stringstream s; + s << "You have " << m_ssUidls.size() << " emails."; + PutModule(s.str()); + StartTimer(); + } + virtual void OnClientDisconnect() + { + RemTimer("EMAIL::" + m_pUser->GetUserName()); + } + + void StartTimer() + { + if (!FindTimer("EMAIL::" + m_pUser->GetUserName())) + { + CEmailJob *p = new CEmailJob(this, 60, 0, "EmailMonitor", "Monitors email activity"); + AddTimer(p); + } + } + + virtual void OnModCommand(const CString& sCommand); + void StartParser(); + + void ParseEmails(const vector<EmailST> & vEmails) + { + if (!m_bInitialized) + { + m_bInitialized = true; + for (u_int a = 0; a < vEmails.size(); a++) + m_ssUidls.insert(vEmails[a].sUidl); + + stringstream s; + s << "You have " << vEmails.size() << " emails."; + PutModule(s.str()); + } else + { + set<CString> ssUidls; + + CTable Table; + Table.AddColumn("From"); + Table.AddColumn("Size"); + Table.AddColumn("Subject"); + + for (u_int a = 0; a < vEmails.size(); a++) + { + if (m_ssUidls.find(vEmails[a].sUidl) == m_ssUidls.end()) + { + //PutModule("------------------- New Email -------------------"); + Table.AddRow(); + Table.SetCell("From", vEmails[a].sFrom.Ellipsize(32)); + Table.SetCell("Size", CString(vEmails[a].iSize)); + Table.SetCell("Subject", vEmails[a].sSubject.Ellipsize(64)); + } + ssUidls.insert(vEmails[a].sUidl); + } + + m_ssUidls = ssUidls; // keep the list in synch + + if (Table.size()) { + PutModule(Table); + + stringstream s; + s << "You have " << vEmails.size() << " emails."; + PutModule(s.str()); + } + } + } + +private: + CString m_sMailPath; + time_t m_iLastCheck; + set<CString> m_ssUidls; + bool m_bInitialized; +}; + +class CEmailFolder : public CSocket +{ +public: + CEmailFolder(CEmail *pModule, const CString & sMailbox) : CSocket(pModule) + { + m_pModule = pModule; + m_sMailbox = sMailbox; + EnableReadLine(); + } + + virtual ~CEmailFolder() + { + if (!m_sMailBuffer.empty()) + ProcessMail(); // get the last one + + if (!m_vEmails.empty()) + m_pModule->ParseEmails(m_vEmails); + } + + virtual void ReadLine(const CS_STRING & sLine) + { + if (sLine.substr(0, 5) == "From ") + { + if (!m_sMailBuffer.empty()) + { + ProcessMail(); + m_sMailBuffer.clear(); + } + } + m_sMailBuffer += sLine; + } + + void ProcessMail() + { + EmailST tmp; + tmp.sUidl = (char *)CMD5(m_sMailBuffer.substr(0, 255)); + VCString vsLines; + VCString::iterator it; + + m_sMailBuffer.Split("\n", vsLines); + + for (it = vsLines.begin(); it != vsLines.end(); it++) { + CString sLine(*it); + sLine.Trim(); + if (sLine.empty()) + break; // out of the headers + + if (sLine.Equals("From: ", false, 6)) + tmp.sFrom = sLine.substr(6, CString::npos); + else if (sLine.Equals("Subject: ", false, 9)) + tmp.sSubject = sLine.substr(9, CString::npos); + + if ((!tmp.sFrom.empty()) && (!tmp.sSubject.empty())) + break; + } + tmp.iSize = m_sMailBuffer.length(); + m_vEmails.push_back(tmp); + } +private: + CEmail *m_pModule; + CString m_sMailbox; + CString m_sMailBuffer; + vector<EmailST> m_vEmails; +}; + +void CEmail::OnModCommand(const CString& sCommand) +{ + CString::size_type iPos = sCommand.find(" "); + CString sCom, sArgs; + if (iPos == CString::npos) + sCom = sCommand; + else + { + sCom = sCommand.substr(0, iPos); + sArgs = sCommand.substr(iPos + 1, CString::npos); + } + + if (sCom == "timers") + { + ListTimers(); + } else + PutModule("Error, no such command [" + sCom + "]"); +} + +void CEmail::StartParser() +{ + CString sParserName = "EMAIL::" + m_pUser->GetUserName(); + + if (m_pManager->FindSockByName(sParserName)) + return; // one at a time sucker + + CFile cFile(m_sMailPath); + if ((!cFile.Exists()) || (cFile.GetSize() == 0)) + { + m_bInitialized = true; + return; // der + } + + if (cFile.GetMTime() <= m_iLastCheck) + return; // only check if modified + + int iFD = open(m_sMailPath.c_str(), O_RDONLY); + if (iFD >= 0) + { + m_iLastCheck = time(NULL); + CEmailFolder *p = new CEmailFolder(this, m_sMailPath); + p->SetRSock(iFD); + p->SetWSock(iFD); + m_pManager->AddSock(p, "EMAIL::" + m_pUser->GetUserName()); + } +} + +void CEmailJob::RunJob() +{ + CEmail *p = (CEmail *)m_pModule; + p->StartParser(); +} +MODULEDEFS(CEmail, "Monitors Email activity on local disk /var/mail/user") + Copied: trunk/modules/extra/imapauth.cpp (from rev 1921, trunk/modules/imapauth.cpp) =================================================================== --- trunk/modules/extra/imapauth.cpp (rev 0) +++ trunk/modules/extra/imapauth.cpp 2010-04-15 15:36:50 UTC (rev 1922) @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2004-2010 See the AUTHORS file for details. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include "Modules.h" +#include "znc.h" + +using std::map; + +class CIMAPAuthMod; + +class CIMAPSock : public CSocket { +public: + CIMAPSock(CIMAPAuthMod* pModule, CSmartPtr<CAuthBase> Auth) + : CSocket((CModule*) pModule), m_spAuth(Auth) { + m_pIMAPMod = pModule; + m_bSentReply = false; + m_bSentLogin = false; + EnableReadLine(); + } + + virtual ~CIMAPSock() { + if (!m_bSentReply) { + m_spAuth->RefuseLogin("IMAP server is down, please try again later"); + } + } + + virtual void ReadLine(const CString& sLine); +private: +protected: + CIMAPAuthMod* m_pIMAPMod; + bool m_bSentLogin; + bool m_bSentReply; + CSmartPtr<CAuthBase> m_spAuth; +}; + + +class CIMAPAuthMod : public CGlobalModule { +public: + GLOBALMODCONSTRUCTOR(CIMAPAuthMod) { + m_Cache.SetTTL(60000); + m_sServer = "localhost"; + m_uPort = 143; + m_bSSL = false; + } + + virtual ~CIMAPAuthMod() {} + + virtual bool OnBoot() { + return true; + } + + virtual bool OnLoad(const CString& sArgs, CString& sMessage) { + if (sArgs.Trim_n().empty()) { + return true; // use defaults + } + + m_sServer = sArgs.Token(0); + CString sPort = sArgs.Token(1); + m_sUserFormat = sArgs.Token(2); + + if (sPort.Left(1) == "+") { + m_bSSL = true; + sPort.LeftChomp(); + } + + unsigned short uPort = sPort.ToUShort(); + + if (uPort) { + m_uPort = uPort; + } + + return true; + } + + virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { + CUser* pUser = CZNC::Get().FindUser(Auth->GetUsername()); + + if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future + Auth->RefuseLogin("Invalid User - Halting IMAP Lookup"); + return HALT; + } + + if (pUser && m_Cache.HasItem(CString(Auth->GetUsername() + ":" + Auth->GetPassword()).MD5())) { + DEBUG("+++ Found in cache"); + Auth->AcceptLogin(*pUser); + return HALT; + } + + CIMAPSock* pSock = new CIMAPSock(this, Auth); + pSock->Connect(m_sServer, m_uPort, m_bSSL, 20); + + return HALT; + } + + virtual void OnModCommand(const CString& sLine) { + } + + void CacheLogin(const CString& sLogin) { + m_Cache.AddItem(sLogin); + } + + // Getters + const CString& GetUserFormat() const { return m_sUserFormat; } + // !Getters +private: + // Settings + CString m_sServer; + unsigned short m_uPort; + bool m_bSSL; + CString m_sUserFormat; + // !Settings + + TCacheMap<CString> m_Cache; +}; + +void CIMAPSock::ReadLine(const CString& sLine) { + if (!m_bSentLogin) { + CString sUsername = m_spAuth->GetUsername(); + m_bSentLogin = true; + + const CString& sFormat = m_pIMAPMod->GetUserFormat(); + + if (!sFormat.empty()) { + if (sFormat.find('%') != CString::npos) { + sUsername = sFormat.Replace_n("%", sUsername); + } else { + sUsername += sFormat; + } + } + + Write("AUTH LOGIN " + sUsername + " " + m_spAuth->GetPassword() + "\r\n"); + } else { + CUser* pUser = CZNC::Get().FindUser(m_spAuth->GetUsername()); + + if (pUser && sLine.Equals("AUTH OK", false, 7)) { + m_spAuth->AcceptLogin(*pUser); + m_pIMAPMod->CacheLogin(CString(m_spAuth->GetUsername() + ":" + m_spAuth->GetPassword()).MD5()); // Use MD5 so passes don't sit in memory in plain text + DEBUG("+++ Successful IMAP lookup"); + } else { + m_spAuth->RefuseLogin("Invalid Password"); + DEBUG("--- FAILED IMAP lookup"); + } + + m_bSentReply = true; + Close(); + } +} + +GLOBALMODULEDEFS(CIMAPAuthMod, "Allow users to authenticate via imap") Deleted: trunk/modules/imapauth.cpp =================================================================== --- trunk/modules/imapauth.cpp 2010-04-15 14:58:00 UTC (rev 1921) +++ trunk/modules/imapauth.cpp 2010-04-15 15:36:50 UTC (rev 1922) @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2004-2010 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include "Modules.h" -#include "znc.h" - -using std::map; - -class CIMAPAuthMod; - -class CIMAPSock : public CSocket { -public: - CIMAPSock(CIMAPAuthMod* pModule, CSmartPtr<CAuthBase> Auth) - : CSocket((CModule*) pModule), m_spAuth(Auth) { - m_pIMAPMod = pModule; - m_bSentReply = false; - m_bSentLogin = false; - EnableReadLine(); - } - - virtual ~CIMAPSock() { - if (!m_bSentReply) { - m_spAuth->RefuseLogin("IMAP server is down, please try again later"); - } - } - - virtual void ReadLine(const CString& sLine); -private: -protected: - CIMAPAuthMod* m_pIMAPMod; - bool m_bSentLogin; - bool m_bSentReply; - CSmartPtr<CAuthBase> m_spAuth; -}; - - -class CIMAPAuthMod : public CGlobalModule { -public: - GLOBALMODCONSTRUCTOR(CIMAPAuthMod) { - m_Cache.SetTTL(60000); - m_sServer = "localhost"; - m_uPort = 143; - m_bSSL = false; - } - - virtual ~CIMAPAuthMod() {} - - virtual bool OnBoot() { - return true; - } - - virtual bool OnLoad(const CString& sArgs, CString& sMessage) { - if (sArgs.Trim_n().empty()) { - return true; // use defaults - } - - m_sServer = sArgs.Token(0); - CString sPort = sArgs.Token(1); - m_sUserFormat = sArgs.Token(2); - - if (sPort.Left(1) == "+") { - m_bSSL = true; - sPort.LeftChomp(); - } - - unsigned short uPort = sPort.ToUShort(); - - if (uPort) { - m_uPort = uPort; - } - - return true; - } - - virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { - CUser* pUser = CZNC::Get().FindUser(Auth->GetUsername()); - - if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future - Auth->RefuseLogin("Invalid User - Halting IMAP Lookup"); - return HALT; - } - - if (pUser && m_Cache.HasItem(CString(Auth->GetUsername() + ":" + Auth->GetPassword()).MD5())) { - DEBUG("+++ Found in cache"); - Auth->AcceptLogin(*pUser); - return HALT; - } - - CIMAPSock* pSock = new CIMAPSock(this, Auth); - pSock->Connect(m_sServer, m_uPort, m_bSSL, 20); - - return HALT; - } - - virtual void OnModCommand(const CString& sLine) { - } - - void CacheLogin(const CString& sLogin) { - m_Cache.AddItem(sLogin); - } - - // Getters - const CString& GetUserFormat() const { return m_sUserFormat; } - // !Getters -private: - // Settings - CString m_sServer; - unsigned short m_uPort; - bool m_bSSL; - CString m_sUserFormat; - // !Settings - - TCacheMap<CString> m_Cache; -}; - -void CIMAPSock::ReadLine(const CString& sLine) { - if (!m_bSentLogin) { - CString sUsername = m_spAuth->GetUsername(); - m_bSentLogin = true; - - const CString& sFormat = m_pIMAPMod->GetUserFormat(); - - if (!sFormat.empty()) { - if (sFormat.find('%') != CString::npos) { - sUsername = sFormat.Replace_n("%", sUsername); - } else { - sUsername += sFormat; - } - } - - Write("AUTH LOGIN " + sUsername + " " + m_spAuth->GetPassword() + "\r\n"); - } else { - CUser* pUser = CZNC::Get().FindUser(m_spAuth->GetUsername()); - - if (pUser && sLine.Equals("AUTH OK", false, 7)) { - m_spAuth->AcceptLogin(*pUser); - m_pIMAPMod->CacheLogin(CString(m_spAuth->GetUsername() + ":" + m_spAuth->GetPassword()).MD5()); // Use MD5 so passes don't sit in memory in plain text - DEBUG("+++ Successful IMAP lookup"); - } else { - m_spAuth->RefuseLogin("Invalid Password"); - DEBUG("--- FAILED IMAP lookup"); - } - - m_bSentReply = true; - Close(); - } -} - -GLOBALMODULEDEFS(CIMAPAuthMod, "Allow users to authenticate via imap") Deleted: trunk/modules/webchat.cpp =================================================================== --- trunk/modules/webchat.cpp 2010-04-15 14:58:00 UTC (rev 1921) +++ trunk/modules/webchat.cpp 2010-04-15 15:36:50 UTC (rev 1922) @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2004-2010 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include "Chan.h" -#include "HTTPSock.h" -#include "Server.h" -#include "Template.h" -#include "User.h" -#include "znc.h" -#include "WebModules.h" -#include <sstream> - -using std::stringstream; - -class CWebChatMod : public CModule { -public: - MODCONSTRUCTOR(CWebChatMod) { - } - - virtual ~CWebChatMod() { - } - - virtual bool OnLoad(const CString& sArgStr, CString& sMessage) { - return true; - } - - virtual bool WebRequiresLogin() { return true; } - virtual bool WebRequiresAdmin() { return false; } - virtual CString GetWebMenuTitle() { return "webchat"; } - - virtual VWebSubPages& GetSubPages() { - ClearSubPages(); - - // @todo Note: I don't actually suggest we use "sub pages" for the channel nav bar - // The channel tabs should be in the main window and updated via jscript - // Examples of good sub pages would be like Status, Chat, Settings, etc. - // Under the Chat subpage we'd have the jscript client with its own chan tabs - const vector<CChan*>& vChans = m_pUser->GetChans(); - - for (size_t a = 0; a < vChans.size(); a++) { - CString sName(vChans[a]->GetName()); - VPair vParams; - - vParams.push_back(make_pair("c", sName)); - AddSubPage(new CWebSubPage("chan", sName, vParams)); - } - - return CModule::GetSubPages(); - } - - virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { - std::cerr << "=============================== webchat sPageName=[" << sPageName << "]" << std::endl; - - if (sPageName.empty() || sPageName == "index") { - return true; - } else if (sPageName == "chan") { - return ChannelPage(WebSock, Tmpl); - } - - return false; - } - - bool ChannelPage(CWebSock& WebSock, CTemplate& Tmpl) { - CChan* pChan = m_pUser->FindChan(WebSock.GetParam("c")); - - if (pChan) { - Tmpl["Title"] = pChan->GetName(); - - const VCString& vLines = pChan->GetBuffer(); - - for (size_t a = 0; a < vLines.size(); a++) { - const CString& sLine(vLines[a]); - CNick Nick(sLine.Token(0).LeftChomp_n()); - CTemplate& Row = Tmpl.AddRow("BufferLoop"); - - if (sLine.Token(1).Equals("PRIVMSG")) { - Row["Type"] = "PRIVMSG"; - Row["Nick"] = Nick.GetNick(); - Row["Message"] = sLine.Token(3, true).TrimLeft_n(":"); - } - } - - const map<CString,CNick*>& msNicks = pChan->GetNicks(); - - for (map<CString,CNick*>::const_iterator it = msNicks.begin(); it != msNicks.end(); it++) { - CTemplate& Row = Tmpl.AddRow("NickLoop"); - CNick& Nick = *it->second; - - Row["Nick"] = Nick.GetNick(); - Row["Ident"] = Nick.GetIdent(); - Row["Host"] = Nick.GetHost(); - Row["ModePrefix"] = CString(Nick.GetPermChar()); - } - - return true; - } - - return false; - } - -private: - map<CString, unsigned int> m_suSwitchCounters; -}; - -MODULEDEFS(CWebChatMod, "Web based chat") Deleted: trunk/modules/www/webchat/chan.tmpl =================================================================== --- trunk/modules/www/webchat/chan.tmpl 2010-04-15 14:58:00 UTC (rev 1921) +++ trunk/modules/www/webchat/chan.tmpl 2010-04-15 15:36:50 UTC (rev 1922) @@ -1,31 +0,0 @@ -<? INC Header.tmpl ?> - -<script type="javascript" src="jisirc.js"></script> -<? VAR ChannelName ?> - -<textarea readonly=on style="width: 75%; height: 350px; display: inline; margin: 0"> -<? LOOP BufferLoop ?> -<? IF Type == "PRIVMSG" ?> -<<? VAR Nick ?>> <? VAR Message ?> -<? ENDIF ?> -<? ENDLOOP ?> -</textarea><select multiple style="width: 20%; height: 350px; vertical-align: top; margin: 0"> -<? LOOP NickLoop ?> -<? IF ModePrefix == "@" ?> -<option value="<? VAR Nick ?>"><? VAR ModePrefix ?><? VAR Nick ?></option> -<? ENDIF ?> -<? ENDLOOP ?> -<? LOOP NickLoop ?> -<? IF ModePrefix == "+" ?> -<option value="<? VAR Nick ?>"><? VAR ModePrefix ?><? VAR Nick ?></option> -<? ENDIF ?> -<? ENDLOOP ?> -<? LOOP NickLoop ?> -<? IF ModePrefix != "@" && ModePrefix != "+" ?> -<option value="<? VAR Nick ?>"><? VAR ModePrefix ?><? VAR Nick ?></option> -<? ENDIF ?> -<? ENDLOOP ?> -</select> -<input style="width: 95%" type="text" value="This box does nothing so far, and you'll have to refresh to get updates!"> - -<? INC Footer.tmpl ?> Deleted: trunk/modules/www/webchat/index.tmpl =================================================================== --- trunk/modules/www/webchat/index.tmpl 2010-04-15 14:58:00 UTC (rev 1921) +++ trunk/modules/www/webchat/index.tmpl 2010-04-15 15:36:50 UTC (rev 1922) @@ -1,5 +0,0 @@ -<? INC Header.tmpl ?> - -Welcome to the webchat module. It's currently more like a buffer reply module since there isn't any real-time back and forth communication (yet). - -<? INC Footer.tmpl ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2010-04-15 15:52:57
|
Revision: 1923 http://znc.svn.sourceforge.net/znc/?rev=1923&view=rev Author: psychon Date: 2010-04-15 15:52:50 +0000 (Thu, 15 Apr 2010) Log Message: ----------- Move discon_kick, blockuser and lastseen out of extra/ discon_kick is renamed to disconkick, seems more consistent with the other modules. Added Paths: ----------- trunk/modules/blockuser.cpp trunk/modules/disconkick.cpp trunk/modules/lastseen.cpp Removed Paths: ------------- trunk/modules/extra/blockuser.cpp trunk/modules/extra/discon_kick.cpp trunk/modules/extra/lastseen.cpp Copied: trunk/modules/blockuser.cpp (from rev 1921, trunk/modules/extra/blockuser.cpp) =================================================================== --- trunk/modules/blockuser.cpp (rev 0) +++ trunk/modules/blockuser.cpp 2010-04-15 15:52:50 UTC (rev 1923) @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2004-2010 See the AUTHORS file for details. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include "User.h" +#include "IRCSock.h" +#include "znc.h" + +#define MESSAGE "Your account has been disabled. Contact your administrator." + +class CBlockUser : public CGlobalModule { +public: + GLOBALMODCONSTRUCTOR(CBlockUser) {} + + virtual ~CBlockUser() {} + + virtual bool OnLoad(const CString& sArgs, CString& sMessage) { + VCString vArgs; + VCString::iterator it; + MCString::iterator it2; + + // Load saved settings + for (it2 = BeginNV(); it2 != EndNV(); ++it2) { + // Ignore errors + Block(it2->first); + } + + // Parse arguments, each argument is a user name to block + sArgs.Split(" ", vArgs, false); + + for (it = vArgs.begin(); it != vArgs.end(); ++it) { + if (!Block(*it)) { + sMessage = "Could not block [" + *it + "]"; + return false; + } + } + + return true; + } + + virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { + if (IsBlocked(Auth->GetUsername())) { + Auth->RefuseLogin(MESSAGE); + return HALT; + } + + return CONTINUE; + } + + void OnModCommand(const CString& sCommand) { + CString sCmd = sCommand.Token(0); + + if (!m_pUser->IsAdmin()) { + PutModule("Access denied"); + return; + } + + if (sCmd.Equals("list")) { + CTable Table; + MCString::iterator it; + + Table.AddColumn("Blocked user"); + + for (it = BeginNV(); it != EndNV(); ++it) { + Table.AddRow(); + Table.SetCell("Blocked user", it->first); + } + + if (PutModule(Table) == 0) + PutModule("No users blocked"); + } else if (sCmd.Equals("block")) { + CString sUser = sCommand.Token(1, true); + + if (m_pUser->GetUserName().Equals(sUser)) { + PutModule("You can't block yourself"); + return; + } + + if (Block(sUser)) + PutModule("Blocked [" + sUser + "]"); + else + PutModule("Could not block [" + sUser + "] (misspelled?)"); + } else if (sCmd.Equals("unblock")) { + CString sUser = sCommand.Token(1, true); + + if (DelNV(sUser)) + PutModule("Unblocked [" + sUser + "]"); + else + PutModule("This user is not blocked"); + } else { + PutModule("Commands: list, block [user], unblock [user]"); + } + } + +private: + bool IsBlocked(const CString& sUser) { + MCString::iterator it; + for (it = BeginNV(); it != EndNV(); ++it) { + if (sUser == it->first) { + return true; + } + } + return false; + } + + bool Block(const CString& sUser) { + CUser *pUser = CZNC::Get().FindUser(sUser); + + if (!pUser) + return false; + + // Disconnect all clients + vector<CClient*>& vpClients = pUser->GetClients(); + vector<CClient*>::iterator it; + for (it = vpClients.begin(); it != vpClients.end(); ++it) { + (*it)->PutStatusNotice(MESSAGE); + (*it)->Close(Csock::CLT_AFTERWRITE); + } + + // Disconnect from IRC... + CIRCSock *pIRCSock = pUser->GetIRCSock(); + if (pIRCSock) { + pIRCSock->Quit(); + } + + // ...and don't reconnect + pUser->SetIRCConnectEnabled(false); + + SetNV(pUser->GetUserName(), ""); + return true; + } +}; + +GLOBALMODULEDEFS(CBlockUser, "Block certain users from logging in") Copied: trunk/modules/disconkick.cpp (from rev 1921, trunk/modules/extra/discon_kick.cpp) =================================================================== --- trunk/modules/disconkick.cpp (rev 0) +++ trunk/modules/disconkick.cpp 2010-04-15 15:52:50 UTC (rev 1923) @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2004-2010 See the AUTHORS file for details. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + + +#include "Modules.h" +#include "User.h" +#include "Chan.h" + +class CKickClientOnIRCDisconnect: public CModule { +public: + MODCONSTRUCTOR(CKickClientOnIRCDisconnect) {} + + void OnIRCDisconnected() + { + const vector<CChan*>& vChans = m_pUser->GetChans(); + + for(vector<CChan*>::const_iterator it = vChans.begin(); it != vChans.end(); ++it) + { + PutUser(":ZNC!zn...@zn... KICK " + (*it)->GetName() + " " + m_pUser->GetIRCNick().GetNick() + + " :You have been disconnected from the IRC server"); + } + } +}; + +MODULEDEFS(CKickClientOnIRCDisconnect, "Kicks the client from all channels when the connection to the IRC server is lost") Deleted: trunk/modules/extra/blockuser.cpp =================================================================== --- trunk/modules/extra/blockuser.cpp 2010-04-15 15:36:50 UTC (rev 1922) +++ trunk/modules/extra/blockuser.cpp 2010-04-15 15:52:50 UTC (rev 1923) @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2004-2010 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include "User.h" -#include "IRCSock.h" -#include "znc.h" - -#define MESSAGE "Your account has been disabled. Contact your administrator." - -class CBlockUser : public CGlobalModule { -public: - GLOBALMODCONSTRUCTOR(CBlockUser) {} - - virtual ~CBlockUser() {} - - virtual bool OnLoad(const CString& sArgs, CString& sMessage) { - VCString vArgs; - VCString::iterator it; - MCString::iterator it2; - - // Load saved settings - for (it2 = BeginNV(); it2 != EndNV(); ++it2) { - // Ignore errors - Block(it2->first); - } - - // Parse arguments, each argument is a user name to block - sArgs.Split(" ", vArgs, false); - - for (it = vArgs.begin(); it != vArgs.end(); ++it) { - if (!Block(*it)) { - sMessage = "Could not block [" + *it + "]"; - return false; - } - } - - return true; - } - - virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { - if (IsBlocked(Auth->GetUsername())) { - Auth->RefuseLogin(MESSAGE); - return HALT; - } - - return CONTINUE; - } - - void OnModCommand(const CString& sCommand) { - CString sCmd = sCommand.Token(0); - - if (!m_pUser->IsAdmin()) { - PutModule("Access denied"); - return; - } - - if (sCmd.Equals("list")) { - CTable Table; - MCString::iterator it; - - Table.AddColumn("Blocked user"); - - for (it = BeginNV(); it != EndNV(); ++it) { - Table.AddRow(); - Table.SetCell("Blocked user", it->first); - } - - if (PutModule(Table) == 0) - PutModule("No users blocked"); - } else if (sCmd.Equals("block")) { - CString sUser = sCommand.Token(1, true); - - if (m_pUser->GetUserName().Equals(sUser)) { - PutModule("You can't block yourself"); - return; - } - - if (Block(sUser)) - PutModule("Blocked [" + sUser + "]"); - else - PutModule("Could not block [" + sUser + "] (misspelled?)"); - } else if (sCmd.Equals("unblock")) { - CString sUser = sCommand.Token(1, true); - - if (DelNV(sUser)) - PutModule("Unblocked [" + sUser + "]"); - else - PutModule("This user is not blocked"); - } else { - PutModule("Commands: list, block [user], unblock [user]"); - } - } - -private: - bool IsBlocked(const CString& sUser) { - MCString::iterator it; - for (it = BeginNV(); it != EndNV(); ++it) { - if (sUser == it->first) { - return true; - } - } - return false; - } - - bool Block(const CString& sUser) { - CUser *pUser = CZNC::Get().FindUser(sUser); - - if (!pUser) - return false; - - // Disconnect all clients - vector<CClient*>& vpClients = pUser->GetClients(); - vector<CClient*>::iterator it; - for (it = vpClients.begin(); it != vpClients.end(); ++it) { - (*it)->PutStatusNotice(MESSAGE); - (*it)->Close(Csock::CLT_AFTERWRITE); - } - - // Disconnect from IRC... - CIRCSock *pIRCSock = pUser->GetIRCSock(); - if (pIRCSock) { - pIRCSock->Quit(); - } - - // ...and don't reconnect - pUser->SetIRCConnectEnabled(false); - - SetNV(pUser->GetUserName(), ""); - return true; - } -}; - -GLOBALMODULEDEFS(CBlockUser, "Block certain users from logging in") Deleted: trunk/modules/extra/discon_kick.cpp =================================================================== --- trunk/modules/extra/discon_kick.cpp 2010-04-15 15:36:50 UTC (rev 1922) +++ trunk/modules/extra/discon_kick.cpp 2010-04-15 15:52:50 UTC (rev 1923) @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2004-2010 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - - -#include "Modules.h" -#include "User.h" -#include "Chan.h" - -class CKickClientOnIRCDisconnect: public CModule { -public: - MODCONSTRUCTOR(CKickClientOnIRCDisconnect) {} - - void OnIRCDisconnected() - { - const vector<CChan*>& vChans = m_pUser->GetChans(); - - for(vector<CChan*>::const_iterator it = vChans.begin(); it != vChans.end(); ++it) - { - PutUser(":ZNC!zn...@zn... KICK " + (*it)->GetName() + " " + m_pUser->GetIRCNick().GetNick() - + " :You have been disconnected from the IRC server"); - } - } -}; - -MODULEDEFS(CKickClientOnIRCDisconnect, "Kicks the client from all channels when the connection to the IRC server is lost") Deleted: trunk/modules/extra/lastseen.cpp =================================================================== --- trunk/modules/extra/lastseen.cpp 2010-04-15 15:36:50 UTC (rev 1922) +++ trunk/modules/extra/lastseen.cpp 2010-04-15 15:52:50 UTC (rev 1923) @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2004-2010 See the AUTHORS file for details. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include "User.h" -#include "Chan.h" -#include "znc.h" - -using std::map; -using std::pair; -using std::multimap; - -class CLastSeenMod : public CGlobalModule { -private: - time_t GetTime(const CUser *pUser) { - return GetNV(pUser->GetUserName()).ToULong(); - } - - void SetTime(const CUser *pUser) { - SetNV(pUser->GetUserName(), CString(time(NULL))); - } - - typedef multimap<time_t, CUser*> MTimeMulti; - typedef map<CString, CUser*> MUsers; -public: - GLOBALMODCONSTRUCTOR(CLastSeenMod) { - } - - virtual ~CLastSeenMod() {} - - // IRC stuff: - - virtual void OnModCommand(const CString& sLine) { - const CString sCommand = sLine.Token(0).AsLower(); - - if (!GetUser()->IsAdmin()) { - PutModule("Access denied"); - return; - } - - if (sCommand == "show") { - char buf[1024]; - const MUsers& mUsers = CZNC::Get().GetUserMap(); - MUsers::const_iterator it; - CTable Table; - - Table.AddColumn("User"); - Table.AddColumn("Last Seen"); - - for (it = mUsers.begin(); it != mUsers.end(); ++it) { - CUser *pUser = it->second; - time_t last = GetTime(pUser); - - Table.AddRow(); - Table.SetCell("User", it->first); - - if (last == 0) - Table.SetCell("Last Seen", "never"); - else { - strftime(buf, sizeof(buf), "%c", localtime(&last)); - Table.SetCell("Last Seen", buf); - } - } - - PutModule(Table); - } else { - PutModule("This module only supports 'show'"); - } - } - - // Event stuff: - - virtual void OnClientLogin() { - SetTime(GetUser()); - } - - virtual void OnClientDisconnect() { - SetTime(GetUser()); - } - - virtual EModRet OnDeleteUser(CUser& User) { - DelNV(User.GetUserName()); - return CONTINUE; - } - - // Web stuff: - - virtual bool WebRequiresAdmin() { return true; } - virtual CString GetWebMenuTitle() { return "Last Seen"; } - - virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { - if (sPageName.empty() || sPageName == "index") { - MTimeMulti mmSorted; - const MUsers& mUsers = CZNC::Get().GetUserMap(); - - for (MUsers::const_iterator uit = mUsers.begin(); uit != mUsers.end(); ++uit) { - mmSorted.insert(pair<time_t, CUser*>(GetTime(uit->second), uit->second)); - } - - char buf[1024] = {0}; - - for (MTimeMulti::const_iterator it = mmSorted.begin(); it != mmSorted.end(); ++it) { - CUser *pUser = it->second; - CTemplate& Row = Tmpl.AddRow("UserLoop"); - - Row["Username"] = pUser->GetUserName(); - Row["IsSelf"] = CString(pUser == WebSock.GetSession()->GetUser()); - - if(it->first > 0) { - strftime(buf, sizeof(buf), "%c", localtime(&it->first)); - Row["LastSeen"] = buf; - } - - Row["Info"] = CString(pUser->GetClients().size()) + " client(s)"; - if(!pUser->GetCurrentServer()) { - Row["Info"] += ", not connected to IRC"; - } else { - unsigned int uChans = 0; - const vector<CChan*>& vChans = pUser->GetChans(); - for (unsigned int a = 0; a < vChans.size(); ++a) { - if (vChans[a]->IsOn()) ++uChans; - } - Row["Info"] += ", joined to " + CString(uChans); - if(uChans != vChans.size()) Row["Info"] += " out of " + CString(vChans.size()) + " configured"; - Row["Info"] += " channel(s)"; - } - } - - return true; - } - - return false; - } -}; - -GLOBALMODULEDEFS(CLastSeenMod, "Collects data about when a user last logged in") Copied: trunk/modules/lastseen.cpp (from rev 1921, trunk/modules/extra/lastseen.cpp) =================================================================== --- trunk/modules/lastseen.cpp (rev 0) +++ trunk/modules/lastseen.cpp 2010-04-15 15:52:50 UTC (rev 1923) @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2004-2010 See the AUTHORS file for details. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include "User.h" +#include "Chan.h" +#include "znc.h" + +using std::map; +using std::pair; +using std::multimap; + +class CLastSeenMod : public CGlobalModule { +private: + time_t GetTime(const CUser *pUser) { + return GetNV(pUser->GetUserName()).ToULong(); + } + + void SetTime(const CUser *pUser) { + SetNV(pUser->GetUserName(), CString(time(NULL))); + } + + typedef multimap<time_t, CUser*> MTimeMulti; + typedef map<CString, CUser*> MUsers; +public: + GLOBALMODCONSTRUCTOR(CLastSeenMod) { + } + + virtual ~CLastSeenMod() {} + + // IRC stuff: + + virtual void OnModCommand(const CString& sLine) { + const CString sCommand = sLine.Token(0).AsLower(); + + if (!GetUser()->IsAdmin()) { + PutModule("Access denied"); + return; + } + + if (sCommand == "show") { + char buf[1024]; + const MUsers& mUsers = CZNC::Get().GetUserMap(); + MUsers::const_iterator it; + CTable Table; + + Table.AddColumn("User"); + Table.AddColumn("Last Seen"); + + for (it = mUsers.begin(); it != mUsers.end(); ++it) { + CUser *pUser = it->second; + time_t last = GetTime(pUser); + + Table.AddRow(); + Table.SetCell("User", it->first); + + if (last == 0) + Table.SetCell("Last Seen", "never"); + else { + strftime(buf, sizeof(buf), "%c", localtime(&last)); + Table.SetCell("Last Seen", buf); + } + } + + PutModule(Table); + } else { + PutModule("This module only supports 'show'"); + } + } + + // Event stuff: + + virtual void OnClientLogin() { + SetTime(GetUser()); + } + + virtual void OnClientDisconnect() { + SetTime(GetUser()); + } + + virtual EModRet OnDeleteUser(CUser& User) { + DelNV(User.GetUserName()); + return CONTINUE; + } + + // Web stuff: + + virtual bool WebRequiresAdmin() { return true; } + virtual CString GetWebMenuTitle() { return "Last Seen"; } + + virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { + if (sPageName.empty() || sPageName == "index") { + MTimeMulti mmSorted; + const MUsers& mUsers = CZNC::Get().GetUserMap(); + + for (MUsers::const_iterator uit = mUsers.begin(); uit != mUsers.end(); ++uit) { + mmSorted.insert(pair<time_t, CUser*>(GetTime(uit->second), uit->second)); + } + + char buf[1024] = {0}; + + for (MTimeMulti::const_iterator it = mmSorted.begin(); it != mmSorted.end(); ++it) { + CUser *pUser = it->second; + CTemplate& Row = Tmpl.AddRow("UserLoop"); + + Row["Username"] = pUser->GetUserName(); + Row["IsSelf"] = CString(pUser == WebSock.GetSession()->GetUser()); + + if(it->first > 0) { + strftime(buf, sizeof(buf), "%c", localtime(&it->first)); + Row["LastSeen"] = buf; + } + + Row["Info"] = CString(pUser->GetClients().size()) + " client(s)"; + if(!pUser->GetCurrentServer()) { + Row["Info"] += ", not connected to IRC"; + } else { + unsigned int uChans = 0; + const vector<CChan*>& vChans = pUser->GetChans(); + for (unsigned int a = 0; a < vChans.size(); ++a) { + if (vChans[a]->IsOn()) ++uChans; + } + Row["Info"] += ", joined to " + CString(uChans); + if(uChans != vChans.size()) Row["Info"] += " out of " + CString(vChans.size()) + " configured"; + Row["Info"] += " channel(s)"; + } + } + + return true; + } + + return false; + } +}; + +GLOBALMODULEDEFS(CLastSeenMod, "Collects data about when a user last logged in") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2010-04-25 14:46:51
|
Revision: 1937 http://znc.svn.sourceforge.net/znc/?rev=1937&view=rev Author: psychon Date: 2010-04-25 14:46:45 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Webadmin: Use a dedicated page for confirming user deletes The old Javascript way didn't work when one had javascript disabled. Modified Paths: -------------- trunk/modules/webadmin.cpp trunk/modules/www/webadmin/listusers.tmpl Added Paths: ----------- trunk/modules/www/webadmin/del_user.tmpl Modified: trunk/modules/webadmin.cpp =================================================================== --- trunk/modules/webadmin.cpp 2010-04-25 14:45:22 UTC (rev 1936) +++ trunk/modules/webadmin.cpp 2010-04-25 14:46:45 UTC (rev 1937) @@ -293,6 +293,20 @@ return false; } + if (!WebSock.IsPost()) { + CString sUser = WebSock.GetParam("user", true); + CUser* pUser = CZNC::Get().FindUser(sUser); + + if (!pUser) { + WebSock.PrintErrorPage("No such username"); + return true; + } + + Tmpl.SetFile("del_user.tmpl"); + Tmpl["Username"] = sUser; + return true; + } + CString sUser = WebSock.GetParam("user"); CUser* pUser = CZNC::Get().FindUser(sUser); Added: trunk/modules/www/webadmin/del_user.tmpl =================================================================== --- trunk/modules/www/webadmin/del_user.tmpl (rev 0) +++ trunk/modules/www/webadmin/del_user.tmpl 2010-04-25 14:46:45 UTC (rev 1937) @@ -0,0 +1,18 @@ +<? INC Header.tmpl ?> + +<div class="section"> + Are you sure you want to delete "<? VAR Username ?>"? + + <form action="deluser" method="post"> + <? INC _csrf_check.tmpl ?> + <input type="hidden" name="submitted" value="1" /> + <input type="hidden" name="user" value="<? VAR Username ?>" /> + + <input type="submit" value="Yes" /> + </form> + <form action="listusers" method="get"> + <input type="submit" value="No" /> + </form> +</div> + +<? INC Footer.tmpl ?> Modified: trunk/modules/www/webadmin/listusers.tmpl =================================================================== --- trunk/modules/www/webadmin/listusers.tmpl 2010-04-25 14:45:22 UTC (rev 1936) +++ trunk/modules/www/webadmin/listusers.tmpl 2010-04-25 14:46:45 UTC (rev 1937) @@ -23,7 +23,7 @@ <td> <span class="nowrap"> [<a href="edituser?user=<?VAR Username ESC=URL?>">Edit</a>] - <? IF !IsSelf ?>[<a href="deluser?user=<?VAR Username ESC=URL?>" onClick="return confirm('Do you really wish to remove this user?');">Delete</a>]<? ENDIF ?> + <? IF !IsSelf ?>[<a href="deluser?user=<?VAR Username ESC=URL?>">Delete</a>]<? ENDIF ?> </span> </td> <td><? VAR Username ?></td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cf...@us...> - 2010-05-01 12:04:50
|
Revision: 1958 http://znc.svn.sourceforge.net/znc/?rev=1958&view=rev Author: cflakes Date: 2010-05-01 12:04:44 +0000 (Sat, 01 May 2010) Log Message: ----------- Added a "Traffic Info" page to webadmin. 99% of the patch have been done by BrianC, so thanks again. Modified Paths: -------------- trunk/modules/webadmin.cpp Added Paths: ----------- trunk/modules/www/webadmin/traffic.tmpl Modified: trunk/modules/webadmin.cpp =================================================================== --- trunk/modules/webadmin.cpp 2010-05-01 11:36:42 UTC (rev 1957) +++ trunk/modules/webadmin.cpp 2010-05-01 12:04:44 UTC (rev 1958) @@ -29,6 +29,7 @@ vParams.push_back(make_pair("user", "")); AddSubPage(new CWebSubPage("settings", "Global Settings", CWebSubPage::F_ADMIN)); AddSubPage(new CWebSubPage("edituser", "Your Settings", vParams)); + AddSubPage(new CWebSubPage("traffic", "Traffic Info", CWebSubPage::F_ADMIN)); AddSubPage(new CWebSubPage("listusers", "List Users", CWebSubPage::F_ADMIN)); AddSubPage(new CWebSubPage("adduser", "Add User", CWebSubPage::F_ADMIN)); } @@ -363,12 +364,10 @@ WebSock.PrintErrorPage("No such username"); return true; - } else if (sPageName == "listusers") { - if (!spSession->IsAdmin()) { - return false; - } - + } else if (sPageName == "listusers" && spSession->IsAdmin()) { return ListUsersPage(WebSock, Tmpl); + } else if (sPageName == "traffic" && spSession->IsAdmin()) { + return TrafficPage(WebSock, Tmpl); } else if (sPageName.empty() || sPageName == "index") { return true; } @@ -747,6 +746,60 @@ return true; } + bool TrafficPage(CWebSock& WebSock, CTemplate& Tmpl) { + CSmartPtr<CWebSession> spSession = WebSock.GetSession(); + Tmpl["Uptime"] = CZNC::Get().GetUptime(); + + if (spSession->IsAdmin()) { + const map<CString,CUser*>& msUsers = CZNC::Get().GetUserMap(); + Tmpl["TotalUsers"] = CString(msUsers.size()); + + unsigned int uiAttached = 0, uiClients = 0, uiServers = 0; + + for (map<CString,CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); ++it) { + CUser& User = *it->second; + if (User.IsUserAttached()) { + uiAttached++; + } + if (User.IsIRCConnected()) { + uiServers++; + } + uiClients += User.GetClients().size(); + } + + Tmpl["AttachedUsers"] = CString(uiAttached); + Tmpl["TotalCConnections"] = CString(uiClients); + Tmpl["TotalIRCConnections"] = CString(uiServers); + + CZNC::TrafficStatsPair Users, ZNC, Total; + CZNC::TrafficStatsMap traffic = CZNC::Get().GetTrafficStats(Users, ZNC, Total); + CZNC::TrafficStatsMap::const_iterator it; + + for (it = traffic.begin(); it != traffic.end(); ++it) { + CTemplate& l = Tmpl.AddRow("TrafficLoop"); + + l["Username"] = it->first; + l["In"] = CString::ToByteStr(it->second.first); + l["Out"] = CString::ToByteStr(it->second.second); + l["Total"] = CString::ToByteStr(it->second.first + it->second.second); + } + + Tmpl["UserIn"] = CString::ToByteStr(Users.first); + Tmpl["UserOut"] = CString::ToByteStr(Users.second); + Tmpl["UserTotal"] = CString::ToByteStr(Users.first + Users.second); + + Tmpl["ZNCIn"] = CString::ToByteStr(ZNC.first); + Tmpl["ZNCOut"] = CString::ToByteStr(ZNC.second); + Tmpl["ZNCTotal"] = CString::ToByteStr(ZNC.first + ZNC.second); + + Tmpl["AllIn"] = CString::ToByteStr(Total.first); + Tmpl["AllOut"] = CString::ToByteStr(Total.second); + Tmpl["AllTotal"] = CString::ToByteStr(Total.first + Total.second); + } + + return true; + } + bool SettingsPage(CWebSock& WebSock, CTemplate& Tmpl) { if (!WebSock.GetParam("submitted").ToUInt()) { CString sVHosts, sMotd; Added: trunk/modules/www/webadmin/traffic.tmpl =================================================================== --- trunk/modules/www/webadmin/traffic.tmpl (rev 0) +++ trunk/modules/www/webadmin/traffic.tmpl 2010-05-01 12:04:44 UTC (rev 1958) @@ -0,0 +1,94 @@ +<? INC Header.tmpl ?> + +<div class="textsection"> + +<div class="section"> + <h3>Information</h3> + <div class="sectionbg"> + <div class="sectionbody"> + <table> + <tbody> + <tr class="oddrow"> + <td>Uptime</td> + <td><? VAR Uptime ?></td> + </tr> + <? IF IsAdmin ?> + <tr class="evenrow"> + <td>Total Users</td> + <td><? VAR TotalUsers ?></td> + </tr> + <tr class="oddrow"> + <td>Attached Users</td> + <td><? VAR AttachedUsers ?></td> + </tr> + <tr class="evenrow"> + <td>Total Client Connections</td> + <td><? VAR TotalCConnections ?></td> + </tr> + <tr class="oddrow"> + <td>Total IRC Connections</td> + <td><? VAR TotalIRCConnections ?></td> + </tr> + <? ENDIF ?> + </tbody> + </table> + </div> + </div> +</div> + +<? IF IsAdmin && TrafficLoop ?> +<div class="section"> + <h3>Traffic</h3> + <div class="sectionbg"> + <div class="sectionbody"> + <table> + <thead> + <tr> + <td>Username</td> + <td>In</td> + <td>Out</td> + <td>Total</td> + </tr> + </thead> + <tbody> + <? LOOP TrafficLoop SORTASC=Username ?> + <tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>"> + <td><? VAR Username ?></td> + <td><? VAR In ?></td> + <td><? VAR Out ?></td> + <td><? VAR Total ?></td> + </tr> + <? REM ?>Add the totals separately so that if sort is ever used they stay at the bottom + By keeping them inside the loop we can figure out even/odd classes though. + <? ENDREM ?> + <? IF __LAST__ ?> + <tr class="<? IF __EVEN__ ?>oddrow<? ELSE ?>evenrow<? ENDIF ?>"> + <td>User Total</td> + <td><? VAR UserIn TOP ?></td> + <td><? VAR UserOut TOP ?></td> + <td><? VAR UserTotal TOP ?></td> + </tr> + <tr class="<? IF __EVEN__ ?>evenrow<? ELSE ?>oddrow<? ENDIF ?>"> + <td>ZNC Total</td> + <td><? VAR ZNCIn TOP ?></td> + <td><? VAR ZNCOut TOP ?></td> + <td><? VAR ZNCTotal TOP ?></td> + </tr> + <tr class="<? IF __EVEN__ ?>oddrow<? ELSE ?>evenrow<? ENDIF ?>"> + <td>Grand Total</td> + <td><? VAR AllIn TOP ?></td> + <td><? VAR AllOut TOP ?></td> + <td><? VAR AllTotal TOP ?></td> + </tr> + <? ENDIF ?> + <? ENDLOOP ?> + </tbody> + </table> + </div> + </div> +</div> +<? ENDIF ?> + +</div> + +<? INC Footer.tmpl ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-09-09 03:30:33
|
Revision: 2126 http://znc.svn.sourceforge.net/znc/?rev=2126&view=rev Author: darthgandalf Date: 2010-09-09 03:30:27 +0000 (Thu, 09 Sep 2010) Log Message: ----------- Lastseen module doesn't display links to webadmin webpages anymore if webadmin isn't loaded. Patch by BrianC, thanks. Modified Paths: -------------- trunk/modules/lastseen/tmpl/index.tmpl trunk/modules/lastseen.cpp Modified: trunk/modules/lastseen/tmpl/index.tmpl =================================================================== --- trunk/modules/lastseen/tmpl/index.tmpl 2010-09-09 03:29:59 UTC (rev 2125) +++ trunk/modules/lastseen/tmpl/index.tmpl 2010-09-09 03:30:27 UTC (rev 2126) @@ -7,7 +7,7 @@ <td>User</td> <td>Last Seen</td> <td>Info</td> - <td>Action</td> + <? IF WebAdminLoaded ?><td>Action</td><? ENDIF ?> </tr> </thead> <tbody> @@ -16,10 +16,10 @@ <td><? VAR Username ?></td> <td><? VAR LastSeen DEFAULT="- unknown -" ?></td> <td><? VAR Info ?></td> - <td><span class="nowrap"> + <? IF WebAdminLoaded TOP ?><td><span class="nowrap"> [<a href="/mods/webadmin/edituser?user=<?VAR Username ESC=URL?>">Edit</a>] <? IF !IsSelf ?>[<a href="/mods/webadmin/deluser?user=<?VAR Username ESC=URL?>">Delete</a>]<? ENDIF ?> - </span></td> + </span></td><? ENDIF ?> </tr> <? ENDLOOP ?> </tbody> Modified: trunk/modules/lastseen.cpp =================================================================== --- trunk/modules/lastseen.cpp 2010-09-09 03:29:59 UTC (rev 2125) +++ trunk/modules/lastseen.cpp 2010-09-09 03:30:27 UTC (rev 2126) @@ -94,6 +94,16 @@ virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName.empty() || sPageName == "index") { + CModules& GModules = CZNC::Get().GetModules(); + if (GModules.size()) { + for (unsigned int b = 0; b < GModules.size(); b++) { + if(GModules[b]->GetModName().Equals("WEBADMIN")) { + Tmpl["WebAdminLoaded"] = "true"; + break; + } + } + } + MTimeMulti mmSorted; const MUsers& mUsers = CZNC::Get().GetUserMap(); @@ -134,7 +144,7 @@ Row["Info"] += " channel" + CString(n == 1 ? "" : "s"); } } - + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-09-11 18:52:30
|
Revision: 2129 http://znc.svn.sourceforge.net/znc/?rev=2129&view=rev Author: darthgandalf Date: 2010-09-11 18:52:24 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Webadmin now supports embedding of web stuff to user and channel pages. Modified Paths: -------------- trunk/modules/webadmin/tmpl/add_edit_chan.tmpl trunk/modules/webadmin/tmpl/add_edit_user.tmpl trunk/modules/webadmin.cpp Modified: trunk/modules/webadmin/tmpl/add_edit_chan.tmpl =================================================================== --- trunk/modules/webadmin/tmpl/add_edit_chan.tmpl 2010-09-11 18:51:54 UTC (rev 2128) +++ trunk/modules/webadmin/tmpl/add_edit_chan.tmpl 2010-09-11 18:52:24 UTC (rev 2129) @@ -51,6 +51,15 @@ </div> </div> + <? LOOP EmbeddedModuleLoop ?> + <? IF Embed ?> + <div class="section"> + <h3>Module <? VAR ModName ?></h3> + <? INC *Embed ?> + </div> + <? ENDIF ?> + <? ENDLOOP ?> + <div class="submitline"> <input type="submit" value="<? IF Edit ?>Save<? ELSE ?>Add Channel<? ENDIF ?>" /> </div> Modified: trunk/modules/webadmin/tmpl/add_edit_user.tmpl =================================================================== --- trunk/modules/webadmin/tmpl/add_edit_user.tmpl 2010-09-11 18:51:54 UTC (rev 2128) +++ trunk/modules/webadmin/tmpl/add_edit_user.tmpl 2010-09-11 18:52:24 UTC (rev 2129) @@ -267,6 +267,15 @@ </div> </div> + <? LOOP EmbeddedModuleLoop ?> + <? IF Embed ?> + <div class="section"> + <h3>Module <? VAR ModName ?></h3> + <? INC *Embed ?> + </div> + <? ENDIF ?> + <? ENDLOOP ?> + <div class="submitline"> <input type="submit" value="<? IF Edit ?>Save<? ELSE ?>Create<? ENDIF ?>" /> </div> Modified: trunk/modules/webadmin.cpp =================================================================== --- trunk/modules/webadmin.cpp 2010-09-11 18:51:54 UTC (rev 2128) +++ trunk/modules/webadmin.cpp 2010-09-11 18:52:24 UTC (rev 2129) @@ -21,7 +21,39 @@ using std::stringstream; using std::make_pair; +/* Stuff to be able to write this: + // i will be name of local variable, see below + // pUser can be NULL if only global modules are needed + FOR_EACH_MODULE(i, pUser) { + // i is local variable of type CModules::iterator, + // so *i has type CModule* + } +*/ +struct FOR_EACH_MODULE_Type { + bool bOnCMuser; + CModules CMtemp; + CModules& CMuser; + FOR_EACH_MODULE_Type(CUser* pUser) : CMuser(pUser ? pUser->GetModules() : CMtemp) { + bOnCMuser = false; + } + operator bool() { return false; } +}; +inline bool FOR_EACH_MODULE_CanContinue(FOR_EACH_MODULE_Type& state, CModules::iterator& i) { + if (!state.bOnCMuser && i == CZNC::Get().GetModules().end()) { + i = state.CMuser.begin(); + state.bOnCMuser = true; + } + if (state.bOnCMuser && i == state.CMuser.end()) { + return false; + } + return true; +} + +#define FOR_EACH_MODULE(I, pUser)\ + if (FOR_EACH_MODULE_Type FOR_EACH_MODULE_Var = pUser) {} else\ + for (CModules::iterator I = CZNC::Get().GetModules().begin(); FOR_EACH_MODULE_CanContinue(FOR_EACH_MODULE_Var, I); ++I) + class CWebAdminMod : public CGlobalModule { public: GLOBALMODCONSTRUCTOR(CWebAdminMod) { @@ -493,6 +525,16 @@ o3["DisplayName"] = "Detached"; if (pChan && pChan->IsDetached()) { o3["Checked"] = "true"; } + FOR_EACH_MODULE(i, pUser) { + CTemplate& mod = Tmpl.AddRow("EmbeddedModuleLoop"); + mod.insert(Tmpl.begin(), Tmpl.end()); + mod["WebadminAction"] = "display"; + if ((*i)->OnEmbeddedWebRequest(WebSock, "webadmin/channel", mod)) { + mod["Embed"] = WebSock.FindTmpl(*i, "WebadminChan.tmpl"); + mod["ModName"] = (*i)->GetModName(); + } + } + return true; } @@ -528,6 +570,14 @@ } } + CTemplate TmplMod; + TmplMod["User"] = pUser->GetUserName(); + TmplMod["ChanName"] = sChanName; + TmplMod["WebadminAction"] = "change"; + FOR_EACH_MODULE(it, pUser) { + (*it)->OnEmbeddedWebRequest(WebSock, "webadmin/channel", TmplMod); + } + if (!CZNC::Get().WriteConfig()) { WebSock.PrintErrorPage("Channel added/modified, but config was not written"); return true; @@ -738,6 +788,16 @@ if (pUser && pUser->DenySetBindHost()) { o11["Checked"] = "true"; } } + FOR_EACH_MODULE(i, pUser) { + CTemplate& mod = Tmpl.AddRow("EmbeddedModuleLoop"); + mod.insert(Tmpl.begin(), Tmpl.end()); + mod["WebadminAction"] = "display"; + if ((*i)->OnEmbeddedWebRequest(WebSock, "webadmin/user", mod)) { + mod["Embed"] = WebSock.FindTmpl(*i, "WebadminUser.tmpl"); + mod["ModName"] = (*i)->GetModName(); + } + } + return true; } @@ -755,6 +815,7 @@ } CString sErr; + CString sAction; if (!pUser) { // Add User Submission @@ -764,10 +825,8 @@ return true; } - if (!CZNC::Get().WriteConfig()) { - WebSock.PrintErrorPage("User added, but config was not written"); - return true; - } + pUser = pNewUser; + sAction = "added"; } else { // Edit User Submission if (!pUser->Clone(*pNewUser, sErr, false)) { @@ -777,12 +836,21 @@ } delete pNewUser; - if (!CZNC::Get().WriteConfig()) { - WebSock.PrintErrorPage("User edited, but config was not written"); - return true; - } + sAction = "edited"; } + CTemplate TmplMod; + TmplMod["Username"] = sUsername; + TmplMod["WebadminAction"] = "change"; + FOR_EACH_MODULE(it, pUser) { + (*it)->OnEmbeddedWebRequest(WebSock, "webadmin/user", TmplMod); + } + + if (!CZNC::Get().WriteConfig()) { + WebSock.PrintErrorPage("User " + sAction + ", but config was not written"); + return true; + } + if (!spSession->IsAdmin()) { WebSock.Redirect("edituser"); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-09-11 18:52:57
|
Revision: 2130 http://znc.svn.sourceforge.net/znc/?rev=2130&view=rev Author: darthgandalf Date: 2010-09-11 18:52:51 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Lastseen module embeds info about last login time to webadmin user page. Modified Paths: -------------- trunk/modules/lastseen.cpp Added Paths: ----------- trunk/modules/lastseen/tmpl/WebadminUser.tmpl Added: trunk/modules/lastseen/tmpl/WebadminUser.tmpl =================================================================== --- trunk/modules/lastseen/tmpl/WebadminUser.tmpl (rev 0) +++ trunk/modules/lastseen/tmpl/WebadminUser.tmpl 2010-09-11 18:52:51 UTC (rev 2130) @@ -0,0 +1,9 @@ +<div class="sectionbg"> + <div class="sectionbody"> + <div class="subsection"> + <div class="inputlabel">Last login time:</div> + <div><input type="text" readonly="readonly" value="<? VAR LastSeen DEFAULT="- unknown -" ?>" class="half" /></div> + </div> + <div style="clear:both;"></div> + </div> +</div> Modified: trunk/modules/lastseen.cpp =================================================================== --- trunk/modules/lastseen.cpp 2010-09-11 18:52:24 UTC (rev 2129) +++ trunk/modules/lastseen.cpp 2010-09-11 18:52:51 UTC (rev 2130) @@ -150,6 +150,24 @@ return false; } + + virtual bool OnEmbeddedWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { + if (sPageName == "webadmin/user" && WebSock.GetSession()->IsAdmin()) { + CUser* pUser = CZNC::Get().FindUser(Tmpl["Username"]); + if (pUser) { + time_t last = GetTime(pUser); + if (last) { + char buf[1024] = {0}; + strftime(buf, sizeof(buf), "%c", localtime(&last)); + Tmpl["LastSeen"] = buf; + } + } + return true; + } + + return false; + } + }; GLOBALMODULEDEFS(CLastSeenMod, "Collects data about when a user last logged in") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-09-11 18:53:36
|
Revision: 2131 http://znc.svn.sourceforge.net/znc/?rev=2131&view=rev Author: darthgandalf Date: 2010-09-11 18:53:30 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Blockuser module adds a checkbox to user page in webadmin. Modified Paths: -------------- trunk/modules/blockuser.cpp Added Paths: ----------- trunk/modules/blockuser/ trunk/modules/blockuser/tmpl/ trunk/modules/blockuser/tmpl/WebadminUser.tmpl Added: trunk/modules/blockuser/tmpl/WebadminUser.tmpl =================================================================== --- trunk/modules/blockuser/tmpl/WebadminUser.tmpl (rev 0) +++ trunk/modules/blockuser/tmpl/WebadminUser.tmpl 2010-09-11 18:53:30 UTC (rev 2131) @@ -0,0 +1,13 @@ +<div class="sectionbg"> + <div class="sectionbody"> + <div class="subsection"> + <input type="hidden" name="embed_blockuser_presented" value="1"> + <input type="hidden" name="embed_blockuser_old" value="<? VAR Blocked ?>"> + <div class="checkbox"> + <input type="checkbox" name="embed_blockuser_block" id="opt_embed_blockuser_block" value="1"<? IF Blocked ?> checked="checked"<? ENDIF ?><? IF Self ?> disabled="disabled"<? ENDIF ?> /> + <label for="opt_embed_blockuser_block">Account is blocked</label> + </div> + </div> + <div style="clear:both;"></div> + </div> +</div> Modified: trunk/modules/blockuser.cpp =================================================================== --- trunk/modules/blockuser.cpp 2010-09-11 18:52:51 UTC (rev 2130) +++ trunk/modules/blockuser.cpp 2010-09-11 18:53:30 UTC (rev 2131) @@ -96,6 +96,39 @@ } } + bool OnEmbeddedWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { + if (sPageName == "webadmin/user" && WebSock.GetSession()->IsAdmin()) { + CString sAction = Tmpl["WebadminAction"]; + if (sAction == "display") { + Tmpl["Blocked"] = CString(IsBlocked(Tmpl["Username"])); + Tmpl["Self"] = CString(Tmpl["Username"].Equals(WebSock.GetSession()->GetUser()->GetUserName())); + return true; + } + if (sAction == "change" && WebSock.GetParam("embed_blockuser_presented").ToBool()) { + if (Tmpl["Username"].Equals(WebSock.GetSession()->GetUser()->GetUserName()) && + WebSock.GetParam("embed_blockuser_block").ToBool()) { + WebSock.GetSession()->AddError("You can't block yourself"); + } else if (WebSock.GetParam("embed_blockuser_block").ToBool()) { + if (!WebSock.GetParam("embed_blockuser_old").ToBool()) { + if (Block(Tmpl["Username"])) { + WebSock.GetSession()->AddSuccess("Blocked [" + Tmpl["Username"] + "]"); + } else { + WebSock.GetSession()->AddError("Couldn't block [" + Tmpl["Username"] + "]"); + } + } + } else if (WebSock.GetParam("embed_blockuser_old").ToBool()){ + if (DelNV(Tmpl["Username"])) { + WebSock.GetSession()->AddSuccess("Unblocked [" + Tmpl["Username"] + "]"); + } else { + WebSock.GetSession()->AddError("User [" + Tmpl["Username"] + "is not blocked"); + } + } + return true; + } + } + return false; + } + private: bool IsBlocked(const CString& sUser) { MCString::iterator it; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-09-11 18:54:03
|
Revision: 2132 http://znc.svn.sourceforge.net/znc/?rev=2132&view=rev Author: darthgandalf Date: 2010-09-11 18:53:57 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Stickychan module adds a checkbox to channel page of webadmin. Modified Paths: -------------- trunk/modules/stickychan.cpp Added Paths: ----------- trunk/modules/stickychan/tmpl/WebadminChan.tmpl Added: trunk/modules/stickychan/tmpl/WebadminChan.tmpl =================================================================== --- trunk/modules/stickychan/tmpl/WebadminChan.tmpl (rev 0) +++ trunk/modules/stickychan/tmpl/WebadminChan.tmpl 2010-09-11 18:53:57 UTC (rev 2132) @@ -0,0 +1,12 @@ + <div class="sectionbg"> + <div class="sectionbody"> +<div class="subsection"> + <input type="hidden" name="embed_stickychan_presented" value="1"> + <div class="checkbox"> + <input type="checkbox" name="embed_stickychan_sticky" id="opt_embed_stickychan_sticky" value="1"<? IF Sticky ?> checked="checked"<? ENDIF ?> /> + <label for="opt_embed_stickychan_sticky">Channel is sticky</label> + </div> +</div> +<div style="clear:both;"></div> + </div> + </div> Modified: trunk/modules/stickychan.cpp =================================================================== --- trunk/modules/stickychan.cpp 2010-09-11 18:53:30 UTC (rev 2131) +++ trunk/modules/stickychan.cpp 2010-09-11 18:53:57 UTC (rev 2132) @@ -139,6 +139,27 @@ return false; } + virtual bool OnEmbeddedWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { + if (sPageName == "webadmin/channel") { + CString sChan = Tmpl["ChanName"]; + bool bStick = FindNV(sChan) != EndNV(); + if (Tmpl["WebadminAction"].Equals("display")) { + Tmpl["Sticky"] = CString(bStick); + } else if (WebSock.GetParam("embed_stickychan_presented").ToBool()) { + bool bNewStick = WebSock.GetParam("embed_stickychan_sticky").ToBool(); + if(bNewStick && !bStick) { + SetNV(sChan, ""); // no password support for now unless chansaver is active too + WebSock.GetSession()->AddSuccess("Channel become sticky!"); + } else if(!bNewStick && bStick) { + DelNV(sChan); + WebSock.GetSession()->AddSuccess("Channel stopped being sticky!"); + } + } + return true; + } + return false; + } + }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-10-10 09:59:21
|
Revision: 2156 http://znc.svn.sourceforge.net/znc/?rev=2156&view=rev Author: darthgandalf Date: 2010-10-10 09:59:15 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Remove sockets and timers from perl modules in their destructors. This should decrease memory usage a bit, and decrease chance of crashing znc from bad perl module a bit. Modified Paths: -------------- trunk/modules/modperl/module.h trunk/modules/modperl/startup.pl trunk/modules/modperl.cpp Modified: trunk/modules/modperl/module.h =================================================================== --- trunk/modules/modperl/module.h 2010-10-02 12:39:20 UTC (rev 2155) +++ trunk/modules/modperl/module.h 2010-10-10 09:59:15 UTC (rev 2156) @@ -107,6 +107,7 @@ } virtual void RunJob(); CString GetPerlID() { return m_sPerlID; } + ~CPerlTimer(); }; inline CPerlTimer* CreatePerlTimer(CPerlModule* pModule, unsigned int uInterval, unsigned int uCycles, @@ -119,6 +120,7 @@ public: CPerlSocket(CPerlModule* pModule, const CString& sPerlID) : CSocket(pModule), m_sPerlID(sPerlID) {} CString GetPerlID() { return m_sPerlID; } + ~CPerlSocket(); virtual void Connected(); virtual void Disconnected(); virtual void Timeout(); Modified: trunk/modules/modperl/startup.pl =================================================================== --- trunk/modules/modperl/startup.pl 2010-10-02 12:39:20 UTC (rev 2155) +++ trunk/modules/modperl/startup.pl 2010-10-10 09:59:15 UTC (rev 2156) @@ -171,6 +171,18 @@ $pmods{$modid}->_CallSocket(@_) } +sub RemoveTimer { + my $modid = shift; + my $timerid = shift; + $pmods{$modid}->_RemoveTimer($timerid) +} + +sub RemoveSocket { + my $modid = shift; + my $sockid = shift; + $pmods{$modid}->_RemoveSocket($sockid) +} + package ZNC::ModuleNV; sub TIEHASH { @@ -377,6 +389,13 @@ &{$self->{_ptimers}{$id}{job}}($self, $self->{_ptimers}{$id}{obj}); } +sub _RemoveTimer { + my $self = shift; + my $id = shift; + say "Removing perl timer $id"; + delete $self->{_ptimers}{$id} +} + sub CreateSocket { my $self = shift; my $class = shift; @@ -398,6 +417,13 @@ $self->{_sockets}{$id}->$func(@_) } +sub _RemoveSocket { + my $self = shift; + my $id = shift; + say "Removing perl socket $id"; + delete $self->{_sockets}{$id} +} + package ZNC::Socket; sub GetModule { Modified: trunk/modules/modperl.cpp =================================================================== --- trunk/modules/modperl.cpp 2010-10-02 12:39:20 UTC (rev 2155) +++ trunk/modules/modperl.cpp 2010-10-10 09:59:15 UTC (rev 2156) @@ -249,6 +249,17 @@ } } +CPerlTimer::~CPerlTimer() { + CPerlModule* pMod = AsPerlModule(GetModule()); + if (pMod) { + PSTART; + PUSH_STR(pMod->GetPerlID()); + PUSH_STR(GetPerlID()); + PCALL("ZNC::Core::RemoveTimer"); + PEND; + } +} + #define SOCKSTART PSTART; PUSH_STR(pMod->GetPerlID()); PUSH_STR(GetPerlID()) #define SOCKCBCHECK(OnSuccess) PCALL("ZNC::Core::CallSocket"); if (SvTRUE(ERRSV)) { Close(); DEBUG("Perl socket hook died with: " + PString(ERRSV)); } else { OnSuccess; } PEND #define CBSOCK(Func) void CPerlSocket::Func() {\ @@ -298,4 +309,13 @@ return result; } +CPerlSocket::~CPerlSocket() { + CPerlModule* pMod = AsPerlModule(GetModule()); + if (pMod) { + SOCKSTART; + PCALL("ZNC::Core::RemoveSocket"); + PEND; + } +} + GLOBALMODULEDEFS(CModPerl, "Loads perl scripts as ZNC modules") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2010-12-24 18:30:19
|
Revision: 2209 http://znc.svn.sourceforge.net/znc/?rev=2209&view=rev Author: psychon Date: 2010-12-24 18:30:11 +0000 (Fri, 24 Dec 2010) Log Message: ----------- Split up modules/Makefile.in This splits the modpython, modperl and modtcl specific parts of modules/Makefile.in into separate files. There shouldn't be any other changes than this in here (hopefully). Modified Paths: -------------- trunk/modules/Makefile.in Added Paths: ----------- trunk/modules/Makefile.modtcl trunk/modules/modperl/Makefile.inc trunk/modules/modpython/Makefile.inc Modified: trunk/modules/Makefile.in =================================================================== --- trunk/modules/Makefile.in 2010-12-24 16:45:22 UTC (rev 2208) +++ trunk/modules/Makefile.in 2010-12-24 18:30:11 UTC (rev 2209) @@ -67,32 +67,6 @@ )) endif -ifeq "$(PERL_ON)" "yes" -# We execute this now so that we see the 'beauty' of these flags in make's output -PERLCOMMON := $(shell $(PERL) -MExtUtils::Embed -e perl_inc -e ldopts) -# Perl API is ugly, casting string literals to char* and redeclaring functions :( -PERLCOMMON += -Wno-write-strings -Wno-redundant-decls -Wno-missing-declarations -# This is for SWIG -PERLCOMMON += -DSWIG_TYPE_TABLE=znc -modperlFLAGS := $(PERLCOMMON) -# Find additional headers for out-of-tree build -modperlFLAGS += -I. -PERLHOOK := modperl_install -else -FILES := $(shell echo $(FILES) | sed -e "s/modperl//") -endif - -ifneq "$(PYCFG)" "" -PYTHONCOMMON := $(shell $(PYCFG) --includes) $(shell $(PYCFG) --ldflags) -PYTHONCOMMON += -DSWIG_TYPE_TABLE=znc -PYTHONCOMMON += -Wno-missing-field-initializers -Wno-unused -Wno-shadow -PYTHONCOMMON += -Wno-missing-declarations -Wno-uninitialized -modpythonFLAGS := $(PYTHONCOMMON) -I. -PYTHONHOOK := modpython_install -else -FILES := $(shell echo $(FILES) | sed -e "s/modpython//") -endif - ifeq "@SASL@" "" FILES := $(shell echo $(FILES) | sed -e "s:extra/saslauth::") endif @@ -103,32 +77,15 @@ endif charsetFLAGS := @LIBICONV@ -ifeq "$(TCL_FLAGS)" "" -FILES := $(shell echo $(FILES) | sed -e "s:extra/modtcl::") -else -TCLHOOK := modtcl_install -endif -modtclFLAGS := $(TCL_FLAGS) - - TARGETS := $(addsuffix .so, $(FILES)) CLEAN := *.so extra/*.so -CLEAN += modperl/ZNC.so modperl/ZNC.pm modpython/functions.cpp modpython/compiler -CLEAN += modpython/_znc_core.so modpython/_znc_core.cpp modpython/znc_core.py modpython/znc_core.pyc -CLEAN += modperl/swigperlrun.h modperl/ZNC.cpp -CLEAN += modpython/swigpyrun.h modpython/znc.pyc -ifneq "$(srcdir)" "." -# Copied from source for out-of-tree builds -CLEAN += modpython/znc.py -endif .PHONY: all clean install install_metadirs create_install_dir uninstall -.PHONY: modperl_install modtcl_install modpython_install modpython_compilepyc all: $(TARGETS) -install: all create_install_dir install_metadirs $(PERLHOOK) $(TCLHOOK) $(PYTHONHOOK) +install: all create_install_dir install_metadirs $(INSTALL_PROGRAM) $(TARGETS) $(DESTDIR)$(MODDIR) create_install_dir: @@ -153,84 +110,6 @@ $(E) Building $(if $(filter %extra/,$(dir $<)),extra )module $(notdir $(basename $@))... $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $($(notdir $(basename $@))FLAGS) -MMD -MF .depend/$(notdir $@).dep -modperl.so: modperl/ZNC.so modperl/swigperlrun.h -modperl/ZNC.so: modperl/ZNC.cpp Makefile - $(E) Building ZNC Perl bindings library... - $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -I$(srcdir) $(PERLCOMMON) -o $@ $< -ifneq "$(SWIG)" "" -modperl/swigperlrun.h: - @mkdir -p modperl - $(Q)$(SWIG) -perl5 -c++ -shadow -external-runtime $@ -modperl/ZNC.cpp: modperl/modperl.i Makefile modperl/module.h modperl/CString.i - $(E) Generating ZNC API for Perl... - @mkdir -p modperl - $(Q)$(SWIG) -perl5 -c++ -shadow -outdir modperl -I$(srcdir) -w362,315,401,402 -o $@.warn $< - $(Q)$(PERL) -pe '$$x==2 and print "items+=0;" and $$x=3;/^XS\(SWIG_init\)/ and $$x=1;$$x==1 and /dXSARGS/ and $$x=2' $@.warn > $@ - $(Q)rm -rf $@.warn -endif - -modpython.so: modpython/_znc_core.so modpython/swigpyrun.h modpython_compilepyc -modpython/_znc_core.so: modpython/_znc_core.cpp Makefile modpython/functions.cpp - $(E) Building ZNC python bindings library... - $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -I$(srcdir) $(PYTHONCOMMON) -o $@ $< -ifneq "$(SWIG)" "" -modpython/swigpyrun.h: - @mkdir -p modpython - $(Q)$(SWIG) -python -py3 -c++ -shadow -external-runtime $@ -modpython/_znc_core.cpp: modpython/modpython.i Makefile - $(E) Generating ZNC API for python... - @mkdir -p modpython - $(Q)$(SWIG) -python -py3 -c++ -shadow -outdir modpython -I$(srcdir) -w362,315,401 -o $@ $< -endif -modpython/functions.cpp: modpython/functions.in - @mkdir -p modpython - $(Q)$(PERL) $(srcdir)/modpython/codegen.pl $< $@ - -modperl_install: create_install_dir install_metadirs modperl.so - for i in $(wildcard $(srcdir)/*.pm); do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ - done - for a in $(srcdir)/*; do \ - if [ -d $$a ] && [ -f $${a}.pm ]; then \ - cp -Rp $$a $(DESTDIR)$(DATADIR); \ - fi \ - done - mkdir -p $(DESTDIR)$(MODDIR)/modperl - $(INSTALL_PROGRAM) modperl/ZNC.so $(DESTDIR)$(MODDIR)/modperl - $(INSTALL_DATA) modperl/ZNC.pm $(DESTDIR)$(MODDIR)/modperl - $(INSTALL_DATA) $(srcdir)/modperl/startup.pl $(DESTDIR)$(MODDIR)/modperl - -modpython/compiler: modpython/compiler.cpp - $(E) Building optimizator for python files... - $(Q)$(CXX) $(PYTHONCOMMON) -o $@ $< - -modpython_compilepyc: modpython/compiler - # This is allowed to fail only if $(srcdir) == pwd. - -$(Q)cp $(srcdir)/*.py ./ - -$(Q)cp $(srcdir)/*.pyc ./ - -$(Q)cp $(srcdir)/modpython/znc*.py modpython/ - $(Q)$< - -modpython_install: create_install_dir install_metadirs modpython.so - for i in $(wildcard *.pyc); do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ - done - for a in $(srcdir)/*; do \ - if [ -d $$a ]; then \ - if [ -f $${a}.py ] || [ -f $${a}.pyc ]; then \ - cp -Rp $$a $(DESTDIR)$(DATADIR); \ - fi \ - fi \ - done - mkdir -p $(DESTDIR)$(MODDIR)/modpython - $(INSTALL_PROGRAM) modpython/_znc_core.so $(DESTDIR)$(MODDIR)/modpython - $(INSTALL_DATA) modpython/znc_core.pyc $(DESTDIR)$(MODDIR)/modpython - $(INSTALL_DATA) modpython/znc.pyc $(DESTDIR)$(MODDIR)/modpython - -modtcl_install: - mkdir -p $(DESTDIR)$(DATADIR)/modtcl/ - $(INSTALL_DATA) $(srcdir)/extra/modtcl.tcl $(srcdir)/extra/binds.tcl $(DESTDIR)$(DATADIR)/modtcl/ - uninstall: # Yes, we are lazy, just remove everything in there rm -rf $(DESTDIR)$(MODDIR)/* @@ -238,4 +117,8 @@ rmdir $(DESTDIR)$(MODDIR) rmdir $(DESTDIR)$(DATADIR) +include modperl/Makefile.inc +include modpython/Makefile.inc +include Makefile.modtcl + -include $(wildcard .depend/*.dep) Added: trunk/modules/Makefile.modtcl =================================================================== --- trunk/modules/Makefile.modtcl (rev 0) +++ trunk/modules/Makefile.modtcl 2010-12-24 18:30:11 UTC (rev 2209) @@ -0,0 +1,14 @@ +ifeq "$(TCL_FLAGS)" "" +FILES := $(shell echo $(FILES) | sed -e "s:extra/modtcl::") +else +TCLHOOK := modtcl_install +endif +modtclFLAGS := $(TCL_FLAGS) + +.PHONY: modtcl_install + +install: $(TCLHOOK) + +modtcl_install: + mkdir -p $(DESTDIR)$(DATADIR)/modtcl/ + $(INSTALL_DATA) $(srcdir)/extra/modtcl.tcl $(srcdir)/extra/binds.tcl $(DESTDIR)$(DATADIR)/modtcl/ Added: trunk/modules/modperl/Makefile.inc =================================================================== --- trunk/modules/modperl/Makefile.inc (rev 0) +++ trunk/modules/modperl/Makefile.inc 2010-12-24 18:30:11 UTC (rev 2209) @@ -0,0 +1,51 @@ +ifeq "$(PERL_ON)" "yes" +# We execute this now so that we see the 'beauty' of these flags in make's output +PERLCOMMON := $(shell $(PERL) -MExtUtils::Embed -e perl_inc -e ldopts) +# Perl API is ugly, casting string literals to char* and redeclaring functions :( +PERLCOMMON += -Wno-write-strings -Wno-redundant-decls -Wno-missing-declarations +# This is for SWIG +PERLCOMMON += -DSWIG_TYPE_TABLE=znc +modperlFLAGS := $(PERLCOMMON) +# Find additional headers for out-of-tree build +modperlFLAGS += -I. +PERLHOOK := modperl_install +else +FILES := $(shell echo $(FILES) | sed -e "s/modperl//") +endif + +CLEAN += modperl/ZNC.so modperl/ZNC.pm +CLEAN += modperl/swigperlrun.h modperl/ZNC.cpp + +.PHONY: modperl_install + +install: $(PERLHOOK) + +modperl.so: modperl/ZNC.so modperl/swigperlrun.h +modperl/ZNC.so: modperl/ZNC.cpp Makefile + $(E) Building ZNC Perl bindings library... + $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -I$(srcdir) $(PERLCOMMON) -o $@ $< +ifneq "$(SWIG)" "" +modperl/swigperlrun.h: + @mkdir -p modperl + $(Q)$(SWIG) -perl5 -c++ -shadow -external-runtime $@ +modperl/ZNC.cpp: modperl/modperl.i Makefile modperl/module.h modperl/CString.i + $(E) Generating ZNC API for Perl... + @mkdir -p modperl + $(Q)$(SWIG) -perl5 -c++ -shadow -outdir modperl -I$(srcdir) -w362,315,401,402 -o $@.warn $< + $(Q)$(PERL) -pe '$$x==2 and print "items+=0;" and $$x=3;/^XS\(SWIG_init\)/ and $$x=1;$$x==1 and /dXSARGS/ and $$x=2' $@.warn > $@ + $(Q)rm -rf $@.warn +endif + +modperl_install: create_install_dir install_metadirs modperl.so + for i in $(wildcard $(srcdir)/*.pm); do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ + done + for a in $(srcdir)/*; do \ + if [ -d $$a ] && [ -f $${a}.pm ]; then \ + cp -Rp $$a $(DESTDIR)$(DATADIR); \ + fi \ + done + mkdir -p $(DESTDIR)$(MODDIR)/modperl + $(INSTALL_PROGRAM) modperl/ZNC.so $(DESTDIR)$(MODDIR)/modperl + $(INSTALL_DATA) modperl/ZNC.pm $(DESTDIR)$(MODDIR)/modperl + $(INSTALL_DATA) $(srcdir)/modperl/startup.pl $(DESTDIR)$(MODDIR)/modperl Added: trunk/modules/modpython/Makefile.inc =================================================================== --- trunk/modules/modpython/Makefile.inc (rev 0) +++ trunk/modules/modpython/Makefile.inc 2010-12-24 18:30:11 UTC (rev 2209) @@ -0,0 +1,65 @@ +ifneq "$(PYCFG)" "" +PYTHONCOMMON := $(shell $(PYCFG) --includes) $(shell $(PYCFG) --ldflags) +PYTHONCOMMON += -DSWIG_TYPE_TABLE=znc +PYTHONCOMMON += -Wno-missing-field-initializers -Wno-unused -Wno-shadow +PYTHONCOMMON += -Wno-missing-declarations -Wno-uninitialized +modpythonFLAGS := $(PYTHONCOMMON) -I. +PYTHONHOOK := modpython_install +else +FILES := $(shell echo $(FILES) | sed -e "s/modpython//") +endif + +CLEAN += modpython/_znc_core.so modpython/_znc_core.cpp modpython/znc_core.py modpython/znc_core.pyc +CLEAN += modpython/swigpyrun.h modpython/znc.pyc modpython/functions.cpp modpython/compiler +ifneq "$(srcdir)" "." +# Copied from source for out-of-tree builds +CLEAN += modpython/znc.py +endif + +.PHONY: modpython_install modpython_compilepyc + +install: $(PYTHONHOOK) + +modpython.so: modpython/_znc_core.so modpython/swigpyrun.h modpython_compilepyc +modpython/_znc_core.so: modpython/_znc_core.cpp Makefile modpython/functions.cpp + $(E) Building ZNC python bindings library... + $(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -I$(srcdir) $(PYTHONCOMMON) -o $@ $< +ifneq "$(SWIG)" "" +modpython/swigpyrun.h: + @mkdir -p modpython + $(Q)$(SWIG) -python -py3 -c++ -shadow -external-runtime $@ +modpython/_znc_core.cpp: modpython/modpython.i Makefile + $(E) Generating ZNC API for python... + @mkdir -p modpython + $(Q)$(SWIG) -python -py3 -c++ -shadow -outdir modpython -I$(srcdir) -w362,315,401 -o $@ $< +endif +modpython/functions.cpp: modpython/functions.in + @mkdir -p modpython + $(Q)$(PERL) $(srcdir)/modpython/codegen.pl $< $@ + +modpython/compiler: modpython/compiler.cpp + $(E) Building optimizator for python files... + $(Q)$(CXX) $(PYTHONCOMMON) -o $@ $< + +modpython_compilepyc: modpython/compiler + # This is allowed to fail only if $(srcdir) == pwd. + -$(Q)cp $(srcdir)/*.py ./ + -$(Q)cp $(srcdir)/*.pyc ./ + -$(Q)cp $(srcdir)/modpython/znc*.py modpython/ + $(Q)$< + +modpython_install: create_install_dir install_metadirs modpython.so + for i in $(wildcard *.pyc); do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ + done + for a in $(srcdir)/*; do \ + if [ -d $$a ]; then \ + if [ -f $${a}.py ] || [ -f $${a}.pyc ]; then \ + cp -Rp $$a $(DESTDIR)$(DATADIR); \ + fi \ + fi \ + done + mkdir -p $(DESTDIR)$(MODDIR)/modpython + $(INSTALL_PROGRAM) modpython/_znc_core.so $(DESTDIR)$(MODDIR)/modpython + $(INSTALL_DATA) modpython/znc_core.pyc $(DESTDIR)$(MODDIR)/modpython + $(INSTALL_DATA) modpython/znc.pyc $(DESTDIR)$(MODDIR)/modpython This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-12-30 12:00:59
|
Revision: 2216 http://znc.svn.sourceforge.net/znc/?rev=2216&view=rev Author: darthgandalf Date: 2010-12-30 12:00:52 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Make modpython and modperl to work with new OnPart too. Thanks, SilverLeo. Modified Paths: -------------- trunk/modules/modperl/functions.in trunk/modules/modperl/module.h trunk/modules/modpython/functions.in trunk/modules/modpython/module.h Modified: trunk/modules/modperl/functions.in =================================================================== --- trunk/modules/modperl/functions.in 2010-12-30 11:28:41 UTC (rev 2215) +++ trunk/modules/modperl/functions.in 2010-12-30 12:00:52 UTC (rev 2216) @@ -32,7 +32,7 @@ void OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans) void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) void OnJoin(const CNick& Nick, CChan& Channel) -void OnPart(const CNick& Nick, CChan& Channel) +void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) EModRet OnChanBufferStarting(CChan& Chan, CClient& Client) EModRet OnChanBufferEnding(CChan& Chan, CClient& Client) EModRet OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine) Modified: trunk/modules/modperl/module.h =================================================================== --- trunk/modules/modperl/module.h 2010-12-30 11:28:41 UTC (rev 2215) +++ trunk/modules/modperl/module.h 2010-12-30 12:00:52 UTC (rev 2216) @@ -55,7 +55,7 @@ virtual void OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans); virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage); virtual void OnJoin(const CNick& Nick, CChan& Channel); - virtual void OnPart(const CNick& Nick, CChan& Channel); + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage); virtual EModRet OnChanBufferStarting(CChan& Chan, CClient& Client); virtual EModRet OnChanBufferEnding(CChan& Chan, CClient& Client); virtual EModRet OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine); Modified: trunk/modules/modpython/functions.in =================================================================== --- trunk/modules/modpython/functions.in 2010-12-30 11:28:41 UTC (rev 2215) +++ trunk/modules/modpython/functions.in 2010-12-30 12:00:52 UTC (rev 2216) @@ -32,7 +32,7 @@ void OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans) void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) void OnJoin(const CNick& Nick, CChan& Channel) -void OnPart(const CNick& Nick, CChan& Channel) +void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) EModRet OnChanBufferStarting(CChan& Chan, CClient& Client) EModRet OnChanBufferEnding(CChan& Chan, CClient& Client) EModRet OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine) Modified: trunk/modules/modpython/module.h =================================================================== --- trunk/modules/modpython/module.h 2010-12-30 11:28:41 UTC (rev 2215) +++ trunk/modules/modpython/module.h 2010-12-30 12:00:52 UTC (rev 2216) @@ -69,7 +69,7 @@ virtual void OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans); virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage); virtual void OnJoin(const CNick& Nick, CChan& Channel); - virtual void OnPart(const CNick& Nick, CChan& Channel); + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage); virtual EModRet OnChanBufferStarting(CChan& Chan, CClient& Client); virtual EModRet OnChanBufferEnding(CChan& Chan, CClient& Client); virtual EModRet OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-12-30 19:18:30
|
Revision: 2220 http://znc.svn.sourceforge.net/znc/?rev=2220&view=rev Author: darthgandalf Date: 2010-12-30 19:18:24 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Fix make clean for modperl and modpython Modified Paths: -------------- trunk/modules/Makefile.in trunk/modules/modperl/Makefile.inc trunk/modules/modpython/Makefile.inc Modified: trunk/modules/Makefile.in =================================================================== --- trunk/modules/Makefile.in 2010-12-30 18:29:42 UTC (rev 2219) +++ trunk/modules/Makefile.in 2010-12-30 19:18:24 UTC (rev 2220) @@ -53,6 +53,8 @@ LDFLAGS += -L.. -lznc -Wl,-rpath,$(LIBZNCDIR) endif +CLEAN := + FILES := $(notdir $(wildcard $(srcdir)/*.cpp)) # If extra is enabled ifeq "@EXTRA@" "yes" @@ -85,7 +87,7 @@ TARGETS := $(addsuffix .so, $(FILES)) -CLEAN := *.so extra/*.so +CLEAN += *.so extra/*.so .PHONY: all clean install install_metadirs create_install_dir uninstall Modified: trunk/modules/modperl/Makefile.inc =================================================================== --- trunk/modules/modperl/Makefile.inc 2010-12-30 18:29:42 UTC (rev 2219) +++ trunk/modules/modperl/Makefile.inc 2010-12-30 19:18:24 UTC (rev 2220) @@ -8,14 +8,15 @@ modperlFLAGS := $(PERLCOMMON) # Find additional headers for out-of-tree build modperlFLAGS += -I. + PERLHOOK := modperl_install +CLEAN += modperl/ZNC.so modperl/ZNC.pm +CLEAN += modperl/swigperlrun.h modperl/ZNC.cpp modperl/functions.cpp + else FILES := $(shell echo $(FILES) | sed -e "s/modperl//") endif -CLEAN += modperl/ZNC.so modperl/ZNC.pm -CLEAN += modperl/swigperlrun.h modperl/ZNC.cpp modperl/functions.cpp - .PHONY: modperl_install install: $(PERLHOOK) Modified: trunk/modules/modpython/Makefile.inc =================================================================== --- trunk/modules/modpython/Makefile.inc 2010-12-30 18:29:42 UTC (rev 2219) +++ trunk/modules/modpython/Makefile.inc 2010-12-30 19:18:24 UTC (rev 2220) @@ -4,11 +4,8 @@ PYTHONCOMMON += -Wno-missing-field-initializers -Wno-unused -Wno-shadow PYTHONCOMMON += -Wno-missing-declarations -Wno-uninitialized modpythonFLAGS := $(PYTHONCOMMON) -I. + PYTHONHOOK := modpython_install -else -FILES := $(shell echo $(FILES) | sed -e "s/modpython//") -endif - CLEAN += modpython/_znc_core.so modpython/_znc_core.cpp modpython/znc_core.py modpython/znc_core.pyc CLEAN += modpython/swigpyrun.h modpython/znc.pyc modpython/functions.cpp modpython/compiler ifneq "$(srcdir)" "." @@ -16,6 +13,10 @@ CLEAN += modpython/znc.py endif +else +FILES := $(shell echo $(FILES) | sed -e "s/modpython//") +endif + .PHONY: modpython_install modpython_compilepyc install: $(PYTHONHOOK) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-12-30 22:02:32
|
Revision: 2222 http://znc.svn.sourceforge.net/znc/?rev=2222&view=rev Author: darthgandalf Date: 2010-12-30 22:02:26 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Add vim modelines to some files. Modified Paths: -------------- trunk/modules/modperl/Makefile.inc trunk/modules/modperl/modperl.i trunk/modules/modpython/Makefile.inc trunk/modules/modpython/modpython.i Modified: trunk/modules/modperl/Makefile.inc =================================================================== --- trunk/modules/modperl/Makefile.inc 2010-12-30 21:11:40 UTC (rev 2221) +++ trunk/modules/modperl/Makefile.inc 2010-12-30 22:02:26 UTC (rev 2222) @@ -1,3 +1,5 @@ +# vim: filetype=make + ifeq "$(PERL_ON)" "yes" # We execute this now so that we see the 'beauty' of these flags in make's output PERLCOMMON := $(shell $(PERL) -MExtUtils::Embed -e perl_inc -e ldopts) Modified: trunk/modules/modperl/modperl.i =================================================================== --- trunk/modules/modperl/modperl.i 2010-12-30 21:11:40 UTC (rev 2221) +++ trunk/modules/modperl/modperl.i 2010-12-30 22:02:26 UTC (rev 2222) @@ -204,3 +204,4 @@ *UNLOAD = *ZNC::CModule::UNLOAD; %} +/* vim: set filetype=cpp noexpandtab: */ Modified: trunk/modules/modpython/Makefile.inc =================================================================== --- trunk/modules/modpython/Makefile.inc 2010-12-30 21:11:40 UTC (rev 2221) +++ trunk/modules/modpython/Makefile.inc 2010-12-30 22:02:26 UTC (rev 2222) @@ -1,3 +1,5 @@ +# vim: filetype=make + ifneq "$(PYCFG)" "" PYTHONCOMMON := $(shell $(PYCFG) --includes) $(shell $(PYCFG) --ldflags) PYTHONCOMMON += -DSWIG_TYPE_TABLE=znc Modified: trunk/modules/modpython/modpython.i =================================================================== --- trunk/modules/modpython/modpython.i 2010-12-30 21:11:40 UTC (rev 2221) +++ trunk/modules/modpython/modpython.i 2010-12-30 22:02:26 UTC (rev 2222) @@ -174,3 +174,4 @@ } %} +/* vim: set filetype=cpp noexpandtab: */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |