via @bot fixed in forwarded, stickers requested in stickersbox, sticker not autoselected in dropdown, forwarded messages to chats fixed from_id and via_bot_id

This commit is contained in:
John Preston 2016-01-11 12:45:07 +08:00
parent 71f588a4fe
commit fc02f96ef1
5 changed files with 22 additions and 10 deletions

View file

@ -727,6 +727,7 @@ StickersBox::StickersBox() : ItemListBox(st::boxScroll)
setMaxHeight(snap(countHeight(), int32(st::sessionsHeight), int32(st::boxMaxListHeight)));
connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));
App::main()->updateStickers();
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));

View file

@ -4030,7 +4030,7 @@ void MentionsInner::mouseMoveEvent(QMouseEvent *e) {
void MentionsInner::clearSel() {
_mouseSel = _overDelete = false;
setSel((_mrows->isEmpty() && _brows->isEmpty() && _hrows->isEmpty() && _srows->isEmpty()) ? -1 : 0);
setSel((_mrows->isEmpty() && _brows->isEmpty() && _hrows->isEmpty()) ? -1 : 0);
}
bool MentionsInner::moveSel(int key) {

View file

@ -6578,17 +6578,18 @@ int32 HistoryMessage::resize(int32 width) {
if (media) _height += _media->resize(width, this);
}
int32 l = 0, w = 0;
countPositionAndSize(l, w);
if (displayFromName()) {
if (emptyText()) {
_height += st::msgPadding.top() + st::msgNameFont->height + st::mediaHeaderSkip;
} else {
_height += st::msgNameFont->height;
}
int32 l = 0, w = 0;
countPositionAndSize(l, w);
fromNameUpdated(w);
} else if (via() && !toHistoryForwarded()) {
int32 l = 0, w = 0;
countPositionAndSize(l, w);
via()->resize(w - st::msgPadding.left() - st::msgPadding.right());
if (emptyText() && !displayFromName()) {
_height += st::msgPadding.top() + st::msgNameFont->height + st::mediaHeaderSkip;
@ -6788,7 +6789,7 @@ HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const
}
HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, QDateTime date, int32 from, HistoryMessage *msg)
: HistoryMessage(history, block, id, newMessageFlags(history->peer) | (!history->peer->isChannel() && msg->getMedia() && (msg->getMedia()->type() == MediaTypeAudio/* || msg->getMedia()->type() == MediaTypeVideo*/) ? MTPDmessage::flag_media_unread : 0), msg->via() ? peerToUser(msg->viaBot()->id) : 0, date, from, msg->HistoryMessage::originalText(), msg->HistoryMessage::originalEntities(), msg->getMedia())
: HistoryMessage(history, block, id, newForwardedFlags(history->peer, from, msg), msg->via() ? peerToUser(msg->viaBot()->id) : 0, date, from, msg->HistoryMessage::originalText(), msg->HistoryMessage::originalEntities(), msg->getMedia())
, fwdDate(msg->dateForwarded())
, fwdFrom(msg->fromForwarded())
, fwdFromVersion(fwdFrom->nameVersion)
@ -6818,6 +6819,11 @@ void HistoryForwarded::initDimensions() {
void HistoryForwarded::fwdNameUpdated() const {
QString fwdName((via() && fwdFrom->isUser()) ? fwdFrom->asUser()->firstName : App::peerName(fwdFrom));
fwdFromName.setText(st::msgServiceNameFont, fwdName, _textNameOptions);
if (via()) {
int32 l = 0, w = 0;
countPositionAndSize(l, w);
via()->resize(w - st::msgPadding.left() - st::msgPadding.right() - fromWidth - fwdFromName.maxWidth() - st::msgServiceFont->spacew);
}
}
void HistoryForwarded::draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const {
@ -6870,7 +6876,9 @@ int32 HistoryForwarded::resize(int32 width) {
_height += st::msgServiceNameFont->height;
}
if (via()) {
via()->resize(width - st::msgPadding.left() - st::msgPadding.right() - fromWidth - fwdFromName.maxWidth() - st::msgServiceFont->spacew);
int32 l = 0, w = 0;
countPositionAndSize(l, w);
via()->resize(w - st::msgPadding.left() - st::msgPadding.right() - fromWidth - fwdFromName.maxWidth() - st::msgServiceFont->spacew);
}
}
}

View file

@ -2235,6 +2235,13 @@ protected:
};
inline int32 newMessageFlags(PeerData *p) {
return p->isSelf() ? 0 : (((p->isChat() || (p->isUser() && !p->asUser()->botInfo)) ? MTPDmessage::flag_unread : 0) | MTPDmessage::flag_out);
}
inline int32 newForwardedFlags(PeerData *p, int32 from, HistoryMessage *msg) {
return newMessageFlags(p) | (from ? MTPDmessage::flag_from_id : 0) | (msg->via() ? MTPDmessage::flag_via_bot_id : 0) | (!p->isChannel() && msg->getMedia() && (msg->getMedia()->type() == MediaTypeAudio/* || msg->getMedia()->type() == MediaTypeVideo*/) ? MTPDmessage::flag_media_unread : 0);
}
class HistoryServiceMsg : public HistoryItem {
public:

View file

@ -717,10 +717,6 @@ inline bool PeerData::canWrite() const {
return isChannel() ? asChannel()->canWrite() : (isChat() ? asChat()->canWrite() : (isUser() ? asUser()->canWrite() : false));
}
inline int32 newMessageFlags(PeerData *p) {
return p->isSelf() ? 0 : (((p->isChat() || (p->isUser() && !p->asUser()->botInfo)) ? MTPDmessage::flag_unread : 0) | MTPDmessage::flag_out);
}
enum ActionOnLoad {
ActionOnLoadNone,
ActionOnLoadOpen,