コード例 #1
0
ファイル: pspecific_mac.cpp プロジェクト: 0ps/telegram
void MacPrivate::notifyClicked(unsigned long long peer, int msgid) {
    History *history = App::history(PeerId(peer));

    App::wnd()->showFromTray();
	if (App::passcoded()) {
		App::wnd()->setInnerFocus();
		App::wnd()->notifyClear();
	} else {
		App::wnd()->hideSettings();
		bool tomsg = !history->peer->isUser() && (msgid > 0);
		if (tomsg) {
			HistoryItem *item = App::histItemById(peerToChannel(PeerId(peer)), MsgId(msgid));
			if (!item || !item->mentionsMe()) {
				tomsg = false;
			}
		}
		App::main()->showPeerHistory(history->peer->id, tomsg ? msgid : ShowAtUnreadMsgId);
		App::wnd()->notifyClear(history);
	}
}
コード例 #2
0
ファイル: confirmbox.cpp プロジェクト: 2asoft/tdesktop
void RichDeleteMessageBox::onDelete() {
    if (_banUser.checked()) {
        MTP::send(MTPchannels_KickFromChannel(_channel->inputChannel, _from->inputUser, MTP_boolTrue()), App::main()->rpcDone(&MainWidget::sentUpdatesReceived));
    }
    if (_reportSpam.checked()) {
        MTP::send(MTPchannels_ReportSpam(_channel->inputChannel, _from->inputUser, MTP_vector<MTPint>(1, MTP_int(_msgId))));
    }
    if (_deleteAll.checked()) {
        App::main()->deleteAllFromUser(_channel, _from);
    }
    if (HistoryItem *item = App::histItemById(_channel ? peerToChannel(_channel->id) : 0, _msgId)) {
        bool wasLast = (item->history()->lastMsg == item);
        item->destroy();

        if (_msgId > 0) {
            App::main()->deleteMessages(_channel, QVector<MTPint>(1, MTP_int(_msgId)));
        } else if (wasLast) {
            App::main()->checkPeerHistory(_channel);
        }
    }
    Ui::hideLayer();
}