Changeset 287:5bf6d7375f4c
- Timestamp:
- 06/30/2008 05:05:45 PM (4 years ago)
- Author:
- Dmitry Nezhevenko <dion@…>
- Branch:
- default
- Message:
-
Fix version matcher
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r286
|
r287
|
|
| 37 | 37 | pluginId=1; |
| 38 | 38 | lazyOffline=DataStorage::instance()->getInt("muc/lazyoffline"); |
| 39 | | |
| | 39 | |
| 40 | 40 | int leaveCheckInterval=DataStorage::instance()->getInt("muc/leave_checkinterval"); |
| 41 | 41 | if (leaveCheckInterval>0) |
| … |
… |
|
| 46 | 46 | timer->start(leaveCheckInterval); |
| 47 | 47 | } |
| 48 | | |
| | 48 | |
| 49 | 49 | } |
| 50 | 50 | |
| … |
… |
|
| 178 | 178 | { |
| 179 | 179 | qDebug() |
| 180 | | << "[MUC] Got type='error' in onPresence. Looks like we can't join conference: " << confFull << "Nick: " << nick; |
| | 180 | << "[MUC] Got type='error' in onPresence. Looks like we can't join conference: " << confFull << "Nick: " << nick; |
| 181 | 181 | int idx=confInProgress.indexOf(getConfExp(confFull)); |
| 182 | 182 | if (idx>=0) |
| … |
… |
|
| 236 | 236 | |
| 237 | 237 | } |
| 238 | | |
| | 238 | |
| 239 | 239 | bool newNick=false; |
| 240 | 240 | if (!n) |
| … |
… |
|
| 247 | 247 | n=new Nick(conf, nick,getItem(s,"jid")); |
| 248 | 248 | conf->nicks()->append(n); |
| 249 | | |
| | 249 | |
| 250 | 250 | if (nick==conf->nick()) |
| 251 | 251 | { |
| 252 | 252 | // Got own presence after renaming |
| 253 | 253 | |
| 254 | | } |
| | 254 | } |
| 255 | 255 | } |
| 256 | 256 | else |
| … |
… |
|
| 310 | 310 | if (newNick || conf->configurator()->isCheckAlistsEveryPresence()) |
| 311 | 311 | checkMember(s, conf, n); |
| 312 | | |
| | 312 | |
| 313 | 313 | if (newNick) |
| 314 | 314 | { |
| … |
… |
|
| 487 | 487 | return true; |
| 488 | 488 | } |
| 489 | | |
| | 489 | |
| 490 | 490 | if (cmd=="IDLE") |
| 491 | 491 | { |
| … |
… |
|
| 505 | 505 | return true; |
| 506 | 506 | } |
| 507 | | |
| | 507 | |
| 508 | 508 | if (cmd=="VERSION") |
| 509 | 509 | { |
| … |
… |
|
| 522 | 522 | return true; |
| 523 | 523 | } |
| 524 | | |
| | 524 | |
| 525 | 525 | if (cmd=="CHECKVCARD") |
| 526 | 526 | { |
| … |
… |
|
| 532 | 532 | return true; |
| 533 | 533 | } |
| 534 | | |
| | 534 | |
| 535 | 535 | if (cmd=="SEEN") |
| 536 | 536 | { |
| … |
… |
|
| 562 | 562 | QString target=arg; |
| 563 | 563 | QString reason=parser.nextToken(); |
| 564 | | |
| | 564 | |
| 565 | 565 | Nick *n=getNickVerbose(s, target); |
| 566 | 566 | if (!n) |
| … |
… |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | | if (cmd=="ABAN" || cmd=="AKICK" || cmd=="AVISITOR" || cmd=="AMODERATOR" |
| | 633 | if (cmd=="ABAN" || cmd=="AKICK" || cmd=="AVISITOR" || cmd=="AMODERATOR" |
| 634 | 634 | || cmd=="ACMD" || cmd=="AEDIT" || cmd=="AFIND") |
| 635 | 635 | { |
| … |
… |
|
| 853 | 853 | if (!joinerBareJid.isEmpty()) |
| 854 | 854 | { |
| 855 | | |
| | 855 | |
| 856 | 856 | } |
| 857 | 857 | |
| … |
… |
|
| 895 | 895 | conf->markOffline(); |
| 896 | 896 | } |
| 897 | | |
| | 897 | |
| 898 | 898 | |
| 899 | 899 | /* Conference *conf=new Conference(cname,cnick); |
| … |
… |
|
| 979 | 979 | nick->setVersionOs(QString::null); |
| 980 | 980 | if (query) |
| 981 | | { |
| | 981 | { |
| 982 | 982 | gloox::Tag* t; |
| 983 | 983 | t=query->findChild("name"); |
| … |
… |
|
| 1063 | 1063 | if (arg=="ACMD") |
| 1064 | 1064 | alist=conf->acommand(); |
| 1065 | | |
| | 1065 | |
| 1066 | 1066 | if (!alist) |
| 1067 | 1067 | { |
| … |
… |
|
| 1124 | 1124 | arg2=parser.nextToken().toUpper(); |
| 1125 | 1125 | isRemoving=true; |
| 1126 | | } |
| | 1126 | } |
| 1127 | 1127 | } |
| 1128 | 1128 | |
| … |
… |
|
| 1166 | 1166 | arg2=parser.nextToken().toUpper(); |
| 1167 | 1167 | } |
| 1168 | | |
| | 1168 | |
| 1169 | 1169 | qDebug() << "1: " << arg2; |
| 1170 | | |
| 1171 | | if (arg2=="NICK" || arg2=="BODY" || arg2=="RES" |
| 1172 | | || arg2=="VERSION" || arg2=="VERSION.NAME" |
| | 1170 | |
| | 1171 | if (arg2=="NICK" || arg2=="BODY" || arg2=="RES" |
| | 1172 | || arg2=="VERSION" || arg2=="VERSION.NAME" |
| 1173 | 1173 | || arg2=="VERSION.CLIENT" || arg2=="VERSION.OS") |
| 1174 | 1174 | { |
| … |
… |
|
| 1189 | 1189 | |
| 1190 | 1190 | arg2=parser.nextToken().toUpper(); |
| 1191 | | } |
| | 1191 | } |
| 1192 | 1192 | else if (arg2=="JID") |
| 1193 | 1193 | { |
| … |
… |
|
| 1197 | 1197 | |
| 1198 | 1198 | qDebug() << "2: " << arg2; |
| 1199 | | |
| | 1199 | |
| 1200 | 1200 | if (arg2=="EXP") |
| 1201 | 1201 | { |
| … |
… |
|
| 1245 | 1245 | |
| 1246 | 1246 | qDebug() << "3: " << arg2; |
| 1247 | | |
| | 1247 | |
| 1248 | 1248 | arg2=arg2.toLower(); |
| 1249 | 1249 | item.setValue(arg2); |
| … |
… |
|
| 1273 | 1273 | } |
| 1274 | 1274 | } |
| 1275 | | |
| | 1275 | |
| 1276 | 1276 | qDebug() << "4: " << arg2; |
| 1277 | 1277 | QString reason=parser.joinBody().trimmed(); |
| … |
… |
|
| 1299 | 1299 | QString version; |
| 1300 | 1300 | if (nick->isVersionStored()) |
| 1301 | | version=nick->versionName()+" "+nick->versionClient()+" // "+nick->versionOs(); |
| 1302 | | |
| | 1301 | { |
| | 1302 | version=nick->versionName(); |
| | 1303 | if (!nick->versionClient().isEmpty()) |
| | 1304 | version+=" "+nick->versionClient(); |
| | 1305 | if (!nick->versionOs().isEmpty()) |
| | 1306 | version+=" // "+nick->versionOs(); |
| | 1307 | version=version.trimmed(); |
| | 1308 | } |
| | 1309 | |
| 1303 | 1310 | bool isPresence=!s || (s->type()==gloox::StanzaPresence); |
| 1304 | | |
| | 1311 | |
| 1305 | 1312 | for (int i=0; i<cnt; i++) |
| 1306 | 1313 | { |
| 1307 | 1314 | AListItem* item=list->at(i); |
| 1308 | | |
| 1309 | | if (matcher!=AListItem::MatcherUnknown && matcher!=AListItem::MatcherAll && |
| | 1315 | |
| | 1316 | if (matcher!=AListItem::MatcherUnknown && matcher!=AListItem::MatcherAll && |
| 1310 | 1317 | !item->matcherType()!=matcher) |
| 1311 | 1318 | { |
| … |
… |
|
| 1320 | 1327 | continue; |
| 1321 | 1328 | } |
| 1322 | | |
| | 1329 | |
| 1323 | 1330 | QString testValue; |
| 1324 | | if (!isPresence && (item->matcherType() == AListItem::MatcherNick |
| | 1331 | if (!isPresence && (item->matcherType() == AListItem::MatcherNick |
| 1325 | 1332 | || item->matcherType()==AListItem::MatcherJid || item->matcherType()==AListItem::MatcherResource)) |
| 1326 | 1333 | continue; |
| 1327 | | |
| 1328 | | if (item->matcherType() == AListItem::MatcherVersion |
| | 1334 | |
| | 1335 | if (item->matcherType() == AListItem::MatcherVersion |
| 1329 | 1336 | || item->matcherType()==AListItem::MatcherVersionName |
| 1330 | 1337 | || item->matcherType()==AListItem::MatcherVersionClient |
| … |
… |
|
| 1336 | 1343 | continue; |
| 1337 | 1344 | } |
| 1338 | | |
| | 1345 | |
| 1339 | 1346 | switch (item->matcherType()) |
| 1340 | 1347 | { |
| … |
… |
|
| 1350 | 1357 | default: continue; |
| 1351 | 1358 | } |
| 1352 | | |
| | 1359 | |
| 1353 | 1360 | if (testValue.isEmpty()) |
| 1354 | 1361 | continue; |
| 1355 | | |
| | 1362 | |
| 1356 | 1363 | switch (item->testType()) |
| 1357 | 1364 | { |
| … |
… |
|
| 1387 | 1394 | if (!n || !c) |
| 1388 | 1395 | return; |
| 1389 | | |
| | 1396 | |
| 1390 | 1397 | // Don't process our own presences |
| 1391 | 1398 | if (c && n->nick()==c->nick()) |
| 1392 | 1399 | return; |
| 1393 | | |
| 1394 | | // We should not parse own messages, since this can create loop |
| | 1400 | |
| | 1401 | // We should not parse own messages, since this can create loop |
| 1395 | 1402 | if (s && (s->from() == s->to() || isMyMessage(s))) |
| 1396 | 1403 | s=0l; |
| … |
… |
|
| 1436 | 1443 | return; |
| 1437 | 1444 | } |
| 1438 | | |
| | 1445 | |
| 1439 | 1446 | if (item=aFind(c->acommand(), n, s, matcher)) |
| 1440 | 1447 | { |
| … |
… |
|
| 1459 | 1466 | bot()->client()->handleMessage(st, 0); |
| 1460 | 1467 | delete st; |
| 1461 | | |
| | 1468 | |
| 1462 | 1469 | return; |
| 1463 | 1470 | } |
| … |
… |
|
| 1482 | 1489 | if (!conf) |
| 1483 | 1490 | return StorageKey(); |
| 1484 | | |
| | 1491 | |
| 1485 | 1492 | return StorageKey(pluginId, conf->id()); |
| 1486 | 1493 | } |
| … |
… |
|
| 1493 | 1500 | if (getRole(s)<ROLE_ADMIN) |
| 1494 | 1501 | return 0; |
| 1495 | | |
| | 1502 | |
| 1496 | 1503 | return conf->configurator(); |
| 1497 | 1504 | } |
| … |
… |
|
| 1601 | 1608 | QString body=QString::fromStdString(s->body()); |
| 1602 | 1609 | msg.replace("${BODY}", body); |
| 1603 | | |
| | 1610 | |
| 1604 | 1611 | if (item) |
| 1605 | 1612 | { |
| 1606 | 1613 | QString value=item->value(); |
| 1607 | | |
| | 1614 | |
| 1608 | 1615 | if (!value.isEmpty() && msg.indexOf("${BODYARG}")>=0) |
| 1609 | 1616 | { |
| … |
… |
|
| 1632 | 1639 | if (nick->jidStr().isEmpty()) |
| 1633 | 1640 | return; |
| 1634 | | |
| | 1641 | |
| 1635 | 1642 | QString jid=conf->name()+"/"+nick->nick(); |
| 1636 | 1643 | QString vcardId=bot()->client()->fetchVCard(jid); |
| … |
… |
|
| 1656 | 1663 | return false; |
| 1657 | 1664 | } |
| 1658 | | |
| | 1665 | |
| 1659 | 1666 | gloox::Stanza* src=req->stanza(); |
| 1660 | 1667 | Conference* conf=getConf(src); |
| 1661 | 1668 | Nick* nick=getNick(src); |
| 1662 | 1669 | QString stored_jid=QString::fromStdString(src->findAttribute("gluxi_jid")); |
| 1663 | | |
| | 1670 | |
| 1664 | 1671 | if (conf && nick && stored_jid==nick->jidStr()) |
| 1665 | 1672 | { |
| … |
… |
|
| 1690 | 1697 | { |
| 1691 | 1698 | qDebug() << "Checking for died conferences"; |
| 1692 | | |
| | 1699 | |
| 1693 | 1700 | QStringList conferencesToLeave=Conference::autoLeaveList(); |
| 1694 | 1701 | if (conferencesToLeave.isEmpty()) |