Changeset 214
- Timestamp:
- 04/05/08 07:30:06 (8 months ago)
- Files:
-
- trunk/Phergie/Driver/Streams.php (modified) (30 diffs)
- trunk/Phergie/Plugin/Altnick.php (modified) (1 diff)
- trunk/Phergie/Plugin/Nickserv.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Driver/Streams.php
r211 r214 32 32 'whowas', 33 33 'mode', 34 'privmsg', 34 35 'nick', 35 'privmsg',36 36 'topic', 37 37 'invite', 38 38 'kill', 39 39 'part' 40 ); 41 42 /** 43 * Names of destructive commands that get queued up last 44 * 45 * @var array 46 */ 47 protected $destuctive = array( 48 'nick', 49 'kill', 50 'part', 51 'quit' 40 52 ); 41 53 … … 356 368 * (optional) 357 369 */ 358 public function send($command, array $arguments = array() )370 public function send($command, array $arguments = array(), $priority = false) 359 371 { 360 372 $command = strtolower($command); 361 if ($this->queueing ) {373 if ($this->queueing && (in_array($command, $this->destuctive) xor $priority)) { 362 374 if (!isset($this->queue[$command])) { 363 375 $this->queue[$command] = array(); … … 388 400 * @param bool $reconnect if true, the bot will reconnect to the server 389 401 */ 390 public function doQuit($reason = null, $reconnect = false )402 public function doQuit($reason = null, $reconnect = false, $priority = false) 391 403 { 392 404 if ($this->queueing) { 393 $this->send(Phergie_Event_Request::TYPE_QUIT, array($reason, $reconnect) );405 $this->send(Phergie_Event_Request::TYPE_QUIT, array($reason, $reconnect), $priority); 394 406 } else { 395 $this->send(Phergie_Event_Request::TYPE_QUIT, array($reason) );407 $this->send(Phergie_Event_Request::TYPE_QUIT, array($reason), $priority); 396 408 } 397 409 } … … 403 415 * @param string $keys Channel key if needed (optional) 404 416 */ 405 public function doJoin($channel, $key = null )417 public function doJoin($channel, $key = null, $priority = false) 406 418 { 407 419 $arguments = array($channel); … … 411 423 } 412 424 413 $this->send(Phergie_Event_Request::TYPE_JOIN, $arguments );425 $this->send(Phergie_Event_Request::TYPE_JOIN, $arguments, $priority); 414 426 } 415 427 … … 419 431 * @param string $channel Name of the channel to leave 420 432 */ 421 public function doPart($channel, $reason = null )422 { 423 $this->send(Phergie_Event_Request::TYPE_PART, array($channel, $reason) );433 public function doPart($channel, $reason = null, $priority = false) 434 { 435 $this->send(Phergie_Event_Request::TYPE_PART, array($channel, $reason), $priority); 424 436 } 425 437 … … 430 442 * @param string $channel Name of the channel 431 443 */ 432 public function doInvite($nick, $channel )433 { 434 $this->send(Phergie_Event_Request::TYPE_INVITE, array($nick, $channel) );444 public function doInvite($nick, $channel, $priority = false) 445 { 446 $this->send(Phergie_Event_Request::TYPE_INVITE, array($nick, $channel), $priority); 435 447 } 436 448 … … 440 452 * @param string $channels Comma-delimited list of one or more channels 441 453 */ 442 public function doNames($channels )443 { 444 $this->send(Phergie_Event_Request::TYPE_NAMES, array($channels) );454 public function doNames($channels, $priority = false) 455 { 456 $this->send(Phergie_Event_Request::TYPE_NAMES, array($channels), $priority); 445 457 } 446 458 … … 452 464 * (optional) 453 465 */ 454 public function doList($channels = null )466 public function doList($channels = null, $priority = false) 455 467 { 456 468 $arguments = array(); … … 460 472 } 461 473 462 $this->send(Phergie_Event_Request::TYPE_LIST, $arguments );474 $this->send(Phergie_Event_Request::TYPE_LIST, $arguments, $priority); 463 475 } 464 476 … … 469 481 * @param string $topic New topic to assign (optional) 470 482 */ 471 public function doTopic($channel, $topic = null )483 public function doTopic($channel, $topic = null, $priority = false) 472 484 { 473 485 $arguments = array($channel); … … 477 489 } 478 490 479 $this->send(Phergie_Event_Request::TYPE_TOPIC, $arguments );491 $this->send(Phergie_Event_Request::TYPE_TOPIC, $arguments, $priority); 480 492 } 481 493 … … 486 498 * @param string $mode New mode to assign (optional) 487 499 */ 488 public function doMode($target, $mode = null )500 public function doMode($target, $mode = null, $priority = false) 489 501 { 490 502 $arguments = array($target); … … 494 506 } 495 507 496 $this->send(Phergie_Event_Request::TYPE_MODE, $arguments );508 $this->send(Phergie_Event_Request::TYPE_MODE, $arguments, $priority); 497 509 } 498 510 … … 502 514 * @param string $nick New nick to assign 503 515 */ 504 public function doNick($nick )505 { 506 $this->send(Phergie_Event_Request::TYPE_NICK, array($nick) );516 public function doNick($nick, $priority = false) 517 { 518 $this->send(Phergie_Event_Request::TYPE_NICK, array($nick), $priority); 507 519 } 508 520 … … 512 524 * @param string $nick 513 525 */ 514 public function doWhois($nick )515 { 516 $this->send(Phergie_Event_Request::TYPE_WHOIS, array($nick) );526 public function doWhois($nick, $priority = false) 527 { 528 $this->send(Phergie_Event_Request::TYPE_WHOIS, array($nick), $priority); 517 529 } 518 530 … … 523 535 * @param string $text Text of the message to send 524 536 */ 525 public function doPrivmsg($target, $text )526 { 527 $this->send(Phergie_Event_Request::TYPE_PRIVMSG, array($target, $text) );537 public function doPrivmsg($target, $text, $priority = false) 538 { 539 $this->send(Phergie_Event_Request::TYPE_PRIVMSG, array($target, $text), $priority); 528 540 } 529 541 … … 534 546 * @param string $text Text of the notice to send 535 547 */ 536 public function doNotice($target, $text )537 { 538 $this->send(Phergie_Event_Request::TYPE_NOTICE, array($target, $text) );548 public function doNotice($target, $text, $priority = false) 549 { 550 $this->send(Phergie_Event_Request::TYPE_NOTICE, array($target, $text), $priority); 539 551 } 540 552 … … 546 558 * @param string $reason Reason for the kick (optional) 547 559 */ 548 public function doKick($nick, $channel, $reason = null )560 public function doKick($nick, $channel, $reason = null, $priority = false) 549 561 { 550 562 $arguments = array($nick, $channel); … … 554 566 } 555 567 556 $this->send(Phergie_Event_Request::TYPE_KICK, $arguments );568 $this->send(Phergie_Event_Request::TYPE_KICK, $arguments, $priority); 557 569 } 558 570 … … 562 574 * @param string $daemon Daemon from which the original request originates 563 575 */ 564 public function doPong($daemon )565 { 566 $this->send(Phergie_Event_Request::TYPE_PONG, array($daemon) );576 public function doPong($daemon, $priority = false) 577 { 578 $this->send(Phergie_Event_Request::TYPE_PONG, array($daemon), $priority); 567 579 } 568 580 … … 575 587 * (optional) 576 588 */ 577 public function doCtcp($target, $command, $arguments = '' )589 public function doCtcp($target, $command, $arguments = '', $priority = false) 578 590 { 579 591 if (is_array($arguments)) { … … 589 601 * @param string $text Text of the action to perform 590 602 */ 591 public function doAction($target, $text )592 { 593 $this->doCtcp($target, Phergie_Event_Request::TYPE_ACTION, array($text) );603 public function doAction($target, $text, $priority = false) 604 { 605 $this->doCtcp($target, Phergie_Event_Request::TYPE_ACTION, array($text), $priority); 594 606 } 595 607 … … 600 612 * @param string $hash The ping hash to use in the handshake 601 613 */ 602 public function doPingReply($target, $hash )603 { 604 $this->doCtcpReply($target, 'ping', $hash );614 public function doPingReply($target, $hash, $priority = false) 615 { 616 $this->doCtcpReply($target, 'ping', $hash, $priority); 605 617 } 606 618 … … 611 623 * @param string $version The version to send 612 624 */ 613 public function doVersionReply($target, $version = '' )625 public function doVersionReply($target, $version = '', $priority = false) 614 626 { 615 627 $version = trim($version); … … 617 629 $version = 'Phergie '.PHERGIE_VERSION.' - An IRC bot written in PHP (http://www.phergie.com)'; 618 630 } 619 $this->doCtcpReply($target, 'version', $version );631 $this->doCtcpReply($target, 'version', $version, $priority); 620 632 } 621 633 … … 626 638 * @param string $time The time to send 627 639 */ 628 public function doTimeReply($target, $time = '' )640 public function doTimeReply($target, $time = '', $priority = false) 629 641 { 630 642 $time = trim($time); … … 633 645 $time = date('D M d H:i:s o', $time); 634 646 } 635 $this->doCtcpReply($target, 'time', $time );647 $this->doCtcpReply($target, 'time', $time, $priority); 636 648 } 637 649 … … 642 654 * @param string $reply The CTCP reply to send 643 655 */ 644 public function doCtcpReply($target, $command, $reply = '' )656 public function doCtcpReply($target, $command, $reply = '', $priority = false) 645 657 { 646 658 $command = trim($command); 647 659 if (empty($command)) 648 660 return; 649 $this->send(Phergie_Event_Request::TYPE_NOTICE, array($target, chr(1).trim(strtoupper($command).' '.$reply).chr(1)) );661 $this->send(Phergie_Event_Request::TYPE_NOTICE, array($target, chr(1).trim(strtoupper($command).' '.$reply).chr(1)), $priority); 650 662 } 651 663 … … 655 667 * @param string $message The message to send to the server 656 668 */ 657 public function doRaw($message )658 { 659 $this->send(Phergie_Event_Request::TYPE_RAW, array($message) );669 public function doRaw($message, $priority = false) 670 { 671 $this->send(Phergie_Event_Request::TYPE_RAW, array($message), $priority); 660 672 } 661 673 } trunk/Phergie/Plugin/Altnick.php
r200 r214 42 42 $altnick = $this->getPluginIni('altnick' . $this->index); 43 43 if ($altnick) { 44 $this->doNick($altnick );44 $this->doNick($altnick, true); 45 45 $this->setIni('nick', $altnick); 46 46 } else { trunk/Phergie/Plugin/Nickserv.php
r200 r214 117 117 $this->doPrivmsg( 118 118 $this->botNick, 119 'GHOST ' . $this->nick . ' ' . $password 119 'GHOST ' . $this->nick . ' ' . $password, 120 true 120 121 ); 121 122 } … … 137 138 $this->doPrivmsg( 138 139 $this->botNick, 139 'GHOST ' . $this->nick . ' ' . $password 140 'GHOST ' . $this->nick . ' ' . $password, 141 true 140 142 ); 141 143 }