Initialize Fernschreiber repository

This commit is contained in:
Sebastian J. Wolf 2020-08-10 14:17:29 +02:00
parent af1746cbae
commit 6d864b3623
37 changed files with 28245 additions and 2 deletions

3
.gitignore vendored
View file

@ -50,3 +50,6 @@ compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
# TDLib API Secrets
tdlibsecrets.h

View file

@ -1,2 +1,25 @@
# harbour-fernschreiber
Fernschreiber is a Telegram client for Sailfish OS
# Fernschreiber
A Telegram client for Sailfish OS
## Author
Sebastian J. Wolf [sebastian@ygriega.de](mailto:sebastian@ygriega.de)
## License
Licensed under GNU GPLv3
## Build
Simply clone this repository and use the project file `harbour-fernschreiber.pro` to import the sources in your SailfishOS IDE. To build and run Fernschreiber or an application which is based on Fernschreiber, you need to create the file `harbour-fernschreiber/src/tdlibsecrets.h` and enter the required constants in the following format:
```
#ifndef TDLIBSECRETS_H
#define TDLIBSECRETS_H
const char TDLIB_API_ID[] = "42424242";
const char TDLIB_API_HASH[] = "1234567890abcdef1234567890abcdef";
#endif // TDLIBSECRETS_H
```
You get the Telegram API ID and hash as soon as you've registered your own application on [https://my.telegram.org](https://my.telegram.org).
## Credits
This project uses
- The Telegram Database Library (TDLib) - available on [GitHub.com](https://github.com/tdlib/td). Thanks for making it available under the conditions of the Boost Software License 1.0! Details about the license of TDLib in [its license file](https://github.com/tdlib/td/blob/master/LICENSE_1_0.txt).

View file

@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
X-Nemo-Application-Type=silica-qt5
Icon=harbour-fernschreiber
Exec=harbour-fernschreiber
Name=Fernschreiber

74
harbour-fernschreiber.pro Normal file
View file

@ -0,0 +1,74 @@
# NOTICE:
#
# Application name defined in TARGET has a corresponding QML filename.
# If name defined in TARGET is changed, the following needs to be done
# to match new name:
# - corresponding QML filename must be changed
# - desktop icon filename must be changed
# - desktop filename must be changed
# - icon definition filename in desktop file must be changed
# - translation filenames have to be changed
# The name of your application
TARGET = harbour-fernschreiber
CONFIG += sailfishapp sailfishapp_i18n
SOURCES += src/harbour-fernschreiber.cpp \
src/tdlibwrapper.cpp
DISTFILES += qml/harbour-fernschreiber.qml \
qml/pages/CoverPage.qml \
qml/pages/OverviewPage.qml \
qml/pages/AboutPage.qml \
rpm/harbour-fernschreiber.changes.in \
rpm/harbour-fernschreiber.changes.run.in \
rpm/harbour-fernschreiber.spec \
rpm/harbour-fernschreiber.yaml \
translations/*.ts \
harbour-fernschreiber.desktop
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 256x256
TRANSLATIONS += translations/harbour-fernschreiber-de.ts
LIBS += -L$$PWD/tdlib/lib/ -ltdjson
INCLUDEPATH += $$PWD/tdlib/include
DEPENDPATH += $$PWD/tdlib/include
telegram.files = $$PWD/tdlib/lib
telegram.path = /usr/share/$${TARGET}
gui.files = qml
gui.path = /usr/share/$${TARGET}
images.files = images
images.path = /usr/share/$${TARGET}
ICONPATH = /usr/share/icons/hicolor
86.png.path = $${ICONPATH}/86x86/apps/
86.png.files += icons/86x86/harbour-fernschreiber.png
108.png.path = $${ICONPATH}/108x108/apps/
108.png.files += icons/108x108/harbour-fernschreiber.png
128.png.path = $${ICONPATH}/128x128/apps/
128.png.files += icons/128x128/harbour-fernschreiber.png
172.png.path = $${ICONPATH}/172x172/apps/
172.png.files += icons/172x172/harbour-fernschreiber.png
256.png.path = $${ICONPATH}/256x256/apps/
256.png.files += icons/256x256/harbour-fernschreiber.png
fernschreiber.desktop.path = /usr/share/applications/
fernschreiber.desktop.files = harbour-fernschreiber.desktop
INSTALLS += telegram 86.png 108.png 128.png 172.png 256.png \
fernschreiber.desktop gui images
HEADERS += \
src/tdlibsecrets.h \
src/tdlibwrapper.h

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
images/background-black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
images/background-white.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
images/fernschreiber.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

View file

@ -0,0 +1,17 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
ApplicationWindow
{
id: appWindow
Component {
id: overviewPage
OverviewPage {}
}
initialPage: overviewPage
cover: Qt.resolvedUrl("pages/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
}

195
qml/pages/AboutPage.qml Normal file
View file

@ -0,0 +1,195 @@
/*
Copyright (C) 2020 Sebastian J. Wolf
This file is part of Fernschreiber.
fernschreiber is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: aboutPage
allowedOrientations: Orientation.All
SilicaFlickable {
id: aboutContainer
contentHeight: column.height
anchors.fill: parent
Column {
id: column
width: aboutPage.width
spacing: Theme.paddingLarge
PageHeader {
title: qsTr("About Fernschreiber")
}
Image {
id: wunderfitzImage
source: "../../images/fernschreiber.png"
anchors {
horizontalCenter: parent.horizontalCenter
}
fillMode: Image.PreserveAspectFit
width: 2/3 * parent.width
}
Label {
text: "Fernschreiber 0.1"
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Theme.fontSizeExtraLarge
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Label {
wrapMode: Text.Wrap
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
horizontalAlignment: Text.AlignHCenter
text: qsTr("A Telegram client for Sailfish OS")
font.pixelSize: Theme.fontSizeSmall
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Label {
text: qsTr("By Sebastian J. Wolf")
font.pixelSize: Theme.fontSizeSmall
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Text {
text: "<a href=\"mailto:sebastian@ygriega.de\">" + qsTr("Send E-Mail") + "</a>"
anchors {
horizontalCenter: parent.horizontalCenter
}
font.pixelSize: Theme.fontSizeSmall
linkColor: Theme.highlightColor
onLinkActivated: Qt.openUrlExternally("mailto:sebastian@ygriega.de")
}
Separator {
width: parent.width
color: Theme.primaryColor
horizontalAlignment: Qt.AlignHCenter
}
Label {
text: qsTr("Licensed under GNU GPLv3")
font.pixelSize: Theme.fontSizeSmall
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Text {
text: "<a href=\"https://github.com/Wunderfitz/harbour-fernschreiber\">" + qsTr("Sources on GitHub") + "</a>"
anchors {
horizontalCenter: parent.horizontalCenter
}
font.pixelSize: Theme.fontSizeSmall
linkColor: Theme.highlightColor
onLinkActivated: Qt.openUrlExternally("https://github.com/Wunderfitz/harbour-fernschreiber")
}
SectionHeader {
text: qsTr("About Telegram")
}
Label {
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
text: qsTr("This product uses the Telegram API but is not endorsed or certified by Telegram")
font.pixelSize: Theme.fontSizeSmall
wrapMode: Text.Wrap
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Button {
id: flickrTosButton
text: qsTr("Terms of Service")
anchors {
horizontalCenter: parent.horizontalCenter
}
onClicked: {
Qt.openUrlExternally("https://telegram.org/tos");
}
}
Button {
id: flickrPrivacyButton
text: qsTr("Privacy Policy")
anchors {
horizontalCenter: parent.horizontalCenter
}
onClicked: {
Qt.openUrlExternally("https://telegram.orgprivacy")
}
}
SectionHeader {
text: qsTr("Credits")
}
Label {
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
text: qsTr("This project uses the Telegram Database Library (TDLib). Thanks for making it available under the conditions of the Boost Software License 1.0!")
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Text {
text: "<a href=\"https://github.com/tdlib/td\">" + qsTr("Open Telegram Database Library on GitHub") + "</a>"
anchors {
horizontalCenter: parent.horizontalCenter
}
font.pixelSize: Theme.fontSizeSmall
linkColor: Theme.highlightColor
onLinkActivated: Qt.openUrlExternally("https://github.com/tdlib/td")
}
Label {
id: separatorLabel
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
anchors {
horizontalCenter: parent.horizontalCenter
}
}
VerticalScrollDecorator {}
}
}
}

43
qml/pages/CoverPage.qml Normal file
View file

@ -0,0 +1,43 @@
/*
Copyright (C) 2020 Sebastian J. Wolf
This file is part of Fernschreiber.
fernschreiber is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import Sailfish.Silica 1.0
CoverBackground {
id: coverPage
Image {
id: backgroundImage
source: "../../images/background" + ( Theme.colorScheme ? "-black" : "-white" ) + ".png"
anchors {
verticalCenter: parent.verticalCenter
bottom: parent.bottom
bottomMargin: Theme.paddingMedium
right: parent.right
rightMargin: Theme.paddingMedium
}
fillMode: Image.PreserveAspectFit
opacity: 0.15
}
}

View file

@ -0,0 +1,56 @@
/*
Copyright (C) 2020 Sebastian J. Wolf
This file is part of Fernschreiber.
fernschreiber is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import QtGraphicalEffects 1.0
import QtMultimedia 5.0
import Sailfish.Silica 1.0
import Nemo.Notifications 1.0
Page {
id: overviewPage
allowedOrientations: Orientation.All
SilicaFlickable {
id: aboutContainer
contentHeight: column.height
anchors.fill: parent
PullDownMenu {
MenuItem {
text: qsTr("About Fernschreiber")
onClicked: pageStack.push(Qt.resolvedUrl("../pages/AboutPage.qml"))
}
}
Column {
id: column
width: parent.width
spacing: Theme.paddingLarge
PageHeader {
title: qsTr("Welcome to Fernschreiber")
}
VerticalScrollDecorator {}
}
}
}

View file

@ -0,0 +1,18 @@
# Rename this file as harbour-fernschreiber.changes to include changelog
# entries in your RPM file.
#
# Add new changelog entries following the format below.
# Add newest entries to the top of the list.
# Separate entries from eachother with a blank line.
#
# Alternatively, if your changelog is automatically generated (e.g. with
# the git-change-log command provided with Sailfish OS SDK), create a
# harbour-fernschreiber.changes.run script to let mb2 run the required commands for you.
# * date Author's Name <author's email> version-release
# - Summary of changes
* Sun Apr 13 2014 Jack Tar <jack.tar@example.com> 0.0.1-1
- Scrubbed the deck
- Hoisted the sails

View file

@ -0,0 +1,25 @@
#!/bin/bash
#
# Rename this file as harbour-fernschreiber.changes.run to let mb2 automatically
# generate changelog from well formatted Git commit messages and tag
# annotations.
git-change-log
# Here are some basic examples how to change from the default behavior. Run
# git-change-log --help inside the Sailfish OS SDK chroot or build engine to
# learn all the options git-change-log accepts.
# Use a subset of tags
#git-change-log --tags refs/tags/my-prefix/*
# Group entries by minor revision, suppress headlines for patch-level revisions
#git-change-log --dense '/[0-9]+.[0-9+$'
# Trim very old changes
#git-change-log --since 2014-04-01
#echo '[ Some changelog entries trimmed for brevity ]'
# Use the subjects (first lines) of tag annotations when no entry would be
# included for a revision otherwise
#git-change-log --auto-add-annotations

View file

@ -0,0 +1,69 @@
#
# Do NOT Edit the Auto-generated Part!
# Generated by: spectacle version 0.27
#
Name: harbour-fernschreiber
# >> macros
%define __provides_exclude_from ^%{_datadir}/.*$
%define __requires_exclude ^libtdjson.*$
# << macros
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.1
Release: 1
Group: Qt/Qt
License: LICENSE
URL: http://werkwolf.eu/
Source0: %{name}-%{version}.tar.bz2
Source100: harbour-fernschreiber.yaml
Requires: sailfishsilica-qt5 >= 0.10.9
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: desktop-file-utils
%description
Fernschreiber is a Telegram client for Sailfish OS
%prep
%setup -q -n %{name}-%{version}
# >> setup
# << setup
%build
# >> build pre
# << build pre
%qmake5
make %{?_smp_mflags}
# >> build post
# << build post
%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%qmake5_install
# >> install post
# << install post
desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/*.desktop
%files
%defattr(-,root,root,-)
%{_bindir}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
# >> files
# << files

View file

@ -0,0 +1,43 @@
Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.1
Release: 1
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Qt/Qt
URL: http://werkwolf.eu/
License: LICENSE
# This must be generated before uploading a package to a remote build service.
# Usually this line does not need to be modified.
Sources:
- '%{name}-%{version}.tar.bz2'
Description: |
Fernschreiber is a Telegram client for Sailfish OS
Configure: none
Builder: qmake5
# This section specifies build dependencies that are resolved using pkgconfig.
# This is the preferred way of specifying build dependencies for your package.
PkgConfigBR:
- sailfishapp >= 1.0.2
- Qt5Core
- Qt5Qml
- Qt5Quick
# Build dependencies without a pkgconfig setup can be listed here
# PkgBR:
# - package-needed-to-build
# Runtime dependencies which are not automatically detected
Requires:
- sailfishsilica-qt5 >= 0.10.9
# All installed files
Files:
- '%{_bindir}'
- '%{_datadir}/%{name}'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/*/apps/%{name}.png'
# For more information about yaml and what's supported in Sailfish OS
# build system, please see https://wiki.merproject.org/wiki/Spectacle

View file

@ -0,0 +1,47 @@
/*
Copyright (C) 2020 Sebastian J. Wolf
This file is part of Fernschreiber.
fernschreiber is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef QT_QML_DEBUG
#include <QtQuick>
#endif
#include <sailfishapp.h>
#include <QScopedPointer>
#include <QQuickView>
#include <QtQml>
#include <QQmlContext>
#include <QQmlEngine>
#include <QGuiApplication>
#include "tdlibwrapper.h"
int main(int argc, char *argv[])
{
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> view(SailfishApp::createView());
QQmlContext *context = view.data()->rootContext();
TDLibWrapper tdLibWrapper;
context->setContextProperty("tdLibWrapper", &tdLibWrapper);
view->setSource(SailfishApp::pathTo("qml/harbour-fernschreiber.qml"));
view->show();
return app->exec();
}

40
src/tdlibwrapper.cpp Normal file
View file

@ -0,0 +1,40 @@
/*
Copyright (C) 2020 Sebastian J. Wolf
This file is part of Fernschreiber.
fernschreiber is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tdlibwrapper.h"
TDLibWrapper::TDLibWrapper(QObject *parent) : QObject(parent)
{
qDebug() << "[TDLibWrapper] Initializing TD Lib...";
this->tdLibClient = td_json_client_create();
//this->testIt();
}
TDLibWrapper::~TDLibWrapper()
{
qDebug() << "[TDLibWrapper] Destroying TD Lib...";
td_json_client_destroy(this->tdLibClient);
}
void TDLibWrapper::testIt()
{
qDebug() << "[TDLibWrapper] Test it!";
td_json_client_send(this->tdLibClient, "BLUBB");
}

27
src/tdlibwrapper.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef TDLIBWRAPPER_H
#define TDLIBWRAPPER_H
#include <QObject>
#include <QDebug>
#include <td/telegram/td_json_client.h>
class TDLibWrapper : public QObject
{
Q_OBJECT
public:
explicit TDLibWrapper(QObject *parent = nullptr);
~TDLibWrapper();
Q_INVOKABLE void testIt();
signals:
public slots:
private:
void *tdLibClient;
};
#endif // TDLIBWRAPPER_H

View file

@ -0,0 +1,134 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
///\file
#include "td/telegram/td_api.h"
#include "td/telegram/td_api.hpp"
#include <cstdint>
#include <memory>
namespace td {
/**
* Native C++ interface for interaction with TDLib.
*
* The TDLib instance is created for the lifetime of the Client object.
* Requests to TDLib can be sent using the Client::send method from any thread.
* New updates and responses to requests can be received using the Client::receive method from any thread,
* this function shouldn't be called simultaneously from two different threads. Also note that all updates and
* responses to requests should be applied in the same order as they were received, to ensure consistency.
* Given this information, it's advisable to call this function from a dedicated thread.
* Some service TDLib requests can be executed synchronously from any thread by using the Client::execute method.
*
* General pattern of usage:
* \code
* std::shared_ptr<td::Client> client = std::make_shared<td::Client>();
* // somehow share the client with other threads, which will be able to send requests via client->send
*
* const double WAIT_TIMEOUT = 10.0; // seconds
* bool is_closed = false; // should be set to true, when updateAuthorizationState with
* // authorizationStateClosed is received
* while (!is_closed) {
* auto response = client->receive(WAIT_TIMEOUT);
* if (response.object == nullptr) {
* continue;
* }
*
* if (response.id == 0) {
* // process response.object as an incoming update of type td_api::Update
* } else {
* // process response.object as an answer to a sent request with id response.id
* }
* }
* \endcode
*/
class Client final {
public:
/**
* Creates a new TDLib client.
*/
Client();
/**
* A request to the TDLib.
*/
struct Request {
/**
* Request identifier.
* Responses to TDLib requests will have the same id as the corresponding request.
* Updates from TDLib will have id == 0, incoming requests are thus disallowed to have id == 0.
*/
std::uint64_t id;
/**
* TDLib API function representing a request to TDLib.
*/
td_api::object_ptr<td_api::Function> function;
};
/**
* Sends request to TDLib. May be called from any thread.
* \param[in] request Request to TDLib.
*/
void send(Request &&request);
/**
* A response to a request, or an incoming update from TDLib.
*/
struct Response {
/**
* TDLib request identifier, which corresponds to the response or 0 for incoming updates from TDLib.
*/
std::uint64_t id;
/**
* TDLib API object representing a response to a TDLib request or an incoming update.
*/
td_api::object_ptr<td_api::Object> object;
};
/**
* Receives incoming updates and request responses from TDLib. May be called from any thread, but shouldn't be
* called simultaneously from two different threads.
* \param[in] timeout The maximum number of seconds allowed for this function to wait for new data.
* \return An incoming update or request response. The object returned in the response may be a nullptr
* if the timeout expires.
*/
Response receive(double timeout);
/**
* Synchronously executes TDLib requests. Only a few requests can be executed synchronously.
* May be called from any thread.
* \param[in] request Request to the TDLib.
* \return The request response.
*/
static Response execute(Request &&request);
/**
* Destroys the client and TDLib instance.
*/
~Client();
/**
* Move constructor.
*/
Client(Client &&other);
/**
* Move assignment operator.
*/
Client &operator=(Client &&other);
private:
class Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace td

View file

@ -0,0 +1,85 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
/**
* \file
* C++ interface for managing the internal logging of TDLib.
* By default TDLib writes logs to stderr or an OS specific log and uses a verbosity level of 5.
*/
#include <cstdint>
#include <string>
namespace td {
/**
* Interface for managing the internal logging of TDLib.
* By default TDLib writes logs to stderr or an OS specific log and uses a verbosity level of 5.
* These functions are deprecated since TDLib 1.4.0 in favor of the td::td_api::setLogVerbosityLevel,
* td::td_api::setLogStream and other synchronous requests for managing the intrenal TDLib logging.
*/
class Log {
public:
/**
* Sets the path to the file to where the internal TDLib log will be written.
* By default TDLib writes logs to stderr or an OS specific log.
* Use this method to write the log to a file instead.
*
* \deprecated Use synchronous td::td_api::setLogStream request instead.
* \param[in] file_path Path to a file where the internal TDLib log will be written. Use an empty path to
* switch back to the default logging behaviour.
* \return True on success, or false otherwise, i.e. if the file can't be opened for writing.
*/
static bool set_file_path(std::string file_path);
/**
* Sets the maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated.
* Unused if log is not written to a file. Defaults to 10 MB.
*
* \deprecated Use synchronous td::td_api::setLogStream request instead.
* \param[in] max_file_size The maximum size of the file to where the internal TDLib log is written before the file
* will be auto-rotated. Should be positive.
*/
static void set_max_file_size(std::int64_t max_file_size);
/**
* Sets the verbosity level of the internal logging of TDLib.
* By default the TDLib uses a verbosity level of 5 for logging.
*
* \deprecated Use synchronous td::td_api::setLogVerbosityLevel request instead.
* \param[in] new_verbosity_level New value of the verbosity level for logging.
* Value 0 corresponds to fatal errors,
* value 1 corresponds to errors,
* value 2 corresponds to warnings and debug warnings,
* value 3 corresponds to informational,
* value 4 corresponds to debug,
* value 5 corresponds to verbose debug,
* value greater than 5 and up to 1024 can be used to enable even more logging.
*/
static void set_verbosity_level(int new_verbosity_level);
/**
* A type of callback function that will be called when a fatal error happens.
*
* \param error_message Null-terminated string with a description of a happened fatal error.
*/
using FatalErrorCallbackPtr = void (*)(const char *error_message);
/**
* Sets the callback that will be called when a fatal error happens.
* None of the TDLib methods can be called from the callback.
* The TDLib will crash as soon as callback returns.
* By default the callback is not set.
*
* \param[in] callback Callback that will be called when a fatal error happens.
* Pass nullptr to remove the callback.
*/
static void set_fatal_error_callback(FatalErrorCallbackPtr callback);
};
} // namespace td

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,99 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
/**
* \file
* C interface for interaction with TDLib via JSON-serialized objects.
* Can be used to easily integrate TDLib with any programming language which supports calling C functions
* and is able to work with JSON.
*
* The JSON serialization of TDLib API objects is straightforward: all API objects are represented as JSON objects with
* the same keys as the API object field names. The object type name is stored in the special field '@type' which is
* optional in places where type is uniquely determined by the context.
* Fields of Bool type are stored as Boolean, fields of int32, int53, and double types are stored as Number, fields of
* int64 and string types are stored as String, fields of bytes type are base64 encoded and then stored as String,
* fields of vector type are stored as Array.
* The main TDLib interface is asynchronous. To match requests with a corresponding response a field "@extra" can
* be added to the request object. The corresponding response will have an "@extra" field with exactly the same value.
*
* A TDLib client instance should be created through td_json_client_create.
* Requests then can be sent using td_json_client_send from any thread.
* New updates and request responses can be received through td_json_client_receive from any thread. This function
* shouldn't be called simultaneously from two different threads. Also note that all updates and request responses
* should be applied in the order they were received to ensure consistency.
* Given this information, it's advisable to call this function from a dedicated thread.
* Some service TDLib requests can be executed synchronously from any thread by using td_json_client_execute.
* The TDLib client instance can be destroyed via td_json_client_destroy.
*
* General pattern of usage:
* \code
* void *client = td_json_client_create();
* // somehow share the client with other threads, which will be able to send requests via td_json_client_send
*
* const double WAIT_TIMEOUT = 10.0; // seconds
* int is_closed = 0; // should be set to 1, when updateAuthorizationState with authorizationStateClosed is received
* while (!is_closed) {
* const char *result = td_json_client_receive(client, WAIT_TIMEOUT);
* if (result) {
* // parse the result as JSON object and process it as an incoming update or an answer to a previously sent request
* }
* }
* td_json_client_destroy(client);
* \endcode
*/
#include "td/telegram/tdjson_export.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Creates a new instance of TDLib.
* \return Pointer to the created instance of TDLib.
*/
TDJSON_EXPORT void *td_json_client_create();
/**
* Sends request to the TDLib client. May be called from any thread.
* \param[in] client The client.
* \param[in] request JSON-serialized null-terminated request to TDLib.
*/
TDJSON_EXPORT void td_json_client_send(void *client, const char *request);
/**
* Receives incoming updates and request responses from the TDLib client. May be called from any thread, but
* shouldn't be called simultaneously from two different threads.
* Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute
* in the same thread, so it can't be used after that.
* \param[in] client The client.
* \param[in] timeout The maximum number of seconds allowed for this function to wait for new data.
* \return JSON-serialized null-terminated incoming update or request response. May be NULL if the timeout expires.
*/
TDJSON_EXPORT const char *td_json_client_receive(void *client, double timeout);
/**
* Synchronously executes TDLib request. May be called from any thread.
* Only a few requests can be executed synchronously.
* Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute
* in the same thread, so it can't be used after that.
* \param[in] client The client. Currently ignored for all requests, so NULL can be passed.
* \param[in] request JSON-serialized null-terminated request to TDLib.
* \return JSON-serialized null-terminated request response. May be NULL if the request can't be parsed.
*/
TDJSON_EXPORT const char *td_json_client_execute(void *client, const char *request);
/**
* Destroys the TDLib client instance. After this is called the client instance shouldn't be used anymore.
* \param[in] client The client.
*/
TDJSON_EXPORT void td_json_client_destroy(void *client);
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -0,0 +1,81 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
/**
* \file
* C interface for managing the internal logging of TDLib.
* By default TDLib writes logs to stderr or an OS specific log and uses a verbosity level of 5.
* These functions are deprecated since TDLib 1.4.0 in favor of the setLogVerbosityLevel, setLogStream and
* other synchronous requests for managing the intrenal TDLib logging.
*/
#include "td/telegram/tdjson_export.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Sets the path to the file where the internal TDLib log will be written.
* By default TDLib writes logs to stderr or an OS specific log.
* Use this method to write the log to a file instead.
*
* \deprecated Use synchronous setLogStream request instead.
* \param[in] file_path Null-terminated path to a file where the internal TDLib log will be written.
* Use an empty path to switch back to the default logging behaviour.
* \return True 1 on success, or 0 otherwise, i.e. if the file can't be opened for writing.
*/
TDJSON_DEPRECATED_EXPORT int td_set_log_file_path(const char *file_path);
/**
* Sets the maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated.
* Unused if log is not written to a file. Defaults to 10 MB.
*
* \deprecated Use synchronous setLogStream request instead.
* \param[in] max_file_size The maximum size of the file to where the internal TDLib log is written before the file
* will be auto-rotated. Should be positive.
*/
TDJSON_DEPRECATED_EXPORT void td_set_log_max_file_size(long long max_file_size);
/**
* Sets the verbosity level of the internal logging of TDLib.
* By default the TDLib uses a log verbosity level of 5.
*
* \deprecated Use synchronous setLogVerbosityLevel request instead.
* \param[in] new_verbosity_level New value of logging verbosity level.
* Value 0 corresponds to fatal errors,
* value 1 corresponds to errors,
* value 2 corresponds to warnings and debug warnings,
* value 3 corresponds to informational,
* value 4 corresponds to debug,
* value 5 corresponds to verbose debug,
* value greater than 5 and up to 1024 can be used to enable even more logging.
*/
TDJSON_DEPRECATED_EXPORT void td_set_log_verbosity_level(int new_verbosity_level);
/**
* A type of callback function that will be called when a fatal error happens.
*
* \param error_message Null-terminated string with a description of a happened fatal error.
*/
typedef void (*td_log_fatal_error_callback_ptr)(const char *error_message);
/**
* Sets the callback that will be called when a fatal error happens.
* None of the TDLib methods can be called from the callback.
* The TDLib will crash as soon as callback returns.
* By default the callback is not set.
*
* \param[in] callback Callback that will be called when a fatal error happens.
* Pass NULL to remove the callback.
*/
TDJSON_EXPORT void td_set_log_fatal_error_callback(td_log_fatal_error_callback_ptr callback);
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -0,0 +1,42 @@
#ifndef TDJSON_EXPORT_H
#define TDJSON_EXPORT_H
#ifdef TDJSON_STATIC_DEFINE
# define TDJSON_EXPORT
# define TDJSON_NO_EXPORT
#else
# ifndef TDJSON_EXPORT
# ifdef tdjson_EXPORTS
/* We are building this library */
# define TDJSON_EXPORT __attribute__((visibility("default")))
# else
/* We are using this library */
# define TDJSON_EXPORT __attribute__((visibility("default")))
# endif
# endif
# ifndef TDJSON_NO_EXPORT
# define TDJSON_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif
#ifndef TDJSON_DEPRECATED
# define TDJSON_DEPRECATED __attribute__ ((__deprecated__))
#endif
#ifndef TDJSON_DEPRECATED_EXPORT
# define TDJSON_DEPRECATED_EXPORT TDJSON_EXPORT TDJSON_DEPRECATED
#endif
#ifndef TDJSON_DEPRECATED_NO_EXPORT
# define TDJSON_DEPRECATED_NO_EXPORT TDJSON_NO_EXPORT TDJSON_DEPRECATED
#endif
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef TDJSON_NO_DEPRECATED
# define TDJSON_NO_DEPRECATED
# endif
#endif
#endif /* TDJSON_EXPORT_H */

View file

@ -0,0 +1,260 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
/**
* \file
* Contains the declarations of a base class for all TL-objects and some helper methods
*/
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
namespace td {
class TlStorerCalcLength;
class TlStorerUnsafe;
class TlStorerToString;
/**
* This class is a base class for all TDLib TL-objects.
*/
class TlObject {
public:
/**
* Returns an identifier, uniquely determining the TL-type of the object.
*/
virtual std::int32_t get_id() const = 0;
/**
* Appends the object to the storer serializing object, a buffer of fixed length.
* \param[in] s Storer to which the object will be appended.
*/
virtual void store(TlStorerUnsafe &s) const {
}
/**
* Appends the object to the storer, calculating the TL-length of the serialized object.
* \param[in] s Storer to which the object will be appended.
*/
virtual void store(TlStorerCalcLength &s) const {
}
/**
* Helper function for the to_string method. Appends a string representation of the object to the storer.
* \param[in] s Storer to which the object string representation will be appended.
* \param[in] field_name Object field_name if applicable.
*/
virtual void store(TlStorerToString &s, const char *field_name) const = 0;
/**
* Default constructor.
*/
TlObject() = default;
/**
* Deleted copy constructor.
*/
TlObject(const TlObject &) = delete;
/**
* Deleted copy assignment operator.
*/
TlObject &operator=(const TlObject &) = delete;
/**
* Default move constructor.
*/
TlObject(TlObject &&) = default;
/**
* Default move assignment operator.
*/
TlObject &operator=(TlObject &&) = default;
/**
* Virtual destructor.
*/
virtual ~TlObject() = default;
};
/**
* A smart wrapper to store a pointer to a TL-object.
*/
namespace tl {
template <class T>
class unique_ptr {
public:
using pointer = T *;
using element_type = T;
unique_ptr() noexcept = default;
unique_ptr(const unique_ptr &other) = delete;
unique_ptr &operator=(const unique_ptr &other) = delete;
unique_ptr(unique_ptr &&other) noexcept : ptr_(other.release()) {
}
unique_ptr &operator=(unique_ptr &&other) noexcept {
reset(other.release());
return *this;
}
~unique_ptr() {
reset();
}
unique_ptr(std::nullptr_t) noexcept {
}
explicit unique_ptr(T *ptr) noexcept : ptr_(ptr) {
}
template <class S, class = std::enable_if_t<std::is_base_of<T, S>::value>>
unique_ptr(unique_ptr<S> &&other) noexcept : ptr_(static_cast<S *>(other.release())) {
}
template <class S, class = std::enable_if_t<std::is_base_of<T, S>::value>>
unique_ptr &operator=(unique_ptr<S> &&other) noexcept {
reset(static_cast<T *>(other.release()));
return *this;
}
void reset(T *new_ptr = nullptr) noexcept {
delete ptr_;
ptr_ = new_ptr;
}
T *release() noexcept {
auto res = ptr_;
ptr_ = nullptr;
return res;
}
T *get() noexcept {
return ptr_;
}
const T *get() const noexcept {
return ptr_;
}
T *operator->() noexcept {
return ptr_;
}
const T *operator->() const noexcept {
return ptr_;
}
T &operator*() noexcept {
return *ptr_;
}
const T &operator*() const noexcept {
return *ptr_;
}
explicit operator bool() const noexcept {
return ptr_ != nullptr;
}
private:
T *ptr_{nullptr};
};
template <class T>
bool operator==(std::nullptr_t, const unique_ptr<T> &p) {
return !p;
}
template <class T>
bool operator==(const unique_ptr<T> &p, std::nullptr_t) {
return !p;
}
template <class T>
bool operator!=(std::nullptr_t, const unique_ptr<T> &p) {
return static_cast<bool>(p);
}
template <class T>
bool operator!=(const unique_ptr<T> &p, std::nullptr_t) {
return static_cast<bool>(p);
}
} // namespace tl
template <class Type>
using tl_object_ptr = tl::unique_ptr<Type>;
/**
* A function to create a dynamically allocated TL-object. Can be treated as an analogue of std::make_unique.
* Usage example:
* \code
* auto get_authorization_state_request = td::make_tl_object<td::td_api::getAuthorizationState>();
* auto message_text = td::make_tl_object<td::td_api::formattedText>("Hello, world!!!",
* std::vector<td::tl_object_ptr<td::td_api::textEntity>>());
* auto send_message_request = td::make_tl_object<td::td_api::sendMessage>(chat_id, 0, nullptr, nullptr,
* td::make_tl_object<td::td_api::inputMessageText>(std::move(message_text), false, true));
* \endcode
*
* \tparam Type Type of the TL-object to construct.
* \param[in] args Arguments to pass to the object constructor.
* \return Wrapped pointer to the created TL-object.
*/
template <class Type, class... Args>
tl_object_ptr<Type> make_tl_object(Args &&... args) {
return tl_object_ptr<Type>(new Type(std::forward<Args>(args)...));
}
/**
* A function to downcast a wrapped pointer to a TL-object to a pointer to its subclass.
* Casting an object to an incorrect type will lead to undefined behaviour.
* Examples of usage:
* \code
* td::tl_object_ptr<td::td_api::callState> call_state = ...;
* switch (call_state->get_id()) {
* case td::td_api::callStatePending::ID: {
* auto state = td::move_tl_object_as<td::td_api::callStatePending>(call_state);
* // use state
* break;
* }
* case td::td_api::callStateExchangingKeys::ID: {
* // no additional fields, so cast isn't needed
* break;
* }
* case td::td_api::callStateReady::ID: {
* auto state = td::move_tl_object_as<td::td_api::callStateReady>(call_state);
* // use state
* break;
* }
* case td::td_api::callStateHangingUp::ID: {
* // no additional fields, so cast isn't needed
* break;
* }
* case td::td_api::callStateDiscarded::ID: {
* auto state = td::move_tl_object_as<td::td_api::callStateDiscarded>(call_state);
* // use state
* break;
* }
* case td::td_api::callStateError::ID: {
* auto state = td::move_tl_object_as<td::td_api::callStateError>(call_state);
* // use state
* break;
* }
* default:
* assert(false);
* }
* \endcode
*
* \tparam ToT Type of a TL-object to move to.
* \tparam FromT Type of a TL-object to move from, this is auto-deduced.
* \param[in] from Wrapped pointer to a TL-object.
*/
template <class ToT, class FromT>
tl_object_ptr<ToT> move_tl_object_as(tl_object_ptr<FromT> &from) {
return tl_object_ptr<ToT>(static_cast<ToT *>(from.release()));
}
/**
* \overload
*/
template <class ToT, class FromT>
tl_object_ptr<ToT> move_tl_object_as(tl_object_ptr<FromT> &&from) {
return tl_object_ptr<ToT>(static_cast<ToT *>(from.release()));
}
} // namespace td

View file

@ -0,0 +1,3 @@
include(CMakeFindDependencyMacro)
#TODO: write all external dependencies
include("${CMAKE_CURRENT_LIST_DIR}/TdTargets.cmake")

View file

@ -0,0 +1,47 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is equal to the requested version.
# The tweak version component is ignored.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "1.6.0")
if("1.6.0" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_NO_TWEAK "1.6.0")
endif()
if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
endif()
if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "4" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "4")
math(EXPR installedBits "4 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View file

@ -0,0 +1,109 @@
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "Td::tdutils" for configuration "Release"
set_property(TARGET Td::tdutils APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdutils PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdutils.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdutils )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdutils "${_IMPORT_PREFIX}/lib/libtdutils.a" )
# Import target "Td::tdactor" for configuration "Release"
set_property(TARGET Td::tdactor APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdactor PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdactor.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdactor )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdactor "${_IMPORT_PREFIX}/lib/libtdactor.a" )
# Import target "Td::tdnet" for configuration "Release"
set_property(TARGET Td::tdnet APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdnet PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdnet.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdnet )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdnet "${_IMPORT_PREFIX}/lib/libtdnet.a" )
# Import target "Td::tdsqlite" for configuration "Release"
set_property(TARGET Td::tdsqlite APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdsqlite PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdsqlite.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdsqlite )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdsqlite "${_IMPORT_PREFIX}/lib/libtdsqlite.a" )
# Import target "Td::tddb" for configuration "Release"
set_property(TARGET Td::tddb APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tddb PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtddb.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tddb )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tddb "${_IMPORT_PREFIX}/lib/libtddb.a" )
# Import target "Td::tdjson" for configuration "Release"
set_property(TARGET Td::tdjson APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdjson PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdjson.so.1.6.0"
IMPORTED_SONAME_RELEASE "libtdjson.so.1.6.0"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdjson )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdjson "${_IMPORT_PREFIX}/lib/libtdjson.so.1.6.0" )
# Import target "Td::tdjson_static" for configuration "Release"
set_property(TARGET Td::tdjson_static APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdjson_static PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdjson_static.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdjson_static )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdjson_static "${_IMPORT_PREFIX}/lib/libtdjson_static.a" )
# Import target "Td::tdjson_private" for configuration "Release"
set_property(TARGET Td::tdjson_private APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdjson_private PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdjson_private.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdjson_private )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdjson_private "${_IMPORT_PREFIX}/lib/libtdjson_private.a" )
# Import target "Td::tdclient" for configuration "Release"
set_property(TARGET Td::tdclient APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdclient PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdclient.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdclient )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdclient "${_IMPORT_PREFIX}/lib/libtdclient.a" )
# Import target "Td::tdcore" for configuration "Release"
set_property(TARGET Td::tdcore APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Td::tdcore PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libtdcore.a"
)
list(APPEND _IMPORT_CHECK_TARGETS Td::tdcore )
list(APPEND _IMPORT_CHECK_FILES_FOR_Td::tdcore "${_IMPORT_PREFIX}/lib/libtdcore.a" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

View file

@ -0,0 +1,190 @@
# Generated by CMake
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget Td::tdutils Td::tdactor Td::tdnet Td::tdsqlite Td::tddb Td::tdjson Td::TdJson Td::tdjson_static Td::TdJsonStatic Td::tdjson_private Td::tdclient Td::tdcore Td::TdStatic)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
endif()
if(TARGET ${_expectedTarget})
list(APPEND _targetsDefined ${_expectedTarget})
endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
# Create imported target Td::tdutils
add_library(Td::tdutils STATIC IMPORTED)
set_target_properties(Td::tdutils PROPERTIES
INTERFACE_LINK_LIBRARIES "-pthread;/usr/lib/libcrypto.so;\$<LINK_ONLY:dl>;/usr/lib/libz.so;/usr/lib/libz.so"
)
# Create imported target Td::tdactor
add_library(Td::tdactor STATIC IMPORTED)
set_target_properties(Td::tdactor PROPERTIES
INTERFACE_LINK_LIBRARIES "Td::tdutils"
)
# Create imported target Td::tdnet
add_library(Td::tdnet STATIC IMPORTED)
set_target_properties(Td::tdnet PROPERTIES
INTERFACE_LINK_LIBRARIES "Td::tdutils;Td::tdactor;\$<LINK_ONLY:dl>;/usr/lib/libz.so;/usr/lib/libssl.so;/usr/lib/libcrypto.so"
)
# Create imported target Td::tdsqlite
add_library(Td::tdsqlite STATIC IMPORTED)
set_target_properties(Td::tdsqlite PROPERTIES
INTERFACE_LINK_LIBRARIES "/usr/lib/libcrypto.so;\$<LINK_ONLY:dl>;/usr/lib/libz.so"
)
# Create imported target Td::tddb
add_library(Td::tddb STATIC IMPORTED)
set_target_properties(Td::tddb PROPERTIES
INTERFACE_LINK_LIBRARIES "Td::tdactor;Td::tdutils;\$<LINK_ONLY:Td::tdsqlite>"
)
# Create imported target Td::tdjson
add_library(Td::tdjson SHARED IMPORTED)
set_target_properties(Td::tdjson PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
# Create imported target Td::TdJson
add_library(Td::TdJson INTERFACE IMPORTED)
set_target_properties(Td::TdJson PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdjson"
)
# Create imported target Td::tdjson_static
add_library(Td::tdjson_static STATIC IMPORTED)
set_target_properties(Td::tdjson_static PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "TDJSON_STATIC_DEFINE"
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Td::tdjson_private>"
)
# Create imported target Td::TdJsonStatic
add_library(Td::TdJsonStatic INTERFACE IMPORTED)
set_target_properties(Td::TdJsonStatic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdjson_static"
)
# Create imported target Td::tdjson_private
add_library(Td::tdjson_private STATIC IMPORTED)
set_target_properties(Td::tdjson_private PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdclient;Td::tdutils"
)
# Create imported target Td::tdclient
add_library(Td::tdclient STATIC IMPORTED)
set_target_properties(Td::tdclient PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Td::tdcore>"
)
# Create imported target Td::tdcore
add_library(Td::tdcore STATIC IMPORTED)
set_target_properties(Td::tdcore PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdactor;Td::tdutils;Td::tdnet;Td::tddb;/usr/lib/libcrypto.so;\$<LINK_ONLY:dl>;/usr/lib/libz.so"
)
# Create imported target Td::TdStatic
add_library(Td::TdStatic INTERFACE IMPORTED)
set_target_properties(Td::TdStatic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "Td::tdclient"
)
if(CMAKE_VERSION VERSION_LESS 3.0.0)
message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.")
endif()
# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/TdTargets-*.cmake")
foreach(f ${CONFIG_FILES})
include(${f})
endforeach()
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"${target}\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AboutPage</name>
<message>
<source>About Fernschreiber</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Telegram client for Sailfish OS</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Sebastian J. Wolf</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Send E-Mail</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Licensed under GNU GPLv3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sources on GitHub</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This product uses the Telegram API but is not endorsed or certified by Telegram</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Terms of Service</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Policy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Credits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This project uses the Telegram Database Library (TDLib). Thanks for making it available under the conditions of the Boost Software License 1.0!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Telegram Database Library on GitHub</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>About Telegram</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<source>About Fernschreiber</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Welcome to Fernschreiber</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AboutPage</name>
<message>
<source>About Fernschreiber</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Telegram client for Sailfish OS</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>By Sebastian J. Wolf</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Send E-Mail</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Licensed under GNU GPLv3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sources on GitHub</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This product uses the Telegram API but is not endorsed or certified by Telegram</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Terms of Service</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Policy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Credits</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This project uses the Telegram Database Library (TDLib). Thanks for making it available under the conditions of the Boost Software License 1.0!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Telegram Database Library on GitHub</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>About Telegram</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<source>About Fernschreiber</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Welcome to Fernschreiber</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>