~vanhoof/+junk/znc

« back to all changes in this revision

Viewing changes to modules/admin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Matthäi
  • Date: 2011-02-06 17:41:38 UTC
  • mfrom: (21.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110206174138-ush4l5mkr4wg738n
Tags: 0.096-2
* Merge 0.092-3~bpo50+1 changelog.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
                        {"Altnick",          string},
71
71
                        {"Ident",            string},
72
72
                        {"RealName",         string},
73
 
                        {"VHost",            string},
 
73
                        {"BindHost",         string},
74
74
                        {"MultiClients",     boolean},
75
75
                        {"BounceDCCs",       boolean},
76
76
                        {"UseClientIP",      boolean},
77
77
                        {"DenyLoadMod",      boolean},
78
 
                        {"DenySetVHost",     boolean},
 
78
                        {"DenySetBindHost",  boolean},
79
79
                        {"DefaultChanModes", string},
80
80
                        {"QuitMsg",          string},
81
81
                        {"BufferCount",      integer},
87
87
                        {"Admin",            boolean},
88
88
                        {"AppendTimestamp",  boolean},
89
89
                        {"PrependTimestamp", boolean},
90
 
                        {"DCCVHost",         boolean}
 
90
                        {"DCCBindHost",      boolean}
91
91
                };
92
92
                for (unsigned int i = 0; i != ARRAY_SIZE(vars); ++i) {
93
93
                        VarTable.AddRow();
160
160
                        PutModule("Ident = " + pUser->GetIdent());
161
161
                else if (sVar == "realname")
162
162
                        PutModule("RealName = " + pUser->GetRealName());
163
 
                else if (sVar == "vhost")
164
 
                        PutModule("VHost = " + pUser->GetVHost());
 
163
                else if (sVar == "bindhost")
 
164
                        PutModule("BindHost = " + pUser->GetBindHost());
165
165
                else if (sVar == "multiclients")
166
166
                        PutModule("MultiClients = " + CString(pUser->MultiClients()));
167
167
                else if (sVar == "bouncedccs")
170
170
                        PutModule("UseClientIP = " + CString(pUser->UseClientIP()));
171
171
                else if (sVar == "denyloadmod")
172
172
                        PutModule("DenyLoadMod = " + CString(pUser->DenyLoadMod()));
173
 
                else if (sVar == "denysetvhost")
174
 
                        PutModule("DenySetVHost = " + CString(pUser->DenySetVHost()));
 
173
                else if (sVar == "denysetbindhost")
 
174
                        PutModule("DenySetBindHost = " + CString(pUser->DenySetBindHost()));
175
175
                else if (sVar == "defaultchanmodes")
176
176
                        PutModule("DefaultChanModes = " + pUser->GetDefaultChanModes());
177
177
                else if (sVar == "quitmsg")
190
190
                        PutModule("AppendTimestamp = " + CString(pUser->GetTimestampAppend()));
191
191
                else if (sVar == "preprendtimestamp")
192
192
                        PutModule("PreprendTimestamp = " + CString(pUser->GetTimestampPrepend()));
193
 
                else if (sVar == "dccvhost")
194
 
                        PutModule("DCCVHost = " + CString(pUser->GetDCCVHost()));
 
193
                else if (sVar == "dccbindhost")
 
194
                        PutModule("DCCBindHost = " + CString(pUser->GetDCCBindHost()));
195
195
                else if (sVar == "admin")
196
196
                        PutModule("Admin = " + CString(pUser->IsAdmin()));
197
197
                else
228
228
                        pUser->SetRealName(sValue);
229
229
                        PutModule("RealName = " + sValue);
230
230
                }
231
 
                else if (sVar == "vhost") {
232
 
                        if(!pUser->DenySetVHost() || m_pUser->IsAdmin()) {
233
 
                                pUser->SetVHost(sValue);
234
 
                                PutModule("VHost = " + sValue);
 
231
                else if (sVar == "bindhost") {
 
232
                        if(!pUser->DenySetBindHost() || m_pUser->IsAdmin()) {
 
233
                                pUser->SetBindHost(sValue);
 
234
                                PutModule("BindHost = " + sValue);
235
235
                        } else {
236
236
                                PutModule("Access denied!");
237
237
                        }
260
260
                                PutModule("Access denied!");
261
261
                        }
262
262
                }
263
 
                else if (sVar == "denysetvhost") {
 
263
                else if (sVar == "denysetbindhost") {
264
264
                        if(m_pUser->IsAdmin()) {
265
265
                                bool b = sValue.ToBool();
266
 
                                pUser->SetDenySetVHost(b);
267
 
                                PutModule("DenySetVHost = " + CString(b));
 
266
                                pUser->SetDenySetBindHost(b);
 
267
                                PutModule("DenySetBindHost = " + CString(b));
268
268
                        } else {
269
269
                                PutModule("Access denied!");
270
270
                        }
279
279
                }
280
280
                else if (sVar == "buffercount") {
281
281
                        unsigned int i = sValue.ToUInt();
282
 
                        pUser->SetBufferCount(i);
283
 
                        PutModule("BufferCount = " + sValue);
 
282
                        // Admins don't have to honour the buffer limit
 
283
                        if (pUser->SetBufferCount(i), m_pUser->IsAdmin()) {
 
284
                                PutModule("BufferCount = " + sValue);
 
285
                        } else {
 
286
                                PutModule("Setting failed, limit is " +
 
287
                                                CString(CZNC::Get().GetMaxBufferSize()));
 
288
                        }
284
289
                }
285
290
                else if (sVar == "keepbuffer") {
286
291
                        bool b = sValue.ToBool();
327
332
                        pUser->SetTimestampAppend(b);
328
333
                        PutModule("AppendTimestamp = " + CString(b));
329
334
                }
330
 
                else if (sVar == "dccvhost") {
331
 
                        if(!pUser->DenySetVHost() || m_pUser->IsAdmin()) {
332
 
                                pUser->SetDCCVHost(sValue);
333
 
                                PutModule("DCCVHost = " + sValue);
 
335
                else if (sVar == "dccbindhost") {
 
336
                        if(!pUser->DenySetBindHost() || m_pUser->IsAdmin()) {
 
337
                                pUser->SetDCCBindHost(sValue);
 
338
                                PutModule("DCCBindHost = " + sValue);
334
339
                        } else {
335
340
                                PutModule("Access denied!");
336
341
                        }
408
413
                        PutModule("DefModes = " + sValue);
409
414
                } else if (sVar == "buffer") {
410
415
                        unsigned int i = sValue.ToUInt();
411
 
                        pChan->SetBufferCount(i);
412
 
                        PutModule("Buffer = " + CString(i));
 
416
                        // Admins don't have to honour the buffer limit
 
417
                        if (pChan->SetBufferCount(i), m_pUser->IsAdmin()) {
 
418
                                PutModule("Buffer = " + sValue);
 
419
                        } else {
 
420
                                PutModule("Setting failed, limit is " +
 
421
                                                CString(CZNC::Get().GetMaxBufferSize()));
 
422
                        }
413
423
                } else if (sVar == "inconfig") {
414
424
                        bool b = sValue.ToBool();
415
425
                        pChan->SetInConfig(b);
446
456
                Table.AddColumn("Nick");
447
457
                Table.AddColumn("AltNick");
448
458
                Table.AddColumn("Ident");
449
 
                Table.AddColumn("VHost");
 
459
                Table.AddColumn("BindHost");
450
460
 
451
461
                for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); ++it) {
452
462
                        Table.AddRow();
459
469
                        Table.SetCell("Nick", it->second->GetNick());
460
470
                        Table.SetCell("AltNick", it->second->GetAltNick());
461
471
                        Table.SetCell("Ident", it->second->GetIdent());
462
 
                        Table.SetCell("VHost", it->second->GetVHost());
 
472
                        Table.SetCell("BindHost", it->second->GetBindHost());
463
473
                }
464
474
 
465
475
                PutModule(Table);
640
650
                CString sModRet;
641
651
 
642
652
                if (sModName.empty()) {
643
 
                        PutModule("Usage: loadmodule <username> <modulename>");
 
653
                        PutModule("Usage: unloadmodule <username> <modulename>");
644
654
                        return;
645
655
                }
646
656