コード例 #1
0
JabberFileTransferService::JabberFileTransferService(
    QXmppTransferManager *transferManager, Account account, QObject *parent)
        : FileTransferService{parent}, m_transferManager{transferManager}, m_account{account}
{
    connect(account, SIGNAL(updated()), this, SLOT(accountUpdated()));
    accountUpdated();

    connect(m_transferManager, SIGNAL(fileReceived(QXmppTransferJob *)), this, SLOT(fileReceived(QXmppTransferJob *)));
}
コード例 #2
0
ファイル: accounts-model.cpp プロジェクト: partition/kadu
AccountsModel::~AccountsModel()
{
	disconnect(AccountManager::instance(), SIGNAL(accountUpdated(Account)),
			this, SLOT(accountUpdated(Account)));
	disconnect(AccountManager::instance(), SIGNAL(accountAboutToBeRegistered(Account)),
			this, SLOT(accountAboutToBeRegistered(Account)));
	disconnect(AccountManager::instance(), SIGNAL(accountRegistered(Account)),
			this, SLOT(accountRegistered(Account)));
	disconnect(AccountManager::instance(), SIGNAL(accountAboutToBeUnregistered(Account)),
			this, SLOT(accountAboutToBeUnregistered(Account)));
	disconnect(AccountManager::instance(), SIGNAL(accountUnregistered(Account)),
			this, SLOT(accountUnregistered(Account)));
}
コード例 #3
0
ファイル: clientapp.cpp プロジェクト: KWMalik/qcloud
ClientApp::ClientApp (int& argc, char** argv) : QApplication (argc, argv)
    ,m_client(0)
    ,m_mainWindow(new MainWindow)
{
    QCloud::Info::registerMetaType();
    QCloud::EntryInfo::registerMetaType();
    m_client = new QCloud::Client(this);
    m_mainWindow->show();

    if (m_client->isValid())
        m_mainWindow->loadAccount();

    connect(m_client, SIGNAL(accountUpdated()), this, SLOT(accountUpdated()));
}
コード例 #4
0
ファイル: accounts-model.cpp プロジェクト: partition/kadu
AccountsModel::AccountsModel(QObject *parent) :
		QAbstractListModel(parent), IncludeIdInDisplay(false)
{
	connect(AccountManager::instance(), SIGNAL(accountUpdated(Account)),
			this, SLOT(accountUpdated(Account)));
	connect(AccountManager::instance(), SIGNAL(accountAboutToBeRegistered(Account)),
			this, SLOT(accountAboutToBeRegistered(Account)));
	connect(AccountManager::instance(), SIGNAL(accountRegistered(Account)),
			this, SLOT(accountRegistered(Account)));
	connect(AccountManager::instance(), SIGNAL(accountAboutToBeUnregistered(Account)),
			this, SLOT(accountAboutToBeUnregistered(Account)));
	connect(AccountManager::instance(), SIGNAL(accountUnregistered(Account)),
			this, SLOT(accountUnregistered(Account)));
}
コード例 #5
0
TransferEnginePrivate::TransferEnginePrivate(TransferEngine *parent):
    m_notificationsEnabled(true),
    m_settings(CONFIG_PATH, QSettings::IniFormat),
    q_ptr(parent)
{
    m_fileWatcherTimer = new QTimer(this);
    m_fileWatcherTimer->setSingleShot(true);
    connect(m_fileWatcherTimer, SIGNAL(timeout()), this, SLOT(enabledPluginsCheck()));

    m_fileWatcher = new QFileSystemWatcher(this);
    m_fileWatcher->addPath(SHARE_PLUGINS_PATH);
    connect(m_fileWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(pluginDirChanged()));

    m_accountManager = new Accounts::Manager("sharing", this);
    connect(m_accountManager, SIGNAL(accountCreated(Accounts::AccountId)), this, SLOT(enabledPluginsCheck()));
    connect(m_accountManager, SIGNAL(accountRemoved(Accounts::AccountId)), this, SLOT(enabledPluginsCheck()));
    connect(m_accountManager, SIGNAL(accountUpdated(Accounts::AccountId)), this, SLOT(enabledPluginsCheck()));

    // Exit safely stuff if we recieve certain signal or there are no active transfers
    Q_Q(TransferEngine);
    connect(TransferEngineSignalHandler::instance(), SIGNAL(exitSafely()), this, SLOT(exitSafely()));
    connect(q, SIGNAL(statusChanged(int,int)), this, SLOT(exitSafely()));

    // Monitor expired transfers and cleanup them if required
    m_activityMonitor = new ClientActivityMonitor(this);
    connect(m_activityMonitor, SIGNAL(transfersExpired(QList<int>)), this, SLOT(cleanupExpiredTransfers(QList<int>)));
}
コード例 #6
0
void AccountSettingsModel::setDefaultProxy(const bool& yes) {
    if (!_proxyConfig || !yes) {
        return;
    }
    linphone_core_set_default_proxy_config(LinphoneManager::getInstance()->getLc(), _proxyConfig);
    emit accountUpdated();
}
コード例 #7
0
void AccountSettingsModel::deleteAccount() {
    if (_proxyConfig) {
        linphone_core_remove_proxy_config(LinphoneManager::getInstance()->getLc(), _proxyConfig);
    }
    if (_authInfo) {
        linphone_core_remove_auth_info(LinphoneManager::getInstance()->getLc(), _authInfo);
    }
    emit accountUpdated();
}
コード例 #8
0
void AccountSettingsModel::selectDefaultProxy() {
    _proxyConfig = linphone_core_get_default_proxy_config(LinphoneManager::getInstance()->getLc());
    if (!_proxyConfig) {
        return;
    }

    const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(_proxyConfig);
    _authInfo = linphone_proxy_config_find_auth_info(_proxyConfig);
    if (_proxyConfig && _authInfo) {
        emit accountUpdated();
    }
}
コード例 #9
0
void AccountSettingsModel::setProxy(const QString& proxy) {
    if (!_proxyConfig) {
        return;
    }

    linphone_proxy_config_edit(_proxyConfig);
    LinphoneAddress *addr = linphone_core_create_address(LinphoneManager::getInstance()->getLc(), proxy.toUtf8().constData());
    linphone_proxy_config_set_server_addr(_proxyConfig, linphone_address_as_string(addr));
    if (outboundProxy()) {
        linphone_proxy_config_set_route(_proxyConfig, linphone_address_as_string(addr));
    }
    linphone_address_destroy(addr);
    linphone_proxy_config_done(_proxyConfig);
    emit accountUpdated();
}
コード例 #10
0
Accounts::Account* AccountsModelPrivate::accountById(int id)
{
    if (m_accHash.contains(id)) {
        return m_accHash.value(id);
    }

    Accounts::Account* account = m_manager->account(id);
    if (!account) {
        qDebug() << "\t Failed to get the account from manager";
        return 0;
    }

    connect(account, SIGNAL(displayNameChanged(QString)), q, SLOT(accountUpdated()));

    m_accHash[id] = account;
    return account;
}
コード例 #11
0
void AccountSettingsModel::setSelectedAccount(QString sipUri) {
    const MSList *proxy_configs = linphone_core_get_proxy_config_list(LinphoneManager::getInstance()->getLc());
    sipUri = QString("sip:") + sipUri;

    while (proxy_configs) {
        LinphoneProxyConfig *lpc = (LinphoneProxyConfig *)proxy_configs->data;
        const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(lpc);
        const char *uri = linphone_address_as_string_uri_only(addr);

        if (strcmp(uri, sipUri.toUtf8().constData()) == 0) {
            _proxyConfig = lpc;
            _authInfo = linphone_proxy_config_find_auth_info(_proxyConfig);
            if (_proxyConfig && _authInfo) {
                emit accountUpdated();
            }
            return;
        }

        proxy_configs = ms_list_next(proxy_configs);
    }
}
コード例 #12
0
void AccountSettingsModel::setTransportIndex(const int& transport) {
    if (!_proxyConfig) {
        return;
    }

    const char *proxy = linphone_proxy_config_get_server_addr(_proxyConfig);
    LinphoneAddress *addr = linphone_core_create_address(LinphoneManager::getInstance()->getLc(), proxy);
    if (transport == 0) {
        linphone_address_set_transport(addr, LinphoneTransportUdp);
    } else if (transport == 1) {
        linphone_address_set_transport(addr, LinphoneTransportTcp);
    } else if (transport == 2) {
        linphone_address_set_transport(addr, LinphoneTransportTls);
    }
    linphone_proxy_config_edit(_proxyConfig);
    linphone_proxy_config_set_server_addr(_proxyConfig, linphone_address_as_string(addr));
    if (outboundProxy()) {
        linphone_proxy_config_set_route(_proxyConfig, linphone_address_as_string(addr));
    }
    linphone_address_destroy(addr);
    linphone_proxy_config_done(_proxyConfig);
    emit accountUpdated();
}
コード例 #13
0
ファイル: gadu-protocol.cpp プロジェクト: vogel/kadu
void GaduProtocol::init()
{
    Connection = new ProtocolGaduConnection(this);
    Connection->setConnectionProtocol(this);

    m_gaduAccountAvatarService = new GaduAccountAvatarService(account(), this);

    CurrentChatImageService = new GaduChatImageService(account(), this);
    CurrentChatImageService->setConnection(Connection);

    CurrentImTokenService = new GaduIMTokenService{this};

    CurrentFileTransferService = pluginInjectedFactory()->makeInjected<GaduFileTransferService>(this);
    CurrentFileTransferService->setGaduIMTokenService(CurrentImTokenService);

    CurrentChatService = pluginInjectedFactory()->makeInjected<GaduChatService>(account(), this);
    CurrentChatService->setConnection(Connection);
    CurrentChatService->setGaduChatImageService(CurrentChatImageService);
    CurrentChatService->setGaduFileTransferService(CurrentFileTransferService);
    CurrentChatImageService->setGaduChatService(CurrentChatService);

    CurrentContactPersonalInfoService =
        pluginInjectedFactory()->makeInjected<GaduContactPersonalInfoService>(account(), this);
    CurrentContactPersonalInfoService->setConnection(Connection);

    CurrentPersonalInfoService = pluginInjectedFactory()->makeInjected<GaduPersonalInfoService>(account(), this);
    CurrentPersonalInfoService->setConnection(Connection);

    CurrentSearchService = pluginInjectedFactory()->makeInjected<GaduSearchService>(account(), this);
    CurrentSearchService->setConnection(Connection);

    CurrentMultilogonService = new GaduMultilogonService(account(), this);
    CurrentMultilogonService->setConnection(Connection);

    CurrentChatStateService = pluginInjectedFactory()->makeInjected<GaduChatStateService>(account(), this);
    CurrentChatStateService->setConnection(Connection);

    m_gaduContactAvatarService = pluginInjectedFactory()->makeInjected<GaduContactAvatarService>(account(), this);

    connect(
        CurrentChatService, SIGNAL(messageReceived(Message)), CurrentChatStateService, SLOT(messageReceived(Message)));

    CurrentDriveService = pluginInjectedFactory()->makeInjected<GaduDriveService>(account(), this);
    CurrentDriveService->setGaduIMTokenService(CurrentImTokenService);

    CurrentUserDataService =
        pluginInjectedFactory()->makeInjected<GaduUserDataService>(m_gaduContactAvatarService, account(), this);

    auto contacts = contactManager()->contacts(account(), ContactManager::ExcludeAnonymous);
    auto rosterService = pluginInjectedFactory()->makeInjected<GaduRosterService>(m_gaduListHelper, contacts, this);
    rosterService->setConnection(Connection);

    CurrentNotifyService = new GaduNotifyService{Connection, this};
    connect(rosterService, SIGNAL(contactAdded(Contact)), CurrentNotifyService, SLOT(contactAdded(Contact)));
    connect(rosterService, SIGNAL(contactRemoved(Contact)), CurrentNotifyService, SLOT(contactRemoved(Contact)));
    connect(
        rosterService, SIGNAL(contactUpdatedLocally(Contact)), CurrentNotifyService,
        SLOT(contactUpdatedLocally(Contact)));

    setRosterService(rosterService);

    configureServices();

    connect(account(), SIGNAL(updated()), this, SLOT(accountUpdated()));

    OpenChatRunner = m_pluginInjectedFactory->makeInjected<GaduOpenChatWithRunner>(account());
    OpenChatWithRunnerManager::instance()->registerRunner(OpenChatRunner);

    m_aggregatedAccountAvatarService->add(m_gaduAccountAvatarService);
    m_aggregatedContactAvatarService->add(m_gaduContactAvatarService);
    m_chatServiceRepository->addChatService(CurrentChatService);
    m_chatStateServiceRepository->addChatStateService(CurrentChatStateService);
}