예제 #1
0
void TCPServer::clientDisconnected()
{
    disconnect(m_socket, SIGNAL(readyRead()), this, SLOT(receiveData()));
    disconnect(m_socket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));

    m_tcpServer.listen(QHostAddress::Any, m_options.port);

    if (m_onClientDisconnectedCallback)
        m_onClientDisconnectedCallback(getClientName());

    m_socket = nullptr;
}
예제 #2
0
void TCPServer::acceptConnection()
{
    m_socket = m_tcpServer.nextPendingConnection();
    if (!m_socket)
        return;

    connect(m_socket, SIGNAL(readyRead()), this, SLOT(receiveData()));
    connect(m_socket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));

    m_tcpServer.close();

    if (m_onClientConnectedCallback)
        m_onClientConnectedCallback(getClientName());
}
예제 #3
0
ClientContext::ClientContext(jobject jsvnclient, SVN::Pool &pool)
    : OperationContext(pool)
{
    static jfieldID ctxFieldID = 0;
    attachJavaObject(jsvnclient, JAVAHL_ARG("/SVNClient$ClientContext;"), "clientContext", &ctxFieldID);

    SVN_JNI_ERR(svn_client_create_context2(&m_context, NULL,
                                           pool.getPool()),
                );

    /* Clear the wc_ctx as we don't want to maintain this unconditionally
       for compatibility reasons */
    SVN_JNI_ERR(svn_wc_context_destroy(m_context->wc_ctx),
                );
    m_context->wc_ctx = NULL;

    /* None of the following members change during the lifetime of
       this object. */
    m_context->notify_func = NULL;
    m_context->notify_baton = NULL;
    m_context->log_msg_func3 = CommitMessage::callback;
    m_context->log_msg_baton3 = NULL;
    m_context->cancel_func = checkCancel;
    m_context->cancel_baton = this;
    m_context->notify_func2= notify;
    m_context->notify_baton2 = m_jctx;
    m_context->progress_func = progress;
    m_context->progress_baton = m_jctx;
    m_context->conflict_func2 = resolve;
    m_context->conflict_baton2 = m_jctx;

    m_context->client_name = getClientName();

    if (m_jtunnelcb)
      {
        m_context->check_tunnel_func = checkTunnel;
        m_context->open_tunnel_func = openTunnel;
        m_context->tunnel_baton = m_jtunnelcb;
      }
}
예제 #4
0
bool IRCSession::initLoginRequest()
{
	std::string nick = getNick();
	std::string user = getUser();
	if(user.empty())
		user = nick;
	std::string clientName = getClientName();

	OS_ASSERT(nick.empty() == false);
	OS_ASSERT(user.empty() == false);
	OS_ASSERT(clientName.empty() == false);

	std::string command;
	command.append("PASS NOPASS");
	command.append(OS_IRC_COMMANDS_TERMINATOR);	
	command.append("NICK " + nick);
	command.append(OS_IRC_COMMANDS_TERMINATOR);			
	command.append("USER " + user + " USING " + clientName + " :" + nick);
	command.append(OS_IRC_COMMANDS_TERMINATOR);

	return addRequest(shared_ptr<IIRCCommand>(OS_NEW IRCCommandRaw(get_this_ptr(), command)), false);
}