diff --git a/Telegram/SourceFiles/gui/popupmenu.cpp b/Telegram/SourceFiles/gui/popupmenu.cpp index cad98ebe0d..035ada7e31 100644 --- a/Telegram/SourceFiles/gui/popupmenu.cpp +++ b/Telegram/SourceFiles/gui/popupmenu.cpp @@ -545,7 +545,7 @@ PopupTooltip::PopupTooltip() : TWidget(0) void PopupTooltip::onShow() { if (_shower) { - QString text = _shower->tooltipText(); + QString text = (App::wnd() && App::wnd()->isActive(false)) ? _shower->tooltipText() : QString(); if (text.isEmpty()) { Hide(); } else { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 27175c2f3f..05d65d9a72 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2854,7 +2854,7 @@ void MainWidget::onUpdateNotifySettings() { if (peer->notify == UnknownNotifySettings || peer->notify == EmptyNotifySettings) { peer->notify = new NotifySettings(); } - MTP::send(MTPaccount_UpdateNotifySettings(MTP_inputNotifyPeer(peer->input), MTP_inputPeerNotifySettings(MTP_int(peer->notify->mute), MTP_string(peer->notify->sound), MTP_bool(peer->notify->previews), MTP_int(peer->notify->events))), RPCResponseHandler(), 0, updateNotifySettingPeers.isEmpty() ? 0 : 10); + MTP::send(MTPaccount_UpdateNotifySettings(MTP_inputNotifyPeer(peer->input), MTP_inputPeerNotifySettings(MTP_int(peer->notify->flags), MTP_int(peer->notify->mute), MTP_string(peer->notify->sound))), RPCResponseHandler(), 0, updateNotifySettingPeers.isEmpty() ? 0 : 10); } } @@ -3668,10 +3668,9 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti } if (setTo == UnknownNotifySettings) break; + setTo->flags = d.vflags.v; setTo->mute = d.vmute_until.v; setTo->sound = d.vsound.c_string().v; - setTo->previews = mtpIsTrue(d.vshow_previews); - setTo->events = d.vevents_mask.v; if (updatePeer) { if (!h) h = App::history(updatePeer->id); int32 changeIn = 0; diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.cpp b/Telegram/SourceFiles/mtproto/mtpScheme.cpp index 0d1eb87c25..57bc8ec598 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.cpp +++ b/Telegram/SourceFiles/mtproto/mtpScheme.cpp @@ -1155,7 +1155,7 @@ void _serialize_channel(MTPStringLogger &to, int32 stage, int32 lev, Types &type case 7: to.add(" verified: "); ++stages.back(); if (flag & MTPDchannel::flag_verified) { to.add("YES [ BY BIT 7 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; case 8: to.add(" megagroup: "); ++stages.back(); if (flag & MTPDchannel::flag_megagroup) { to.add("YES [ BY BIT 8 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; case 9: to.add(" restricted: "); ++stages.back(); if (flag & MTPDchannel::flag_restricted) { to.add("YES [ BY BIT 9 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; - case 10: to.add(" admin_invites: "); ++stages.back(); if (flag & MTPDchannel::flag_admin_invites) { to.add("YES [ BY BIT 10 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; + case 10: to.add(" democracy: "); ++stages.back(); if (flag & MTPDchannel::flag_democracy) { to.add("YES [ BY BIT 10 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; case 11: to.add(" signatures: "); ++stages.back(); if (flag & MTPDchannel::flag_signatures) { to.add("YES [ BY BIT 11 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; case 12: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 13: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; @@ -1856,10 +1856,11 @@ void _serialize_inputPeerNotifySettings(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" mute_until: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" sound: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" show_previews: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" events_mask: "); ++stages.back(); 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(" show_previews: "); ++stages.back(); if (flag & MTPDinputPeerNotifySettings::flag_show_previews) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPDinputPeerNotifySettings::flag_silent) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" mute_until: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" sound: "); ++stages.back(); types.push_back(mtpc_string); 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; } } @@ -1884,10 +1885,11 @@ void _serialize_peerNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" mute_until: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" sound: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" show_previews: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" events_mask: "); ++stages.back(); 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(" show_previews: "); ++stages.back(); if (flag & MTPDpeerNotifySettings::flag_show_previews) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPDpeerNotifySettings::flag_silent) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" mute_until: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" sound: "); ++stages.back(); types.push_back(mtpc_string); 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; } } @@ -5133,11 +5135,7 @@ void _serialize_channels_messageEditData(MTPStringLogger &to, int32 stage, int32 } 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 1: to.add(" caption: "); ++stages.back(); if (flag & MTPDchannels_messageEditData::flag_caption) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 2: to.add(" from_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" edit_by: "); ++stages.back(); if (flag & MTPDchannels_messageEditData::flag_edit_by) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 4: to.add(" edit_date: "); ++stages.back(); if (flag & MTPDchannels_messageEditData::flag_edit_date) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 5: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); if (flag & MTPDchannels_messageEditData::flag_caption) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -6520,12 +6518,13 @@ void _serialize_messages_sendMessage(MTPStringLogger &to, int32 stage, int32 lev case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_no_webpage) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; case 2: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; case 3: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 4: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 6: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 9: to.add(" entities: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 4: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 5: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 7: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 10: to.add(" entities: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -6541,11 +6540,12 @@ void _serialize_messages_sendMedia(MTPStringLogger &to, int32 stage, int32 lev, 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(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 3: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 5: to.add(" media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 4: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 6: to.add(" media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -6561,10 +6561,11 @@ void _serialize_messages_forwardMessages(MTPStringLogger &to, int32 stage, int32 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(" broadcast: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::flag_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::flag_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 3: to.add(" from_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" random_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" to_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::flag_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 4: to.add(" from_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" random_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" to_peer: "); ++stages.back(); types.push_back(0); 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; } } @@ -6738,11 +6739,12 @@ void _serialize_messages_sendInlineBotResult(MTPStringLogger &to, int32 stage, i 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(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 3: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 5: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 4: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 6: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string); 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; } } diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.h b/Telegram/SourceFiles/mtproto/mtpScheme.h index 87a972c7e2..94cd2994a5 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.h +++ b/Telegram/SourceFiles/mtproto/mtpScheme.h @@ -186,11 +186,11 @@ enum { mtpc_inputNotifyAll = 0xa429b886, mtpc_inputPeerNotifyEventsEmpty = 0xf03064d8, mtpc_inputPeerNotifyEventsAll = 0xe86a2c74, - mtpc_inputPeerNotifySettings = 0x46a2ce98, + mtpc_inputPeerNotifySettings = 0x38935eb2, mtpc_peerNotifyEventsEmpty = 0xadd53cb3, mtpc_peerNotifyEventsAll = 0x6d1ded88, mtpc_peerNotifySettingsEmpty = 0x70a68512, - mtpc_peerNotifySettings = 0x8d5e11ee, + mtpc_peerNotifySettings = 0x9acda4c0, mtpc_wallPaper = 0xccb03657, mtpc_wallPaperSolid = 0x63117f24, mtpc_inputReportReasonSpam = 0x58dbcab8, @@ -449,7 +449,7 @@ enum { mtpc_messages_botResults = 0x1170b0a3, mtpc_exportedMessageLink = 0x1f486803, mtpc_messageFwdHeader = 0xc786ddcb, - mtpc_channels_messageEditData = 0xb86fd3cf, + mtpc_channels_messageEditData = 0x67e1255f, mtpc_invokeAfterMsg = 0xcb9f372d, mtpc_invokeAfterMsgs = 0x3dc4b4f0, mtpc_initConnection = 0x69796de9, @@ -4240,7 +4240,7 @@ public: private: explicit MTPinputPeerNotifySettings(MTPDinputPeerNotifySettings *_data); - friend MTPinputPeerNotifySettings MTP_inputPeerNotifySettings(MTPint _mute_until, const MTPstring &_sound, MTPBool _show_previews, MTPint _events_mask); + friend MTPinputPeerNotifySettings MTP_inputPeerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound); }; typedef MTPBoxed MTPInputPeerNotifySettings; @@ -4301,7 +4301,7 @@ private: explicit MTPpeerNotifySettings(MTPDpeerNotifySettings *_data); friend MTPpeerNotifySettings MTP_peerNotifySettingsEmpty(); - friend MTPpeerNotifySettings MTP_peerNotifySettings(MTPint _mute_until, const MTPstring &_sound, MTPBool _show_previews, MTPint _events_mask); + friend MTPpeerNotifySettings MTP_peerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound); mtpTypeId _type; }; @@ -9080,7 +9080,7 @@ public: private: explicit MTPchannels_messageEditData(MTPDchannels_messageEditData *_data); - friend MTPchannels_messageEditData MTP_channels_messageEditData(MTPint _flags, MTPint _from_id, MTPint _edit_by, MTPint _edit_date, const MTPVector &_users); + friend MTPchannels_messageEditData MTP_channels_messageEditData(MTPint _flags); }; typedef MTPBoxed MTPchannels_MessageEditData; @@ -9953,7 +9953,7 @@ public: flag_verified = (1 << 7), flag_megagroup = (1 << 8), flag_restricted = (1 << 9), - flag_admin_invites = (1 << 10), + flag_democracy = (1 << 10), flag_signatures = (1 << 11), flag_username = (1 << 6), flag_restriction_reason = (1 << 9), @@ -9968,7 +9968,7 @@ public: bool is_verified() const { return vflags.v & flag_verified; } bool is_megagroup() const { return vflags.v & flag_megagroup; } bool is_restricted() const { return vflags.v & flag_restricted; } - bool is_admin_invites() const { return vflags.v & flag_admin_invites; } + bool is_democracy() const { return vflags.v & flag_democracy; } bool is_signatures() const { return vflags.v & flag_signatures; } bool has_username() const { return vflags.v & flag_username; } bool has_restriction_reason() const { return vflags.v & flag_restriction_reason; } @@ -10551,26 +10551,40 @@ class MTPDinputPeerNotifySettings : public mtpDataImpl { public: MTPDpeerNotifySettings() { } - MTPDpeerNotifySettings(MTPint _mute_until, const MTPstring &_sound, MTPBool _show_previews, MTPint _events_mask) : vmute_until(_mute_until), vsound(_sound), vshow_previews(_show_previews), vevents_mask(_events_mask) { + MTPDpeerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound) : vflags(_flags), vmute_until(_mute_until), vsound(_sound) { } + MTPint vflags; MTPint vmute_until; MTPstring vsound; - MTPBool vshow_previews; - MTPint vevents_mask; + + enum { + flag_show_previews = (1 << 0), + flag_silent = (1 << 1), + }; + + bool is_show_previews() const { return vflags.v & flag_show_previews; } + bool is_silent() const { return vflags.v & flag_silent; } }; class MTPDwallPaper : public mtpDataImpl { @@ -13214,24 +13228,16 @@ class MTPDchannels_messageEditData : public mtpDataImpl &_users) : vflags(_flags), vfrom_id(_from_id), vedit_by(_edit_by), vedit_date(_edit_date), vusers(_users) { + MTPDchannels_messageEditData(MTPint _flags) : vflags(_flags) { } MTPint vflags; - MTPint vfrom_id; - MTPint vedit_by; - MTPint vedit_date; - MTPVector vusers; enum { - flag_caption = (1 << 1), - flag_edit_by = (1 << 0), - flag_edit_date = (1 << 0), + flag_caption = (1 << 0), }; bool is_caption() const { return vflags.v & flag_caption; } - bool has_edit_by() const { return vflags.v & flag_edit_by; } - bool has_edit_date() const { return vflags.v & flag_edit_date; } }; // RPC methods @@ -16418,6 +16424,7 @@ public: flag_no_webpage = (1 << 1), flag_broadcast = (1 << 4), flag_silent = (1 << 5), + flag_background = (1 << 6), flag_reply_to_msg_id = (1 << 0), flag_reply_markup = (1 << 2), flag_entities = (1 << 3), @@ -16426,6 +16433,7 @@ public: bool is_no_webpage() const { return vflags.v & flag_no_webpage; } bool is_broadcast() const { return vflags.v & flag_broadcast; } bool is_silent() const { return vflags.v & flag_silent; } + bool is_background() const { return vflags.v & flag_background; } bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } bool has_reply_markup() const { return vflags.v & flag_reply_markup; } bool has_entities() const { return vflags.v & flag_entities; } @@ -16489,12 +16497,14 @@ public: enum { flag_broadcast = (1 << 4), flag_silent = (1 << 5), + flag_background = (1 << 6), flag_reply_to_msg_id = (1 << 0), flag_reply_markup = (1 << 2), }; bool is_broadcast() const { return vflags.v & flag_broadcast; } bool is_silent() const { return vflags.v & flag_silent; } + bool is_background() const { return vflags.v & flag_background; } bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } bool has_reply_markup() const { return vflags.v & flag_reply_markup; } @@ -16554,10 +16564,12 @@ public: enum { flag_broadcast = (1 << 4), flag_silent = (1 << 5), + flag_background = (1 << 6), }; bool is_broadcast() const { return vflags.v & flag_broadcast; } bool is_silent() const { return vflags.v & flag_silent; } + bool is_background() const { return vflags.v & flag_background; } uint32 innerLength() const { return vflags.innerLength() + vfrom_peer.innerLength() + vid.innerLength() + vrandom_id.innerLength() + vto_peer.innerLength(); @@ -18448,11 +18460,13 @@ public: enum { flag_broadcast = (1 << 4), flag_silent = (1 << 5), + flag_background = (1 << 6), flag_reply_to_msg_id = (1 << 0), }; bool is_broadcast() const { return vflags.v & flag_broadcast; } bool is_silent() const { return vflags.v & flag_silent; } + bool is_background() const { return vflags.v & flag_background; } bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } uint32 innerLength() const { @@ -24333,7 +24347,7 @@ inline MTPinputPeerNotifySettings::MTPinputPeerNotifySettings() : mtpDataOwner(n inline uint32 MTPinputPeerNotifySettings::innerLength() const { const MTPDinputPeerNotifySettings &v(c_inputPeerNotifySettings()); - return v.vmute_until.innerLength() + v.vsound.innerLength() + v.vshow_previews.innerLength() + v.vevents_mask.innerLength(); + return v.vflags.innerLength() + v.vmute_until.innerLength() + v.vsound.innerLength(); } inline mtpTypeId MTPinputPeerNotifySettings::type() const { return mtpc_inputPeerNotifySettings; @@ -24343,22 +24357,20 @@ inline void MTPinputPeerNotifySettings::read(const mtpPrime *&from, const mtpPri if (!data) setData(new MTPDinputPeerNotifySettings()); MTPDinputPeerNotifySettings &v(_inputPeerNotifySettings()); + v.vflags.read(from, end); v.vmute_until.read(from, end); v.vsound.read(from, end); - v.vshow_previews.read(from, end); - v.vevents_mask.read(from, end); } inline void MTPinputPeerNotifySettings::write(mtpBuffer &to) const { const MTPDinputPeerNotifySettings &v(c_inputPeerNotifySettings()); + v.vflags.write(to); v.vmute_until.write(to); v.vsound.write(to); - v.vshow_previews.write(to); - v.vevents_mask.write(to); } inline MTPinputPeerNotifySettings::MTPinputPeerNotifySettings(MTPDinputPeerNotifySettings *_data) : mtpDataOwner(_data) { } -inline MTPinputPeerNotifySettings MTP_inputPeerNotifySettings(MTPint _mute_until, const MTPstring &_sound, MTPBool _show_previews, MTPint _events_mask) { - return MTPinputPeerNotifySettings(new MTPDinputPeerNotifySettings(_mute_until, _sound, _show_previews, _events_mask)); +inline MTPinputPeerNotifySettings MTP_inputPeerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound) { + return MTPinputPeerNotifySettings(new MTPDinputPeerNotifySettings(_flags, _mute_until, _sound)); } inline uint32 MTPpeerNotifyEvents::innerLength() const { @@ -24397,7 +24409,7 @@ inline uint32 MTPpeerNotifySettings::innerLength() const { switch (_type) { case mtpc_peerNotifySettings: { const MTPDpeerNotifySettings &v(c_peerNotifySettings()); - return v.vmute_until.innerLength() + v.vsound.innerLength() + v.vshow_previews.innerLength() + v.vevents_mask.innerLength(); + return v.vflags.innerLength() + v.vmute_until.innerLength() + v.vsound.innerLength(); } } return 0; @@ -24413,10 +24425,9 @@ inline void MTPpeerNotifySettings::read(const mtpPrime *&from, const mtpPrime *e case mtpc_peerNotifySettings: _type = cons; { if (!data) setData(new MTPDpeerNotifySettings()); MTPDpeerNotifySettings &v(_peerNotifySettings()); + v.vflags.read(from, end); v.vmute_until.read(from, end); v.vsound.read(from, end); - v.vshow_previews.read(from, end); - v.vevents_mask.read(from, end); } break; default: throw mtpErrorUnexpected(cons, "MTPpeerNotifySettings"); } @@ -24425,10 +24436,9 @@ inline void MTPpeerNotifySettings::write(mtpBuffer &to) const { switch (_type) { case mtpc_peerNotifySettings: { const MTPDpeerNotifySettings &v(c_peerNotifySettings()); + v.vflags.write(to); v.vmute_until.write(to); v.vsound.write(to); - v.vshow_previews.write(to); - v.vevents_mask.write(to); } break; } } @@ -24444,8 +24454,8 @@ inline MTPpeerNotifySettings::MTPpeerNotifySettings(MTPDpeerNotifySettings *_dat inline MTPpeerNotifySettings MTP_peerNotifySettingsEmpty() { return MTPpeerNotifySettings(mtpc_peerNotifySettingsEmpty); } -inline MTPpeerNotifySettings MTP_peerNotifySettings(MTPint _mute_until, const MTPstring &_sound, MTPBool _show_previews, MTPint _events_mask) { - return MTPpeerNotifySettings(new MTPDpeerNotifySettings(_mute_until, _sound, _show_previews, _events_mask)); +inline MTPpeerNotifySettings MTP_peerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound) { + return MTPpeerNotifySettings(new MTPDpeerNotifySettings(_flags, _mute_until, _sound)); } inline uint32 MTPwallPaper::innerLength() const { @@ -30909,7 +30919,7 @@ inline MTPchannels_messageEditData::MTPchannels_messageEditData() : mtpDataOwner inline uint32 MTPchannels_messageEditData::innerLength() const { const MTPDchannels_messageEditData &v(c_channels_messageEditData()); - return v.vflags.innerLength() + v.vfrom_id.innerLength() + (v.has_edit_by() ? v.vedit_by.innerLength() : 0) + (v.has_edit_date() ? v.vedit_date.innerLength() : 0) + v.vusers.innerLength(); + return v.vflags.innerLength(); } inline mtpTypeId MTPchannels_messageEditData::type() const { return mtpc_channels_messageEditData; @@ -30920,23 +30930,15 @@ inline void MTPchannels_messageEditData::read(const mtpPrime *&from, const mtpPr if (!data) setData(new MTPDchannels_messageEditData()); MTPDchannels_messageEditData &v(_channels_messageEditData()); v.vflags.read(from, end); - v.vfrom_id.read(from, end); - if (v.has_edit_by()) { v.vedit_by.read(from, end); } else { v.vedit_by = MTPint(); } - if (v.has_edit_date()) { v.vedit_date.read(from, end); } else { v.vedit_date = MTPint(); } - v.vusers.read(from, end); } inline void MTPchannels_messageEditData::write(mtpBuffer &to) const { const MTPDchannels_messageEditData &v(c_channels_messageEditData()); v.vflags.write(to); - v.vfrom_id.write(to); - if (v.has_edit_by()) v.vedit_by.write(to); - if (v.has_edit_date()) v.vedit_date.write(to); - v.vusers.write(to); } inline MTPchannels_messageEditData::MTPchannels_messageEditData(MTPDchannels_messageEditData *_data) : mtpDataOwner(_data) { } -inline MTPchannels_messageEditData MTP_channels_messageEditData(MTPint _flags, MTPint _from_id, MTPint _edit_by, MTPint _edit_date, const MTPVector &_users) { - return MTPchannels_messageEditData(new MTPDchannels_messageEditData(_flags, _from_id, _edit_by, _edit_date, _users)); +inline MTPchannels_messageEditData MTP_channels_messageEditData(MTPint _flags) { + return MTPchannels_messageEditData(new MTPDchannels_messageEditData(_flags)); } // Human-readable text serialization diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index 94df0ec3e7..8e4b7bf2f7 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -209,7 +209,7 @@ userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; -channel#4b1b7506 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true editor:flags.3?true moderator:flags.4?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true admin_invites:flags.10?true signatures:flags.11?true id:int access_hash:long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string = Chat; +channel#4b1b7506 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true editor:flags.3?true moderator:flags.4?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true id:int access_hash:long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string = Chat; channelForbidden#2d85832c id:int access_hash:long title:string = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; @@ -280,13 +280,13 @@ inputNotifyAll#a429b886 = InputNotifyPeer; inputPeerNotifyEventsEmpty#f03064d8 = InputPeerNotifyEvents; inputPeerNotifyEventsAll#e86a2c74 = InputPeerNotifyEvents; -inputPeerNotifySettings#46a2ce98 mute_until:int sound:string show_previews:Bool events_mask:int = InputPeerNotifySettings; +inputPeerNotifySettings#38935eb2 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = InputPeerNotifySettings; peerNotifyEventsEmpty#add53cb3 = PeerNotifyEvents; peerNotifyEventsAll#6d1ded88 = PeerNotifyEvents; peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; -peerNotifySettings#8d5e11ee mute_until:int sound:string show_previews:Bool events_mask:int = PeerNotifySettings; +peerNotifySettings#9acda4c0 flags:# show_previews:flags.0?true silent:flags.1?true mute_until:int sound:string = PeerNotifySettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; @@ -644,7 +644,7 @@ exportedMessageLink#1f486803 link:string = ExportedMessageLink; messageFwdHeader#c786ddcb flags:# from_id:flags.0?int date:int channel_id:flags.1?int channel_post:flags.2?int = MessageFwdHeader; -channels.messageEditData#b86fd3cf flags:# caption:flags.1?true from_id:int edit_by:flags.0?int edit_date:flags.0?int users:Vector = channels.MessageEditData; +channels.messageEditData#67e1255f flags:# caption:flags.0?true = channels.MessageEditData; ---functions--- @@ -721,9 +721,9 @@ messages.deleteHistory#b7c13bd9 peer:InputPeer max_id:int = messages.AffectedHis messages.deleteMessages#a5f18925 id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; -messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true broadcast:flags.4?true silent:flags.5?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; -messages.sendMedia#c8f16791 flags:# broadcast:flags.4?true silent:flags.5?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; -messages.forwardMessages#708e0195 flags:# broadcast:flags.4?true silent:flags.5?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; +messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true broadcast:flags.4?true silent:flags.5?true background:flags.6?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; +messages.sendMedia#c8f16791 flags:# broadcast:flags.4?true silent:flags.5?true background:flags.6?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; +messages.forwardMessages#708e0195 flags:# broadcast:flags.4?true silent:flags.5?true background:flags.6?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.getChats#3c6aa187 id:Vector = messages.Chats; messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; @@ -767,7 +767,7 @@ messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#9324600d bot:InputUser query:string offset:string = messages.BotResults; messages.setInlineBotResults#3f23ec12 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string = Bool; -messages.sendInlineBotResult#b16e06fe flags:# broadcast:flags.4?true silent:flags.5?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; +messages.sendInlineBotResult#b16e06fe flags:# broadcast:flags.4?true silent:flags.5?true background:flags.6?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; updates.getState#edd4882a = updates.State; updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index 69604e5017..16df19fcd5 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -163,12 +163,16 @@ static const MsgId ServerMaxMsgId = 0x3FFFFFFF; static const MsgId ShowAtUnreadMsgId = 0; struct NotifySettings { - NotifySettings() : mute(0), sound("default"), previews(true), events(1) { + NotifySettings() : flags(MTPDinputPeerNotifySettings::flag_show_previews), mute(0), sound("default") { } - int32 mute; + int32 flags, mute; string sound; - bool previews; - int32 events; + bool previews() const { + return flags & MTPDinputPeerNotifySettings::flag_show_previews; + } + bool silent() const { + return flags & MTPDinputPeerNotifySettings::flag_silent; + } }; typedef NotifySettings *NotifySettingsPtr; @@ -633,7 +637,7 @@ public: return flags & MTPDchannel::flag_verified; } bool canAddParticipants() const { - return amCreator() || amEditor() || (flags & MTPDchannel::flag_admin_invites); + return amCreator() || amEditor() || (flags & MTPDchannel::flag_democracy); } // ImagePtr photoFull;