channel icon added, views count display done

This commit is contained in:
John Preston 2015-09-15 11:50:54 +03:00
parent eaacc1b7e2
commit 77a92c62f7
16 changed files with 487 additions and 450 deletions

View File

@ -156,9 +156,9 @@ sysUnlock: sysButton(sysUpd) {
img: sprite(207px, 22px, 19px, 19px); img: sprite(207px, 22px, 19px, 19px);
} }
titleBackButton: iconedButton(btnDefIconed) { titleBackButton: iconedButton(btnDefIconed) {
icon: sprite(113px, 108px, 13px, 20px); icon: sprite(9px, 104px, 13px, 20px);
iconPos: point(5px, 9px); iconPos: point(5px, 9px);
downIcon: sprite(113px, 108px, 13px, 20px); downIcon: sprite(9px, 104px, 13px, 20px);
downIconPos: point(5px, 10px); downIconPos: point(5px, 10px);
bgColor: #c4d8e9; bgColor: #c4d8e9;
@ -259,12 +259,12 @@ cbDefFlat: flatCheckbox {
disabledCursor: cursor(default); disabledCursor: cursor(default);
imageRect: sprite(140px, 68px, 22px, 22px); imageRect: sprite(142px, 43px, 22px, 22px);
chkImageRect: sprite(115px, 68px, 22px, 22px); chkImageRect: sprite(120px, 68px, 22px, 22px);
overImageRect: sprite(190px, 68px, 22px, 22px); overImageRect: sprite(142px, 68px, 22px, 22px);
chkOverImageRect: sprite(115px, 68px, 22px, 22px); chkOverImageRect: sprite(120px, 68px, 22px, 22px);
disImageRect: sprite(140px, 43px, 22px, 22px); disImageRect: sprite(142px, 43px, 22px, 22px);
chkDisImageRect: sprite(115px, 43px, 22px, 22px); chkDisImageRect: sprite(120px, 43px, 22px, 22px);
imagePos: point(0px, 0px); imagePos: point(0px, 0px);
} }
@ -715,12 +715,14 @@ dlgActiveDblCheckImg: sprite(302px, 36px, 17px, 11px);
dlgActiveCheckImg: sprite(320px, 36px, 17px, 11px); dlgActiveCheckImg: sprite(320px, 36px, 17px, 11px);
dlgSendImg: sprite(122px, 25px, 17px, 11px); dlgSendImg: sprite(122px, 25px, 17px, 11px);
dlgActiveSendImg: sprite(142px, 25px, 17px, 11px); dlgActiveSendImg: sprite(142px, 25px, 17px, 11px);
dlgChatImg: sprite(302px, 51px, 16px, 11px);
dlgActiveChatImg: sprite(322px, 51px, 16px, 11px);
dlgChatImgLeft: 1px; dlgChatImgPos: point(1px, 4px);
dlgChatImgTop: 4px; dlgChatImg: sprite(104px, 26px, 16px, 11px);
dlgChatImgSkip: 22px; dlgActiveChatImg: sprite(104px, 37px, 16px, 11px);
dlgChannelImgPos: point(2px, 3px);
dlgChannelImg: sprite(104px, 0px, 14px, 13px);
dlgActiveChannelImg: sprite(104px, 13px, 14px, 13px);
dlgImgSkip: 22px;
dlgCheckLeft: 5px; dlgCheckLeft: 5px;
dlgCheckTop: 4px; dlgCheckTop: 4px;
@ -757,8 +759,8 @@ topBarBG: white;
topBarDuration: 200; topBarDuration: 200;
topBarForwardPadding: margins(17px, 8px, 39px, 8px); topBarForwardPadding: margins(17px, 8px, 39px, 8px);
topBarForwardAlpha: 0.6; topBarForwardAlpha: 0.6;
topBarForwardImg: sprite(45px, 112px, 9px, 16px); topBarForwardImg: sprite(31px, 104px, 9px, 16px);
topBarBackwardImg: sprite(35px, 112px, 9px, 16px); topBarBackwardImg: sprite(22px, 104px, 9px, 16px);
topBarBackPadding: margins(15px, 7px, 9px, 7px); topBarBackPadding: margins(15px, 7px, 9px, 7px);
topBarBackAlpha: 0.8; topBarBackAlpha: 0.8;
topBarBackImg: sprite(65px, 112px, 9px, 16px); topBarBackImg: sprite(65px, 112px, 9px, 16px);
@ -873,19 +875,30 @@ msgPtr: 8px;
msgBG: ':/gui/art/bg.jpg'; msgBG: ':/gui/art/bg.jpg';
msgBG0: ':/gui/art/bg0.png'; msgBG0: ':/gui/art/bg0.png';
msgSendingRect: sprite(260px, 20px, 20px, 20px); msgCheckPos: point(3px, 1px);
msgCheckRect: sprite(320px, 0px, 20px, 20px); msgSendingImg: sprite(260px, 20px, 20px, 20px);
msgCheckPos: point(5px, 1px); msgCheckImg: sprite(320px, 0px, 20px, 20px);
msgDblCheckRect: sprite(300px, 0px, 20px, 20px); msgDblCheckImg: sprite(300px, 0px, 20px, 20px);
msgSelectCheckRect: sprite(160px, 0px, 20px, 20px); msgSelectCheckImg: sprite(162px, 0px, 20px, 20px);
msgSelectDblCheckRect: sprite(140px, 0px, 20px, 20px); msgSelectDblCheckImg: sprite(142px, 0px, 20px, 20px);
msgViewsPos: point(0px, -4px);
msgViewsImg: sprite(104px, 48px, 16px, 11px);
msgSelectViewsImg: sprite(104px, 70px, 16px, 11px);
msgOutViewsImg: sprite(104px, 81px, 16px, 11px);
msgSelectOutViewsImg: sprite(104px, 92px, 16px, 11px);
msgSendingViewsImg: sprite(104px, 103px, 16px, 11px);
msgSendingOutViewsImg: sprite(104px, 125px, 16px, 11px);
msgInvSendingImg: sprite(320px, 65px, 20px, 20px);
msgInvCheckImg: sprite(280px, 20px, 20px, 20px);
msgInvDblCheckImg: sprite(300px, 65px, 20px, 20px);
msgInvViewsImg: sprite(104px, 59px, 16px, 11px);
msgInvSendingViewsImg: sprite(104px, 114px, 16px, 11px);
msgDateSpace: 19px; msgDateSpace: 19px;
msgDateCheckSpace: 4px; msgDateCheckSpace: 4px;
msgDateViewsSpace: 11px;
msgDateDelta: point(2px, 5px); msgDateDelta: point(2px, 5px);
msgImgSendingRect: sprite(320px, 65px, 20px, 20px);
msgImgCheckRect: sprite(280px, 20px, 20px, 20px);
msgImgDblCheckRect: sprite(300px, 65px, 20px, 20px);
msgDateImgDelta: 4px; msgDateImgDelta: 4px;
msgDateImgColor: #fff; msgDateImgColor: #fff;
msgDateImgBg: #00000054; msgDateImgBg: #00000054;
@ -1027,8 +1040,8 @@ btnAttachDocument: iconedButton(btnDefIconed) {
height: 46px; height: 46px;
} }
btnAttachPhoto: iconedButton(btnAttachDocument) { btnAttachPhoto: iconedButton(btnAttachDocument) {
icon: sprite(113px, 0px, 24px, 24px); icon: sprite(118px, 0px, 24px, 24px);
downIcon: sprite(113px, 0px, 24px, 24px); downIcon: sprite(118px, 0px, 24px, 24px);
} }
btnAttachEmoji: iconedButton(btnAttachDocument) { btnAttachEmoji: iconedButton(btnAttachDocument) {
overBgColor: white; overBgColor: white;
@ -1057,6 +1070,8 @@ btnBotKbHide: iconedButton(btnAttachEmoji) {
downIcon: sprite(373px, 95px, 23px, 14px); downIcon: sprite(373px, 95px, 23px, 14px);
downIconPos: point(5px, 17px); downIconPos: point(5px, 17px);
} }
broadcastToggle: sprite(40px, 104px, 22px, 21px);
broadcastToggleOn: sprite(40px, 125px, 22px, 21px);
btnRecordAudio: sprite(379px, 390px, 16px, 24px); btnRecordAudio: sprite(379px, 390px, 16px, 24px);
btnRecordAudioActive: sprite(379px, 366px, 16px, 24px); btnRecordAudioActive: sprite(379px, 366px, 16px, 24px);
recordSignalColor: #f17077; recordSignalColor: #f17077;
@ -1258,7 +1273,7 @@ profileListStatusBottom: 6px;
profileHoverBG: #f5f5f5; profileHoverBG: #f5f5f5;
profileActiveBG: #6294b9; profileActiveBG: #6294b9;
profileSubFont: font(fsize); profileSubFont: font(fsize);
profileCheckRect: sprite(88px, 108px, 24px, 24px); profileCheckRect: sprite(78px, 114px, 24px, 24px);
profileCheckActiveRect: sprite(128px, 108px, 24px, 24px); profileCheckActiveRect: sprite(128px, 108px, 24px, 24px);
profileCheckDeltaX: 18px; profileCheckDeltaX: 18px;
profileCheckDeltaY: 1px; profileCheckDeltaY: 1px;
@ -1419,7 +1434,7 @@ contactsClose: flatButton {
font: font(16px); font: font(16px);
overFont: font(16px); overFont: font(16px);
} }
contactsImg: sprite(45px, 112px, 9px, 16px); contactsImg: sprite(31px, 104px, 9px, 16px);
contactsAdd: flatButton(topBarButton) { contactsAdd: flatButton(topBarButton) {
width: -40px; width: -40px;
height: 52px; height: 52px;
@ -1429,7 +1444,7 @@ contactsAdd: flatButton(topBarButton) {
downTextTop: 19px; downTextTop: 19px;
} }
aboutIcon: sprite(2px, 2px, 104px, 104px); aboutIcon: sprite(0px, 0px, 104px, 104px);
aboutIconTop: 28px; aboutIconTop: 28px;
aboutWidth: 448px; aboutWidth: 448px;
aboutHeight: 441px; aboutHeight: 441px;
@ -1499,8 +1514,8 @@ dropdownAttachDocument: iconedButton(btnAttachDocument) {
downTextPos: point(50px, 14px); downTextPos: point(50px, 14px);
} }
dropdownAttachPhoto: iconedButton(dropdownAttachDocument) { dropdownAttachPhoto: iconedButton(dropdownAttachDocument) {
icon: sprite(113px, 0px, 24px, 24px); icon: sprite(118px, 0px, 24px, 24px);
downIcon: sprite(113px, 0px, 24px, 24px); downIcon: sprite(118px, 0px, 24px, 24px);
} }
dropdownMediaPhotos: iconedButton(dropdownAttachPhoto) { dropdownMediaPhotos: iconedButton(dropdownAttachPhoto) {
width: 200px; width: 200px;
@ -1552,7 +1567,7 @@ dpiSlider: slider {
thikness: 2px; thikness: 2px;
width: 260px; width: 260px;
bar: sprite(6px, 110px, 9px, 22px); bar: sprite(0px, 104px, 9px, 22px);
} }
dpiActive: black; dpiActive: black;
dpiInactive: #999; dpiInactive: #999;
@ -1738,7 +1753,7 @@ emojiSwitchColor: #42a8db;
stickerPanSize: size(64px, 64px); stickerPanSize: size(64px, 64px);
stickerPanPadding: 11px; stickerPanPadding: 11px;
stickerPanDelete: sprite(123px, 132px, 12px, 12px); stickerPanDelete: sprite(128px, 132px, 12px, 12px);
stickerPanDeleteOpacity: 0.5; stickerPanDeleteOpacity: 0.5;
stickerIconPadding: 3px; stickerIconPadding: 3px;
stickerIconOpacity: 0.7; stickerIconOpacity: 0.7;
@ -1880,7 +1895,7 @@ medviewSaveMsgShown: 2000;
medviewSaveMsgHiding: 2500; medviewSaveMsgHiding: 2500;
medviewSaveMsg: #000000b2; medviewSaveMsg: #000000b2;
mvTransparentBrush: sprite(113px, 128px, 8px, 8px); mvTransparentBrush: sprite(9px, 124px, 8px, 8px);
overviewPhotoSkip: 10px; overviewPhotoSkip: 10px;
overviewPhotoMinSize: 100px; overviewPhotoMinSize: 100px;

View File

@ -746,7 +746,7 @@ namespace App {
} }
} }
void checkEntitiesUpdate(const MTPDmessage &m) { void checkEntitiesAndViewsUpdate(const MTPDmessage &m) {
PeerId peerId = peerFromMTP(m.vto_id); PeerId peerId = peerFromMTP(m.vto_id);
if (m.has_from_id() && peerToUser(peerId) == MTP::authedId()) { if (m.has_from_id() && peerToUser(peerId) == MTP::authedId()) {
peerId = peerFromUser(m.vfrom_id); peerId = peerFromUser(m.vfrom_id);
@ -761,6 +761,8 @@ namespace App {
existing->history()->addToOverview(existing, OverviewLinks); existing->history()->addToOverview(existing, OverviewLinks);
} }
} }
existing->setViewsCount(m.has_views() ? m.vviews.v : -1);
} }
} }
@ -774,7 +776,7 @@ namespace App {
const MTPDmessage &d(msg.c_message()); const MTPDmessage &d(msg.c_message());
msgsIds.insert((uint64(uint32(d.vid.v)) << 32) | uint64(i), i); msgsIds.insert((uint64(uint32(d.vid.v)) << 32) | uint64(i), i);
if (msgsState == 1) { // new message, index my forwarded messages to links overview if (msgsState == 1) { // new message, index my forwarded messages to links overview
checkEntitiesUpdate(d); checkEntitiesAndViewsUpdate(d);
} }
} break; } break;
case mtpc_messageEmpty: msgsIds.insert((uint64(uint32(msg.c_messageEmpty().vid.v)) << 32) | uint64(i), i); break; case mtpc_messageEmpty: msgsIds.insert((uint64(uint32(msg.c_messageEmpty().vid.v)) << 32) | uint64(i), i); break;

View File

@ -102,7 +102,7 @@ namespace App {
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated = true); void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated = true);
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated = true); void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated = true);
void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated = true); void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated = true);
void checkEntitiesUpdate(const MTPDmessage &m); void checkEntitiesAndViewsUpdate(const MTPDmessage &m);
void feedMsgs(const MTPVector<MTPMessage> &msgs, int msgsState = 0); // 2 - new read message, 1 - new unread message, 0 - not new message, -1 - searched message void feedMsgs(const MTPVector<MTPMessage> &msgs, int msgsState = 0); // 2 - new read message, 1 - new unread message, 0 - not new message, -1 - searched message
void feedInboxRead(const PeerId &peer, MsgId upTo); void feedInboxRead(const PeerId &peer, MsgId upTo);
void feedOutboxRead(const PeerId &peer, MsgId upTo); void feedOutboxRead(const PeerId &peer, MsgId upTo);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 229 KiB

View File

@ -1285,7 +1285,7 @@ void CreateGroupBox::onCreate() {
_create.setDisabled(true); _create.setDisabled(true);
_name.setDisabled(true); _name.setDisabled(true);
if (_creatingChannel) { if (_creatingChannel) {
_createRequestId = MTP::send(MTPmessages_CreateChannel(MTP_int(MTPmessages_CreateChannel_flag_broadcast), MTP_string(_name.text()), _users), rpcDone(&CreateGroupBox::created), rpcFail(&CreateGroupBox::failed)); _createRequestId = MTP::send(MTPmessages_CreateChannel(MTP_int(MTPmessages_CreateChannel_flag_broadcast), MTP_string(_name.text()), MTP_string(""), _users), rpcDone(&CreateGroupBox::created), rpcFail(&CreateGroupBox::failed));
} else { } else {
_createRequestId = MTP::send(MTPmessages_CreateChat(_users, MTP_string(_name.text())), rpcDone(&CreateGroupBox::created), rpcFail(&CreateGroupBox::failed)); _createRequestId = MTP::send(MTPmessages_CreateChat(_users, MTP_string(_name.text())), rpcDone(&CreateGroupBox::created), rpcFail(&CreateGroupBox::failed));
} }

View File

@ -241,9 +241,12 @@ void DialogsListWidget::peopleResultPaint(PeerData *peer, QPainter &p, int32 w,
QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height); QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height);
// draw chat icon // draw chat icon
if (history->peer->isChat()) { // CHANNELS_UI if (history->peer->isChat()) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), (act ? st::dlgActiveChatImg : st::dlgChatImg)); p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgPos.x(), rectForName.top() + st::dlgChatImgPos.y()), App::sprite(), (act ? st::dlgActiveChatImg : st::dlgChatImg));
rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip); rectForName.setLeft(rectForName.left() + st::dlgImgSkip);
} else if (history->peer->isChannel()) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChannelImgPos.x(), rectForName.top() + st::dlgChannelImgPos.y()), App::sprite(), (act ? st::dlgActiveChannelImg : st::dlgChannelImg));
rectForName.setLeft(rectForName.left() + st::dlgImgSkip);
} }
QRect tr(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, namewidth, st::dlgFont->height); QRect tr(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, namewidth, st::dlgFont->height);
@ -281,9 +284,12 @@ void DialogsListWidget::searchInPeerPaint(QPainter &p, int32 w) const {
QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height); QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height);
// draw chat icon // draw chat icon
if (_searchInPeer->isChat()) { // CHANNELS_UI if (_searchInPeer->isChat()) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), st::dlgChatImg); p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgPos.x(), rectForName.top() + st::dlgChatImgPos.y()), App::sprite(), st::dlgChatImg);
rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip); rectForName.setLeft(rectForName.left() + st::dlgImgSkip);
} else if (_searchInPeer->isChannel()) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChannelImgPos.x(), rectForName.top() + st::dlgChannelImgPos.y()), App::sprite(), st::dlgChannelImg);
rectForName.setLeft(rectForName.left() + st::dlgImgSkip);
} }
QRect tr(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, namewidth, st::dlgFont->height); QRect tr(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, namewidth, st::dlgFont->height);

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,7 @@ struct DialogRow {
DialogRow(History *history = 0, DialogRow *prev = 0, DialogRow *next = 0, int32 pos = 0) : prev(prev), next(next), history(history), pos(pos), attached(0) { DialogRow(History *history = 0, DialogRow *prev = 0, DialogRow *next = 0, int32 pos = 0) : prev(prev), next(next), history(history), pos(pos), attached(0) {
} }
void paint(QPainter &p, int32 w, bool act, bool sel) const; void paint(Painter &p, int32 w, bool act, bool sel) const;
DialogRow *prev, *next; DialogRow *prev, *next;
History *history; History *history;
@ -80,7 +80,7 @@ struct FakeDialogRow {
FakeDialogRow(HistoryItem *item) : _item(item), _cacheFor(0), _cache(st::dlgRichMinWidth) { FakeDialogRow(HistoryItem *item) : _item(item), _cacheFor(0), _cache(st::dlgRichMinWidth) {
} }
void paint(QPainter &p, int32 w, bool act, bool sel) const; void paint(Painter &p, int32 w, bool act, bool sel) const;
HistoryItem *_item; HistoryItem *_item;
mutable const HistoryItem *_cacheFor; mutable const HistoryItem *_cacheFor;
@ -293,7 +293,7 @@ struct History : public QList<HistoryBlock*> {
mutable const HistoryItem *textCachedFor; // cache mutable const HistoryItem *textCachedFor; // cache
mutable Text lastItemTextCache; mutable Text lastItemTextCache;
void paintDialog(QPainter &p, int32 w, bool sel) const; void paintDialog(Painter &p, int32 w, bool sel) const;
typedef QMap<QChar, DialogRow*> DialogLinks; typedef QMap<QChar, DialogRow*> DialogLinks;
DialogLinks dialogs; DialogLinks dialogs;
@ -341,7 +341,7 @@ struct DialogsList {
} }
} }
void paint(QPainter &p, int32 w, int32 hFrom, int32 hTo, PeerData *act, PeerData *sel) const { void paint(Painter &p, int32 w, int32 hFrom, int32 hTo, PeerData *act, PeerData *sel) const {
adjustCurrent(hFrom, st::dlgHeight); adjustCurrent(hFrom, st::dlgHeight);
DialogRow *drawFrom = current; DialogRow *drawFrom = current;
@ -662,6 +662,11 @@ enum HistoryCursorState {
HistoryInDateCursorState HistoryInDateCursorState
}; };
enum InfoDisplayType {
InfoDisplayDefault,
InfoDisplayOverImage,
};
class HistoryMedia; class HistoryMedia;
class HistoryItem : public HistoryElem { class HistoryItem : public HistoryElem {
public: public:
@ -676,7 +681,7 @@ public:
virtual void initDimensions() = 0; virtual void initDimensions() = 0;
virtual int32 resize(int32 width) = 0; // return new height virtual int32 resize(int32 width) = 0; // return new height
virtual void draw(QPainter &p, uint32 selection) const = 0; virtual void draw(Painter &p, uint32 selection) const = 0;
History *history() { History *history() {
return _history; return _history;
@ -728,7 +733,7 @@ public:
return _from->isChannel(); return _from->isChannel();
} }
virtual bool needCheck() const { virtual bool needCheck() const {
return out() && !fromChannel(); return out() && (!fromChannel() || id <= 0);
} }
virtual bool hasPoint(int32 x, int32 y) const { virtual bool hasPoint(int32 x, int32 y) const {
return false; return false;
@ -764,7 +769,11 @@ public:
return inDialogsText(); return inDialogsText();
} }
virtual void drawInDialog(QPainter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const = 0; virtual void drawInfo(Painter &p, int32 right, int32 bottom, bool selected, InfoDisplayType type) const {
}
virtual void setViewsCount(int32 count) {
}
virtual void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const = 0;
virtual QString notificationHeader() const { virtual QString notificationHeader() const {
return QString(); return QString();
} }
@ -793,12 +802,39 @@ public:
virtual bool textHasLinks() { virtual bool textHasLinks() {
return false; return false;
} }
virtual QString time() const {
return QString(); virtual int32 infoWidth() const {
}
virtual int32 timeWidth(bool forText) const {
return 0; return 0;
} }
virtual int32 timeLeft() const {
return 0;
}
virtual QString timeText() const {
return QString();
}
virtual int32 timeWidth() const {
return 0;
}
virtual QString viewsText() const {
return QString();
}
virtual int32 viewsWidth() const {
return 0;
}
virtual bool pointInTime(int32 right, int32 bottom, int32 x, int32 y, InfoDisplayType type) const {
return false;
}
int32 skipBlockWidth() const {
return st::msgDateSpace + infoWidth() - st::msgDateDelta.x();
}
int32 skipBlockHeight() const {
return st::msgDateFont->height - st::msgDateDelta.y();
}
QString skipBlock() const {
return textcmdSkipBlock(skipBlockWidth(), skipBlockHeight());
}
virtual bool animating() const { virtual bool animating() const {
return false; return false;
} }
@ -886,7 +922,7 @@ public:
return _height; return _height;
} }
virtual void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent, int32 width = -1) const = 0; virtual void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent, int32 width = -1) const = 0;
virtual void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const = 0; virtual void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width = -1) const = 0;
virtual bool uploading() const { virtual bool uploading() const {
return false; return false;
} }
@ -935,7 +971,7 @@ public:
void init(); void init();
void initDimensions(const HistoryItem *parent); void initDimensions(const HistoryItem *parent);
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const; void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
int32 resize(int32 width, const HistoryItem *parent); int32 resize(int32 width, const HistoryItem *parent);
HistoryMediaType type() const { HistoryMediaType type() const {
return MediaTypePhoto; return MediaTypePhoto;
@ -985,7 +1021,7 @@ public:
HistoryVideo(const MTPDvideo &video, const QString &caption, HistoryItem *parent); HistoryVideo(const MTPDvideo &video, const QString &caption, HistoryItem *parent);
void initDimensions(const HistoryItem *parent); void initDimensions(const HistoryItem *parent);
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const; void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
int32 resize(int32 width, const HistoryItem *parent); int32 resize(int32 width, const HistoryItem *parent);
HistoryMediaType type() const { HistoryMediaType type() const {
return MediaTypeVideo; return MediaTypeVideo;
@ -1027,7 +1063,7 @@ public:
HistoryAudio(const MTPDaudio &audio); HistoryAudio(const MTPDaudio &audio);
void initDimensions(const HistoryItem *parent); void initDimensions(const HistoryItem *parent);
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const; void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
HistoryMediaType type() const { HistoryMediaType type() const {
return MediaTypeAudio; return MediaTypeAudio;
} }
@ -1065,7 +1101,7 @@ public:
HistoryDocument(DocumentData *document); HistoryDocument(DocumentData *document);
void initDimensions(const HistoryItem *parent); void initDimensions(const HistoryItem *parent);
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const; void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
int32 resize(int32 width, const HistoryItem *parent); int32 resize(int32 width, const HistoryItem *parent);
HistoryMediaType type() const { HistoryMediaType type() const {
return MediaTypeDocument; return MediaTypeDocument;
@ -1094,7 +1130,7 @@ public:
} }
ImagePtr replyPreview(); ImagePtr replyPreview();
void drawInPlaylist(QPainter &p, const HistoryItem *parent, bool selected, bool over, int32 width) const; void drawInPlaylist(Painter &p, const HistoryItem *parent, bool selected, bool over, int32 width) const;
TextLinkPtr linkInPlaylist(); TextLinkPtr linkInPlaylist();
private: private:
@ -1116,7 +1152,7 @@ public:
HistorySticker(DocumentData *document); HistorySticker(DocumentData *document);
void initDimensions(const HistoryItem *parent); void initDimensions(const HistoryItem *parent);
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const; void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
int32 resize(int32 width, const HistoryItem *parent); int32 resize(int32 width, const HistoryItem *parent);
HistoryMediaType type() const { HistoryMediaType type() const {
return MediaTypeSticker; return MediaTypeSticker;
@ -1152,7 +1188,7 @@ public:
HistoryContact(int32 userId, const QString &first, const QString &last, const QString &phone); HistoryContact(int32 userId, const QString &first, const QString &last, const QString &phone);
void initDimensions(const HistoryItem *parent); void initDimensions(const HistoryItem *parent);
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width) const; void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width) const;
HistoryMediaType type() const { HistoryMediaType type() const {
return MediaTypeContact; return MediaTypeContact;
} }
@ -1178,7 +1214,7 @@ public:
HistoryWebPage(WebPageData *data); HistoryWebPage(WebPageData *data);
void initDimensions(const HistoryItem *parent); void initDimensions(const HistoryItem *parent);
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const; void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
bool isDisplayed() const { bool isDisplayed() const {
return !data->pendingTill; return !data->pendingTill;
} }
@ -1285,7 +1321,7 @@ public:
int32 fullHeight() const; int32 fullHeight() const;
void initDimensions(const HistoryItem *parent); void initDimensions(const HistoryItem *parent);
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const; void draw(Painter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
int32 resize(int32 width, const HistoryItem *parent); int32 resize(int32 width, const HistoryItem *parent);
HistoryMediaType type() const { HistoryMediaType type() const {
return MediaTypeImageLink; return MediaTypeImageLink;
@ -1311,9 +1347,8 @@ class HistoryMessage : public HistoryItem {
public: public:
HistoryMessage(History *history, HistoryBlock *block, const MTPDmessage &msg); HistoryMessage(History *history, HistoryBlock *block, const MTPDmessage &msg);
HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, const MTPMessageMedia *media); HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, HistoryMedia *media); // local forwarded
HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, const LinksInText &links, HistoryMedia *media); HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, DocumentData *doc); // local sticker and reply sticker
HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, DocumentData *doc);
void initTime(); void initTime();
void initMedia(const MTPMessageMedia *media, QString &currentText); void initMedia(const MTPMessageMedia *media, QString &currentText);
@ -1328,11 +1363,14 @@ public:
bool uploading() const; bool uploading() const;
void draw(QPainter &p, uint32 selection) const; void drawInfo(Painter &p, int32 right, int32 bottom, bool selected, InfoDisplayType type) const;
virtual void drawMessageText(QPainter &p, const QRect &trect, uint32 selection) const; void setViewsCount(int32 count);
void draw(Painter &p, uint32 selection) const;
virtual void drawMessageText(Painter &p, const QRect &trect, uint32 selection) const;
int32 resize(int32 width); int32 resize(int32 width);
bool hasPoint(int32 x, int32 y) const; bool hasPoint(int32 x, int32 y) const;
bool pointInTime(int32 right, int32 bottom, int32 x, int32 y, InfoDisplayType type) const;
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const; void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const;
virtual void getStateFromMessageText(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const QRect &r) const; virtual void getStateFromMessageText(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const QRect &r) const;
@ -1342,7 +1380,7 @@ public:
return _text.adjustSelection(from, to, type); return _text.adjustSelection(from, to, type);
} }
void drawInDialog(QPainter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const; void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const;
QString notificationHeader() const; QString notificationHeader() const;
QString notificationText() const; QString notificationText() const;
@ -1361,20 +1399,35 @@ public:
void getTextWithLinks(QString &text, LinksInText &links); void getTextWithLinks(QString &text, LinksInText &links);
bool textHasLinks(); bool textHasLinks();
QString time() const { int32 infoWidth() const {
return _time;
}
int32 timeWidth(bool forText) const {
int32 result = _timeWidth; int32 result = _timeWidth;
if (forText) { if (!_viewsText.isEmpty()) {
result += st::msgDateSpace - st::msgDateDelta.x(); result += st::msgDateViewsSpace + _viewsWidth + st::msgDateCheckSpace + st::msgViewsImg.pxWidth();
if (fromChannel()) { }
} else if (out()) { if (out() && !fromChannel()) {
result += st::msgDateCheckSpace + st::msgCheckRect.pxWidth(); result += st::msgDateCheckSpace + st::msgCheckImg.pxWidth();
}
} }
return result; return result;
} }
int32 timeLeft() const {
int32 result = 0;
if (!_viewsText.isEmpty()) {
result += st::msgDateViewsSpace + _viewsWidth + st::msgDateCheckSpace + st::msgViewsImg.pxWidth();
}
return result;
}
QString timeText() const {
return _timeText;
}
int32 timeWidth() const {
return _timeWidth;
}
QString viewsText() const {
return _viewsText;
}
int32 viewsWidth() const {
return _viewsWidth;
}
virtual bool animating() const { virtual bool animating() const {
return _media ? _media->animating() : false; return _media ? _media->animating() : false;
} }
@ -1402,8 +1455,11 @@ protected:
int32 _textWidth, _textHeight; int32 _textWidth, _textHeight;
HistoryMedia *_media; HistoryMedia *_media;
QString _time; QString _timeText;
int32 _timeWidth; int32 _timeWidth;
QString _viewsText;
int32 _views, _viewsWidth;
}; };
@ -1416,9 +1472,9 @@ public:
void initDimensions(); void initDimensions();
void fwdNameUpdated() const; void fwdNameUpdated() const;
void draw(QPainter &p, uint32 selection) const; void draw(Painter &p, uint32 selection) const;
void drawForwardedFrom(QPainter &p, int32 x, int32 y, int32 w, bool selected) const; void drawForwardedFrom(Painter &p, int32 x, int32 y, int32 w, bool selected) const;
void drawMessageText(QPainter &p, const QRect &trect, uint32 selection) const; void drawMessageText(Painter &p, const QRect &trect, uint32 selection) const;
int32 resize(int32 width); int32 resize(int32 width);
bool hasPoint(int32 x, int32 y) const; bool hasPoint(int32 x, int32 y) const;
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const; void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const;
@ -1469,9 +1525,9 @@ public:
HistoryItem *replyToMessage() const; HistoryItem *replyToMessage() const;
void replyToReplaced(HistoryItem *oldItem, HistoryItem *newItem); void replyToReplaced(HistoryItem *oldItem, HistoryItem *newItem);
void draw(QPainter &p, uint32 selection) const; void draw(Painter &p, uint32 selection) const;
void drawReplyTo(QPainter &p, int32 x, int32 y, int32 w, bool selected, bool likeService = false) const; void drawReplyTo(Painter &p, int32 x, int32 y, int32 w, bool selected, bool likeService = false) const;
void drawMessageText(QPainter &p, const QRect &trect, uint32 selection) const; void drawMessageText(Painter &p, const QRect &trect, uint32 selection) const;
int32 resize(int32 width); int32 resize(int32 width);
bool hasPoint(int32 x, int32 y) const; bool hasPoint(int32 x, int32 y) const;
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const; void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const;
@ -1512,7 +1568,7 @@ public:
void initDimensions(); void initDimensions();
void draw(QPainter &p, uint32 selection) const; void draw(Painter &p, uint32 selection) const;
int32 resize(int32 width); int32 resize(int32 width);
bool hasPoint(int32 x, int32 y) const; bool hasPoint(int32 x, int32 y) const;
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const; void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const;
@ -1521,7 +1577,7 @@ public:
return _text.adjustSelection(from, to, type); return _text.adjustSelection(from, to, type);
} }
void drawInDialog(QPainter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const; void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const;
QString notificationText() const; QString notificationText() const;
bool needCheck() const { bool needCheck() const {
@ -1584,10 +1640,10 @@ public:
void setCount(int32 count); void setCount(int32 count);
void draw(QPainter &p, uint32 selection) const; void draw(Painter &p, uint32 selection) const;
int32 resize(int32 width); int32 resize(int32 width);
void drawInDialog(QPainter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const; void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const;
QString notificationText() const; QString notificationText() const;
QString selectedText(uint32 selection) const { QString selectedText(uint32 selection) const {

View File

@ -99,7 +99,7 @@ void HistoryList::paintEvent(QPaintEvent *e) {
QRect r(e->rect()); QRect r(e->rect());
bool trivial = (rect() == r); bool trivial = (rect() == r);
QPainter p(this); Painter p(this);
if (!trivial) { if (!trivial) {
p.setClipRect(r); p.setClipRect(r);
} }
@ -809,14 +809,18 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
} }
if (isUponSelected > 1) { if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), historyWidget, SLOT(onForwardSelected())); _menu->addAction(lang(lng_context_forward_selected), historyWidget, SLOT(onForwardSelected()));
_menu->addAction(lang(lng_context_delete_selected), historyWidget, SLOT(onDeleteSelected())); if ((!hist->peer->isChannel() || hist->peer->asChannel()->adminned)) {
_menu->addAction(lang(lng_context_delete_selected), historyWidget, SLOT(onDeleteSelected()));
}
_menu->addAction(lang(lng_context_clear_selection), historyWidget, SLOT(onClearSelected())); _menu->addAction(lang(lng_context_clear_selection), historyWidget, SLOT(onClearSelected()));
} else if (App::hoveredLinkItem()) { } else if (App::hoveredLinkItem()) {
if (isUponSelected != -2 && (!hist->peer->isChannel() || hist->peer->asChannel()->adminned)) { if (isUponSelected != -2) {
if (dynamic_cast<HistoryMessage*>(App::hoveredLinkItem()) && App::hoveredLinkItem()->id > 0) { if (dynamic_cast<HistoryMessage*>(App::hoveredLinkItem()) && App::hoveredLinkItem()->id > 0) {
_menu->addAction(lang(lng_context_forward_msg), historyWidget, SLOT(forwardMessage()))->setEnabled(true); _menu->addAction(lang(lng_context_forward_msg), historyWidget, SLOT(forwardMessage()))->setEnabled(true);
} }
_menu->addAction(lang(lng_context_delete_msg), historyWidget, SLOT(deleteMessage()))->setEnabled(true); if ((!hist->peer->isChannel() || hist->peer->asChannel()->adminned)) {
_menu->addAction(lang(lng_context_delete_msg), historyWidget, SLOT(deleteMessage()))->setEnabled(true);
}
} }
if (App::hoveredLinkItem()->id > 0 && (!hist->peer->isChannel() || hist->peer->asChannel()->adminned)) { if (App::hoveredLinkItem()->id > 0 && (!hist->peer->isChannel() || hist->peer->asChannel()->adminned)) {
_menu->addAction(lang(lng_context_select_msg), historyWidget, SLOT(selectMessage()))->setEnabled(true); _menu->addAction(lang(lng_context_select_msg), historyWidget, SLOT(selectMessage()))->setEnabled(true);
@ -825,7 +829,7 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
} }
} else { // maybe cursor on some text history item? } else { // maybe cursor on some text history item?
bool canDelete = (item && item->itemType() == HistoryItem::MsgType) && (!hist->peer->isChannel() || hist->peer->asChannel()->adminned); bool canDelete = (item && item->itemType() == HistoryItem::MsgType) && (!hist->peer->isChannel() || hist->peer->asChannel()->adminned);
bool canForward = canDelete && (item->id > 0) && !item->serviceMsg(); bool canForward = (item && item->itemType() == HistoryItem::MsgType) && (item->id > 0) && !item->serviceMsg();
HistoryMessage *msg = dynamic_cast<HistoryMessage*>(item); HistoryMessage *msg = dynamic_cast<HistoryMessage*>(item);
HistoryServiceMsg *srv = dynamic_cast<HistoryServiceMsg*>(item); HistoryServiceMsg *srv = dynamic_cast<HistoryServiceMsg*>(item);
@ -878,7 +882,9 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (isUponSelected > 1) { if (isUponSelected > 1) {
if (!_menu) _menu = new ContextMenu(this); if (!_menu) _menu = new ContextMenu(this);
_menu->addAction(lang(lng_context_forward_selected), historyWidget, SLOT(onForwardSelected())); _menu->addAction(lang(lng_context_forward_selected), historyWidget, SLOT(onForwardSelected()));
_menu->addAction(lang(lng_context_delete_selected), historyWidget, SLOT(onDeleteSelected())); if ((!hist->peer->isChannel() || hist->peer->asChannel()->adminned)) {
_menu->addAction(lang(lng_context_delete_selected), historyWidget, SLOT(onDeleteSelected()));
}
_menu->addAction(lang(lng_context_clear_selection), historyWidget, SLOT(onClearSelected())); _menu->addAction(lang(lng_context_clear_selection), historyWidget, SLOT(onClearSelected()));
} else if (item && ((isUponSelected != -2 && (canForward || canDelete)) || item->id > 0)) { } else if (item && ((isUponSelected != -2 && (canForward || canDelete)) || item->id > 0)) {
if (!_menu) _menu = new ContextMenu(this); if (!_menu) _menu = new ContextMenu(this);
@ -3647,10 +3653,11 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const
bool fromChannelName = p->isChannel(); bool fromChannelName = p->isChannel();
if (fromChannelName) { if (fromChannelName) {
sendFlags |= MTPmessages_SendMessage_flag_broadcast; sendFlags |= MTPmessages_SendMessage_flag_broadcast;
flags |= MTPDmessage::flag_views;
} else { } else {
flags |= MTPDmessage::flag_from_id; flags |= MTPDmessage::flag_from_id;
} }
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(peer), MTPPeer(), MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities, MTPint())); h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(peer), MTPPeer(), MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities, MTP_int(1)));
h->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), p->input, MTP_int(replyTo), MTP_inputMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, h->sendRequestId); h->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), p->input, MTP_int(replyTo), MTP_inputMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, h->sendRequestId);
App::historyRegRandom(randomId, newId); App::historyRegRandom(randomId, newId);
@ -4552,16 +4559,17 @@ void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) {
if (img.replyTo) flags |= MTPDmessage::flag_reply_to_msg_id; if (img.replyTo) flags |= MTPDmessage::flag_reply_to_msg_id;
bool fromChannelName = h->peer->isChannel(); bool fromChannelName = h->peer->isChannel();
if (fromChannelName) { if (fromChannelName) {
flags |= MTPDmessage::flag_views;
} else { } else {
flags |= MTPDmessage::flag_from_id; flags |= MTPDmessage::flag_from_id;
} }
if (img.type == ToPreparePhoto) { if (img.type == ToPreparePhoto) {
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo, MTP_string("")), MTPnullMarkup, MTPnullEntities, MTPint())); h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo, MTP_string("")), MTPnullMarkup, MTPnullEntities, MTP_int(1)));
} else if (img.type == ToPrepareDocument) { } else if (img.type == ToPrepareDocument) {
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(img.document), MTPnullMarkup, MTPnullEntities, MTPint())); h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(img.document), MTPnullMarkup, MTPnullEntities, MTP_int(1)));
} else if (img.type == ToPrepareAudio) { } else if (img.type == ToPrepareAudio) {
flags |= MTPDmessage_flag_media_unread; flags |= MTPDmessage_flag_media_unread;
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaAudio(img.audio), MTPnullMarkup, MTPnullEntities, MTPint())); h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaAudio(img.audio), MTPnullMarkup, MTPnullEntities, MTP_int(1)));
} }
if (_peer && img.peer == _peer->id) { if (_peer && img.peer == _peer->id) {
@ -5557,7 +5565,7 @@ void HistoryWidget::onForwardSelected() {
} }
void HistoryWidget::onDeleteSelected() { void HistoryWidget::onDeleteSelected() {
if (!_list) return; if (!_list || (peer()->isChannel() && !peer()->asChannel()->adminned)) return;
SelectedItemSet sel; SelectedItemSet sel;
_list->fillSelectedItems(sel); _list->fillSelectedItems(sel);

View File

@ -1123,11 +1123,12 @@ void MainWidget::sendPreparedText(History *hist, const QString &text, MsgId repl
bool fromChannelName = hist->peer->isChannel(); bool fromChannelName = hist->peer->isChannel();
if (fromChannelName) { if (fromChannelName) {
sendFlags |= MTPmessages_SendMessage_flag_broadcast; sendFlags |= MTPmessages_SendMessage_flag_broadcast;
flags |= MTPDmessage::flag_views;
} else { } else {
flags |= MTPDmessage::flag_from_id; flags |= MTPDmessage::flag_from_id;
} }
MTPVector<MTPMessageEntity> localEntities = linksToMTP(textParseLinks(sendingText, itemTextParseOptions(hist, App::self()).flags)); MTPVector<MTPMessageEntity> localEntities = linksToMTP(textParseLinks(sendingText, itemTextParseOptions(hist, App::self()).flags));
hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(hist->peer->id), MTPPeer(), MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities, MTPint())); hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(hist->peer->id), MTPPeer(), MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities, MTP_int(1)));
hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_int(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, localEntities), rpcDone(&MainWidget::sentUpdatesReceived, randomId), rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_int(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, localEntities), rpcDone(&MainWidget::sentUpdatesReceived, randomId), rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
} }
@ -3801,7 +3802,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
return; return;
} }
if (d.vmessage.type() == mtpc_message) { // index forwarded messages to links overview if (d.vmessage.type() == mtpc_message) { // index forwarded messages to links overview
App::checkEntitiesUpdate(d.vmessage.c_message()); App::checkEntitiesAndViewsUpdate(d.vmessage.c_message());
} }
HistoryItem *item = App::histories().addToBack(d.vmessage); HistoryItem *item = App::histories().addToBack(d.vmessage);
@ -4102,7 +4103,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
} }
} }
if (d.vmessage.type() == mtpc_message) { // index forwarded messages to links overview if (d.vmessage.type() == mtpc_message) { // index forwarded messages to links overview
App::checkEntitiesUpdate(d.vmessage.c_message()); App::checkEntitiesAndViewsUpdate(d.vmessage.c_message());
} }
HistoryItem *item = App::histories().addToBack(d.vmessage); HistoryItem *item = App::histories().addToBack(d.vmessage);
@ -4149,7 +4150,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
const MTPDupdateChannelMessageViews &d(update.c_updateChannelMessageViews()); const MTPDupdateChannelMessageViews &d(update.c_updateChannelMessageViews());
if (HistoryItem *item = App::histItemById(peerToChannel(peerFromMTP(d.vpeer)), d.vid.v)) { if (HistoryItem *item = App::histItemById(peerToChannel(peerFromMTP(d.vpeer)), d.vid.v)) {
if (item->from()->id == peerFromMTP(d.vpeer) && item->channelId() != NoChannel) { if (item->from()->id == peerFromMTP(d.vpeer) && item->channelId() != NoChannel) {
// CHANNELS_TODO item->setViewsCount(d.vviews.v);
} }
} }
} break; } break;

View File

@ -2784,6 +2784,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
} }
break; break;
case mtpc_updateChannel:
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ updateChannel");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
break;
case mtpc_updateChannelGroup: case mtpc_updateChannelGroup:
if (stage) { if (stage) {
to.add(",\n").addSpaces(lev); to.add(",\n").addSpaces(lev);
@ -6192,7 +6205,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
switch (stage) { switch (stage) {
case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" about: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 3: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
} }
break; break;

View File

@ -255,6 +255,7 @@ enum {
mtpc_updateWebPage = 0x7f891213, mtpc_updateWebPage = 0x7f891213,
mtpc_updateReadMessagesContents = 0x68c13933, mtpc_updateReadMessagesContents = 0x68c13933,
mtpc_updateChannelTooLong = 0x60946422, mtpc_updateChannelTooLong = 0x60946422,
mtpc_updateChannel = 0xb6d45656,
mtpc_updateChannelGroup = 0xc36c1e3c, mtpc_updateChannelGroup = 0xc36c1e3c,
mtpc_updateNewChannelMessage = 0x62ba04d9, mtpc_updateNewChannelMessage = 0x62ba04d9,
mtpc_updateReadChannelInbox = 0x87b87b7d, mtpc_updateReadChannelInbox = 0x87b87b7d,
@ -517,7 +518,7 @@ enum {
mtpc_messages_getChannelDialogs = 0x92689583, mtpc_messages_getChannelDialogs = 0x92689583,
mtpc_messages_getImportantHistory = 0x24af43a5, mtpc_messages_getImportantHistory = 0x24af43a5,
mtpc_messages_readChannelHistory = 0x36a1210e, mtpc_messages_readChannelHistory = 0x36a1210e,
mtpc_messages_createChannel = 0xe830f8cb, mtpc_messages_createChannel = 0x7f44d2c3,
mtpc_messages_deleteChannelMessages = 0x9995a84f, mtpc_messages_deleteChannelMessages = 0x9995a84f,
mtpc_messages_getChannelMessages = 0x5f46b265, mtpc_messages_getChannelMessages = 0x5f46b265,
mtpc_messages_incrementMessagesViews = 0x91ffd479, mtpc_messages_incrementMessagesViews = 0x91ffd479,
@ -878,6 +879,7 @@ class MTPDupdateReadHistoryOutbox;
class MTPDupdateWebPage; class MTPDupdateWebPage;
class MTPDupdateReadMessagesContents; class MTPDupdateReadMessagesContents;
class MTPDupdateChannelTooLong; class MTPDupdateChannelTooLong;
class MTPDupdateChannel;
class MTPDupdateChannelGroup; class MTPDupdateChannelGroup;
class MTPDupdateNewChannelMessage; class MTPDupdateNewChannelMessage;
class MTPDupdateReadChannelInbox; class MTPDupdateReadChannelInbox;
@ -5306,6 +5308,18 @@ public:
return *(const MTPDupdateChannelTooLong*)data; return *(const MTPDupdateChannelTooLong*)data;
} }
MTPDupdateChannel &_updateChannel() {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_updateChannel) throw mtpErrorWrongTypeId(_type, mtpc_updateChannel);
split();
return *(MTPDupdateChannel*)data;
}
const MTPDupdateChannel &c_updateChannel() const {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_updateChannel) throw mtpErrorWrongTypeId(_type, mtpc_updateChannel);
return *(const MTPDupdateChannel*)data;
}
MTPDupdateChannelGroup &_updateChannelGroup() { MTPDupdateChannelGroup &_updateChannelGroup() {
if (!data) throw mtpErrorUninitialized(); if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_updateChannelGroup) throw mtpErrorWrongTypeId(_type, mtpc_updateChannelGroup); if (_type != mtpc_updateChannelGroup) throw mtpErrorWrongTypeId(_type, mtpc_updateChannelGroup);
@ -5404,6 +5418,7 @@ private:
explicit MTPupdate(MTPDupdateWebPage *_data); explicit MTPupdate(MTPDupdateWebPage *_data);
explicit MTPupdate(MTPDupdateReadMessagesContents *_data); explicit MTPupdate(MTPDupdateReadMessagesContents *_data);
explicit MTPupdate(MTPDupdateChannelTooLong *_data); explicit MTPupdate(MTPDupdateChannelTooLong *_data);
explicit MTPupdate(MTPDupdateChannel *_data);
explicit MTPupdate(MTPDupdateChannelGroup *_data); explicit MTPupdate(MTPDupdateChannelGroup *_data);
explicit MTPupdate(MTPDupdateNewChannelMessage *_data); explicit MTPupdate(MTPDupdateNewChannelMessage *_data);
explicit MTPupdate(MTPDupdateReadChannelInbox *_data); explicit MTPupdate(MTPDupdateReadChannelInbox *_data);
@ -5439,6 +5454,7 @@ private:
friend MTPupdate MTP_updateWebPage(const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateWebPage(const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count);
friend MTPupdate MTP_updateReadMessagesContents(const MTPVector<MTPint> &_messages, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateReadMessagesContents(const MTPVector<MTPint> &_messages, MTPint _pts, MTPint _pts_count);
friend MTPupdate MTP_updateChannelTooLong(MTPint _channel_id); friend MTPupdate MTP_updateChannelTooLong(MTPint _channel_id);
friend MTPupdate MTP_updateChannel(MTPint _channel_id);
friend MTPupdate MTP_updateChannelGroup(MTPint _channel_id, const MTPMessageGroup &_group); friend MTPupdate MTP_updateChannelGroup(MTPint _channel_id, const MTPMessageGroup &_group);
friend MTPupdate MTP_updateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count);
friend MTPupdate MTP_updateReadChannelInbox(const MTPPeer &_peer, MTPint _max_id); friend MTPupdate MTP_updateReadChannelInbox(const MTPPeer &_peer, MTPint _max_id);
@ -10525,6 +10541,16 @@ public:
MTPint vchannel_id; MTPint vchannel_id;
}; };
class MTPDupdateChannel : public mtpDataImpl<MTPDupdateChannel> {
public:
MTPDupdateChannel() {
}
MTPDupdateChannel(MTPint _channel_id) : vchannel_id(_channel_id) {
}
MTPint vchannel_id;
};
class MTPDupdateChannelGroup : public mtpDataImpl<MTPDupdateChannelGroup> { class MTPDupdateChannelGroup : public mtpDataImpl<MTPDupdateChannelGroup> {
public: public:
MTPDupdateChannelGroup() { MTPDupdateChannelGroup() {
@ -16819,6 +16845,7 @@ class MTPmessages_createChannel { // RPC method 'messages.createChannel'
public: public:
MTPint vflags; MTPint vflags;
MTPstring vtitle; MTPstring vtitle;
MTPstring vabout;
MTPVector<MTPInputUser> vusers; MTPVector<MTPInputUser> vusers;
MTPmessages_createChannel() { MTPmessages_createChannel() {
@ -16826,11 +16853,11 @@ public:
MTPmessages_createChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_createChannel) { MTPmessages_createChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_createChannel) {
read(from, end, cons); read(from, end, cons);
} }
MTPmessages_createChannel(MTPint _flags, const MTPstring &_title, const MTPVector<MTPInputUser> &_users) : vflags(_flags), vtitle(_title), vusers(_users) { MTPmessages_createChannel(MTPint _flags, const MTPstring &_title, const MTPstring &_about, const MTPVector<MTPInputUser> &_users) : vflags(_flags), vtitle(_title), vabout(_about), vusers(_users) {
} }
uint32 innerLength() const { uint32 innerLength() const {
return vflags.innerLength() + vtitle.innerLength() + vusers.innerLength(); return vflags.innerLength() + vtitle.innerLength() + vabout.innerLength() + vusers.innerLength();
} }
mtpTypeId type() const { mtpTypeId type() const {
return mtpc_messages_createChannel; return mtpc_messages_createChannel;
@ -16838,11 +16865,13 @@ public:
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_createChannel) { void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_createChannel) {
vflags.read(from, end); vflags.read(from, end);
vtitle.read(from, end); vtitle.read(from, end);
vabout.read(from, end);
vusers.read(from, end); vusers.read(from, end);
} }
void write(mtpBuffer &to) const { void write(mtpBuffer &to) const {
vflags.write(to); vflags.write(to);
vtitle.write(to); vtitle.write(to);
vabout.write(to);
vusers.write(to); vusers.write(to);
} }
@ -16856,7 +16885,7 @@ public:
} }
MTPmessages_CreateChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_createChannel>(from, end, cons) { MTPmessages_CreateChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_createChannel>(from, end, cons) {
} }
MTPmessages_CreateChannel(MTPint _flags, const MTPstring &_title, const MTPVector<MTPInputUser> &_users) : MTPBoxed<MTPmessages_createChannel>(MTPmessages_createChannel(_flags, _title, _users)) { MTPmessages_CreateChannel(MTPint _flags, const MTPstring &_title, const MTPstring &_about, const MTPVector<MTPInputUser> &_users) : MTPBoxed<MTPmessages_createChannel>(MTPmessages_createChannel(_flags, _title, _about, _users)) {
} }
}; };
@ -22905,6 +22934,10 @@ inline uint32 MTPupdate::innerLength() const {
const MTPDupdateChannelTooLong &v(c_updateChannelTooLong()); const MTPDupdateChannelTooLong &v(c_updateChannelTooLong());
return v.vchannel_id.innerLength(); return v.vchannel_id.innerLength();
} }
case mtpc_updateChannel: {
const MTPDupdateChannel &v(c_updateChannel());
return v.vchannel_id.innerLength();
}
case mtpc_updateChannelGroup: { case mtpc_updateChannelGroup: {
const MTPDupdateChannelGroup &v(c_updateChannelGroup()); const MTPDupdateChannelGroup &v(c_updateChannelGroup());
return v.vchannel_id.innerLength() + v.vgroup.innerLength(); return v.vchannel_id.innerLength() + v.vgroup.innerLength();
@ -23128,6 +23161,11 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI
MTPDupdateChannelTooLong &v(_updateChannelTooLong()); MTPDupdateChannelTooLong &v(_updateChannelTooLong());
v.vchannel_id.read(from, end); v.vchannel_id.read(from, end);
} break; } break;
case mtpc_updateChannel: _type = cons; {
if (!data) setData(new MTPDupdateChannel());
MTPDupdateChannel &v(_updateChannel());
v.vchannel_id.read(from, end);
} break;
case mtpc_updateChannelGroup: _type = cons; { case mtpc_updateChannelGroup: _type = cons; {
if (!data) setData(new MTPDupdateChannelGroup()); if (!data) setData(new MTPDupdateChannelGroup());
MTPDupdateChannelGroup &v(_updateChannelGroup()); MTPDupdateChannelGroup &v(_updateChannelGroup());
@ -23331,6 +23369,10 @@ inline void MTPupdate::write(mtpBuffer &to) const {
const MTPDupdateChannelTooLong &v(c_updateChannelTooLong()); const MTPDupdateChannelTooLong &v(c_updateChannelTooLong());
v.vchannel_id.write(to); v.vchannel_id.write(to);
} break; } break;
case mtpc_updateChannel: {
const MTPDupdateChannel &v(c_updateChannel());
v.vchannel_id.write(to);
} break;
case mtpc_updateChannelGroup: { case mtpc_updateChannelGroup: {
const MTPDupdateChannelGroup &v(c_updateChannelGroup()); const MTPDupdateChannelGroup &v(c_updateChannelGroup());
v.vchannel_id.write(to); v.vchannel_id.write(to);
@ -23393,6 +23435,7 @@ inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) {
case mtpc_updateWebPage: setData(new MTPDupdateWebPage()); break; case mtpc_updateWebPage: setData(new MTPDupdateWebPage()); break;
case mtpc_updateReadMessagesContents: setData(new MTPDupdateReadMessagesContents()); break; case mtpc_updateReadMessagesContents: setData(new MTPDupdateReadMessagesContents()); break;
case mtpc_updateChannelTooLong: setData(new MTPDupdateChannelTooLong()); break; case mtpc_updateChannelTooLong: setData(new MTPDupdateChannelTooLong()); break;
case mtpc_updateChannel: setData(new MTPDupdateChannel()); break;
case mtpc_updateChannelGroup: setData(new MTPDupdateChannelGroup()); break; case mtpc_updateChannelGroup: setData(new MTPDupdateChannelGroup()); break;
case mtpc_updateNewChannelMessage: setData(new MTPDupdateNewChannelMessage()); break; case mtpc_updateNewChannelMessage: setData(new MTPDupdateNewChannelMessage()); break;
case mtpc_updateReadChannelInbox: setData(new MTPDupdateReadChannelInbox()); break; case mtpc_updateReadChannelInbox: setData(new MTPDupdateReadChannelInbox()); break;
@ -23459,6 +23502,8 @@ inline MTPupdate::MTPupdate(MTPDupdateReadMessagesContents *_data) : mtpDataOwne
} }
inline MTPupdate::MTPupdate(MTPDupdateChannelTooLong *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelTooLong) { inline MTPupdate::MTPupdate(MTPDupdateChannelTooLong *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelTooLong) {
} }
inline MTPupdate::MTPupdate(MTPDupdateChannel *_data) : mtpDataOwner(_data), _type(mtpc_updateChannel) {
}
inline MTPupdate::MTPupdate(MTPDupdateChannelGroup *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelGroup) { inline MTPupdate::MTPupdate(MTPDupdateChannelGroup *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelGroup) {
} }
inline MTPupdate::MTPupdate(MTPDupdateNewChannelMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateNewChannelMessage) { inline MTPupdate::MTPupdate(MTPDupdateNewChannelMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateNewChannelMessage) {
@ -23556,6 +23601,9 @@ inline MTPupdate MTP_updateReadMessagesContents(const MTPVector<MTPint> &_messag
inline MTPupdate MTP_updateChannelTooLong(MTPint _channel_id) { inline MTPupdate MTP_updateChannelTooLong(MTPint _channel_id) {
return MTPupdate(new MTPDupdateChannelTooLong(_channel_id)); return MTPupdate(new MTPDupdateChannelTooLong(_channel_id));
} }
inline MTPupdate MTP_updateChannel(MTPint _channel_id) {
return MTPupdate(new MTPDupdateChannel(_channel_id));
}
inline MTPupdate MTP_updateChannelGroup(MTPint _channel_id, const MTPMessageGroup &_group) { inline MTPupdate MTP_updateChannelGroup(MTPint _channel_id, const MTPMessageGroup &_group) {
return MTPupdate(new MTPDupdateChannelGroup(_channel_id, _group)); return MTPupdate(new MTPDupdateChannelGroup(_channel_id, _group));
} }

View File

@ -378,6 +378,7 @@ updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Up
updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update;
updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update; updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update;
updateChannelTooLong#60946422 channel_id:int = Update; updateChannelTooLong#60946422 channel_id:int = Update;
updateChannel#b6d45656 channel_id:int = Update;
updateChannelGroup#c36c1e3c channel_id:int group:MessageGroup = Update; updateChannelGroup#c36c1e3c channel_id:int group:MessageGroup = Update;
updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;
updateReadChannelInbox#87b87b7d peer:Peer max_id:int = Update; updateReadChannelInbox#87b87b7d peer:Peer max_id:int = Update;
@ -716,7 +717,7 @@ messages.startBot#f4cc052d bot:InputUser chat_id:InputChat random_id:long start_
messages.getChannelDialogs#92689583 offset:int limit:int = messages.Dialogs; messages.getChannelDialogs#92689583 offset:int limit:int = messages.Dialogs;
messages.getImportantHistory#24af43a5 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.getImportantHistory#24af43a5 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
messages.readChannelHistory#36a1210e peer:InputPeer max_id:int = Bool; messages.readChannelHistory#36a1210e peer:InputPeer max_id:int = Bool;
messages.createChannel#e830f8cb flags:# title:string users:Vector<InputUser> = Updates; messages.createChannel#7f44d2c3 flags:# title:string about:string users:Vector<InputUser> = Updates;
messages.deleteChannelMessages#9995a84f peer:InputPeer id:Vector<int> = messages.AffectedMessages; messages.deleteChannelMessages#9995a84f peer:InputPeer id:Vector<int> = messages.AffectedMessages;
messages.getChannelMessages#5f46b265 peer:InputPeer id:Vector<int> = messages.Messages; messages.getChannelMessages#5f46b265 peer:InputPeer id:Vector<int> = messages.Messages;
messages.incrementMessagesViews#91ffd479 peer:InputPeer id:Vector<int> = Bool; messages.incrementMessagesViews#91ffd479 peer:InputPeer id:Vector<int> = Bool;

View File

@ -985,7 +985,7 @@ QPixmap OverviewInner::genPix(PhotoData *photo, int32 size) {
} }
void OverviewInner::paintEvent(QPaintEvent *e) { void OverviewInner::paintEvent(QPaintEvent *e) {
QPainter p(this); Painter p(this);
QRect r(e->rect()); QRect r(e->rect());
p.setClipRect(r); p.setClipRect(r);
@ -1784,7 +1784,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
} }
if (isUponSelected > 1) { if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), _overview, SLOT(onForwardSelected())); _menu->addAction(lang(lng_context_forward_selected), _overview, SLOT(onForwardSelected()));
_menu->addAction(lang(lng_context_delete_selected), _overview, SLOT(onDeleteSelected())); if (!_peer->isChannel() || _peer->asChannel()->adminned) {
_menu->addAction(lang(lng_context_delete_selected), _overview, SLOT(onDeleteSelected()));
}
_menu->addAction(lang(lng_context_clear_selection), _overview, SLOT(onClearSelected())); _menu->addAction(lang(lng_context_clear_selection), _overview, SLOT(onClearSelected()));
} else if (App::hoveredLinkItem()) { } else if (App::hoveredLinkItem()) {
if (isUponSelected != -2) { if (isUponSelected != -2) {
@ -1822,7 +1824,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_menu->addAction(lang(lng_context_to_msg), this, SLOT(goToMessage()))->setEnabled(true); _menu->addAction(lang(lng_context_to_msg), this, SLOT(goToMessage()))->setEnabled(true);
if (isUponSelected > 1) { if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), _overview, SLOT(onForwardSelected())); _menu->addAction(lang(lng_context_forward_selected), _overview, SLOT(onForwardSelected()));
_menu->addAction(lang(lng_context_delete_selected), _overview, SLOT(onDeleteSelected())); if (!_peer->isChannel() || _peer->asChannel()->adminned) {
_menu->addAction(lang(lng_context_delete_selected), _overview, SLOT(onDeleteSelected()));
}
_menu->addAction(lang(lng_context_clear_selection), _overview, SLOT(onClearSelected())); _menu->addAction(lang(lng_context_clear_selection), _overview, SLOT(onClearSelected()));
} else { } else {
if (isUponSelected != -2) { if (isUponSelected != -2) {

View File

@ -151,7 +151,7 @@ void NotifyWindow::updateNotifyDisplay() {
img.fill(st::notifyBG->c); img.fill(st::notifyBG->c);
{ {
QPainter p(&img); Painter p(&img);
p.fillRect(0, 0, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b); p.fillRect(0, 0, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b);
p.fillRect(w - st::notifyBorderWidth, 0, st::notifyBorderWidth, h - st::notifyBorderWidth, st::notifyBorder->b); p.fillRect(w - st::notifyBorderWidth, 0, st::notifyBorderWidth, h - st::notifyBorderWidth, st::notifyBorder->b);
p.fillRect(st::notifyBorderWidth, h - st::notifyBorderWidth, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b); p.fillRect(st::notifyBorderWidth, h - st::notifyBorderWidth, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b);
@ -174,9 +174,12 @@ void NotifyWindow::updateNotifyDisplay() {
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height); QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
if (!App::passcoded() && cNotifyView() <= dbinvShowName) { if (!App::passcoded() && cNotifyView() <= dbinvShowName) {
if (history->peer->isChat()) { // CHANNELS_UI if (history->peer->isChat()) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), st::dlgChatImg); p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgPos.x(), rectForName.top() + st::dlgChatImgPos.y()), App::sprite(), st::dlgChatImg);
rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip); rectForName.setLeft(rectForName.left() + st::dlgImgSkip);
} else if (history->peer->isChannel()) {
p.drawPixmap(QPoint(rectForName.left() + st::dlgChannelImgPos.x(), rectForName.top() + st::dlgChannelImgPos.y()), App::sprite(), st::dlgChannelImg);
rectForName.setLeft(rectForName.left() + st::dlgImgSkip);
} }
} }