void SSH1Channel::channelPacketReceived(int flag) { // TODO: other flags; switch (flag) { case SSH_SMSG_SUCCESS: if (m_status == RequestPty) { #ifdef SSH_DEBUG qDebug() << "Pty request succeed"; #endif m_status = Interactive; emit channelReady(); } break; case SSH_SMSG_FAILURE: if (m_status == RequestPty) qDebug("Pty request failed"); break; case SSH_SMSG_STDOUT_DATA: case SSH_SMSG_STDERR_DATA: #ifdef SSH_DEBUG qDebug() << "new data available"; #endif receiveData(); break; default: qDebug("unknown packet: %d", flag); break; } }
void SSH2Channel::requestPty(uint id) { // TODO: Env #ifdef SSH_DEBUG qDebug() << "request PTY"; #endif m_out->startPacket(SSH2_MSG_CHANNEL_REQUEST); m_out->putUInt32(id); m_out->putString("pty-req"); m_out->putUInt8(0); // TODO: "xterm" does not work somehow m_out->putString(m_termType.toLatin1()); // TODO: configuration m_out->putUInt32(80); m_out->putUInt32(24); m_out->putUInt32(0); m_out->putUInt32(0); m_out->putString(""); m_out->sendPacket(); #ifdef SSH_DEBUG qDebug() << "start shell"; #endif m_out->startPacket(SSH2_MSG_CHANNEL_REQUEST); m_out->putUInt32(id); m_out->putString("shell"); m_out->putUInt8(0); m_out->sendPacket(); emit channelReady(); }
void TpSessionChannel::onChannelReady(Tp::PendingOperation *op) { QDEBUG_FUNCTION_BEGIN Q_UNUSED(op); qDebug() << "TpSessionChannel::onChannelReady type=" << channel->channelType() << "path " << channel->objectPath() << "initiatorContact=" << (channel->initiatorContact() ? channel->initiatorContact()->id() : "NULL") ; ; connect(channel.data(), SIGNAL(messageReceived(const Tp::ReceivedMessage &)), SLOT(onMessageReceived(const Tp::ReceivedMessage &))); connect(channel.data(), SIGNAL(messageSent(const Tp::Message &, Tp::MessageSendingFlags, const QString &)), SLOT(onMessageSent(const Tp::Message &, Tp::MessageSendingFlags, const QString &))); connect(channel.data(), SIGNAL(destroyed(QObject *)), SLOT(onChannelDestroyed(QObject *))); emit channelReady(this); peerContact = channel->initiatorContact(); QList<Tp::ReceivedMessage> queuedMessages = channel->messageQueue(); foreach (const Tp::ReceivedMessage &message, queuedMessages) { qDebug() << "received " << message.text(); emit messageReceived(message, this); }
void MumbleClient::processUserState(quint8 *message, quint64 size) { MumbleProto::UserState us; us.ParseFromArray(message,size); if((_session_id==-1) && (us.has_channel_id())) { _channel_id = us.channel_id(); qDebug() << " Joined channel: " << _channel_id; } if(us.session() == _session_id) { if(us.has_channel_id()) { _channel_id = us.channel_id(); qDebug() << " Joined channel: " << _channel_id; if(_channel_id > 1) { emit channelReady(_channel_id); } } for(int i=0; i < _stations.size(); i++) { Station *s = _stations.at(i); if(s->_id == _session_id) { delete s; s = NULL; _stations.remove(i); } } } else { bool set_station = false; for(int i=0; i < _stations.size(); i++) { Station *s = _stations.at(i); if(s->_id == us.session()) { s->_conference_id = us.channel_id(); if(us.has_self_mute()) s->_mute = us.self_mute(); if(us.has_deaf()) s->_deaf = us.self_deaf(); if(us.has_comment()) s->_callsign = QString::fromStdString(us.comment()); set_station = true; } } if(!set_station) { Station *s = new Station; s->_id = us.session(); s->_radio_id = QString::fromStdString(us.name()); s->_conference_id = us.channel_id(); if(us.has_self_mute()) s->_mute = us.self_mute(); if(us.has_deaf()) s->_deaf = us.self_deaf(); if(us.has_comment()) s->_callsign = QString::fromStdString(us.comment()); _stations.push_back(s); emit newStation(s); } } /* Just debug code for(int i = 0;i < _stations.size();i++) { Station *s = _stations.at(i); qDebug() << "Session: " << QString::number(s->_id) << " radio_id: " << s->_radio_id << " channel: " << QString::number(s->_conference_id) << s->_callsign; } */ StationList sl; for(int i =0; i<_stations.size(); ++i) { sl.append(*(_stations.at(i))); } emit onlineStations(sl); }