0001-add-support-for-oping-a-whole-channel-with-op.patch
src/core/coreuserinputhandler.cpp | ||
---|---|---|
371 | 371 |
} |
372 | 372 | |
373 | 373 |
void CoreUserInputHandler::handleOp(const BufferInfo &bufferInfo, const QString &msg) { |
374 |
QStringList nicks = msg.split(' ', QString::SkipEmptyParts); |
|
375 |
QString m = "+"; for(int i = 0; i < nicks.count(); i++) m += 'o'; |
|
376 |
QStringList params; |
|
377 |
params << bufferInfo.bufferName() << m << nicks; |
|
378 |
emit putCmd("MODE", serverEncode(params)); |
|
374 |
QStringList nicks; |
|
375 |
if (msg == "*") { |
|
376 |
const QList<IrcUser*> users = network()->ircChannel(bufferInfo.bufferName())->ircUsers(); |
|
377 |
foreach(IrcUser *user, users) { |
|
378 |
if (!network()->ircChannel(bufferInfo.bufferName())->userModes(user).contains("o")) |
|
379 |
nicks.append(user->nick()); |
|
380 |
} |
|
381 |
} else { |
|
382 |
nicks = msg.split(' ', QString::SkipEmptyParts); |
|
383 |
} |
|
384 |
if (nicks.count() == 0) return; |
|
385 |
|
|
386 |
bool isNumber; |
|
387 |
int maxModes = network()->support("MODES").toInt(&isNumber); |
|
388 |
if (!isNumber || maxModes == 0) maxModes = 1; |
|
389 |
|
|
390 |
while (!nicks.isEmpty()) { |
|
391 |
int amount = qMin(nicks.count(), maxModes); |
|
392 |
QString m = "+"; for(int i = 0; i < amount; i++) m += 'o'; |
|
393 |
QStringList params; |
|
394 |
params << bufferInfo.bufferName() << m; |
|
395 |
for(int i = 0; i < amount; i++) params << nicks.takeFirst(); |
|
396 |
emit putCmd("MODE", serverEncode(params)); |
|
397 |
} |
|
379 | 398 |
} |
380 | 399 | |
381 | 400 |
void CoreUserInputHandler::handleOper(const BufferInfo &bufferInfo, const QString &msg) { |
382 |
- |