Example #1
0
MyIrcBuffer::MyIrcBuffer(const QString& receiver, Irc::Session* parent)
    : Irc::Buffer(receiver, parent)
{
    connect(this, SIGNAL(receiverChanged(QString)), SLOT(on_receiverChanged(QString)));
    connect(this, SIGNAL(joined(QString)), SLOT(on_joined(QString)));
    connect(this, SIGNAL(parted(QString, QString)), SLOT(on_parted(QString, QString)));
    connect(this, SIGNAL(quit(QString, QString)), SLOT(on_quit(QString, QString)));
    connect(this, SIGNAL(nickChanged(QString, QString)), SLOT(on_nickChanged(QString, QString)));
    connect(this, SIGNAL(modeChanged(QString, QString, QString)), SLOT(on_modeChanged(QString, QString, QString)));
    connect(this, SIGNAL(topicChanged(QString, QString)), SLOT(on_topicChanged(QString, QString)));
    connect(this, SIGNAL(invited(QString, QString, QString)), SLOT(on_invited(QString, QString, QString)));
    connect(this, SIGNAL(kicked(QString, QString, QString)), SLOT(on_kicked(QString, QString, QString)));
    connect(this, SIGNAL(messageReceived(QString, QString, Irc::Buffer::MessageFlags)),
                  SLOT(on_messageReceived(QString, QString, Irc::Buffer::MessageFlags)));
    connect(this, SIGNAL(noticeReceived(QString, QString, Irc::Buffer::MessageFlags)),
                  SLOT(on_noticeReceived(QString, QString, Irc::Buffer::MessageFlags)));
    connect(this, SIGNAL(ctcpRequestReceived(QString, QString, Irc::Buffer::MessageFlags)),
                  SLOT(on_ctcpRequestReceived(QString, QString, Irc::Buffer::MessageFlags)));
    connect(this, SIGNAL(ctcpReplyReceived(QString, QString, Irc::Buffer::MessageFlags)),
                  SLOT(on_ctcpReplyReceived(QString, QString, Irc::Buffer::MessageFlags)));
    connect(this, SIGNAL(ctcpActionReceived(QString, QString, Irc::Buffer::MessageFlags)),
                  SLOT(on_ctcpActionReceived(QString, QString, Irc::Buffer::MessageFlags)));
    connect(this, SIGNAL(numericMessageReceived(QString, uint, QStringList)), SLOT(on_numericMessageReceived(QString, uint, QStringList)));
    connect(this, SIGNAL(unknownMessageReceived(QString, QStringList)), SLOT(on_unknownMessageReceived(QString, QStringList)));
}
void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel)
{
    if (_ircChannel) {
        qWarning() << Q_FUNC_INFO << "IrcChannel already set; cleanup failed!?";
        disconnect(_ircChannel, 0, this, 0);
    }

    _ircChannel = ircChannel;

    connect(ircChannel, SIGNAL(destroyed(QObject*)),
        this, SLOT(ircChannelDestroyed()));
    connect(ircChannel, SIGNAL(topicSet(QString)),
        this, SLOT(setTopic(QString)));
    connect(ircChannel, SIGNAL(encryptedSet(bool)),
        this, SLOT(setEncrypted(bool)));
    connect(ircChannel, SIGNAL(ircUsersJoined(QList<IrcUser *> )),
        this, SLOT(join(QList<IrcUser *> )));
    connect(ircChannel, SIGNAL(ircUserParted(IrcUser *)),
        this, SLOT(part(IrcUser *)));
    connect(ircChannel, SIGNAL(parted()),
        this, SLOT(ircChannelParted()));
    connect(ircChannel, SIGNAL(ircUserModesSet(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));
    connect(ircChannel, SIGNAL(ircUserModeAdded(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));
    connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));

    if (!ircChannel->ircUsers().isEmpty())
        join(ircChannel->ircUsers());

    emit dataChanged();
}
Example #3
0
void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel)
{
    Q_ASSERT(!_ircChannel && ircChannel);

    _ircChannel = ircChannel;

    connect(ircChannel, SIGNAL(topicSet(QString)),
        this, SLOT(setTopic(QString)));
    connect(ircChannel, SIGNAL(encryptedSet(bool)),
        this, SLOT(setEncrypted(bool)));
    connect(ircChannel, SIGNAL(ircUsersJoined(QList<IrcUser *> )),
        this, SLOT(join(QList<IrcUser *> )));
    connect(ircChannel, SIGNAL(ircUserParted(IrcUser *)),
        this, SLOT(part(IrcUser *)));
    connect(ircChannel, SIGNAL(parted()),
        this, SLOT(ircChannelParted()));
    connect(ircChannel, SIGNAL(ircUserModesSet(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));
    connect(ircChannel, SIGNAL(ircUserModeAdded(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));
    connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)),
        this, SLOT(userModeChanged(IrcUser *)));

    if (!ircChannel->ircUsers().isEmpty())
        join(ircChannel->ircUsers());

    emit dataChanged();
}
Example #4
0
void IrcChannel::part(IrcUser *ircuser) {
  if(isKnownUser(ircuser)) {
    _userModes.remove(ircuser);
    ircuser->partChannel(this);
    // if you wonder why there is no counterpart to ircUserParted:
    // the joines are propagted by the ircuser. the signal ircUserParted is only for convenience
    disconnect(ircuser, 0, this, 0);
    emit ircUserParted(ircuser);

    if(network()->isMe(ircuser) || _userModes.isEmpty()) {
      // in either case we're no longer in the channel
      //  -> clean up the channel and destroy it
      QList<IrcUser *> users = _userModes.keys();
      _userModes.clear();
      foreach(IrcUser *user, users) {
        disconnect(user, 0, this, 0);
        user->partChannel(this);
      }
      emit parted();
      network()->removeIrcChannel(this);
    }