~phablet-team/telephony-service/fix_account_status_watching

« back to all changes in this revision

Viewing changes to libtelephonyservice/chatentry.cpp

  • Committer: Gustavo Pichorim Boiko
  • Date: 2016-10-29 02:19:55 UTC
  • mfrom: (1228.1.1 mms_group_fixes)
  • Revision ID: gustavo.boiko@canonical.com-20161029021955-jq2l5ua9n2neii35
Make sure we only request a channel for the desired account when chatType is Room.

Show diffs side-by-side

added added

removed removed

Lines of Context:
447
447
        setChannels(channels);
448
448
    }
449
449
 
450
 
    if (chatType() == 0) {
 
450
    if (chatType() == ChatTypeNone) {
451
451
        return;
452
452
    }
453
453
 
470
470
    }
471
471
 
472
472
    if (mAutoRequest) {
473
 
        // if there is any remaining account, request to start chatting using the account
474
 
        Q_FOREACH(AccountEntry *account, accounts) {
475
 
            ChatManager::instance()->startChat(account->accountId(), properties);
 
473
        // if the chat type is room we should only request the channel to the desired account.
 
474
        if (chatType() == ChatTypeRoom) {
 
475
            AccountEntry *account = TelepathyHelper::instance()->accountForId(mAccountId);
 
476
            if (account && accounts.contains(account)) {
 
477
                ChatManager::instance()->startChat(account->accountId(), properties);
 
478
            }
 
479
        } else {
 
480
            // if there is any remaining account, request to start chatting using the account
 
481
            Q_FOREACH(AccountEntry *account, accounts) {
 
482
                ChatManager::instance()->startChat(account->accountId(), properties);
 
483
            }
476
484
        }
477
485
    }
478
486