Skip to content

Commit

Permalink
version 0.6.9 - some network and protocol improvements, checkboxes in…
Browse files Browse the repository at this point in the history
… photos overview, other fixes
  • Loading branch information
john-preston committed Nov 14, 2014
1 parent c89f13b commit 868b984
Show file tree
Hide file tree
Showing 46 changed files with 4,049 additions and 2,741 deletions.
4 changes: 2 additions & 2 deletions Telegram/DeployLinux.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppVersionStr=0.6.8
AppVersion=6008
AppVersionStr=0.6.9
AppVersion=6009

if [ ! -f "./../Linux/Release/deploy/$AppVersionStr/tlinuxupd$AppVersion" ]; then
echo "tlinuxupd$AppVersion not found!";
Expand Down
4 changes: 2 additions & 2 deletions Telegram/DeployLinux32.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppVersionStr=0.6.8
AppVersion=6008
AppVersionStr=0.6.9
AppVersion=6009

if [ ! -f "./../Linux/Release/deploy/$AppVersionStr/tlinux32upd$AppVersion" ]; then
echo "tlinux32upd$AppVersion not found!"
Expand Down
4 changes: 2 additions & 2 deletions Telegram/DeployMacWin.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppVersionStr=0.6.8
AppVersion=6008
AppVersionStr=0.6.9
AppVersion=6009

if [ ! -f "./../Mac/Release/deploy/$AppVersionStr/tmacupd$AppVersion" ]; then
echo "tmacupd$AppVersion not found!"
Expand Down
4 changes: 2 additions & 2 deletions Telegram/DeployWin.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppVersionStr=0.6.8
AppVersion=6008
AppVersionStr=0.6.9
AppVersion=6009

if [ ! -f "./../Win32/Deploy/deploy/$AppVersionStr/tupdate$AppVersion" ]; then
echo "tupdate$AppVersion not found!"
Expand Down
4 changes: 2 additions & 2 deletions Telegram/PrepareLinux.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppVersionStr=0.6.8
AppVersion=6008
AppVersionStr=0.6.9
AppVersion=6009

if [ -d "./../Linux/Release/deploy/$AppVersionStr" ]; then
echo "Deploy folder for version $AppVersionStr already exists!"
Expand Down
4 changes: 2 additions & 2 deletions Telegram/PrepareLinux32.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppVersionStr=0.6.8
AppVersion=6008
AppVersionStr=0.6.9
AppVersion=6009

if [ -d "./../Linux/Release/deploy/$AppVersionStr" ]; then
echo "Deploy folder for version $AppVersionStr already exists!"
Expand Down
4 changes: 2 additions & 2 deletions Telegram/PrepareMac.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppVersionStr=0.6.8
AppVersion=6008
AppVersionStr=0.6.9
AppVersion=6009

echo ""
echo "Preparing version $AppVersionStr.."
Expand Down
2 changes: 1 addition & 1 deletion Telegram/PrepareWin.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo OFF

set "AppVersionStr=0.6.8"
set "AppVersionStr=0.6.9"
echo.
echo Preparing version %AppVersionStr%..
echo.
Expand Down
5 changes: 4 additions & 1 deletion Telegram/Resources/lang.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ lng_connecting: "Connecting..";
lng_reconnecting: "Reconnect in %1 s..";
lng_reconnecting_try_now: "Try now";

lng_status_offline: "offline";
lng_status_offline: "last seen a long time ago";
lng_status_recently: "last seen recently";
lng_status_last_week: "last seen within a week";
lng_status_last_month: "last seen within a month";
lng_status_invisible: "invisible";
lng_status_lastseen: "last seen {when}";
lng_status_lastseen_now: "just now";
Expand Down
3 changes: 3 additions & 0 deletions Telegram/Resources/style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,9 @@ medviewPhotoSpritePos: point(14px, 14px);

overviewPhotoSkip: 10px;
overviewPhotoMinSize: 100px;
overviewPhotoCheck: sprite(245px, 308px, 32px, 32px);
overviewPhotoChecked: sprite(278px, 308px, 32px, 32px);
overviewPhotoSelectOverlay: #0a7bb03f;

// Mac specific

Expand Down
6 changes: 3 additions & 3 deletions Telegram/Setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#define MyAppShortName "Telegram"
#define MyAppName "Telegram Desktop"
#define MyAppVersion "0.6.8"
#define MyAppVersionZero "0.6.8"
#define MyAppFullVersion "0.6.8.0"
#define MyAppVersion "0.6.9"
#define MyAppVersionZero "0.6.9"
#define MyAppFullVersion "0.6.9.0"
#define MyAppPublisher "Telegram Messenger LLP"
#define MyAppURL "https://tdesktop.com"
#define MyAppExeName "Telegram.exe"
Expand Down
17 changes: 14 additions & 3 deletions Telegram/SourceFiles/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,15 @@ namespace App {
}

QString onlineText(int32 online, int32 now, bool precise) {
if (!online) return lang(lng_status_offline);
if (online < 0) return lang(lng_status_invisible);
if (online <= 0) {
switch (online) {
case 0: return lang(lng_status_offline);
case -2: return lang(lng_status_recently);
case -3: return lang(lng_status_last_week);
case -4: return lang(lng_status_last_month);
}
return lang(lng_status_invisible);
}
if (online > now) {
return lang(lng_status_online);
}
Expand Down Expand Up @@ -329,6 +336,10 @@ namespace App {

data->loaded = true;
if (status) switch (status->type()) {
case mtpc_userStatusEmpty: data->onlineTill = 0; break;
case mtpc_userStatusRecently: data->onlineTill = -2; break;
case mtpc_userStatusLastWeek: data->onlineTill = -3; break;
case mtpc_userStatusLastMonth: data->onlineTill = -4; break;
case mtpc_userStatusOffline: data->onlineTill = status->c_userStatusOffline().vwas_online.v; break;
case mtpc_userStatusOnline: data->onlineTill = status->c_userStatusOnline().vexpires.v; break;
}
Expand Down Expand Up @@ -408,7 +419,7 @@ namespace App {
if (!data) continue;

data->loaded = true;
data->updateName(title.trimmed(), QString());
data->updateName(title.trimmed(), QString(), QString());

if (App::main()) App::main()->peerUpdated(data);
}
Expand Down
1 change: 0 additions & 1 deletion Telegram/SourceFiles/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,6 @@ void Application::startApp() {

readSupportTemplates();

MTP::setLayer(mtpLayerMax);
MTP::start();

MTP::setStateChangedHandler(mtpStateChanged);
Expand Down
Binary file modified Telegram/SourceFiles/art/sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Telegram/SourceFiles/art/sprite_200x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/addcontactbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ bool AddContactBox::onSaveFail(const RPCError &error) {
QString err(error.type());
QString firstName = _firstInput.text().trimmed(), lastName = _lastInput.text().trimmed();
if (err == "CHAT_TITLE_NOT_MODIFIED") {
_peer->updateName(firstName, QString());
_peer->updateName(firstName, QString(), QString());
emit closed();
return true;
} else if (err == "NO_CHAT_TITLE") {
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/boxes/addparticipantbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ void AddParticipantInner::mousePressEvent(QMouseEvent *e) {
}

void AddParticipantInner::chooseParticipant() {
_time = unixtime();
int32 rh = st::profileListPhotoSize + st::profileListPadding.height() * 2, from;
if (_filter.isEmpty()) {
if (!_sel || contactData(_sel)->inchat) return;
Expand Down Expand Up @@ -293,6 +294,7 @@ void AddParticipantInner::updateSel() {
}

void AddParticipantInner::updateFilter(QString filter) {
_time = unixtime();
QStringList f;
if (!filter.isEmpty()) {
QStringList filterList = filter.split(cWordSplit(), QString::SkipEmptyParts);
Expand Down Expand Up @@ -405,6 +407,7 @@ AddParticipantInner::~AddParticipantInner() {
}

void AddParticipantInner::selectSkip(int32 dir) {
_time = unixtime();
_mouseSel = false;
int32 rh = st::profileListPhotoSize + st::profileListPadding.height() * 2, origDir = dir;
if (_filter.isEmpty()) {
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
*/
#pragma once

static const int32 AppVersion = 6008;
static const wchar_t *AppVersionStr = L"0.6.8";
static const int32 AppVersion = 6009;
static const wchar_t *AppVersionStr = L"0.6.9";

static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop";
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/gui/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3975,7 +3975,7 @@ QString textAccentFold(const QString &text) {
continue;
}
if (ch->isHighSurrogate() && ch + 1 < e && (ch + 1)->isLowSurrogate()) {
QChar noAccent = QChar::surrogateToUcs4(*ch, *(ch + 1));
QChar noAccent = chNoAccent(QChar::surrogateToUcs4(*ch, *(ch + 1)));
if (noAccent.unicode() > 0) {
copying = true;
result[i] = noAccent;
Expand Down
28 changes: 14 additions & 14 deletions Telegram/SourceFiles/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,13 @@ const ChatData *PeerData::asChat() const {
return chat ? static_cast<const ChatData *>(this) : App::chat(id | 0x100000000L);
}

void PeerData::updateName(const QString &newName, const QString &newNameOrPhone) {
if (name == newName && nameOrPhone == newNameOrPhone) return;
void PeerData::updateName(const QString &newName, const QString &newNameOrPhone, const QString &newUsername) {
if (name == newName && nameOrPhone == newNameOrPhone && (chat || asUser()->username == newUsername)) return;

++nameVersion;
name = newName;
nameOrPhone = newNameOrPhone;
if (!chat) asUser()->username = newUsername;
Names oldNames = names;
NameFirstChars oldChars = chars;
fillNames();
Expand Down Expand Up @@ -352,24 +353,23 @@ void PeerData::fillNames() {


void UserData::setName(const QString &first, const QString &last, const QString &phoneName, const QString &usern) {
bool updName = !first.isEmpty() || !last.isEmpty();

if (username != usern) {
username = usern;
if (App::main()) {
App::main()->peerUsernameChanged(this);
}
}
bool updName = !first.isEmpty() || !last.isEmpty(), updUsername = (username != usern);

if (updName && first.trimmed().isEmpty()) {
firstName = last;
lastName = QString();
updateName(firstName, phoneName);
updateName(firstName, phoneName, usern);
} else {
if (updName) {
firstName = first;
lastName = last;
}
updateName(firstName + ' ' + lastName, phoneName);
updateName(firstName + ' ' + lastName, phoneName, usern);
}
if (updUsername) {
if (App::main()) {
App::main()->peerUsernameChanged(this);
}
}
}

Expand Down Expand Up @@ -1168,7 +1168,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo
case mtpc_messageActionChatEditTitle: {
const MTPDmessageActionChatEditTitle &d(action.c_messageActionChatEditTitle());
ChatData *chat = peer->asChat();
if (chat) chat->updateName(qs(d.vtitle), QString());
if (chat) chat->updateName(qs(d.vtitle), QString(), QString());
} break;
}
}
Expand Down Expand Up @@ -3074,7 +3074,7 @@ void ImageLinkManager::init() {
App::setProxySettings(*manager);

connect(manager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, SLOT(onFailed(QNetworkReply*)));
connect(manager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&errors)), this, SLOT(onFailed(QNetworkReply*)));
connect(manager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT(onFailed(QNetworkReply*)));
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*)));

if (black) delete black;
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct PeerData {
ChatData *asChat();
const ChatData *asChat() const;

void updateName(const QString &newName, const QString &newNameOrPhone);
void updateName(const QString &newName, const QString &newNameOrPhone, const QString &newUsername);

void fillNames();

Expand Down
7 changes: 6 additions & 1 deletion Telegram/SourceFiles/historywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent)
connect(&_attachDocument, SIGNAL(clicked()), this, SLOT(onDocumentSelect()));
connect(&_attachPhoto, SIGNAL(clicked()), this, SLOT(onPhotoSelect()));
connect(&_field, SIGNAL(submitted(bool)), this, SLOT(onSend(bool)));
connect(&_field, SIGNAL(cancelled()), this, SIGNAL(cancelled()));
connect(&_field, SIGNAL(cancelled()), this, SLOT(onCancel()));
connect(&_field, SIGNAL(tabbed()), this, SLOT(onFieldTabbed()));
connect(&_field, SIGNAL(resized()), this, SLOT(onFieldResize()));
connect(&_field, SIGNAL(focused()), this, SLOT(onFieldFocused()));
Expand Down Expand Up @@ -3161,6 +3161,11 @@ void HistoryWidget::setFieldText(const QString &text) {
noTypingUpdate = false;
}

void HistoryWidget::onCancel() {
showPeer(0);
emit cancelled();
}

void HistoryWidget::peerUpdated(PeerData *data) {
if (data && data == histPeer) {
updateListSize();
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/historywidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ class HistoryWidget : public QWidget, public RPCSender, public Animated {

public slots:

void onCancel();

void peerUpdated(PeerData *data);

void cancelTyping();
Expand Down
11 changes: 9 additions & 2 deletions Telegram/SourceFiles/mainwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,9 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
if (user) {
switch (d.vstatus.type()) {
case mtpc_userStatusEmpty: user->onlineTill = 0; break;
case mtpc_userStatusRecently: user->onlineTill = -2; break;
case mtpc_userStatusLastWeek: user->onlineTill = -3; break;
case mtpc_userStatusLastMonth: user->onlineTill = -4; break;
case mtpc_userStatusOffline: user->onlineTill = d.vstatus.c_userStatusOffline().vwas_online.v; break;
case mtpc_userStatusOnline: user->onlineTill = d.vstatus.c_userStatusOnline().vexpires.v; break;
}
Expand All @@ -2263,8 +2266,12 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
case mtpc_updateUserName: {
const MTPDupdateUserName &d(update.c_updateUserName());
UserData *user = App::userLoaded(d.vuser_id.v);
if (user && user->contact <= 0) {
user->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), user->nameOrPhone, textOneLine(qs(d.vusername)));
if (user) {
if (user->contact <= 0) {
user->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), user->nameOrPhone, textOneLine(qs(d.vusername)));
} else {
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), user->nameOrPhone, textOneLine(qs(d.vusername)));
}
if (App::main()) App::main()->peerUpdated(user);
}
} break;
Expand Down
10 changes: 5 additions & 5 deletions Telegram/SourceFiles/mtproto/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@
funcsText += '\tMTP' + name + '(' + ', '.join(prmsStr) + ') : ' + ', '.join(prmsInit) + ' {\n\t}\n';
funcsText += '\n';

funcsText += '\tuint32 size() const {\n'; # count size
funcsText += '\tuint32 innerLength() const {\n'; # count size
size = [];
for k in prmsList:
v = prms[k];
size.append('v' + k + '.size()');
size.append('v' + k + '.innerLength()');
if (not len(size)):
size.append('0');
funcsText += '\t\treturn ' + ' + '.join(size) + ';\n';
Expand Down Expand Up @@ -402,7 +402,7 @@ def addTextSerialize(dct):
writeText += '\t\t';
readText += '\tv.v' + paramName + '.read(from, end);\n';
writeText += '\tv.v' + paramName + '.write(to);\n';
sizeList.append('v.v' + paramName + '.size()');
sizeList.append('v.v' + paramName + '.innerLength()');

forwards += 'class MTPD' + name + ';\n'; # data class forward declaration

Expand Down Expand Up @@ -505,8 +505,8 @@ def addTextSerialize(dct):
if (withData):
typesText += getters;

typesText += '\n\tuint32 size() const;\n'; # size method
inlineMethods += '\ninline uint32 MTP' + restype + '::size() const {\n';
typesText += '\n\tuint32 innerLength() const;\n'; # size method
inlineMethods += '\ninline uint32 MTP' + restype + '::innerLength() const {\n';
if (withType and sizeCases):
inlineMethods += '\tswitch (_type) {\n';
inlineMethods += sizeCases;
Expand Down
Loading

0 comments on commit 868b984

Please sign in to comment.