示例#1
0
	virtual uint32_t main(void)
	{
		bool eof_flag = false, abort_flag = false;

		while(!(eof_flag || (abort_flag = is_stopped())))
		{
			size_t bytes_read = 0;
			if(!m_client->read_data(m_buffer, BUFF_SIZE, bytes_read, eof_flag))
			{
				set_error_text(m_client->get_error_text());
				return TRANSFER_ERR_INET;
			}

			if(bytes_read > 0)
			{
				m_transferred_bytes.add(bytes_read);
				if(!(abort_flag = is_stopped()))
				{
					if(!m_sink->write(m_buffer, bytes_read))
					{
						return TRANSFER_ERR_SINK;
					}
				}
			}
		}

		return abort_flag ? TRANSFER_ERR_ABRT : TRANSFER_COMPLETE;
	}
示例#2
0
void Gobby::UserJoinCommands::UserJoinInfo::
	on_user_join_finished(InfUser* user, const GError* error)
{
	if(m_request != NULL)
	{
		g_object_unref(m_request);
		m_request = NULL;
	}

	if(error == NULL)
	{
		user_join_complete(user);
	}
	else if(error->domain == inf_user_error_quark() &&
	        error->code == INF_USER_ERROR_NAME_IN_USE)
	{
		// If name is in use retry with alternative user name
		++m_retry_index;
		attempt_user_join();
	}
	else if(error->domain == inf_request_error_quark() &&
	        error->code == INF_REQUEST_ERROR_NOT_AUTHORIZED)
	{
		set_permission_denied_text(m_view);
		finish();
	}
	else
	{
		set_error_text(m_view, error->message);
		finish();
	}
}
示例#3
0
	virtual uint32_t main(void)
	{
		if(!m_client->open(m_verb, m_url, m_post_data, m_referrer, m_timestamp))
		{
			set_error_text(m_client->get_error_text());
			return CONNECTION_ERR_INET;
		}

		return is_stopped() ? CONNECTION_ERR_ABRT : CONNECTION_COMPLETE;
	}
void
Gobby::SynchronizationCommands::
	on_synchronization_failed(InfSession* session,
                                  InfXmlConnection* c,
                                  const GError* error)
{
	SyncMap::iterator iter = m_sync_map.find(session);
	g_assert(iter != m_sync_map.end());

	set_error_text(iter->second->get_session_view(), error->message);

	// The document will be of no use anyway, so consider it as not
	// being modified.
	InfBuffer* buffer = inf_session_get_buffer(session);
	inf_buffer_set_modified(buffer, FALSE);

	delete iter->second;
	m_sync_map.erase(iter);
}