Compare commits

..

975 commits

Author SHA1 Message Date
mj
94dd3be54f Merge pull request #423 from TiagoDanin-Forks/README
README: Fix Markdown
2017-10-17 07:52:34 +02:00
Tiago Danin
0e0958753c README: Fix Markdown 2017-10-15 19:01:24 -03:00
mj
5876c98f8a Merge pull request #422 from unansweredocd/add-remove-session-in-faq
Add remove old session info to README
2017-10-15 21:23:31 +02:00
Sam Form
d286c1f338 use the more common purple directory 2017-10-15 20:52:24 +02:00
Sam Form
a54c4e7dd2 add info on how to clean the telegram-purple directory to deal with revoked sessions 2017-10-15 20:07:03 +02:00
Ben Wiederhake
7aa6874074 Update nsi file to reflect changes in po/LINGUAS 2017-04-10 22:54:08 +02:00
Ben Wiederhake
065e0b7ac9 Silence warnings about bad .po files
Sadly, Transifex doesn't seem to acknowledge that the generated files
are bad.  Also, I don't want to introduce any infrastructure to
fix the files every time after I download them.
So they stay broken, and the warnings must be silenced.
Sadly, this means that future warnings will get ignored, too.
Let's hope this won't go too bad.
2017-04-10 22:17:54 +02:00
mjentsch
6fd109bfca Increase version to 1.3.1 2017-04-09 13:48:52 +02:00
Ben Wiederhake
ada2c9aa1f AppStream: import translations from Transifex. Thanks to samant! 2017-03-13 23:36:27 +01:00
Ben Wiederhake
42c9ea8a3a AppStream: fix target order
Ahh, right, thankyou make, for reminding me that 'all' isn't actually
any automagically chosen target that is chosen when no target has been
specified.  No, instead, the first target is chosen.
And not just any target!  Only the first non-templated target is chosen,
so in this case: po/telegram-purple.metainfo.xml.pot .

However, in our case that's utterly pointless, so 'all' needs to
be on top again.  I should have known there was an important reason.
2017-03-13 23:35:59 +01:00
Ben Wiederhake
2ffa9e176a Import translations from Transifex. Thanks to eischmann, raven, savant! 2017-03-13 23:30:39 +01:00
mjentsch
77d50c3ae1 Merge branch 'EionRobb-group-typing-notifications' into dev-1.4.0
Merges pull request #359
2017-03-13 22:32:15 +01:00
mjentsch
ea0efaeab7 Merge branch 'dev-1.4.0' of https://github.com/majn/telegram-purple into dev-1.4.0 2017-03-13 22:28:38 +01:00
mjentsch
942e7c6244 Include autoloading for all types of documents and improve document captions 2017-03-13 22:28:10 +01:00
mjentsch
72151e7cbd Increase default file size download threshold
Far too many files are bigger than 8mb, we need a more pleasant default behavior
2017-03-13 21:56:49 +01:00
Eion Robb
0446ca2b9b Support typing notifications using the group-typing-notifications plugin
See https://github.com/EionRobb/pidgin-groupchat-typing-notifications
2017-03-13 22:27:01 +13:00
Ben Wiederhake
653eb902ce Import tgl updates 2017-03-06 22:01:07 +01:00
mjentsch
ab5b444e26 code style 2017-03-06 20:13:45 +01:00
mjentsch
014145c8ee Include libtgl crash and c++ compilation fixes 2017-03-02 20:34:02 +01:00
mjentsch
1cb22c9df1 Fix debug message 2017-03-02 20:24:33 +01:00
mjentsch
5a59dc100c Include pull request #302 by EionRobb 2017-03-02 20:23:17 +01:00
Ben Wiederhake
1842756995 Import plugin translations from Transifex. Thanks to all translators!
Also removed outdated HOWTO.md; and deprecated pt_BR,
as it fell below the 75% mark.
2017-02-27 11:47:10 +01:00
Ben Wiederhake
ea697f1cc7 Import AppStream translations from Transifex. Thanks to all translators! 2017-02-27 10:57:41 +01:00
Samuel Vandamme
20c78ce94c Added missing dependencies for Debian/Ubuntu 2017-02-24 22:30:37 +01:00
mjentsch
c0210af0b9 Fix crash on joining non-existing chat 2017-02-11 12:51:33 +01:00
mjentsch
aa3e220738 Increase version of OSX SDK for Adium bundle 2017-02-11 12:51:33 +01:00
mjentsch
4980fa460c Fix crash on duplicated peer name in peer tree 2017-02-11 12:51:33 +01:00
Ben Wiederhake
d8a040b5d5 tgl patch for OpenSSL variant 2017-01-22 22:09:04 +01:00
Ben Wiederhake
c5929af862 Merge branch 'master' into dev-1.4.0 2017-01-22 22:07:52 +01:00
mj
766335c34d Update README.md 2017-01-16 12:18:34 +01:00
mj
2ca2c46807 Merge pull request #342 from redsn0w0/patch-1
Update README.md
2017-01-16 10:54:59 +01:00
redsn0w
6234a65228 Update README.md
Fixed the telegram group invite link.
2017-01-14 12:15:44 +01:00
Ben Wiederhake
f45ed4572a Print some info when running into 'Sending message failed' errors
Related to #339
2017-01-09 18:22:17 +01:00
Ben Wiederhake
5de79c45a6 Merge branch 'master' into dev-1.4.0 2017-01-09 17:42:44 +01:00
mj
c52854ae51 Fix group chat link 2017-01-02 15:15:30 +01:00
mj
1dc5e2ba46 Merge pull request #334 from stefan2904/patch-1
updated readme to telegram-adium-1.3.0
2016-12-13 08:05:24 +01:00
Stefan
345006633c updated readme to telegram-adium-1.3.0 2016-12-13 00:31:12 +01:00
Ben Wiederhake
bb215b59d3 Import translations form Transifex. Thanks to all translators!
I'm aware that the new PO files are fishy and throw a lot of warnings.
I've created a ticket with Transifex, as their new PO-generation routine
seems to be bug-ridden.

However, until they fix it, we have to use the ugly value for msgid "".
2016-11-28 01:09:43 +01:00
Ben Wiederhake
59ec18fe1b Merge branch 'dev-1.3.0' into dev-1.4.0 2016-11-27 23:53:54 +01:00
mjentsch
7744facaec Merge branch 'chat-kick-c' of https://github.com/EionRobb/telegram-purple into dev-1.4.0 2016-11-13 19:26:55 +01:00
Eion Robb
71276b109e Add support for a /kick command in chat rooms 2016-11-13 09:22:28 +13:00
mj
cd451723ef Update README.md
Update chat link
2016-10-29 19:09:01 +02:00
Ben Wiederhake
a904aa37da Enable stack smashing protection (#315)
Check "by example" whether `-fstack-protector-strong` is supported.
2016-10-13 16:02:37 +02:00
Alain
ab7dcb8ee6 Changed check if -fstack-protector-strong is supported 2016-10-13 15:41:22 +02:00
Alain
0d0a2cbbd7 Check if gcc >= 5.0 before enabling stack smashing protection 2016-10-13 13:48:06 +02:00
Alain
9d86bf2af6 Enhance security using stack protector and -D_FORTIFY_SOURCE 2016-10-13 12:38:07 +02:00
Ben Wiederhake
23864bf541 Only load photos for non-deleted users 2016-10-11 00:13:09 +02:00
Ben Wiederhake
5fea0dae38 Merge Pull Request #304 from EionRobb/patch-4 2016-09-04 21:54:16 +02:00
Ben Wiederhake
82a5cbbf5a Merge Pull Request #303 from EionRobb/patch-3 2016-09-04 21:53:56 +02:00
Ben Wiederhake
6f89e259df Update tgl (32-bit BN2ull) 2016-09-04 21:52:41 +02:00
Eion Robb
f4b47623cf Compile tgp-info on Windows 2016-09-02 20:52:39 +12:00
Eion Robb
8b46df36b6 tgl Windows Makefile no longer needs scheme version
This change was made a while ago in the Makefile.in but not brought through to the mingw Makefile
2016-09-02 20:51:34 +12:00
Ben Wiederhake
f75e3e9954 Produce new master-pot 2016-08-31 22:55:47 +02:00
Ben Wiederhake
b7283219c0 Makefile: remove superfluous indirection 2016-08-30 00:39:29 +02:00
Ben Wiederhake
80d3146ebb Fix tgl build (don't dep on xxd, don't create empty file)
Fixes #298.
2016-08-30 00:26:12 +02:00
Ben Wiederhake
150f0c48cc Only build required libraries 2016-08-22 22:38:31 +02:00
Ben Wiederhake
4d8995d565 Merge pull request #299 from ilario/master
README.md: add submodule update in Debian package build instructions
2016-08-19 21:48:11 +02:00
Ilario Gelmetti
1798a43d91 README.md: add submodule update in Debian package build instructions 2016-08-19 17:14:45 +02:00
Ben Wiederhake
0340e4f14b Fix description how to build Debian package 2016-08-08 10:53:04 +02:00
Ben Wiederhake
43e5f81683 build: properly clean up 2016-08-08 10:53:04 +02:00
Ben Wiederhake
be0d4cd299 build: proper recursion in make 2016-08-08 10:53:04 +02:00
Ben Wiederhake
de3100e6f2 Minor typos 2016-08-08 10:25:11 +02:00
mjentsch
bf837abf38 Update CHANGELOG 2016-08-08 00:57:04 +02:00
mjentsch
0926d27195 Fix dropped HTML messages
Remove ability to send bold and italic messages to quick-fix a bug that causes
messages with unknown formatting to be dropped by libtgl.
2016-08-08 00:03:19 +02:00
mjentsch
1c32a0ef9e Fix clang warnings. 2016-08-02 01:27:00 +02:00
Ben Wiederhake
99d684bf89 Check for error return values of tgl_init 2016-08-02 01:10:02 +02:00
Ben Wiederhake
f2431f3a3a Fix tgl for OpenSSL-mode 2016-08-02 00:40:41 +02:00
Ben Wiederhake
a6b2ea20e1 Update LINGUAS 2016-08-02 00:04:45 +02:00
Ben Wiederhake
e1242691d2 Comments shouldn't be printed 2016-08-02 00:04:45 +02:00
Ben Wiederhake
b15d0a3f86 Import from Transifex: updated translations. Thank you! 2016-08-02 00:04:45 +02:00
Ben Wiederhake
9a2c6a73ac Import intermediate translation 2016-08-02 00:04:45 +02:00
mjentsch
35faf09857 Merge important crash fixes in tgl 2016-08-01 23:57:13 +02:00
mjentsch
11631ace8b Merge branch 'master' of https://github.com/majn/telegram-purple into dev-1.3.0 2016-08-01 23:28:26 +02:00
mjentsch
7463ef080e Merge HTML href fix in libtgl 2016-07-22 21:05:45 +02:00
mjentsch
e926b216b6 Fix code style 2016-06-30 19:29:55 +02:00
mjentsch
6940278a51 Merge HTML fixes in libtgl 2016-04-10 18:27:21 +02:00
mjentsch
daeb7db701 Only fetch history for joined channels
Prevent loading history for non-joined channels that may occur when messages forwarded for non-joined channels are being fetched.
2016-04-03 17:16:13 +02:00
mjentsch
786394bb3e Fix history in Adium, store channel sequence as account options instead of the blist 2016-04-03 17:04:35 +02:00
mjentsch
01104c87d3 Disable style tags in Adium, not working with Telegram 2016-04-02 22:37:57 +02:00
mjentsch
413e449112 cleanup 2016-04-02 22:28:03 +02:00
mjentsch
5f7da0ab50 Fix use-after-free, improve forward messages 2016-04-02 22:00:08 +02:00
mjentsch
e73e247444 Auto-load audio, video and animated messages up to 8mb
Reduce the amount of annoying popup messages for file transfers. Don't do it for Adium, which doesn't support file-links for security reasons. Make the threshold configurable.
2016-04-02 21:58:08 +02:00
mjentsch
921db6bc5c Fix outgoing message handling 2016-03-28 01:12:35 +02:00
mjentsch
a35c6cdd3b Support sending code tags and improve inline image handling
Properly parse inline img tags in messages to support multiple inline messages in one message.
Adium: remove adium-specific code path and allow embedding markup in outgoing message
2016-03-27 03:00:23 +02:00
Eion Robb
7205b4df1b Update telegram-purple.c to say that the connection supports HTML messages 2016-03-27 03:00:23 +02:00
Eion Robb
952a41f1ed Update tgp-msg.c to flag outgoing messages as HTML 2016-03-27 03:00:23 +02:00
Ben Wiederhake
81f33055b5 Use constant instead of magic string 2016-03-23 16:32:07 +01:00
Ben Wiederhake
7103bf9bfe Remove unused file 2016-03-23 16:32:07 +01:00
Ben Wiederhake
e828fc36ef Allow out-of-vcs builds 2016-03-23 16:32:07 +01:00
Ben Wiederhake
70340d7b55 Extract script to generate origtar 2016-03-23 16:32:07 +01:00
Ben Wiederhake
7439a68b09 Extract script to generate commit.h 2016-03-23 16:32:07 +01:00
Ben Wiederhake
6684a75865 Include HACKING files
Closes #242 by keeping track of all requirements, rationals,
and approaches in a version-controlled file.
2016-03-23 16:32:07 +01:00
Ben Wiederhake
4de2a69ac1 Use correct repository 2016-03-23 16:31:10 +01:00
mjentsch
6a6bff563b Merge branch 'dev-1.3.0' of https://github.com/majn/telegram-purple into dev-1.3.0 2016-03-23 14:00:48 +01:00
mjentsch
c595e9ef14 Always load channel history on startup 2016-03-23 12:57:27 +01:00
mjentsch
236083e217 Fix coding guidelines 2016-03-23 12:49:16 +01:00
mjentsch
aa87311f6d Fix crash on deleted chat 2016-03-23 12:48:14 +01:00
mjentsch
236153cee7 Reduce the amount of needless read recipes being sent 2016-03-23 12:47:24 +01:00
mjentsch
dc9dac44ff Fix compiling Adium plugin 2016-03-23 12:46:29 +01:00
mjentsch
004f84b544 Experimental support for channel history
Fetch missing channel history, keep track of message IDs. Still broken in Adium.
2016-03-23 12:46:04 +01:00
mjentsch
a3341cb5cf Merge branch 'master' into dev-1.3.0 2016-03-20 17:18:37 +01:00
Ben Wiederhake
ee2a6fb740 Merge pull request #254 from rshadow/master
Fix README.md prerequires for deb
2016-03-17 11:21:07 +01:00
Roman V. Nikolaev
ff66ed2512 Fix README.md prerequires for deb 2016-03-17 01:10:35 +03:00
Ben Wiederhake
1388bc6ed7 Fix empty group handling
Fixes #203.
2016-03-11 15:06:35 +01:00
mjentsch
54cfce4df2 Bump version to 1.2.6 2016-03-11 13:10:14 +01:00
mjentsch
d020f9c32a Fix Adium bundle breaking on library version jumps
Link against the generic libpurple and glib bundled with Adium instead of the specific version number to avoid breakage on version updates.
2016-03-11 12:18:08 +01:00
mjentsch
3107a601eb Merge libtgl fix use-after-not-created for photos 2016-02-27 17:59:03 +01:00
mj
cb12fbf4f9 Update group chat link 2016-02-27 17:55:01 +01:00
mj
a0ecd0c66d Merge pull request #246 from khorben/khorben/configure-equals
Portability fix for POSIX shells
2016-02-24 10:28:45 +01:00
Pierre Pronchery
a61c9db881 Portability fix for POSIX shells
Only a handful of shells support the "==" comparison operator for
the "test" built-in. The standard, portable operator is "=" instead.
2016-02-24 03:39:01 +01:00
Ben Wiederhake
0c1623a8f6 Fix the system one more time
Closes #242. Hopefully.
2016-02-19 01:54:07 +01:00
Ben Wiederhake
d4f52a175c Generate and upload new potfile for 1.3.0 2016-02-18 21:41:59 +01:00
Ben Wiederhake
37438544df AppStream: auto-generate translated file 2016-02-18 21:41:59 +01:00
Ben Wiederhake
b45e494771 AppStream: import translations from transifex. Thank you all! 2016-02-18 21:41:59 +01:00
Ben Wiederhake
e5adfc1bd6 Let autogen.sh take care of the .nsi 2016-02-18 21:41:59 +01:00
Ben Wiederhake
5828496b52 Auto-generate .nsi via awk script
Fixes #195
2016-02-18 21:41:59 +01:00
Ben Wiederhake
1398ab1362 README.md: uniform orig-tarball generation 2016-02-18 21:41:59 +01:00
Ben Wiederhake
b30905ef41 Add safety belts when building .orig.tar.gz 2016-02-18 21:41:59 +01:00
Ben Wiederhake
f872bb9bc3 Create a .orig.tar.gz reproducibly
Where "reproducible" means:
Every execution on every machine will always
generate the exact same, bitwise identical result,
when at the same git commit.

Closes #100.
2016-02-18 21:41:59 +01:00
Ben Wiederhake
a00d1ee6c6 Update README.md for Debian installation 2016-02-18 21:41:59 +01:00
Ben Wiederhake
84f742de3a AppStream: add German language 2016-02-18 21:41:59 +01:00
Ben Wiederhake
26e5b2de9f Fix gitignore patterns for *.mo 2016-02-18 21:41:59 +01:00
Ben Wiederhake
8779215927 AppStream: allow for translations
Fixes #211
2016-02-18 21:41:59 +01:00
Ben Wiederhake
cc8873682a AppStream: Add bugtracker, fix XML
Note: I don't care what the header looks like.
I just want the diff between "with translation" and
"without translation" to be as small as possible.
2016-02-18 21:41:59 +01:00
Ben Wiederhake
9b4fa898a9 Reflow AppStream file 2016-02-18 21:41:59 +01:00
Ben Wiederhake
dd349ff7cb Fix typos and errors in strings 2016-02-18 21:41:59 +01:00
Ben Wiederhake
5c88b021af Clean up 'clean' target 2016-02-18 21:41:59 +01:00
Ben Wiederhake
f648686f1b Correctly build commit.h without complaining
The old version threw ugly warnings when commit.h didn't exist (ugh),
and it depended on ifneq, which I don't really like (second ugh).
2016-02-18 21:41:59 +01:00
mjentsch
4e3b913a9d Remove unneeded code 2016-02-17 20:53:20 +01:00
mjentsch
0a786049fc Fix auto-join and bookmarks in Adium
Fix a regression that was caused by automatically adding all chats to the blist. Adiums method for joining chats by name assumes that an existing chat in the blist means we already joined and not join the chat.
2016-02-17 20:52:45 +01:00
mjentsch
abbaad7a0c Support leaving channels and exporting channel invite links 2016-02-14 00:34:30 +01:00
mjentsch
496eb6328f Add hint for phone number 2016-02-10 23:23:54 +01:00
mjentsch
581e024254 Display chat and channel icons, refactor image loading code 2016-02-10 02:03:46 +01:00
mjentsch
1070b5a6e7 Cleanup and add a few notes 2016-02-07 18:23:12 +01:00
mjentsch
e8005883ab Display channels and supergroups in roomlist 2016-02-07 00:40:48 +01:00
mjentsch
fbe3a7fbba Support supergroups and displaying channel members
Change all channels to be chats instead of regular buddies and implement fetching channel memberships. Remove some unneeded code scraps from old channel handling.
2016-02-07 00:04:31 +01:00
mjentsch
4ef719cd3a Emphasize that just the contact will be deleted, not the dialogue list entry. 2016-01-25 23:23:34 +01:00
mjentsch
69acd90512 Support deleting contacts, handle deletions of chats and channels
When a user deletes a buddy list entry, ask if the chat or channel should be destroyed / left or the contact should be deleted. In many cases, deleting a buddy from the blist would have no effect, since the buddy would show up again on the next startup, which is most likely confusing to the user. Just destroying the chat or the channel is dangerous too, so ask for confirmation every time this happens to let the user choose what to do with that entry.
2016-01-25 00:59:56 +01:00
mjentsch
8100114319 Handle contacts added on different devices
Assure to add contacts, even when they are not in the dialog list. Refactor contact handling.
2016-01-25 00:51:33 +01:00
mjentsch
00b709e39f Display incoming read recipes for secret chats
Outgoing still don't work they aren't implemented in libtgl yet.
2016-01-24 22:16:20 +01:00
mjentsch
af70b22699 Handle group chats more intuitively
Remove all left chats from buddy list when selecting to auto-join chats and also make that option default.
2016-01-24 21:36:41 +01:00
mjentsch
660376b9df Remove all left chats
Use new TGLCF_LEFT instead of user count to determine left chats more reliably.
2016-01-24 21:29:48 +01:00
mjentsch
4e08542823 Change version back to 1.3.0 2016-01-24 21:23:35 +01:00
mjentsch
9edcd8f6e5 Fix run scheme in Adium 2016-01-24 21:19:59 +01:00
mjentsch
90a4286e90 Fix compilation error 2016-01-24 20:40:36 +01:00
mjentsch
ac1c748650 Merge branch 'master' into dev-1.3.0 2016-01-24 18:22:18 +01:00
mjentsch
df29bbcda1 Update bundle link 2016-01-24 16:17:10 +01:00
mjentsch
68b71dae70 Fix tgp version displayed as NULL in sessions
Set telegram-purple version in app data, to make the correct version
show up in the session dialogue.
2016-01-24 16:11:33 +01:00
mjentsch
9208d9b1e9 Show version in Adium Xtras
Until now the adium plugin version was only shown in the bundle info,
not inside Adium.
2016-01-24 15:41:15 +01:00
mjentsch
fc0b402d72 Increase version to 1.2.5 2016-01-24 15:17:54 +01:00
mjentsch
9cd264dea6 Still display the message when the chat info cannot be fetched
User objects will be allocated once they send a message that needs to be displayed, until then the users will just not show up in the user list of the chat.
2016-01-24 15:17:54 +01:00
mjentsch
739f2b7e46 Improve error handling a little more 2016-01-24 15:17:54 +01:00
mjentsch
1808ca4984 Automatically refresh revoked sessions and prompt for a new code 2016-01-24 15:17:54 +01:00
mjentsch
6a8760d5d3 Graceful error handling
Never kill process on issues, always log errors and write errors instead of failed messages.
2016-01-24 15:17:54 +01:00
mjentsch
625374fbc4 Include libtgl fix for channel messages 2016-01-24 15:17:54 +01:00
mj
65105dd11b Fix group chat link 2016-01-15 18:20:03 +01:00
mjentsch
6eee0c3c43 Use flags instead of users_num to check if a chat is already left 2016-01-12 23:53:49 +01:00
mj
2c74a733d5 Update chat link 2016-01-12 11:15:53 +01:00
mjentsch
9ad31b041a Update submodule branch to include all fixes 2016-01-10 02:12:27 +01:00
mjentsch
ff7300f6c9 Merge branch 'dev-1.2.5' into dev-1.3.0 2016-01-10 01:45:57 +01:00
mjentsch
d032f3a237 cleanup 2016-01-10 01:27:38 +01:00
mjentsch
d8fc5281ce Fix buddy icon refreshing and refactor user info and icon handling
Keep track of loaded pictures to refresh user pictures more reliably. Create new file tgp-info to contain all code related to user information and icons. Clean up the messy code for fetching user info and user pictures and provide a streamlined function in tg-info.
2016-01-10 01:27:38 +01:00
mjentsch
4438dcae0e Include libtgl fix for channel messages 2016-01-09 18:33:31 +01:00
Ben Wiederhake
8e3cebf165 Output commit in debug message on startup
Fixes #214.
2016-01-07 10:53:07 +01:00
Ben Wiederhake
dec3a260c4 Make tgl in appropriate place
Fixes #206.
2016-01-07 10:51:24 +01:00
Ben Wiederhake
a8cf6f88d0 Typos, email-addresses, trailing spaces 2016-01-07 10:51:24 +01:00
Ben Wiederhake
f4f058edb5 Add target noicon_install
This moves the feature #100 from the ./configure option to a make target,
which reduces the combinatory explosion of the ./configure options.
2016-01-07 10:51:24 +01:00
Ben Wiederhake
f958dfe2bc Re-order Makefile to be more sensible 2016-01-06 12:32:06 +01:00
Ben Wiederhake
1e78c9685c Merge branch 'master' into dev-1.3.0
Conflicts:
  rpm/purple-telegram.spec
  tgl
  tgp-ft.c
2016-01-06 12:30:35 +01:00
mj
cf851ad630 Remove Webupd8 PPA until it contains the hotfix 2016-01-06 10:59:46 +01:00
mj
4079aea8c0 Merge pull request #208 from tuxmaster/master
Fix appdata build for rpm.
2016-01-05 11:44:36 +01:00
tuxmaster
e4d04d990b Fix appdata build. 2016-01-05 07:01:14 +01:00
mj
7611afc323 Update README.md 2016-01-05 00:34:35 +01:00
mjentsch
94beda1419 Bump version in configure 2016-01-04 23:38:38 +01:00
mjentsch
10bac37b2c Fix xfer memory leak
Prevent leaking of cancelled xfers and stop warning messages for
"un-completed" file transfers when closing Adium.
2016-01-04 17:37:54 +01:00
mjentsch
c52d8811f3 Update version for hotfix 2016-01-04 17:37:54 +01:00
Ben Wiederhake
1cf511f526 Actually install the appdata file 2016-01-03 16:39:25 +01:00
mjentsch
66ef529edb Fix file transfer memory management 2016-01-03 00:29:53 +01:00
mjentsch
38b9e44a3e Fix crash on unknown messages 2016-01-02 19:56:58 +01:00
mj
0f10389a34 Update documentation for updates
Document how to handle changes in the .gitmodules configuration
2016-01-02 19:54:35 +01:00
Ben Wiederhake
a22204df13 Don't hardcode paths
Sometimes I'm really, really dumb.
2016-01-02 00:58:54 +01:00
Ben Wiederhake
d498c116ed Active logging on Travis 2016-01-02 00:58:54 +01:00
Ben Wiederhake
ef7a655dea Add new test with dummy frontend 2016-01-02 00:58:34 +01:00
Ben Wiederhake
0a349cc38e Fix name of test, fix clean target
Since this is a trivial change, [skip ci]
2016-01-02 00:22:17 +01:00
Ben Wiederhake
f41571934a Slim down combinations
Can't 'skip' this build: the .travis.yml still needs to be checked.
2016-01-02 00:22:17 +01:00
Ben Wiederhake
a0a03fe35e Include new test goals, integrate with Travis 2016-01-02 00:22:17 +01:00
Ben Wiederhake
7ce2d397b8 Implement very basic test.
This can only detect missing symbols or other severe failures.
2016-01-02 00:22:17 +01:00
Ben Wiederhake
cf121a5d59 Build all combinations 2016-01-02 00:22:17 +01:00
Ben Wiederhake
7d7f67f227 Build on trusty 2016-01-02 00:22:17 +01:00
Ben Wiederhake
2d4c06883f gcrypt20 not available in U12.04.5 2016-01-02 00:22:17 +01:00
Ben Wiederhake
9d8db69aad Broken submodule support, need to mention apt-get explicitely 2016-01-02 00:22:17 +01:00
Ben Wiederhake
fbba265512 First version for Travis 2016-01-02 00:22:17 +01:00
Ben Wiederhake
be4f5877c4 Fix compilation error 2016-01-02 00:22:17 +01:00
Ben Wiederhake
26669c8a6c Remove private files 2016-01-02 00:22:17 +01:00
Ben Wiederhake
39177beff9 Refresh/harden .gitignore-files 2016-01-02 00:22:17 +01:00
mjentsch
97f26e9b24 Merge branch 'master' into dev-1.3.0 2016-01-02 00:09:57 +01:00
mj
5b11831e3f Update README.md 2016-01-02 00:04:06 +01:00
mj
d42d647dfe Update README.md 2016-01-01 23:49:30 +01:00
matj
ffca726ca1 Fix compilation with openssl 2015-12-31 16:33:18 +01:00
mjentsch
603f19f641 Fix compilation
Do the libgcrypt check to assure that all necessary flags are included,
and clean up configure.ac a bit.
2015-12-31 16:33:18 +01:00
Ben Wiederhake
be49bdc66b fixup! Introduce --disable-gcrypt flag 2015-12-31 16:33:18 +01:00
mjentsch
a846ef03b0 Revert "Revert "Introduce --disable-gcrypt flag""
This reverts commit 893bb3369c.
2015-12-31 16:31:16 +01:00
mjentsch
893bb3369c Revert "Introduce --disable-gcrypt flag"
This reverts commit 89c27afac1.
2015-12-31 00:14:02 +01:00
mjentsch
eee367bdb0 update readme 2015-12-30 20:30:11 +01:00
mjentsch
edd86b60e2 Allow sending "cleartext" img tags in Adium
Adium does not use <img> tags for outgoing inline pictures in messages,
but initalizes a file transfer on its own. Additionally, they also don't
escape outgoing user-entered HTML, which means we must not search for outgoing HTML
<img> tags when using Adium, otherwise we would skip actual message
content.
2015-12-30 17:52:25 +01:00
mjentsch
3b3a4eafc2 Merge branch 'dev-1.2.3' into dev-1.3.0 2015-12-30 16:32:28 +01:00
Ben Wiederhake
ad921e866a Care about Windows packaging -- possibly broken 2015-12-30 15:19:43 +01:00
Ben Wiederhake
f1078f2d3a Add proper copyright headers 2015-12-30 15:04:18 +01:00
Ben Wiederhake
89c27afac1 Introduce --disable-gcrypt flag 2015-12-30 14:34:44 +01:00
Eion Robb
b48f7645d6 Update telegram-base.c
Fix whitespace nightmare
2015-12-30 14:34:44 +01:00
Eion Robb
0d7e8923c5 Remove the need for gcrypt in telegram-purple
Use libpurple's own SHA1 implementation
2015-12-30 14:34:44 +01:00
Ben Wiederhake
86f7fe0b9a Import from Transifex: New translations. Thank you! 2015-12-30 14:33:35 +01:00
Ben Wiederhake
5b275a6abb Read po/LINGUAS only in one place 2015-12-30 14:17:42 +01:00
mjentsch
c536cf0aec Ask if secret chats should be accepted by default 2015-12-29 23:47:12 +01:00
mjentsch
c0f3020884 Fix group chats auto-initialized in wrong group 2015-12-29 22:18:11 +01:00
mjentsch
3994fcdcff Assure that the tgl makefile is always updated after configure 2015-12-29 19:50:36 +01:00
mjentsch
085e14287f Make gettext dependency optional 2015-12-29 18:11:29 +01:00
mjentsch
f3091e7e51 Merge remote-tracking branch 'origin/master' into dev-1.2.3 2015-12-29 17:19:13 +01:00
mjentsch
67f9ba830c Bump version to 1.2.3 2015-12-29 17:03:18 +01:00
mjentsch
46485a08c3 Remove redundant code
Existance of print_name is already assured in the check above.
2015-12-29 15:28:57 +01:00
mjentsch
838e08a0e8 Fix coding guidelines 2015-12-29 14:33:03 +01:00
mjentsch
6cadb04fbd Fix glib log errors on joining chats and clean up code 2015-12-29 14:32:13 +01:00
mjentsch
67bc9cea92 Remove testing / debugging code 2015-12-29 12:27:21 +01:00
mjentsch
fc9a7ebb2e cleanup 2015-12-29 12:20:06 +01:00
mjentsch
b2541f14d4 Fix user alias not updated on name changes 2015-12-28 17:49:34 +01:00
mjentsch
c921a91b42 Fix RPC calls failing for users with Umlauts in Adium
Fix issue with name normalization by assuring that the id/name lookup always uses composed strings. Remove the now-unused function in the Adium bundle.
2015-12-28 17:46:39 +01:00
mjentsch
8fed82cc75 Fix writing messages to deleted buddies and cleanup
Do not depend on buddy list entries when looking up the ID from the user name, by maintaining a bi-directional mapping ID <-> username. Rename functions to make them more evident as something that operatos on the lookup. Cleanup blist functions by implementating generic iterator function over account buddies.
2015-12-28 17:44:49 +01:00
Ben Wiederhake
855e6fc04e Fix ${LOCALES} in Makefile 2015-12-26 11:22:57 +01:00
Ben Wiederhake
07a27e1edc Add Ben's email address 2015-12-26 11:20:22 +01:00
mjentsch
37c43ac830 Fix double free 2015-12-21 01:35:26 +01:00
mjentsch
877eb1ac04 Fix compilation with gcc 2015-12-20 21:52:56 +01:00
mjentsch
c099d49f41 Do not display read recipes for non-user messages 2015-12-20 15:57:22 +01:00
mjentsch
b828460886 Merge branch 'dev-1.2.3' into dev-1.3.0 2015-12-19 22:02:54 +01:00
mjentsch
65c96cae5a Fix secret chats not being properly canceled 2015-12-19 02:25:04 +01:00
mjentsch
00bf713c43 Fix secret chat not being removed when the other peer ends it 2015-12-19 02:25:04 +01:00
mjentsch
f2fd8a981b coding style 2015-12-19 02:25:04 +01:00
mjentsch
88d3963929 Fix compiler warning
Remove unused function
2015-12-18 23:09:12 +01:00
mjentsch
91a4c3b845 Fix use after free 2015-12-18 23:03:31 +01:00
mjentsch
b85fc85322 Fix auto-joining chats 2015-12-18 22:59:51 +01:00
Ben Wiederhake
233e6c2811 Generate and upload new potfile for 1.3.0 2015-12-18 13:51:54 +01:00
mj
ab75ad61d5 Update README.md
Include more info about submitting bug reports
2015-12-17 00:20:06 +01:00
mjentsch
ccf28caa8c Adium: Fix adding contacts with non-ascii names to buddy list 2015-12-16 22:37:53 +01:00
mj
aa237bed79 Update README.md 2015-12-15 12:26:30 +01:00
mj
b818752acc Merge pull request #181 from tuxmaster/dev-1.3.0
Prepare for 1.3.0
2015-12-13 13:42:52 +01:00
mjentsch
de17ccb982 Fix trailing whitespace on users without a last name 2015-12-13 01:10:13 +01:00
mjentsch
f681aa21e2 Fix adium bundle not loading 2015-12-13 01:10:13 +01:00
mj
935dea734b Merge pull request #172 from dequis/timer-delete-warnings
timer_alarm: Set fd to -1 to avoid warnings on tgl_timer_delete
2015-12-12 14:37:41 +01:00
mjentsch
9f34c13384 Fix reconnect failing
Fail complete connection when a reconnect to the main data center fails.
2015-12-12 00:55:21 +01:00
mjentsch
ce442eef22 Fix including libgcrypt in Adium bundle 2015-12-12 00:55:21 +01:00
mj
63e006c97c Merge pull request #180 from tuxmaster/dev-1.2.3
Prepare rpm for 1.2.3
2015-12-10 12:32:48 +01:00
tuxmaster
b61131c7e1 Prepare for 1.3.0 2015-12-10 12:30:31 +01:00
tuxmaster
261a1e5f54 Prepare rpm for 1.2.3 2015-12-10 12:28:11 +01:00
mjentsch
97e295ddde Fix format warning 2015-12-10 11:56:48 +01:00
mjentsch
18c2539f75 Fix regressions: chat actions not available for chats 2015-12-09 01:08:45 +01:00
mjentsch
de72552309 Ignore the file containing the current commit hash 2015-12-08 11:24:56 +01:00
mjentsch
b1fb7e500c Improve logging of peer flags 2015-12-08 11:24:01 +01:00
mjentsch
c8befa2c9e Display correct display time for special chats
Bug was introduced a few commits earlier in the test branch during refactoring.
2015-12-07 23:45:15 +01:00
mjentsch
85e7f17e65 Display newly added channels as online 2015-12-07 23:39:53 +01:00
mjentsch
618cbf7001 Handle channel photo updates and channel deletions
Change channel photo on update, delete channels from blist when leaving.
2015-12-07 23:15:17 +01:00
mjentsch
d1d03da879 Create a channel that is created in other clients during the session 2015-12-07 22:28:09 +01:00
mjentsch
60d6b3c8e5 Improve error handling when sending to non-ready secret chats 2015-12-07 00:32:54 +01:00
mjentsch
bab470cf1f Support posting documents to channels 2015-12-07 00:27:16 +01:00
mjentsch
350bdad82e Improve error handling for channels 2015-12-07 00:26:21 +01:00
mjentsch
5bd31bdae0 Add basic channel support 2015-12-06 23:46:09 +01:00
mjentsch
498f87eff5 Remove code duplication 2015-12-06 22:57:50 +01:00
mjentsch
a1f49d4748 Translate plugin description and update version/authors 2015-12-06 22:20:01 +01:00
mjentsch
5d6f9f35bb Remove migration for translated group names
Keep it maintainable and non-intrusive, the affected users can easily move the buddies into the new chat.
2015-12-06 22:04:54 +01:00
mjentsch
b2194b6a5d Translate group names 2015-12-06 20:38:06 +01:00
mjentsch
51e7d211fe Improve logging 2015-12-06 19:21:58 +01:00
mj
22cd6f071b Update README.md 2015-12-06 17:24:28 +01:00
mjentsch
7a6792ff04 Update copyright strings
Add current year where its left out, add missing authors and remove authors without any contributions in that file.
2015-12-05 20:40:08 +01:00
mjentsch
0bb5b0121d Make gettext dependency optional 2015-12-05 20:31:08 +01:00
mjentsch
53c6b384ec Clean up comments in Makefile.in 2015-12-05 16:56:40 +01:00
mjentsch
7d5722462f Display git commit in commit.h 2015-12-05 16:55:03 +01:00
mjentsch
b2845e41aa Clean up code
Order update callbacks just like in libtgl.h
2015-12-05 12:31:18 +01:00
mjentsch
fc1863cca9 Remove (now) unused function declaration. 2015-12-05 11:27:54 +01:00
mjentsch
9019ee1038 Comment-out unused function 2015-12-05 10:48:31 +01:00
mjentsch
eebd337929 Upgrade libtgl that supports layer 42 2015-12-03 23:16:28 +01:00
mjentsch
3670c41f41 Push partial implementation of displaying forwarded messages 2015-12-03 21:31:00 +01:00
dequis
3236a31551 timer_alarm: Set fd to -1 to avoid warnings on tgl_timer_delete
Warnings like this:

GLib-CRITICAL **: Source ID N was not found when attempting to remove it
2015-12-01 21:06:23 -03:00
mjentsch
41b4fd1792 Fix accepting secret chats from buddies not in the buddy list 2015-12-01 21:57:11 +01:00
mjentsch
a412ae2c19 Prevent frightening "directory could not be deleted" error
If an image is not found its filename will be NULL, which will cause build_filename to just return path of the tmp dir. When passing a directory to set_file_contents, it will attempt to unlink it (as the file already exists), but fail doing do, since unlink doesn't work on directories. This will still cause a scary warning message about "not being able to delete the tmp directory", which is now no longer printed.
2015-12-01 21:00:32 +01:00
mjentsch
2c21b59445 Fix memory leak 2015-12-01 20:55:14 +01:00
mjentsch
3016781b52 Clean up dialog list code and improve logging 2015-12-01 20:44:33 +01:00
mjentsch
b3d538de8a Improve error handling 2015-12-01 18:09:39 +01:00
mjentsch
8845f32454 Update AUTHORS 2015-11-29 22:07:16 +01:00
mjentsch
b3d09c1565 Fix redundant message when users are leaving chats
Do not display an extended reason when a user leaves on its own. Such a message makes only sense when a user is removed by somebody else.
2015-11-29 14:41:31 +01:00
mjentsch
202772ed78 Improve robustness against name changes 2015-11-29 13:11:48 +01:00
mjentsch
5502824ac4 Clean up, refactoring and fix coding guidelines 2015-11-28 20:17:47 +01:00
mjentsch
5ae6bdde82 Update authors 2015-11-28 15:02:23 +01:00
mjentsch
2a1a2d2167 Fix Adium compilation
Remove lodepng complation instruction from xcode project.
2015-11-28 14:55:11 +01:00
mjentsch
65fdf2802c Remove "sync all" option that doesn't have any effect
When migrating to libtgl-internal authentication code it became impossible to define the "tgl_do_get_difference" options, which
makes it impossible to fetch past history on first login. As this option used to fetch the whole history since the "beginning of time",
it wasn't a viable option anyways, so removing it was necessary sooner or later. An action to fetch past history for
conversations / chats / globally on demand will be added in the future to make up for this.
2015-11-28 14:54:11 +01:00
mjentsch
5428b39547 Fix messages not being marked as read despite sending responses or typing 2015-11-28 02:33:50 +01:00
mjentsch
bf70a184e1 Cleanup and coding guidelines 2015-11-28 02:14:31 +01:00
mjentsch
601440004a Fix read recipes only sent on next incoming message / read recipe 2015-11-28 02:14:31 +01:00
Ben Wiederhake
18a4d51b94 Upload new potfile 2015-11-26 08:23:25 +01:00
Ben Wiederhake
b44a218b22 Clean up strings 2015-11-26 08:23:25 +01:00
Ben Wiederhake
00cd867f6c Import potfile from transifex
This commit should be dated 2015-10-20 00:14:21
2015-11-26 08:23:25 +01:00
Ben Wiederhake
d2a3a7dc6f Fix autogen issue (symbol was not properly exported) 2015-11-26 08:23:25 +01:00
Ben Wiederhake
b5521b1688 Polish some more 2015-11-26 08:23:25 +01:00
Ben Wiederhake
7812603dee Fix typo 2015-11-26 08:23:25 +01:00
Ben Wiederhake
77317fb99f Add plural support
Fixes #139.
2015-11-26 08:23:25 +01:00
Ben Wiederhake
954ed6048b Clarify messages, use 'please' where appropriate 2015-11-26 08:23:25 +01:00
Ben Wiederhake
f53f13592a Disable unused feature 2015-11-26 08:21:09 +01:00
Ben Wiederhake
669880ab4d Fix color channels: TGA uses BGRA, not RGBA 2015-11-25 20:32:31 +01:00
Ben Wiederhake
8d8f299aec Drop LodePNG 2015-11-25 20:32:31 +01:00
Ben Wiederhake
98221ec036 Implement basic raw-to-tga conversion 2015-11-25 20:32:31 +01:00
Ben Wiederhake
2f467a2591 Fix missing inclusion 2015-11-25 20:31:44 +01:00
mjentsch
e10c548dd1 Fix compilation of plugin 2015-11-25 11:31:07 +01:00
mjentsch
a7be036a05 Remove unused commented-out code 2015-11-23 11:47:29 +01:00
mjentsch
04bc03bebf Clean up the include mess
Keep all libtgl and telegram-purple includes in telegram-purple.h to prevent duplication of all those includes. Remove redundant includes.
2015-11-23 03:06:30 +01:00
mjentsch
9ee84e73a2 Remove unneeded class includes in Adium plugin 2015-11-23 02:56:41 +01:00
mjentsch
a11c8da4fa Remove unneded unix-specific includes 2015-11-23 02:55:44 +01:00
mjentsch
05131d999e Remove code duplication 2015-11-23 01:33:20 +01:00
mjentsch
23507c0303 Fix compilation 2015-11-23 00:44:52 +01:00
mjentsch
643a30faa7 Do not rely on g_utf_8_substring length checking, it doesn't always do it 2015-11-23 00:37:23 +01:00
mjentsch
9a166cbc8b Cleanup and coding guidelines 2015-11-21 22:43:16 +01:00
mjentsch
72070e0016 Fix potential segfault 2015-11-21 22:42:07 +01:00
mjentsch
3cc0a832a9 Remove dead code and unused functions 2015-11-21 22:21:00 +01:00
mjentsch
f094319519 Fix typos 2015-11-21 22:20:38 +01:00
mjentsch
2d90f3ea03 More cleanup and refactoring 2015-11-21 22:14:57 +01:00
mjentsch
553b10dee5 Fix compilation 2015-11-21 18:54:33 +01:00
mjentsch
e5e58d0c2f Fix compiler error in MinGW 2015-11-21 16:31:15 +01:00
mjentsch
602edc8b5f Cleanup and coding guidelines 2015-11-21 16:30:50 +01:00
mjentsch
a44600a0ac Fix static analysis warning 2015-11-21 16:24:17 +01:00
mjentsch
c7a855a62c Do not rely on g_utf_8_substring length checking, it doesn't always do it 2015-11-21 16:23:46 +01:00
mjentsch
1a428ed80a Do not needlessly enable pfs anymore 2015-11-21 09:48:02 +01:00
mjentsch
05fc97381f Cleanup and slightly improve labels 2015-11-21 09:47:33 +01:00
mjentsch
5d52fce666 Fix compilation on Unix 2015-11-21 09:42:53 +01:00
mj
6cfeeb4835 Merge pull request #159 from tuxmaster/master
Fix rpm spec file.
2015-11-21 09:27:22 +01:00
mjentsch
2fc4f53831 Merge branch 'EionRobb-beta4' into cleanup-requests 2015-11-21 01:14:36 +01:00
mjentsch
0b0dbfd25e Merge branch 'beta4' of https://github.com/EionRobb/telegram-purple into EionRobb-beta4 2015-11-21 01:14:06 +01:00
mjentsch
09339c7785 Update adium bundle to 1.2.2 2015-11-21 00:39:14 +01:00
mjentsch
b10dc45bfc Fix secret chat duplication issue 2015-11-21 00:28:29 +01:00
mjentsch
dc27b1ec03 Display secret chat once its ready 2015-11-21 00:18:08 +01:00
mjentsch
0826bcad76 Improve logging messages for peer updates 2015-11-21 00:14:52 +01:00
mjentsch
97f619b1d0 Fix crash 2015-11-21 00:13:58 +01:00
tuxmaster
2e3951f5a5 Add missing space. 2015-11-18 15:05:10 +01:00
tuxmaster
f7b01583fc Add required version for libgcrypt. 2015-11-18 15:03:40 +01:00
mjentsch
81cf092554 Fix adding foreign buddy
Fix user info and user status not being correctly fetched.
2015-11-18 01:19:40 +01:00
tuxmaster
2f5c70b04b -Fix date for rpm spec file. 2015-11-17 18:53:09 +01:00
mjentsch
b721e8d217 Fix secret chats being duplicated on login 2015-11-16 16:15:20 +01:00
mjentsch
85df0e0bcd Fix status not updated for all buddies 2015-11-16 15:48:30 +01:00
mjentsch
6e210b8417 Improve comments and logging messages 2015-11-16 15:47:32 +01:00
mjentsch
8ee4f680c2 Fix own name being added to the buddy list 2015-11-16 15:43:32 +01:00
mjentsch
a77adfaf0d Fix offline messages being received on wrong conversations
Fix buddy messages are being received before buddy list was initialized, by changing the state to CONNECTED
on "logged in" event and not on "ready".
2015-11-16 15:41:51 +01:00
mjentsch
b6dd5adad7 Implement create / change password requests. 2015-11-16 10:05:03 +01:00
mjentsch
87225d7098 Fix sign in dialogue and clean up password prompt
Use purple_input_request with the masked bit set, instead of needlessly creating a request with generic fields. Implement correct sign in dialogue only queries for first and last name.
2015-11-16 10:04:41 +01:00
mjentsch
58b7f8c7f9 Coding style 2015-11-15 14:55:36 +01:00
mjentsch
e3d67dd47f Add missing string translations 2015-11-15 14:54:12 +01:00
mjentsch
4b68797f89 Remove pointless "create chat" confirmation dialogue 2015-11-15 14:51:40 +01:00
mjentsch
f89f3fd71a Remove code duplication in sign-in procedures
Use the new libtgl request_values callback to query inputs from the user instead
of implementing the sign-in methods manually.
2015-11-15 14:04:00 +01:00
mjentsch
6fce2cf8fa Fix sign in not starting for new accounts 2015-11-14 14:28:10 +01:00
mj
3a9f1e2cfe Merge pull request #145 from Sesivany/master
Adding AppData file
2015-11-13 23:40:27 +01:00
mjentsch
57a76fdabd Fix confusing comment 2015-11-13 22:50:26 +01:00
mjentsch
5dcf2687ca Update changelog 2015-11-12 22:22:48 +01:00
mjentsch
82971299a7 Do not write to secret file when reading a secret chat from it 2015-11-12 21:14:12 +01:00
mjentsch
9aa597edfc Include merge of "secret chat fix" pull request. 2015-11-12 21:14:12 +01:00
mjentsch
50c4b2ead7 Allow passing configure flags to libtgl subproject
Pass compiler and linker flags down to libtgl Makefile, when calling configure.
2015-11-12 21:14:12 +01:00
mjentsch
13fb3a74c6 Fix segfault on closing down
TLS now frees itself when calling tgl_free_all, adapt to this change.
2015-11-12 21:14:12 +01:00
mjentsch
90b4e3b5b5 Fix secret chat name and fingerprint
Correctly initialize secret chat fingerprint and print name when loading the chats from the secret file.
2015-11-12 21:14:12 +01:00
mjentsch
3fe025e877 Improve secret chat robustness.
Do not crash when removing secret chats and the print_name is not set
anymore.
2015-11-12 21:14:11 +01:00
mjentsch
f7bcbe8851 Update tgl version 2015-11-12 21:14:11 +01:00
Ben Wiederhake
f1d7a67a4b Import from Transifex: uk. Thank you! 2015-11-01 21:47:21 +01:00
mjentsch
23b357fac3 Fix read recipes not being sent when users leave or join chats 2015-11-01 19:11:22 +01:00
mjentsch
cb0bbe5b1c cleanup 2015-10-31 21:49:56 +01:00
mjentsch
4c32efddc2 Do not crash when opening / hovering over unmigrated buddies 2015-10-31 21:46:54 +01:00
mjentsch
46b5fa25b9 Do not brick secret chats when sending documents
At least make sure to cancel _all_ file transfers to encrypted chats, until the secret chat file transfer issue is properly fixed.
2015-10-31 21:46:20 +01:00
mjentsch
42543706b4 Remove "Start secret chat ..." action from secret chats 2015-10-31 20:38:56 +01:00
mjentsch
e3892cab16 Fix leaving and removing chats again 2015-10-31 20:34:47 +01:00
mjentsch
81b64d7542 Fix "crashes" on name changes
Do not assume that a name for each ID can only be set once anymore.
Remove assertion that names always exist, return 0 instead and propagate
error handling to the calling function.
2015-10-31 20:09:31 +01:00
mjentsch
87278f6742 Merge branch 'tuxmaster-beta4-2' into beta4 2015-10-30 19:16:55 +01:00
mjentsch
e90c7aa0f8 Merge branch 'beta4' of https://github.com/tuxmaster/telegram-purple into tuxmaster-beta4-2 2015-10-30 19:16:34 +01:00
mjentsch
895c8dc14f Merge branch 'beta4' of https://github.com/majn/telegram-purple into beta4 2015-10-30 19:03:55 +01:00
Eion Robb
6e78b51527 Missed a couple more binary file open()s 2015-10-25 15:32:03 +13:00
Eion Robb
7f64b57461 Set binary flag on open() calls so that windows doesn't terminate files early 2015-10-25 15:22:34 +13:00
Eion Robb
ed2f9d527c Add a make installer option that builds an exe installer using NSIS 2015-10-24 19:17:29 +13:00
Eion Robb
fde3af9f4c Add mingw Makefile/config's 2015-10-24 12:31:11 +13:00
Eion Robb
5a0ee5b22e Enable PFS
Seems to be the only way to trigger all the events loop in libtgl
2015-10-24 11:21:18 +13:00
Eion Robb
a8bad2e361 Use send()/recv() on sockets
and apply it to the right branch this time
2015-10-24 11:11:42 +13:00
Ben Wiederhake
70acb337cf Merge branch 'master' into develop
Conflicts:
	README.md
2015-10-22 11:35:42 +02:00
Eion Robb
8562eb342c Allow compiling on Windows 2015-10-22 21:41:37 +13:00
mj
6bc8fb49e2 Update README.md 2015-10-21 10:51:00 +02:00
mj
ddb94969dd Update README.md
Add note about missing Windows support.
2015-10-21 10:49:56 +02:00
Ben Wiederhake
75e1efdb86 Use https where possible 2015-10-20 18:36:27 +02:00
Ben Wiederhake
31768d1e4d Use new lodepng version 2015-10-20 18:28:11 +02:00
Ben Wiederhake
af3d14bec0 Import from Transifex: fr, pt_BR, ru. Thank you all!
See previous commit for 'ru'.
2015-10-20 18:25:05 +02:00
Ben Wiederhake
3edab136cd Update translations due to previous commit 2015-10-20 18:22:33 +02:00
Ben Wiederhake
a155d4b41c Update translation strings, positions, and Transifex 2015-10-20 18:22:33 +02:00
Ben Wiederhake
59d9cc88a9 Fix autogen incompatibility
Also, only regenerate the parts that actually have changed.
2015-10-20 18:22:04 +02:00
Matthias Jentsch
b8e73f819c Fix compilation errors and warning when disbaling libwebp 2015-10-20 14:15:50 +02:00
Matthias Jentsch
ee9626e6da Merge remote-tracking branch 'wiederhake/beta4' into beta4 2015-10-20 12:38:40 +02:00
Jiri Eischmann
8ece7fcccc Fixing license in the appdata file 2015-10-20 00:16:41 +02:00
Matthias Jentsch
728da04d3c Try to fix failing reconnect after hibernate 2015-10-19 19:05:50 +02:00
mjentsch
b98b742c14 Fix Adium reconnect after hibernate and not disconnecting properly 2015-10-18 21:18:12 +02:00
Jiri Eischmann
5a72023848 Adding AppData file 2015-10-18 18:42:29 +02:00
majn
3824eae025 Fix empty file in pidgin after transfer
Fetch local filename before calling purple_xfer_end to avoid that the local filename contains bogus.
2015-10-18 01:21:18 +02:00
mjentsch
c2873d2e3f Fix libgcrypt check
Use a libgcrypt check that will only succeed with a version >= 1.6.0.
2015-10-17 23:49:41 +02:00
mjentsch
d43f4f0d64 Use better names 2015-10-17 23:11:15 +02:00
mjentsch
bd7662aaeb Do not crash when displaying the tooltip of an old user 2015-10-17 21:18:42 +02:00
mjentsch
306273d4c4 Merge branch 'beta4-human-reable-user-names' into beta4 2015-10-17 18:09:42 +02:00
mjentsch
9f96be976d clearer function names 2015-10-17 14:51:09 +02:00
mjentsch
df5a168a1f Remove unneeded and confusing messages 2015-10-17 00:26:00 +02:00
mjentsch
5c76324b78 cleanup 2015-10-17 00:00:25 +02:00
mjentsch
5f2da4b4fc Avoid nullpointer dereference when purple requests actions on deleted telegram secret chats 2015-10-16 23:32:49 +02:00
mjentsch
3f2f557284 Use clearer names for name and id resolution functions and clean up 2015-10-16 22:45:21 +02:00
Ben Wiederhake
4e43a6208a Import from Transifex: es_AR, pl, sq. Thank you all! 2015-10-16 00:42:08 +02:00
mjentsch
a2fc31cda7 Fix service message formatting in Adium
Adium drops MESSAGE_SYSTEM flags in serv_got_im, directly write to the conversation in case the message contains such a flag.
2015-10-16 00:33:23 +02:00
mjentsch
afa650cfc1 Fix messages in secret chats not showing notifications in Adium
Secret chat messages are always unread, do not set MESSAGE_DELAYED.
2015-10-16 00:28:36 +02:00
mjentsch
76e6c2a4ad Never drop unread messages, even when they are older than the history threshold 2015-10-16 00:24:00 +02:00
mjentsch
adeacb7c42 Remove flag that is no longer used in update_buddy 2015-10-16 00:15:37 +02:00
mjentsch
b25eeb6951 Cleanup and coding style 2015-10-16 00:14:36 +02:00
mjentsch
a3a35eb7ff Do not drop history or break conversations when buddy print name changes
Do not update blist buddy names, but set an alias instead to prevent breaking conversations or loosing history. Instead, keep the first print name as permanent user name
and set the alias on all buddy name changes. When interacting with purple always use the original buddy name stored in the blist instead of the print name provided by libpurple.
This allows both, meaningful names in group chats and permanent identifiers in the buddy list, while still propagating names changes to the interface.
2015-10-16 00:08:24 +02:00
tuxmaster
96f689ca1c - Use the better pkconfig for build requires.
- Add translations.
- Switch to libgcrypt from openssl.
- Modify Readme for the new requirements of the build for Fedora.
2015-10-14 15:28:00 +02:00
Ben Wiederhake
56445b4821 Fix annoying 'missing config.h' error. 2015-10-14 01:15:14 +02:00
Ben Wiederhake
512c052cdc Add Makefile targets local_{,un}install. 2015-10-14 01:15:14 +02:00
Ben Wiederhake
b9a1ab23be Allow loading alternative pubkey from local, as a fallback. 2015-10-14 01:15:14 +02:00
Ben Wiederhake
829b9f996f Mark static function as static. 2015-10-14 01:15:14 +02:00
Ben Wiederhake
f444ae0866 Fix *install* targets.
Fixes #47 by removing the feature, as it seems that nobody uses it.
If you would like to see a feature like this again, please open a new
bug and reference either this commit or issue #47.
2015-10-14 01:15:14 +02:00
Ben Wiederhake
d83d1df00d Add option --disable-icons.
Closes #100.
2015-10-14 01:15:14 +02:00
Hugues Morisset
ada7a5018f Add build package build step in README 2015-10-14 01:15:14 +02:00
Ben Wiederhake
029c1eece3 Rebasing mistake. Sorry. 2015-10-12 19:58:48 +02:00
Ben Wiederhake
7c6831ee93 Include latest translations to demo. 2015-10-12 19:09:46 +02:00
Ben Wiederhake
c1888926df Dumb typos. Sorry. 2015-10-12 18:48:56 +02:00
Ben Wiederhake
d923ed1130 Beautify and fix strings (part 2/2). 2015-10-12 18:40:21 +02:00
Ben Wiederhake
65336849fb Beautify and fix strings (part 1/2). 2015-10-12 13:27:46 +02:00
mjentsch
cf8f4da2fb Assure that buddy names and images are being updated correctly 2015-10-11 23:51:40 +02:00
mjentsch
7813cedb06 Update Adium package to new user management
Add new files to xcode project, remove now useless "workaround" for setting chat participant aliases, set user ids to case insensitivity so normalization doesn't break the plaintext usernames.
2015-10-11 14:38:56 +02:00
mjentsch
365f7b1da1 Provide utility function for printing system messages in all chat types 2015-10-11 14:19:37 +02:00
mjentsch
61597e9101 Remove manual "group" creation, use blist utility function instead 2015-10-11 14:18:42 +02:00
mjentsch
527f16985d Remove dead code 2015-10-11 14:17:47 +02:00
mjentsch
4eeb7f73c9 Overhaul username handling
Use print names instead of ids as usernames, to fix problems with "useless" user ids showing up for unknown users and in group chats. Remove workarounds like "Telegram Foreign" needed to temporarily store user names for alias resolution.
2015-10-11 14:17:24 +02:00
Ben Wiederhake
ab762710e4 Add notice that installation on Debian will eventually become easier 2015-10-09 09:29:47 +02:00
Ben Wiederhake
cac87f92b8 Fix sticker resizing.
So far, a sticker of size 1028x1028 would have been resized to 128x128,
even though the maximum was set to 256x256.
This fix introduces a different way of resizing, which means that any dimension
of length >256 will result =256.

Also, I factored out the maximum size, so maybe we can make this an option in the future.
2015-10-08 17:44:12 +02:00
Ben Wiederhake
e26416bc49 Standardize password prompt. 2015-10-08 12:59:17 +02:00
Ben Wiederhake
7f9c8122b0 Make 'clean' a recursive target. 2015-10-08 00:03:32 +02:00
Ben Wiederhake
0dc2c750ae Fix typo.
Beleive it or not, credits for discovering this typo go to
...
lintian.

This thing is a hell of a tool. Thank you, lintian developers.
2015-10-07 23:54:55 +02:00
Ben Wiederhake
7a7480ae9d Ensure that local directories exist.
Fixes #47.
2015-10-07 22:54:00 +02:00
Ben Wiederhake
f3acef6737 Fix a few unimportant memory leaks. 2015-10-07 22:07:56 +02:00
Ben Wiederhake
ed9505400d Remove dead code. 2015-10-07 22:07:56 +02:00
Ben Wiederhake
6e7e9ce862 Fix translations to be at least passable. 2015-10-07 22:07:56 +02:00
Ben Wiederhake
d96002ac97 Fix support for install. 2015-10-07 22:07:56 +02:00
Ben Wiederhake
d0bbd773fc Fix ordering of autoheader/autoconf.
Running autoconf when config.h.in is missing yields warnings,
so don't do that.
2015-10-07 22:07:56 +02:00
Ben Wiederhake
d1d6865a0a Remove superfluous -lm flag. 2015-10-07 22:07:56 +02:00
mjentsch
7f3cf7c58f Bump version to 1.2.2 2015-10-07 21:52:35 +02:00
mjentsch
fe3bc9e3fc Update tgl version 2015-10-07 14:16:40 +02:00
mjentsch
e557e72ab4 Update version in README 2015-10-07 14:16:18 +02:00
mjentsch
7838f242ae Coding style 2015-10-07 03:28:37 +02:00
mjentsch
6caed24f0d Integrate libgcrypt header in config.h.in 2015-10-07 03:23:09 +02:00
mjentsch
27c69851eb Ignore compiled translation catalogs 2015-10-07 03:19:28 +02:00
mjentsch
86ec16e73d Update translation HOWTO 2015-10-07 03:18:34 +02:00
mjentsch
6be41aa18b Add even more missing translation strings 2015-10-07 03:06:08 +02:00
mjentsch
94c24a1120 Add German locale 2015-10-07 02:09:38 +02:00
mjentsch
7bc5ac54da Fix configure script
Remove intltool checks failing because of missing po/Makefile.in and just check for msgfmt instead.
2015-10-07 02:07:23 +02:00
mjentsch
8a0e43d128 Use package name as gettext package name 2015-10-07 01:41:21 +02:00
mjentsch
6d16be5238 Support installing/uninstalling the localizations 2015-10-07 01:38:17 +02:00
mjentsch
2abe43cd96 Fix plugin init function
Change include order to not fail PURPLE_PLUGIN_INIT.
2015-10-07 01:30:28 +02:00
mjentsch
6a465b24a1 Fix broken inclusion of gettext translation 2015-10-06 21:45:26 +02:00
mjentsch
688f628890 Consolidate user messages 2015-10-06 19:23:07 +02:00
mjentsch
ffef370ae1 Translate a few more left-out strings 2015-10-06 14:37:12 +02:00
mjentsch
b297944650 Add skeletons for translation catalogs 2015-10-06 14:37:12 +02:00
mjentsch
8009b8c0ac Translate strings in telegram-purple 2015-10-06 14:37:12 +02:00
mjentsch
08168c6339 Include translation functions and restructure includes 2015-10-06 14:28:13 +02:00
mjentsch
a91a6ab304 Add translation-related stuff to configure.ac 2015-10-06 14:26:40 +02:00
mjentsch
f0b0550cf8 Support message mentions
Display mentions like messages that contain the user nick in Pidgin.
2015-10-06 13:45:59 +02:00
mjentsch
ba8d9cf378 Fix compilation when not using libwebp 2015-10-05 13:01:17 +02:00
mjentsch
f8cf133c06 Use libgcrypt in Adium plugin 2015-10-05 12:02:00 +02:00
mjentsch
a7043fd5cc Update README 2015-10-05 12:00:53 +02:00
mjentsch
63f7edc2f9 Update tgl vers. and set gitmodule to test branch 2015-10-05 11:36:31 +02:00
mjentsch
1e8513909d Merge remote-tracking branch 'tuxmaer/pull_request' into beta4 2015-10-05 00:13:29 +02:00
Ben Wiederhake
7ad9a0a45c Fix inclusion type. 2015-10-04 17:51:49 +02:00
Ben Wiederhake
b469af3582 Make tgl_timer_insert robust against double insertion 2015-10-04 17:51:49 +02:00
Ben Wiederhake
6dc58df1c2 Fix overcleaning. 2015-10-04 17:51:49 +02:00
Ben Wiederhake
7ab7f4126e Avoid the PEM issue. 2015-10-04 17:51:49 +02:00
Ben Wiederhake
57e6a777d9 Build telegram-purple and libtgl without OpenSSL (skip when bisecting).
This version still tries to load a PEM file, although libtgl
--disable-openssl does not support it. Since there are several
ways to resolve it, this switch away from OpenSSL and its solution
should be different commits.
2015-10-04 17:51:49 +02:00
Ben Wiederhake
47bd4b2b33 Use new API, fix build system. 2015-10-04 17:51:49 +02:00
mjentsch
858177626c Update README
Add documentation about telepathy-haze and third party repositories
2015-10-03 02:18:27 +02:00
mjentsch
f4755bd65b Update XCode project to include new files and update SDK version to 10.11 2015-10-03 02:12:58 +02:00
mjentsch
5064acaaf9 Cleanup an coding guidelines 2015-10-03 02:12:58 +02:00
mjentsch
4c576524e4 Move requests into separate file 2015-10-03 02:12:58 +02:00
mj
3a53dd8540 Merge pull request #129 from BenWiederhake/master
Create files for copyright management (non-specific to Debian)
2015-10-03 02:12:03 +02:00
Hugues Morisset
9529f44802 Add COPYING file 2015-10-02 23:17:18 +02:00
Hugues Morisset
6d730f4610 Add AUTHORS file 2015-10-02 23:17:18 +02:00
tuxmaster
aa7a8d43f6 - Aktualisieren temporär entfernt. 2015-09-30 12:59:36 +02:00
tuxmaster
ba790edb64 - remove unneeded requirements from rpm spec file
- remove source code fix from rpm spec file
- fix source code permissions
2015-09-30 12:53:59 +02:00
tuxmaster
9a4216e170 - Hilfsprogramm zum syncron halten 2015-09-30 10:32:13 +02:00
mjentsch
8c6e4e6079 Update spec file 2015-09-17 20:24:28 +02:00
mjentsch
586268424a Merge branch 'fix-group-participant-aliases' 2015-09-17 20:06:18 +02:00
mj
4ffb777496 Merge pull request #118 from shlomif/remove-executable-bit-from-source-files
Remove executable bit
2015-09-17 10:39:24 +02:00
mjentsch
04df0afa95 Fix segfaults when adding chat 2015-09-17 00:00:53 +02:00
mjentsch
95664e1358 Better input validation in adium chat print name callback 2015-09-16 23:52:46 +02:00
Shlomi Fish
f6f01c848f Remove executable bit 2015-09-16 17:48:56 +03:00
mj
973e209e2c Merge pull request #117 from shlomif/shlomif-fix-typos
Fix spelling/grammar/etc. errors
2015-09-16 16:46:51 +02:00
Shlomi Fish
be5bbbc682 Add missing comma 2015-09-16 17:37:28 +03:00
Shlomi Fish
b334efc5c8 Fix a misphrasing 2015-09-16 17:36:13 +03:00
Shlomi Fish
5762d48339 Fix a misphrasing 2015-09-16 17:33:56 +03:00
Shlomi Fish
f9960c1f6e Fix misphrasing 2015-09-16 17:33:26 +03:00
Shlomi Fish
562df1ad7c Fix misphrasing 2015-09-16 17:32:31 +03:00
Shlomi Fish
37f86fda7e Fix misphrasing 2015-09-16 17:31:49 +03:00
Shlomi Fish
6afe244757 Correct “mail” to “E-mail” 2015-09-16 17:29:15 +03:00
Shlomi Fish
00658a322a Fix a misphrasing 2015-09-16 17:28:28 +03:00
Shlomi Fish
6fca984210 Fix typo - "these" 2015-09-16 17:27:05 +03:00
Shlomi Fish
54094572d0 Fix typo - "prebuilt" 2015-09-16 17:26:33 +03:00
Shlomi Fish
10e9d17121 Fix a typo - 'requires' 2015-09-16 17:24:56 +03:00
Shlomi Fish
4da40ecbc1 Fix a double phrase 2015-09-16 17:23:15 +03:00
mjentsch
470f3fd5cb Fix joining by roomlist when setting an alias 2015-09-14 23:40:26 +02:00
mjentsch
50367783db Do not display outgoing captioned images in group chats twice 2015-09-14 22:03:36 +02:00
mjentsch
32161b1558 Revert "Fix auto joining chats on connection"
This reverts commit fa9b331b39.
2015-09-13 22:24:22 +02:00
mjentsch
114dedcdc9 Do not add deleted users to buddy list and clean up a bit 2015-09-13 15:50:16 +02:00
mjentsch
cf536552b5 Bump version and update README 2015-09-12 23:29:47 +02:00
mjentsch
fa9b331b39 Fix auto joining chats on connection
Only set the connection status to online when all chat info was fetched,
to avoid annoying chat creation requests on startup.
2015-09-12 22:38:28 +02:00
mjentsch
4341bf0804 Fix showing joining chats by roomlist 2015-09-12 22:23:24 +02:00
mjentsch
dac0632ab1 Coding style and cleanup 2015-09-12 22:22:40 +02:00
mjentsch
c3f48b9835 Don't automatically add all chats to the buddy list
This should fix issue where left chats show up in the blist and cannot be removed anymore and broken Adium bookmarks.
This patch should make the whole chat handling much more native to libpurple, in which chats are added through the chatlist,
the join-chat window or automatically when incoming messages are received. Add a new option "Add chats to buddy list" in
case anyone wants the old behavior.
2015-09-12 22:21:27 +02:00
mjentsch
ce51b0bb68 Provide chat info defaults to allow joining chats from roomlist 2015-09-12 12:34:23 +02:00
mjentsch
665f27c279 Add missing account type check to adium signal handler 2015-09-11 22:55:46 +02:00
mjentsch
1004a4005d Fix user names not being displayed in group chats
Add users to temporary group "Telegram Foreign", to assure that the user
alias is always known to Pidgin. Don't store this group permanently but
drop it when closing.
2015-09-11 21:35:27 +02:00
mjentsch
66a1536d4b Fix segfault when receiving msg_send_done callback without a message
cherry-picks 936c541361 from branch
fix-group-participant-aliases
2015-09-08 22:40:38 +02:00
mjentsch
0c06c63dc8 Fix support for old glib versions 2015-09-08 22:28:24 +02:00
mjentsch
d9ca1c0f51 coding style 2015-09-08 22:17:43 +02:00
mjentsch
4670e3ede4 Don't add contacts when adding new buddy
The user should be able to just add buddies to the buddy list without any further side effects, especially
considering you now need to add any user not in the dialog list if you want him to show up.
2015-09-08 22:16:53 +02:00
mjentsch
a43aa8de42 Prevent flood warnings #2
Only get every chat info exactly once to avoid stalling of the incoming message queue through flood warnings.
2015-09-08 22:13:37 +02:00
mjentsch
e82fef3826 Prevent flood warnings
Only load user info on first start when the user actually has a pic to display.
2015-09-08 22:09:15 +02:00
mjentsch
546bcdc760 cleanup 2015-09-08 22:07:27 +02:00
mjentsch
de131bd3cc Fix bug that caused dialog list to not be loaded 2015-09-08 21:06:12 +02:00
mjentsch
5d187216cf Only get user info for dialogs that actually have a photo 2015-09-08 19:27:58 +02:00
Matthias Jentsch
2d7d1016a8 Better input validation for phone numbers 2015-09-08 17:06:57 +02:00
mjentsch
936c541361 Fix segfault when receiving msg_send_done callback without a message 2015-09-08 17:06:56 +02:00
mjentsch
ff2df0861b Add users in bulk to generate better join-messages in Finch 2015-09-08 17:06:56 +02:00
mjentsch
e665729ee2 Do not remove contact when deleting buddy list node, this is not obvious to the user 2015-09-08 17:06:56 +02:00
mjentsch
31c1037e4d Small fixes and cleanup 2015-09-08 17:06:56 +02:00
mjentsch
3dfb1ac17e Make sure to clear users when leaving chat with non-pidgin clients 2015-09-08 17:06:56 +02:00
mjentsch
ccc6dab512 fix input validation 2015-09-08 17:06:56 +02:00
mjentsch
620d4d5b8b Fix issue that caused newly created chats to not open 2015-09-08 17:06:56 +02:00
mjentsch
a5cef7dcaa Add support for roomlists 2015-09-08 17:06:56 +02:00
mjentsch
888cffffc1 Improve group chat management
Load full chat info lazily, prevents useless network request and should fix issues with delays through flood errors when handling big amounts of user chats. Handle chat participant deletions and additions correctly and only touch the user list when it is actually updated, this should fix some issues with printing annoying messages in Finch and users not showing up in the buddy list in certain situations. Only add chats to buddy list that are actively joined or receive incoming message, which should help keeping the buddy list more tidy when using much chats.
2015-09-08 17:06:56 +02:00
mjentsch
592b31e8c8 Cleanup 2015-09-08 17:06:55 +02:00
mjentsch
abd316a659 Support leaving and deleting chats 2015-09-08 17:06:55 +02:00
mjentsch
791b048eb1 Fix crash in Adium when exporting a non-existing chats link 2015-09-08 17:06:55 +02:00
mjentsch
6dd94bc3bc Fix certain chats now showing up when opening through Adium dialougue. 2015-09-08 17:06:55 +02:00
mjentsch
6ad121bb88 Fix segfault 2015-09-08 17:06:55 +02:00
mjentsch
f79897ec8e Fix chat participant names in Adium
first attempt, probably might cause issues with concurrency...
2015-09-08 17:06:55 +02:00
mjentsch
644416aa89 Display user aliases of users not in the buddy list in group chats 2015-09-08 17:06:55 +02:00
mj
b0ac19fc5f Merge pull request #111 from tuxmaster/master
- Fix rpmlint errors in the spec file.
2015-09-05 11:14:09 +02:00
tuxmaster
4509ccacb7 - Fix rpmlint errors in the spec file. 2015-09-02 17:00:30 +02:00
mjentsch
f770abce19 Include RPM-fix by tuxmaster 2015-09-01 00:21:03 +02:00
mjentsch
f6691e0c63 Update telegram-adium version and depend on 1.5.10 2015-08-30 21:58:09 +02:00
mjentsch
227fe399bb Don't break config window in telegram-adium 2015-08-30 21:58:09 +02:00
mj
c4a17ca0b5 Merge pull request #107 from flocke/master
Some minor build improvements
2015-08-30 21:10:32 +02:00
Jakob Nixdorf
75a9b56ddb Use pkg-config found in configure in make. 2015-08-29 18:37:02 +02:00
Jakob Nixdorf
3fbe1079bc Set the 'ar' command as variable in Makefile.tgl
Allows the location of the ar binary to be changed by passing the argument AR=/path/to/ar to make.
2015-08-29 18:33:28 +02:00
mjentsch
f10b683fc9 Merge branch 'final' 2015-08-29 17:33:03 +02:00
mjentsch
31afb76895 Update README 2015-08-29 17:31:38 +02:00
mjentsch
8e87c16c75 Update own user-name properly 2015-08-29 14:22:32 +02:00
mjentsch
8a80eeccae Remove network logging temporarily 2015-08-29 13:44:26 +02:00
mjentsch
793b1fc0fb Disable defective set_buddy_icon temporarily 2015-08-29 12:57:16 +02:00
mjentsch
2b15603685 Always add secret chats to buddy list
Active secret chats should always show up in the buddy list, since there's the only endpoint for a conversation.
2015-08-29 12:56:36 +02:00
mjentsch
973f236abc Fix OSM geo link formatting when using a different locale 2015-08-28 20:55:31 +02:00
mjentsch
b6136a6a9c Fix sending animated pictures by inline image 2015-08-28 00:03:33 +02:00
mjentsch
1a8172e922 Fix issue that caused sending captioned images to fail in Pidgin 2015-08-27 23:40:08 +02:00
mjentsch
ee48642232 Change module source to my own fork until it is merged 2015-08-26 23:41:33 +02:00
mjentsch
2e7bd3e3c6 Update README 2015-08-25 23:02:23 +02:00
mjentsch
153762c5af Bump version 2015-08-25 21:58:58 +02:00
mjentsch
70b03b969c Try to fix secret chat corruption 2015-08-25 21:54:15 +02:00
mjentsch
5e65a6675c Fix compilation 2015-08-22 13:42:44 +02:00
mjentsch
8af1991bc8 Update libtgl and fix receiving file transfers of audio and video documents 2015-08-22 13:34:53 +02:00
mjentsch
b5198b3184 Clean up and update README 2015-08-22 13:13:19 +02:00
mjentsch
f5ec7f3e80 Rework buddy list handling
Only add buddies that are on the dialogue list or were explicitly added by the user, to prevent adding non-related users that are now allocated due to protocol updates.
2015-08-22 13:07:11 +02:00
mjentsch
9f71a73632 Remove makefile as dependency from XCode project, only caused trouble 2015-08-22 12:27:34 +02:00
mjentsch
0b95f05da0 Update libtgl 2015-08-16 21:35:43 +02:00
mj
ba868f7f24 Merge pull request #97 from surrim/dnf
using fedora's dnf instead of deprecated yum
2015-08-04 17:41:22 +02:00
surrim
c0b6329b71 using fedora's dnf instead of deprecated yum 2015-08-04 15:20:57 +02:00
mjentsch
4b96e3cb34 Do not display notifications and sounds for messages that were already read on other devices
This should make receiving message history a little less annoying when not using the client for a long time, while still getting the full history in your log.
2015-08-02 19:52:30 +02:00
mjentsch
dc5bc8d039 Improve error handling 2015-08-01 23:34:00 +02:00
mjentsch
8ebd970fbc Escape webpage messages properly 2015-07-31 12:53:24 +02:00
mjentsch
dd6031900e Cleanup 2015-07-30 21:49:13 +02:00
mjentsch
ea12251897 Fix chat creation 2015-07-30 21:46:03 +02:00
mjentsch
7be7fb12f4 Fix video and audio file names 2015-07-30 21:02:22 +02:00
mjentsch
e8ceb21e64 Revise media message handling
This should fix many seg faults and make media handling more consistent.
2015-07-30 11:45:50 +02:00
mjentsch
f810ac5b94 Update user list in chats properly 2015-07-28 21:28:28 +02:00
mjentsch
54c6f4d519 fix bug 2015-07-24 14:28:18 +02:00
mjentsch
254293bc2c Display new chats after creation 2015-07-24 14:27:20 +02:00
mjentsch
61cddd1340 Support for joining chats by invite link 2015-07-24 14:26:13 +02:00
mjentsch
287ace46a4 Support autocompletion in chat creation windows
Offer several autocompletion fields instead of a list of users in Adium and Pidgin.
2015-07-24 14:25:05 +02:00
mjentsch
3a2af54fad Coding style 2015-07-19 16:16:21 +02:00
mjentsch
c5b98eccb2 Increase dialog list limit to ensure that we always get old chats 2015-07-19 16:15:30 +02:00
mjentsch
a4c5bca05f Support creating chat invitation links 2015-07-19 15:18:59 +02:00
mjentsch
e14b681d6e Fix segfault 2015-07-19 15:07:27 +02:00
mjentsch
747c214dcd Support creating new chats
Offer creating a new chat when trying to join a non-existing chat and
add user choice dialogue...
2015-07-18 03:00:11 +02:00
mjentsch
5a06970c23 Hotfix when one DC is not available 2015-07-12 23:01:04 +02:00
mjentsch
c7898c7596 Support image captions 2015-07-11 19:50:55 +02:00
mjentsch
01e7f8da2b Improve printing geo positions 2015-07-11 19:50:32 +02:00
mjentsch
cd1e8d8020 Mask password in settings ... 2015-07-11 19:35:07 +02:00
mjentsch
47812f2f72 Improve string sanitation in fallback chat 2015-07-11 19:34:19 +02:00
mjentsch
8f790253a7 Improve geo position link and support printing venues 2015-07-11 18:31:03 +02:00
mjentsch
ed1f91123e remove unused functions and clean up 2015-07-11 17:44:49 +02:00
mjentsch
51064e06b4 Update tgl version 2015-07-11 17:41:50 +02:00
mjentsch
5588de63f0 Fix logging 2015-06-15 21:04:58 +02:00
mjentsch
006890a29c downscale big stickers
use sticker downscaling to keep readabillity in chats with many stickers
2015-06-04 14:27:49 +02:00
mjentsch
0d62d1bed3 Fix XCode build for adium bundle 2015-06-04 14:27:35 +02:00
mjentsch
1646992349 Set submodule url back to upstream 2015-05-31 17:43:31 +02:00
mjentsch
d5175188e8 Merge branch 'beta2' 2015-05-31 16:34:38 +02:00
mjentsch
a6d75e9593 Update version 2015-05-31 16:01:09 +02:00
mjentsch
e37a0b8cca code style 2015-05-31 15:50:46 +02:00
mjentsch
d8379ce127 Update to newest version of libtgl 2015-05-30 15:56:20 +02:00
mjentsch
8c859ad825 Fix bug that caused dropping of group chat messages when leaving the chat window open during reconnect 2015-05-30 15:55:13 +02:00
mjentsch
e7554c739c Add option for disabling sending a message read recipes, and fix some bugs in adium settings menu 2015-05-30 15:52:17 +02:00
mjentsch
0033837210 Add Makefile.tgl to Xcode project 2015-05-30 11:30:56 +02:00
mjentsch
cec3bf098d Do not include unused net and timer objects in tgl 2015-05-29 19:47:29 +02:00
mjentsch
0065e6d1a9 Fix compile error 2015-05-29 19:04:49 +02:00
mjentsch
49cc80f8c0 Support two factor authentication 2015-05-29 18:25:55 +02:00
mjentsch
0bcbb272ee Don't require manual compiling of libtgl.a before building the Adium bundle 2015-05-27 21:51:08 +02:00
mjentsch
f092273bf6 Fix displaying messages send from other sessions 2015-05-25 22:36:30 +02:00
mjentsch
bad92d3bd6 Fix segfault when receiving images as documents 2015-05-24 14:56:59 +02:00
mjentsch
82b36060b8 Fix progress of receiving file transfers in Adium
Set the xfer before requesting the xfer from the user, as this is the only time when Adium sets the xfer size in its controller class.
2015-05-24 14:55:26 +02:00
mjentsch
b5fb8df3b7 rename key visualization function 2015-05-24 00:23:28 +02:00
mjentsch
c3abf27376 Add support for displaying stickers in chats 2015-05-24 00:22:31 +02:00
mjentsch
899f6bf167 Include segfault-fix in libtgl 2015-05-23 03:10:58 +02:00
mjentsch
efb0f56598 improve secret chat error handling for unsupported features 2015-05-23 03:10:34 +02:00
mjentsch
74f6b6e2f7 Improve support for receiving pictures in secret chats 2015-05-23 03:10:08 +02:00
mjentsch
87ae72a739 cleanup 2015-05-23 03:08:11 +02:00
mjentsch
e022b46ea0 Determine automatic filename, in case caption is missing 2015-05-23 03:07:44 +02:00
mjentsch
aec0cda21b Fix broken secret chats after reload 2015-05-23 02:06:40 +02:00
mjentsch
b415bbd3b4 Update to libtgl v2 2015-05-23 00:18:26 +02:00
mjentsch
6614c25cbc Add workaround for telepathy haze
Use home directory for storing configs, in case purple settings are in a tmp directory
2015-05-02 14:28:49 +02:00
mjentsch
6e501a2a56 Add RPM packaging spec 2015-04-07 22:45:16 +02:00
mjentsch
14e5e106b7 Don't drop secret chat state updates 2015-04-06 16:43:10 +02:00
mjentsch
65f8c4aa6e Handle DC updates during authentication 2015-04-06 16:37:01 +02:00
mjentsch
e0d1f77a79 cleanup 2015-04-05 00:38:22 +02:00
mjentsch
1c7eebbe7c Ensure that messages are not sent during events.
Don't cause segfault in libtgl when add_log_event is called twice.
2015-04-03 01:23:09 +02:00
mjentsch
8a678f98cc Coding style 2015-04-02 22:27:23 +02:00
mjentsch
43266f4a0f Fix adium account settings view 2015-03-28 12:33:29 +01:00
mjentsch
1573309875 Fix retrieval threshold unlimited 2015-03-28 12:22:19 +01:00
mjentsch
13cf093ab1 Update README 2015-03-21 23:54:08 +01:00
mjentsch
fdd05f19b1 Update version 2015-03-21 18:32:41 +01:00
mjentsch
c6669a508d Don't display "empty chat" messages, created confusing output in a few cases. 2015-03-21 17:25:48 +01:00
mjentsch
517604a2b4 Small fixes 2015-03-21 00:56:32 +01:00
mjentsch
5463090d48 Fix naming inconsitency 2015-03-20 18:21:52 +01:00
mjentsch
95db4f42a0 Include file transfer filename fix in tgl submodule 2015-03-20 18:18:00 +01:00
mjentsch
a8314eb3ae Only display chats the user is currently member of in chat the "join chat" view 2015-03-20 17:48:54 +01:00
mjentsch
293c6049a6 Display warning when opening a chat the current user is no longer a member of 2015-03-20 17:47:22 +01:00
mjentsch
0664c5b2fe Clean up inconsitencies in prpl tgl data type wrapper functions 2015-03-20 17:45:21 +01:00
mjentsch
f98ec356ba List all existing group chats in the chat join view 2015-03-20 15:48:15 +01:00
mjentsch
9838eb7b85 Add basic chat join view for the Adium Plugin 2015-03-18 22:33:26 +01:00
mjentsch
a0700adeb0 Fix segfault on chat join in Pidgin 2015-03-15 15:59:27 +01:00
mjentsch
4382e1d779 Add custom preferences views for the Adium plugin 2015-03-15 15:56:57 +01:00
mjentsch
5a6b08f60f cleanup
reorder a few functions
2015-03-13 19:47:41 +01:00
mjentsch
7e03ff6e1b Remove naming incosistency 2015-03-13 18:40:28 +01:00
mjentsch
9317fa0f17 Add basic support for read notifications
Add option to enable read notifications in chats and display read notifications as sytem messages.
2015-03-13 18:38:35 +01:00
mjentsch
a480867d99 Remove obsolete purge command
Purge command stopped working when telegram state file path was changed a few commits earlier.
2015-03-13 16:58:39 +01:00
mjentsch
9c1628e18f Remove unused callbacks 2015-03-13 16:57:43 +01:00
mjentsch
7903ce1811 Fix user online/offline status
Fix bug that prevented users from being displayed as online. Add option to set inactive users offline after a certain amount of days. Clean up user status code.
2015-03-13 16:57:08 +01:00
mjentsch
0590862151 Add support for file transfers in encrypted chats 2015-03-13 00:18:01 +01:00
mjentsch
077edc19d5 Repository cleanup and coding guidelines 2015-03-13 00:17:35 +01:00
mjentsch
c375ed1df0 Support for history retrieval threshold
Include option to define the maximum amount of days, for which the history should be fetched. Introduce 14 days as default, to reduce performance issues or crashes when the user hasn't been using telegram-purple for a long time.
2015-03-13 00:16:26 +01:00
mjentsch
b67c4115ff Repository cleanup and housekeeping 2015-03-12 01:56:16 +01:00
mjentsch
1b7dd971d8 Don't segfault when transfer filename is not set 2015-03-12 01:39:48 +01:00
mjentsch
a0b873933a Remove colors from messagelog 2015-03-12 01:39:03 +01:00
mjentsch
1e442ac195 Ensure that the message sequence doesn't get mixed up
Process incoming messages in a queue. Move all message-related functionality into one file.
2015-03-12 01:38:17 +01:00
mjentsch
95258c940b Handle message size properly
Split oversized messages into chunks in case they are too big and make max amount of chunks configurable in settings.
2015-03-10 16:23:43 +01:00
mjentsch
249588a49d Handle missing public key more gracefully
Don't crash pidgin and display an error message when no public key is not found.
2015-03-10 02:01:42 +01:00
mjentsch
cd8085ce5a Use purple configuration directory for storing telegram state files 2015-03-09 16:03:10 +01:00
mjentsch
489535fbd4 Add DC hotfix in submodule 2015-03-09 15:44:16 +01:00
mjentsch
2d94194d45 Fix segfault on automatic chat join
Check if peer was already allocated in chat_show. The auto-join flag can be safely ignored, all incoming chat messages are added to the chat anyways and will trigger an opening of the chat.
2015-03-07 16:21:26 +01:00
mjentsch
c994730f3e Add hotfix number to Adium version 2015-03-05 00:58:57 +01:00
mjentsch
fffe7519d7 Don't drop HTML markup in Adium 2015-03-05 00:57:36 +01:00
mjentsch
8548576651 Fix file permissions again
Directories need to be executable for opening.
2015-03-04 23:32:29 +01:00
mjentsch
9cddd63f96 Clean up repository 2015-03-04 23:17:23 +01:00
mjentsch
81ab5bf1f3 Fix install script on all plattforms
Creating missing directories when installing regular files is not supported on BSD install.
2015-03-04 23:16:03 +01:00
mjentsch
0cc28ecea6 Fix configuration script 2015-03-04 23:05:02 +01:00
mjentsch
97c393db4b Update version to 0.7.0 and make changelog a Mardown 2015-03-04 22:38:58 +01:00
mjentsch
deaa659895 Fix segfault in file transfer memory management 2015-03-04 22:37:59 +01:00
mjentsch
39c9d6d5b4 Fix file transfer progress in Adium
Set sent bytes to file size manually, since Adium won't do it automatically and also wont display the file transfer as completed as a result.
2015-02-28 15:44:59 +01:00
mjentsch
9fca523161 Implement file transfer in Adium Plugin
Implement file transfer protocol in Plugin and fix a few things that stopped old file handling from working with Adium.
2015-02-25 22:53:28 +01:00
mjentsch
64e0a7f35f Fix plugin for Centos 6 by removing functions unsupported in old glib versions 2015-02-23 20:34:24 +01:00
mjentsch
c9aab9c8eb Support file transfers 2015-02-23 20:34:24 +01:00
mj
8fec18e8c4 Merge pull request #43 from flyvint/master
Fix install
2015-02-04 19:06:12 +01:00
vint
832b56c4e7 Fix install 2015-02-04 18:42:42 +03:00
mjentsch
3ccd738d5c Update CHANGELOG 2015-01-30 19:47:43 +01:00
mjentsch
c3445be62f Fix debug logging linebreaks 2015-01-30 01:08:00 +01:00
mjentsch
bf511c94af Display an extra alert when the connection fails 2015-01-29 01:03:19 +01:00
mjentsch
7ffe2694cc Use pull-request branch temporarily 2015-01-29 00:21:49 +01:00
mjentsch
e545057039 Fix outgoing image messages 2015-01-28 20:05:08 +01:00
mjentsch
bb29ee82bc Rather just change this than fiddling around with c standards in the makefile 2015-01-28 19:43:42 +01:00
mjentsch
f6570914a6 Fix framework include paths in XCode
If you are compiling the Adium plugin with XCode yourself, this will break your Project and you will have move all frameworks into telegram-adium/Frameworks/Adium (sorry about that)
2015-01-28 19:07:10 +01:00
mjentsch
3b940fca1d Fix outgoing messages for Adium and old libpurple versions 2015-01-28 18:51:07 +01:00
mjentsch
c85b8da619 Do not add group chats in which the user is not a member
Clean up and refactor group chat code, move chat functions into separate file, always load all chat infos on plugin load so we know the members.
2015-01-28 18:41:41 +01:00
mjentsch
2ec44834fc Fix bugs in makefile
Remove -D from install script, since its not supported in all versions. Libpurple has created all of those directories, and if they do not exist, there is a different problem so cancelling those installation should be a good thing.
2015-01-26 23:06:04 +01:00
mjentsch
73913b3a2c Fix Adium incoming group chat message problem 2015-01-26 19:01:18 +01:00
mjentsch
e938132721 Clean up and fix coding style 2015-01-25 22:49:46 +01:00
mjentsch
45bd244593 Update to 0.6.1 to and handle version in autoconf 2015-01-25 22:43:43 +01:00
mjentsch
aa28f37d37 Fix Makefile.in on OSX
Include DEFS generated by configure into makefile.
2015-01-25 21:25:27 +01:00
mjentsch
adc429beb4 Fix coding style and remove old commented-out code 2015-01-23 20:56:50 +01:00
mjentsch
2f44ea928f Fix memory leak 2015-01-23 20:47:23 +01:00
mjentsch
048ef56eee Remove username normalization
We don't have one unified username format, it can be a name, a phone number or a user id. Therefore we can't put it into a unified format without eventually breaking things.
2015-01-23 20:42:20 +01:00
mjentsch
51bb79947c Improve writing to state file and clean up repository
Instead of using a timer, schedule writes on each new messages. This ensures that there are not too many writes on big updates and still works without a long-running timer.
2015-01-23 16:37:22 +01:00
mjentsch
1dd7be0262 Fix segfault by canceling pending login timer on close 2015-01-22 21:28:13 +01:00
mjentsch
3f70192cd3 Sleeker README, move changelog to separate file 2015-01-22 01:21:31 +01:00
mjentsch
ac9ce29b1d Fix user info and clean up source code 2015-01-22 00:16:35 +01:00
mjentsch
58f34cbe8a Merge branch 'fix-centos' 2015-01-20 00:45:32 +01:00
mjentsch
7ef1648180 Remove more functions unsupported in old glib versions 2015-01-20 00:23:32 +01:00
mjentsch
6ba649fdba Remove functions unsupported in old glib versions 2015-01-19 23:47:46 +01:00
mjentsch
977947a357 Revert "Respect destdir in public key path"
This reverts commit 5985d08fc5.
2015-01-19 23:26:02 +01:00
mjentsch
8f136c2aa6 Merge branch 'master' into fix-centos 2015-01-19 22:47:39 +01:00
mjentsch
97257f5d32 Fix submodule makefiles 2015-01-16 16:29:17 +01:00
mjentsch
f90f812f2b Fix compiler warnings 2015-01-16 12:39:04 +01:00
mjentsch
871a06a5bd fix makefile for tgl 2015-01-16 12:38:44 +01:00
mjentsch
96821b8d67 Add release scheme for XCode project 2015-01-16 10:57:59 +01:00
mjentsch
dbd7d5638b Add better input validation for phone number 2015-01-16 10:38:16 +01:00
mjentsch
ae4b0fc92b Fix search path in xcode project 2015-01-15 22:07:10 +01:00
mjentsch
ab61a44c17 Update used version of tgl 2015-01-15 21:49:36 +01:00
mjentsch
a08a267e22 fix compat. with centos 2015-01-13 22:10:31 +01:00
mjentsch
5985d08fc5 Respect destdir in public key path 2015-01-11 00:39:10 +01:00
mj
87fad25bde Merge pull request #29 from acran/master
Bugfix: always respect $(DESTDIR) in Makefile
2015-01-11 00:36:33 +01:00
mjentsch
9dc697059d Change README 2015-01-10 14:26:36 +01:00
mjentsch
0ad955688c Update TODO list 2015-01-10 12:54:53 +01:00
mjentsch
498eebba6d Move installation instructions to top 2015-01-10 12:15:27 +01:00
mjentsch
a1feffc841 Change README 2015-01-10 12:11:03 +01:00
mjentsch
7353fdcf5c Change README 2015-01-10 11:40:41 +01:00
mjentsch
b2627d9d5c Display stub messages for unimplemented methods and clean up unused code 2015-01-10 11:07:01 +01:00
mjentsch
26743c55a8 update version in xcode project 2015-01-10 00:15:23 +01:00
mjentsch
c02fc83879 Update Version 2015-01-09 20:05:01 +01:00
mjentsch
36744dbf7f Display notification on pending secret chats 2015-01-09 18:09:28 +01:00
mjentsch
5553de65f6 Remove exponential timeouts to prevent segfaults
Do not create the reconnection timeout, since we don't use it anymore and it caused segfaults.
2015-01-09 11:56:03 +01:00
mjentsch
cb9d744d57 Add missing files to XCode project. 2015-01-09 11:34:40 +01:00
mjentsch
376a1165af Use newest version of tgl 2015-01-07 23:25:08 +01:00
mjentsch
9e072f0ebb Some cosmetic changes and code cleanup 2015-01-07 22:50:53 +01:00
mjentsch
4bf90fc333 Do not automatically accept secret chats
Allow the user to decide if a secret chat should be handled by Pidgin. Add options
to set default behavior for secret chets.
2015-01-07 22:28:36 +01:00
mjentsch
a0981c0abb Coding style 2015-01-07 16:54:56 +01:00
mjentsch
e8f30f2284 Handle secret chat deletions 2015-01-07 16:54:35 +01:00
root
97c3ff894a Added basic user info to encrypted user 2015-01-06 18:30:03 +01:00
mjentsch
ed47a16de1 Fix get_info for encrypted chats 2015-01-04 15:29:41 +01:00
mjentsch
0e9b0606b9 Create extra directories for lodepng in build output 2015-01-04 15:14:17 +01:00
mjentsch
34b026dc34 Handle user name formatting in tgl callback 2015-01-04 12:37:23 +01:00
mjentsch
1dda956166 Support secret chats
Load and store secret chats in a file, handle secret chat updates, visualize fingerprint in settings
2015-01-04 12:36:13 +01:00
mjentsch
0c718206d7 Move lodepng into separate folder 2015-01-02 22:03:47 +01:00
mjentsch
f834b7cd38 Fix memory leak 2015-01-02 19:55:43 +01:00
mjentsch
817ab52aae Merge branch 'master' into support-secret-chats
Conflicts:
	Makefile.in
	telegram-base.c
	telegram-base.h
	telegram-purple.c
	telegram-purple.h
2015-01-02 14:29:42 +01:00
mjentsch
8881011fac Move key visualization function into base functions 2015-01-02 14:12:52 +01:00
mjentsch
4dba56db58 Remove unused functions for adding/removing multiple buddies
Libpurple will automatically iterate the list of buddies and call purple_add_buddy for each entrie
if those functions are missing.
2015-01-02 13:51:48 +01:00
mjentsch
106f828b9e Mark chat messages as read 2015-01-02 12:54:41 +01:00
mjentsch
4a4179d262 Fix group-message sending in Adium 2015-01-01 18:02:14 +01:00
mjentsch
9d61f6815b Remove duplicate user alias change handling 2015-01-01 17:27:05 +01:00
mjentsch
c1ab317f1b Error connection instead of reconnecting
Reconnection attempts are expected to be handled by libpurple and not by the protocol plugin, so it is visible to the user when the connection is not working.
2014-12-31 16:17:11 +01:00
mjentsch
94b4390c8c Add new files to Makefile 2014-12-28 00:23:35 +01:00
mjentsch
00ece8a3b4 Fix huge memory leak
Implement proper handling of imgstore reference counting and remove
several leaky memdup functions
2014-12-27 23:40:25 +01:00
mjentsch
e3caa6acdb Remove unused functions and add some comments 2014-12-26 19:19:29 +01:00
mjentsch
d08e54d3e0 Move functions and defintions for plugin-internal structs into separate file and fix memory leak 2014-12-26 18:54:12 +01:00
markus
2f752c7fd5 added secret chat buddy option 2014-12-24 12:20:01 +01:00
mjentsch
4fa2b91eaa Mark messages as read
Send a mark_read command for each received message as soon as the user is available.
2014-12-24 02:44:10 +01:00
root
2937140a07 added lodepng lib and function to genearte image from hashkey 2014-12-19 13:57:20 +01:00
mjentsch
91b8cb5bb1 Add proper error handling for login phase 2014-12-19 11:22:24 +01:00
mjentsch
b2c26771b5 Fix segmentation fault on chat creation update
Check for null-pointer before passing hash table content to strcmp
2014-12-13 16:09:09 +01:00
Roman Anasal
17065ba1cb Bugfix: always respect $(DESTDIR) in Makefile 2014-12-10 12:42:44 +01:00
mj
f1549804a5 Merge pull request #22 from malishev/better-icons
Better icons
2014-11-30 13:29:41 +01:00
vvaltman
68d69e1da8 Use latest version of tgl 2014-11-27 21:53:21 +03:00
vvaltman
433a96a9d1 Show outgoing messages 2014-11-27 17:33:17 +03:00
mjentsch
8dcc2a55f7 Update README 2014-11-26 15:11:05 +01:00
mjentsch
69360b4f57 Implement better fallback mode in case requests is missing
Open a dummy chat to query the user for the entered SMS code
2014-11-26 12:32:19 +01:00
mjentsch
62909f9c83 Implement better fallback behavior if requests.h is missing
When compat-mode is activated or purple_request does not return a valid handle, open a new conversation and query the user for the SMS code.
2014-11-26 09:30:43 +01:00
mjentsch
c934f5742b Merge branch 'master' of https://github.com/majn/telegram-purple into support-secret-chats 2014-11-26 09:26:02 +01:00
Yuri
d30dfb047a Better icons 2014-11-24 23:01:58 +03:00
Vysheng
50c52b091c Fixed -lrt check 2014-11-24 20:37:10 +03:00
vvaltman
674a2935cf Makefile.in: deleted -m64 option 2014-11-24 19:42:31 +03:00
mjentsch
82b11fffa3 Fix argument types in secret chat update callback 2014-11-24 13:34:00 +01:00
mjentsch
04e8c3e0cd Add stubs for handling updates of secret chats 2014-11-24 13:26:00 +01:00
mjentsch
8bd58265fd Update plugin description version 2014-11-24 12:51:14 +01:00
mjentsch
d0b318ee21 Don't display own messages twice in Pidgin 2014-11-24 09:26:57 +01:00
mjentsch
33c49321fd Fix potential segfault 2014-11-24 01:35:55 +01:00
mjentsch
5327b8825b Remove outdated stuff from README 2014-11-24 01:26:30 +01:00
mjentsch
4fa71f579b Remove duplicated code 2014-11-24 01:04:31 +01:00
mjentsch
653d8a8f2d Update README 2014-11-24 00:58:53 +01:00
mjentsch
9062ee8b46 Add vysheng to authors 2014-11-24 00:26:07 +01:00
mjentsch
7709f2fd3d Merge branch 'master' into tgl-test 2014-11-24 00:03:36 +01:00
mjentsch
a7f4669982 Update README 2014-11-23 23:54:06 +01:00
mjentsch
0a759867e2 Print service messages 2014-11-23 23:43:39 +01:00
mjentsch
20278e3c26 Support adding new contacts 2014-11-23 21:18:13 +01:00
mjentsch
b926b4d266 Respect user and chat updates during runtime
Update chat and user properties, update user profile photos, delete users and chats
2014-11-23 19:52:08 +01:00
mjentsch
3e7be633eb Do not add our own messages to chats to prevent them from showing up twice 2014-11-23 00:27:44 +01:00
mjentsch
c847bce557 Make: link libraries after including objects in linker step
Including libraries before the objectse will result in improperly linked OpenSSL library (see issue #3)
2014-11-22 22:39:33 +01:00
vvaltman
75251d9379 Send typing notifications 2014-11-22 18:17:47 +03:00
vvaltman
10ca6ccd46 telegram-base: fixed bug in read_state 2014-11-22 17:32:10 +03:00
vvaltman
6e19bc87cf Fixed duplicate free. Escape received messages. Updated to latest tgl 2014-11-21 19:36:48 +03:00
mjentsch
d3c045711e Unescape HTML special chars on outgoing messages 2014-11-21 16:42:53 +01:00
mjentsch
210741de43 Add "image" flag to all picture messages 2014-11-21 16:30:03 +01:00
mjentsch
d755992821 Prevent infinite loop on lost network connection
Increase the timeout exponentially on failed connections to prevent an infinite loop of reconnects.
2014-11-21 16:03:17 +01:00
mjentsch
54f6a29456 Accept conn_failed as valid state on timeouts
When the internet connection is lost, in some cases libpurple can return a file descriptor without any error that is still not writable or readable. In that case, the connection would remain in the state conn_error until the next ping timeout, which has been causing an assertion error until now.
2014-11-21 16:03:17 +01:00
vvaltman
3e4fc8513f Added support for incoming pictures 2014-11-21 17:44:49 +03:00
vvaltman
27206a6f69 Updated to latest version of libtgl 2014-11-18 17:45:19 +03:00
vvaltman
5d19892508 Use correct app_id 2014-11-17 18:24:09 +03:00
Vysheng
3025c63350 small bugfixes 2014-11-17 16:27:01 +03:00
mjentsch
ba177d885a Add compatibility mode to support SMS authentication on clients that can't prompt the user directly
Read the sms code from settings in case compatibility mode is selected or
the purple_request functions do not return a valid code.
2014-11-16 21:55:36 +01:00
mjentsch
2586273f72 Clean up README and license headers 2014-11-16 20:41:03 +01:00
mjentsch
e3e8fb7984 Clean up repository
Remove outdated comments, refactor function names, conform to coding guidelines
2014-11-16 20:39:10 +01:00
mjentsch
ef23a1b589 Fix coding guidelines 2014-11-16 17:56:55 +01:00
mjentsch
22a37c3894 Wrap purple functions for use with libtgl types 2014-11-16 16:33:27 +01:00
mjentsch
6cdd435ace Fix README installation guide pictures 2014-11-15 18:02:21 +01:00
mjentsch
fad61cb3d8 Fix readme (again) 2014-11-15 17:58:41 +01:00
mjentsch
bc110cde96 Fix download link 2014-11-15 17:53:34 +01:00
mjentsch
1cb745aa65 Remove obsolete note about ubuntu build from README 2014-11-15 01:26:28 +01:00
mjentsch
2f788edd99 Adapt telegram-adium to changes in submodule path 2014-11-15 01:24:20 +01:00
mjentsch
363c170550 Free read-event properly in tgln_free 2014-11-15 01:14:29 +01:00
mjentsch
6a401eb4bd Fix Adium plugin 2014-11-13 00:45:51 +01:00
vvaltman
b82f391749 Fixed README 2014-11-13 01:58:03 +03:00
vvaltman
6a36be8b10 Deleted Makefile 2014-11-13 01:56:15 +03:00
Vysheng
8bdf22648d Merge branch 'tgl-test' of github.com:majn/telegram-purple into tgl-test
Conflicts:
	.gitignore
	Makefile
	telegram-base.c
	telegram-purple.c
2014-11-12 21:37:09 +03:00
Vysheng
5b4f1cd450 Updated to use subdirectory. Fixed buffer overflow in date format 2014-11-12 21:23:01 +03:00
Vysheng
8ebbdfbaff updated .gitignore 2014-11-11 20:38:01 +03:00
Vysheng
f46c685bbd Rewritten to use libtgl 2014-11-11 20:29:09 +03:00
Vysheng
0894c093a5 Added missing files 2014-11-11 20:24:30 +03:00
Vysheng
8f69d8d11d Slightly working version 2014-11-11 20:21:14 +03:00
mjentsch
1b6fdf44e8 Fix link to Adium bundle for 0.3.3 2014-11-05 21:52:18 +01:00
mjentsch
560b55b299 Don't print debug messages in unused functions 2014-10-31 20:37:30 +01:00
mjentsch
bd4bc51651 Fix library includes in linker step 2014-10-28 01:20:30 +01:00
mjentsch
a9a48fff90 Update version to 0.3.3 2014-10-14 22:29:22 +02:00
mjentsch
c54ebf5c17 Error the telegram-plugin on failed connections, so hopefully libpurple will inform the user and restart it once the connectivity is back 2014-10-14 22:15:02 +02:00
mjentsch
b3642e2e7e Remove correct server.pub when uninstalling 2014-10-14 22:08:15 +02:00
mjentsch
91ac1b06ee Remove old printfs of telegram-cli to fix issues on Finch 2014-10-14 22:06:29 +02:00
mjentsch
2b366fe1a8 Fix segfaults on disconnect 2014-10-14 18:59:04 +02:00
mjentsch
d5fb1601b7 cleanup useless comments 2014-10-14 18:53:59 +02:00
mjentsch
4843c4052d Remove linebreaks from user names 2014-10-10 17:28:10 +02:00
mjentsch
61c8735578 Force-free all open connections on close 2014-10-10 17:26:31 +02:00
mjentsch
2bebb7ab62 Display time correctly and don't display empty messages 2014-10-10 17:16:16 +02:00
mjentsch
a8f228cef5 Upgrade to version 0.3.2 2014-10-09 21:31:33 +02:00
mjentsch
531a36fa63 Add comments and logging messages to event listener stubs 2014-10-09 20:26:47 +02:00
mjentsch
8a63df1529 Fix TelegramService settings 2014-10-09 20:21:12 +02:00
mjentsch
d66775cc70 Avoid compiler warnings 2014-10-09 20:20:21 +02:00
mjentsch
b2d3a39fb4 Do not use colors when compiling for production mode
Pidgin and Adium debug logs do not display terminal color codes correctly, avoid that.
2014-10-09 20:13:08 +02:00
mjentsch
531d27ef61 Set Build-Target for Adium Plugin to OSX 10.8 and include AppKit 2014-10-09 20:12:22 +02:00
mjentsch
056d7c7c19 Improve README and update to version 0.3.1 2014-10-06 23:18:45 +02:00
mjentsch
dd27d4f66c Remove unused includes from XCode project 2014-10-06 22:59:18 +02:00
mjentsch
7d63485e0a Fail gracefully on error responses by server 2014-10-06 22:58:16 +02:00
mjentsch
2f7f2068de Improve event handling-system 2014-10-06 22:57:20 +02:00
mjentsch
290a3251e6 Remove unused code 2014-10-06 22:56:02 +02:00
mjentsch
3773562201 Do not compile on uninstallation 2014-10-05 20:54:24 +02:00
mjentsch
17e925e4ef Add Makefile target "purge" to delete all user data 2014-10-05 20:53:14 +02:00
mjentsch
41b3230a9f Update version and README 2014-10-05 15:38:31 +02:00
mjentsch
bfb663088d Don't include libcrypto in working tree 2014-10-05 15:34:51 +02:00
mjentsch
535c0f645e Merge branch 'adium-plugin' 2014-10-05 14:46:35 +02:00
mjentsch
ac266fb1f5 Set "Release" build as default in XCode Project 2014-10-05 14:19:40 +02:00
mjentsch
8eacac2b87 Load public key from Adium bundle 2014-10-05 14:19:05 +02:00
mjentsch
b48e1b240e Use mobile-state instead of unavailable, to ensure proper display in Adium 2014-10-05 12:29:15 +02:00
mjentsch
4b7b1e0010 Fix includes and remove obsolete code 2014-10-05 12:25:23 +02:00
mjentsch
feff8675db Add missing license to adium plugin 2014-10-05 12:21:29 +02:00
mjentsch
cc03e5d059 Update adium wrapper settings 2014-10-05 12:19:15 +02:00
mjentsch
8bc8d2477e Deploy bundle on run 2014-10-05 00:24:41 +02:00
mjentsch
b6c9515de4 Rename struct user to a avoid name collisions 2014-10-05 00:12:31 +02:00
mjentsch
114bce7d45 Fix dependencies and build settings in XCode project 2014-10-05 00:09:33 +02:00
mjentsch
b5e242ea40 Do not include framework files 2014-10-04 23:42:08 +02:00
mjentsch
922fe0e090 Do not use Macros to represent Booleans 2014-10-04 20:36:54 +02:00
mjentsch
c5d7fdb89c Fix build process by adjusting search path and adding missing libraries
Add openssl and libz, don't warn about deprecated functions and add purple and glib to the search path so we don't need to change the includes in our other files
2014-10-04 20:36:54 +02:00
mjentsch
de82654434 Ignore more XCode userdata 2014-10-04 20:36:54 +02:00
mjentsch
f16f32d8c4 Rename struct user to struct tgl_user to avoid namespace collisions with osx system headers 2014-10-04 20:36:54 +02:00
mjentsch
f58302be5e Ignore XCode xcuserstate file and remove it from cache 2014-10-04 20:33:28 +02:00
mjentsch
d3d8903b49 Add a nicer description 2014-10-04 20:32:59 +02:00
mjentsch
706a28a4e6 Add xCode project files for an Adium telegram plugin 2014-10-04 20:32:59 +02:00
mjentsch
cc09ab19e0 Fix errors in README 2014-10-04 12:19:43 +02:00
mjentsch
da8ff5782c Move Ubuntu note to Debian 2014-10-03 18:50:09 +02:00
mjentsch
cf1bd23762 Add manual for installing Emojis 2014-10-03 18:42:25 +02:00
mjentsch
83c09aeed3 Remove useless protocoll options 2014-10-03 18:24:16 +02:00
mjentsch
84e549fc96 Use correct DC number for our updated application configuration 2014-10-03 18:21:20 +02:00
mjentsch
e3d6f02a67 Add form for phone registratrion 2014-10-03 17:34:10 +02:00
mjentsch
334101c406 Improve logging system 2014-10-03 14:23:15 +02:00
mjentsch
c870e967db Send bytes to correct connection on importAuth 2014-10-03 00:14:57 +02:00
mjentsch
1082e4d18a Add install instruction for openSuse 2014-10-02 23:10:45 +02:00
mjentsch
598559105f Fix importAuthorization 2014-10-02 23:10:23 +02:00
mjentsch
30ebe78fca Avoid invalid cast warning 2014-10-02 17:32:37 +02:00
mjentsch
4f711c16d7 Update README 2014-10-02 17:11:42 +02:00
mjentsch
30f6f0d381 Add makefile 2014-10-02 14:17:36 +02:00
mjentsch
a7f0b16599 Remove automake 2014-10-02 13:56:29 +02:00
mjentsch
97c8b37121 Do not use old tg-cli directory for storing files 2014-10-02 13:30:44 +02:00
mjentsch
d4eff42a42 Use our own application configuration 2014-10-02 13:29:54 +02:00
mjentsch
3fa72a9d42 Remove unused binlog functions 2014-10-02 13:01:28 +02:00
mjentsch
89ddae23ef Restart ping-timer on read 2014-10-02 12:49:46 +02:00
mjentsch
7c69af9b00 Remove unused code 2014-10-02 12:46:19 +02:00
mjentsch
1954cb0d63 Add hotfix for "new group message"-infinite loop 2014-10-02 12:31:17 +02:00
mjentsch
5c488f9c8d Support downloads from foreign DCs 2014-10-02 12:29:02 +02:00
mjentsch
d6530b69bb Don't show info window on first user load 2014-09-21 22:30:50 +02:00
mjentsch
a6013016f1 Ensure that download directory exists 2014-09-21 00:11:07 +02:00
Christopher Althaus
164620f65d Add show user icons in buddy list 2014-09-20 23:20:14 +02:00
mjentsch
8919d2c3ec Improve README 2014-09-20 18:39:13 +02:00
mjentsch
52058a52e3 Fix errors in README 2014-09-20 18:18:34 +02:00
mjentsch
90bed1ef61 Provide english readme file and update build instructions 2014-09-20 18:13:46 +02:00
mjentsch
55949d8d92 Update build tool dependencies and add a new configure 2014-09-20 18:13:02 +02:00
mjentsch
81e9eed71f Ignore core dumps 2014-09-20 18:12:00 +02:00
mjentsch
73f44ffe0b Remove non-working checks for glib and libpurple (for now) and generate a new configure 2014-09-20 16:57:50 +02:00
mjentsch
92a57d18bb Don't check for libreadline and but check for glib and libpurple in configure 2014-09-20 16:24:43 +02:00
mjentsch
cd8866c4e2 Remove unused includes of libreadline 2014-09-20 16:23:39 +02:00
mjentsch
7fa1600e0b Add log output for received message types 2014-09-20 10:04:40 +02:00
mjentsch
c1f170467c Flush connection after execiton of timer function 2014-09-20 10:02:49 +02:00
mjentsch
4c358b6962 Don't open multiple chats when multiple messages arrive while a chat is still not joined 2014-09-19 18:22:11 +02:00
mjentsch
bb87200d5f Fix a bug that caused old messages to not be loaded on startup
Do not overwrite state file with secret chat file, provide flag for complete sync from start in do_get_difference
2014-09-18 22:26:08 +02:00
mjentsch
4a062b764f Use a separate handles for each mtproto_connection 2014-09-17 22:51:46 +02:00
Matthias Jentsch
dcf9b4f427 Do not free tree elements manually, the tree already does that 2014-09-10 18:09:57 +02:00
Matthias Jentsch
703d6e9e2e Remove overlooked merge leftovers 2014-09-10 16:23:44 +02:00
mjentsch
1f7f768bb5 Merge branch 'master' of bitbucket.org:telegrampurple/telegram-purple
Conflicts:
	purple-plugin/telegram-purple.c
2014-09-09 19:14:28 +02:00
mjentsch
07a0766948 Fix sending and receiving of messages in group chats
Add received messages to correct group chat, open closed chats on received messages, display our name correctly, handle messages from ourself correctly.
2014-09-08 23:10:25 +02:00
mjentsch
00944910bc Remove pinging 2014-09-08 23:09:55 +02:00
mjentsch
7d8ec1ef42 Add missing message allocated handlers 2014-09-08 23:09:20 +02:00
Christopher Althaus
9d23ecac7f Added group chat functions 2014-09-07 21:44:37 +02:00
mjentsch
956a034be1 Add group chats 2014-09-07 20:56:44 +02:00
mjentsch
709b7f2cdb Use current home for config instead of a static directory 2014-09-07 13:48:25 +02:00
mjentsch
f0447fa958 Free all pending timers and queries after erroring 2014-09-06 01:09:47 +02:00
mjentsch
ce96381ef9 write secret chat file into user-specific directory and fix config path creation 2014-09-06 01:04:57 +02:00
mjentsch
40485fabdc Remove unused code 2014-09-05 21:23:22 +02:00
mjentsch
a05b3b8405 fix typo 2014-09-05 21:19:37 +02:00
mjentsch
4f33201d09 Don't leak data center list when closing down telegram 2014-09-04 22:07:25 +02:00
mjentsch
a7bb59a13a move message store size into telegram.h 2014-09-01 22:25:02 +02:00
mjentsch
178583cd72 Clean up whitespaces and ugly code 2014-09-01 22:23:59 +02:00
mjentsch
f39eaa5f99 Fix telegram-purple functions that broke when removing globals 2014-09-01 22:21:45 +02:00
mjentsch
305253b3f6 Add a few comments 2014-09-01 22:17:42 +02:00
mjentsch
0aa8a9de15 Remove "_network" from telegram connect function 2014-09-01 22:14:40 +02:00
mjentsch
fa457a6900 Clean up out-commented code 2014-09-01 21:59:23 +02:00
mjentsch
b90c9453da Free memory and close connections on disconnect 2014-09-01 21:57:35 +02:00
mjentsch
d94dc52df0 Remove remaining global variables 2014-09-01 21:43:22 +02:00
mjentsch
2e50ec47b7 Merge user-status 2014-08-23 17:36:52 +02:00
mjentsch
6706ac14cb Merge branch 'States' 2014-08-23 16:42:14 +02:00
Christopher Althaus
6441c6be4b Fixed telegram notification client bug 2014-08-23 16:40:30 +02:00
Christopher Althaus
fa9d45bd20 User State/Typing implemented
Send Messages activated
2014-08-23 16:23:37 +02:00
mjentsch
386abe2ab9 Merge branch 'refactor-telegram-cli' 2014-08-23 13:03:55 +02:00
mjentsch
5a425be62f Remove unused code and build files 2014-08-23 12:57:38 +02:00
mjentsch
832cf949f0 Fix message allocation 2014-08-23 11:18:42 +02:00
mjentsch
eec5ea50aa Remove globals containing account and connection from the purple plugin to enable multiple connections 2014-08-23 02:56:47 +02:00
mjentsch
dddbe451c1 fix a bug in the configuration writer
creates new configuration files readable and writable
2014-08-23 02:55:13 +02:00
mjentsch
7ee334ec37 Fix user registration 2014-08-23 02:52:04 +02:00
mjentsch
32039628a6 Remove unneeded commented code 2014-08-23 02:44:57 +02:00
mjentsch
d062ec44d0 Switch to ready-state when the data center is already registered 2014-08-23 02:41:26 +02:00
mjentsch
a4e5449d5a Move telegram callbacks and settings into configuration struct 2014-08-23 02:40:10 +02:00
mjentsch
f09b4c1c87 Move config function to avoid predeclaration 2014-08-22 19:02:11 +02:00
mjentsch
c81ce16e80 Fix coding style and add missing docstrings 2014-08-22 18:57:14 +02:00
mjentsch
8ff9734077 Handle the SWITCH_DC RPCError by changing the data center and creating a new mtproto_connection 2014-08-22 18:54:25 +02:00
mjentsch
5d8d170927 Use allocation utilities from utilites.h and initiate telegram with zeroes 2014-08-22 18:44:23 +02:00
mjentsch
c144484fd5 Add memory management for mtproto_connections
Mark connections for destruction on close and free all allocated memory only once all incoming queries are read, since those queries will still access data on the current mtproto_connection and cause segmentation faults.
2014-08-22 18:41:35 +02:00
mjentsch
1e6598c11c Request proxy connections by callback
Require the user of telegram to provide a callback to create and cleanup proxy connections, to allow
the application to create new connections when needed.
2014-08-22 18:28:58 +02:00
mjentsch
1b1c5d132a Remove overlooked incrementation of queries_num 2014-08-22 17:45:40 +02:00
mjentsch
54091b26e3 Log all output of verbosity-level 1 to libpurple log 2014-08-22 17:39:05 +02:00
mjentsch
e4bb5bf5a6 Count pending queries using the elements in the query tree, instead of counting the incoming and outgoing messages
Since the server is able to send queries without any response, and is also able to send multiple responses to an arbitrary query, the current way to count pending queries is not accurate and will lead to errors. Instead, the amount of queries in the query tree will be determined to decide whether there are pending messages.
2014-08-22 17:21:46 +02:00
mjentsch
e667299d2f Add binlog to telegram struct 2014-08-22 17:14:08 +02:00
mjentsch
7720beab6e Remove global configuration flags 2014-08-22 17:13:25 +02:00
mjentsch
32799a9086 Move binlog globals into a structure 2014-08-22 17:05:29 +02:00
mjentsch
331d631659 Ignore gdb files 2014-08-22 16:43:45 +02:00
mjentsch
188f890df5 Ignore app-hash 2014-08-08 08:46:39 +02:00
mjentsch
1170ae5710 Implement state machine for dc discovery and login. 2014-08-08 08:45:58 +02:00
mjentsch
f1a2738783 remove redundant functions from binlog 2014-08-08 08:44:56 +02:00
mjentsch
9e5b4ca5ec Refactor - Intermediate Commit 3 2014-08-06 19:45:46 +02:00
mjentsch
8a2c043db4 Refactor - Intermediate Commit 2 2014-07-29 15:36:59 +02:00
mjentsch
ed7aa7de5b Refactor Intermediate State 1 2014-07-29 15:36:59 +02:00
mjentsch
67c5a5e712 Ignore ycm-autocompletion files 2014-07-29 15:31:37 +02:00
Matthias Jentsch
9b7f273579 README.md edited online with Bitbucket 2014-07-26 09:11:47 +00:00
mjentsch
7fad1403ec Fetch chats and refactor libtelegram api 2014-07-11 19:57:32 +02:00
mjentsch
f78adc8b96 Support sending messages 2014-07-11 02:19:05 +02:00
mjentsch
43a5a80c48 Set up stub for telegram library 2014-07-11 01:13:01 +02:00
mjentsch
44e9163b66 Remove useless comments 2014-07-11 01:06:37 +02:00
mjentsch
6a439a5d55 Move everything into one Makefile
Avoid having to execute two different make commands to properly build the plugin, when there are changes in the telegram-cli files.
2014-07-08 21:17:50 +02:00
mjentsch
2099d9fbc3 Rename printname to alias 2014-06-27 09:37:35 +02:00
mjentsch
f28d89c9c6 Replace tabs with 4 spaces 2014-06-27 09:35:47 +02:00
mjentsch
6325bd108d Listen to changed users and add new chats to the current sessions 2014-06-22 23:39:05 +02:00
mjentsch
0945a3ca11 Add event handler functionality to tg-cli 2014-06-22 23:38:06 +02:00
mjentsch
d712b7e17f Add possibillity to listen to created users, chats and groups with event handlers and add some ability to exchange output functions with own callbacks 2014-06-22 23:36:52 +02:00
mjentsch
dbf509d59e Log some terminal messages to libpurple log 2014-06-22 23:33:57 +02:00
mjentsch
75e1abe520 Remove useless functions 2014-06-21 01:51:26 +02:00
mjentsch
a005c015cd Implement phone number registration
When the current phone number is not registered with the telegram network, ask for first and last name and proceed with the regular sms-code authentication scheme.
2014-06-15 19:58:49 +02:00
mjentsch
62090b3ca0 Implement login and authentication mechanism and fix the logging mechanism
Use purple debugging functions by formatting the string beforehand and then passing the readily formatted string, instead of doing it with va_list. Log into the telegram network using the provided SMS code and hash or request a new one, in case one of those isn't provided. Store and load the state using the file config/auth, to be able to restore previous logins.
2014-06-15 13:38:38 +02:00
mjentsch
90f7b39e11 Fix log format arguments
Remove the misuse of va_list and emulate behavior of purple debugging functions in our own code, since a va_list cannot be passed to purple_debug_info,
2014-06-15 03:22:39 +02:00
mjentsch
93f4bd25ae Add an externally controllable message-log and redirect tg-cli logging to the libpurple logging mechanism 2014-06-09 14:22:06 +02:00
Christopher Althaus
58244abb2d changed login 2014-05-30 10:05:48 +02:00
mjentsch
855c461f35 Debugging changes 2014-05-23 13:42:05 +02:00
mjentsch
cc2a19d6ea Merge branch master of bitbucket.org:telegrampurple/telegram-purple 2014-05-23 11:37:59 +02:00
mjentsch
8b4a1c8d10 Use input values from account settings to authentication to data center 2014-05-23 11:36:54 +02:00
Christopher Althaus
70682ef8b5 Git Kommandos hinzugefügt 2014-05-23 09:49:00 +02:00
mjentsch
377c809ba7 Add options for user verification, refactor header file-name to include functions into the purple-plugin and copy server.pub into the /etc/telegram directory when installing. 2014-05-11 22:18:21 +02:00
mjentsch
da57c79053 Update readme for new build process 2014-05-10 19:58:52 +02:00
mjentsch
02296e3774 Link header files of the telegram cli tool 2014-05-10 19:56:29 +02:00
mjentsch
e0c65b1b8d Move plugin into separate directory 2014-05-10 15:37:43 +02:00
mjentsch
0bc969918a Add files from telegram-purple-skeleton 2014-05-08 13:17:11 +02:00
202 changed files with 21552 additions and 31961 deletions

25
.gitignore vendored
View file

@ -1,14 +1,11 @@
telegram
*.o
Makefile
autom4te.cache
config.h
config.log
config.status
.idea/
nbproject/
bin/
objs/
dep/
auto/
libs/
/objs/
/autom4te.cache/
/config.h
*~
/dep/
/libs/
/bin/
/config.log
/config.status
/Makefile
/commit.h

4
.gitmodules vendored Normal file
View file

@ -0,0 +1,4 @@
[submodule "tgl"]
path = tgl
branch = test
url = https://github.com/majn/tgl

View file

@ -1,16 +1,48 @@
language: c
compiler:
- gcc
- clang
install:
- sudo apt-get install libconfig8-dev
- sudo apt-get install libreadline6-dev
- sudo apt-get install libssl-dev
- sudo apt-get install liblua5.2-dev lua5.2
- sudo apt-get install libevent-dev
# Select Trusty Tahr.
sudo: required
dist: trusty
# Travis' git submodule support is ... broken? half-broken? Maybe intentional?
git:
submodules: false
depth: 3
before_install:
- git submodule update --init --recursive
- sudo apt-get update -qq
- sudo apt-get install -qq libssl-dev libgcrypt20-dev libpurple-dev libwebp-dev
script:
- ./configure
- make
- ./configure $CONFIGURE_FLAGS
- make -j2
- make check
compiler:
- clang
- gcc
env:
# Try to be nice to the builder
- CONFIGURE_FLAGS=""
- CONFIGURE_FLAGS="--disable-gcrypt"
- CONFIGURE_FLAGS=" --disable-libwebp"
# - CONFIGURE_FLAGS="--disable-gcrypt --disable-libwebp"
- CONFIGURE_FLAGS=" --disable-translation"
# - CONFIGURE_FLAGS="--disable-gcrypt --disable-translation"
# - CONFIGURE_FLAGS=" --disable-libwebp --disable-translation"
- CONFIGURE_FLAGS="--disable-gcrypt --disable-libwebp --disable-translation"
matrix:
# Be even nicer by excluding half of the combinations
exclude:
- compiler: clang
env: CONFIGURE_FLAGS=""
- compiler: gcc
env: CONFIGURE_FLAGS="--disable-gcrypt"
- compiler: clang
env: CONFIGURE_FLAGS=" --disable-libwebp"
# - compiler: XXX
# env: CONFIGURE_FLAGS="--disable-gcrypt --disable-libwebp"
- compiler: gcc
env: CONFIGURE_FLAGS=" --disable-translation"
# - compiler: clang
# env: CONFIGURE_FLAGS="--disable-gcrypt --disable-translation"
# - compiler: gcc
# env: CONFIGURE_FLAGS=" --disable-libwebp --disable-translation"
- compiler: clang
env: CONFIGURE_FLAGS="--disable-gcrypt --disable-libwebp --disable-translation"

4
AUTHORS Normal file
View file

@ -0,0 +1,4 @@
Matthias Jentsch <mtthsjntsch@gmail.com>
Ben Wiederhake <Ben.Wiederhake@gmail.com>
Vitaly Valtman <vvaltman@aurum>
Christopher Althaus <althaus.christopher@gmail.com>

45
AppStream/Makefile Normal file
View file

@ -0,0 +1,45 @@
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Ben Wiederhake 2016
# This file is NOT meant for inclusion into the main Makefile.
LOCALES=$(shell cat po/LINGUAS)
LOCALE_MOS=$(addprefix po/,$(addsuffix .mo,$(LOCALES)))
# Hardcoded, since this should only be run on very few machines anyway,
# which are expected to have msgfmt on their $PATH
MSGFMT_PATH=msgfmt
all: translate
po/%.mo: po/%.po
${MSGFMT_PATH} -cf -o $@ $<
po/telegram-purple.metainfo.xml.pot: telegram-purple.metainfo.untranslated.xml as-metainfo.its
itstool -i as-metainfo.its -o $@ $<
# CAREFUL WHEN EDITING!
# "-j raw.xml *.mo" must be the last options!
telegram-purple.metainfo.xml: as-metainfo.its telegram-purple.metainfo.untranslated.xml $(LOCALE_MOS) po/LINGUAS
itstool -i as-metainfo.its -o $@ \
-j telegram-purple.metainfo.untranslated.xml $(LOCALE_MOS)
.PHONY: potfile
potfile: po/telegram-purple.metainfo.xml.pot
.PHONY: translate
translate: telegram-purple.metainfo.xml

23
AppStream/as-metainfo.its Normal file
View file

@ -0,0 +1,23 @@
<!-- Copyright © 2012-2015 Matthias Klumpp.
This material may only be distributed subject to the terms and
conditions set forth in the GNU Free Documentation License (GFDL),
V1.2 with no invariant sections or later (the latest version is
presently available at http://www.gnu.org/licenses/fdl.txt).
This file bases on the "Quickstart Translation using itstool":
http://www.freedesktop.org/software/appstream/docs/sect-Quickstart-Translation.html
The copyright for the base transformer was found at:
http://www.freedesktop.org/software/appstream/docs/index.html
-->
<its:rules
xmlns:its="http://www.w3.org/2005/11/its"
version="1.0">
<its:translateRule translate="no" selector="/component"/>
<its:translateRule translate="yes"
selector="/component/name |
/component/summary |
/component/description |
/component/screenshots/screenshot/caption |
/component/developer_name"/>
</its:rules>

1
AppStream/po/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/*.mo

12
AppStream/po/LINGUAS Normal file
View file

@ -0,0 +1,12 @@
bg
cs_CZ
de_DE
es
es_AR
fr
it_IT
nl
pl_PL
ru_RU
sq
uk

25
AppStream/po/bg.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Любомир Василев, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2016-10-19 14:07+0000\n"
"Last-Translator: Любомир Василев\n"
"Language-Team: Bulgarian (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/bg/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: bg\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Добавка, която добавя поддръжка на Telegram"

25
AppStream/po/cs_CZ.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Jan Breuer <j123b567@jaybee.cz>, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2016-02-18 14:45+0000\n"
"Last-Translator: Jan Breuer <j123b567@jaybee.cz>\n"
"Language-Team: Czech (Czech Republic) (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/cs_CZ/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs_CZ\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Zásuvný modul, který přidá podporu pro Telegram"

25
AppStream/po/de_DE.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Ben Wiederhake <BenWiederhake.GitHub@gmx.de>, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2016-01-09 13:14+0000\n"
"Last-Translator: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>\n"
"Language-Team: German (Germany) (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/de_DE/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de_DE\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Plugin zur Unterstützung von Telegram"

25
AppStream/po/es.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# aguador <aguador@openmailbox.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2017-02-27 09:08+0000\n"
"Last-Translator: aguador <aguador@openmailbox.org>\n"
"Language-Team: Spanish (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Un plugin que añade soporte para Telegram"

25
AppStream/po/es_AR.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# KNTRO <kntro@msn.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2016-10-08 19:37+0000\n"
"Last-Translator: KNTRO <kntro@msn.com>\n"
"Language-Team: Spanish (Argentina) (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/es_AR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es_AR\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Un plugin que agrega soporte para Telegram"

25
AppStream/po/fr.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Javier Sixto, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2016-04-14 19:51+0000\n"
"Last-Translator: Javier Sixto\n"
"Language-Team: French (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Une extension qui ajoute le support pour Telegram"

25
AppStream/po/it_IT.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Giuseppe Pignataro (Fasbyte01) <rogepix@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2017-02-27 09:08+0000\n"
"Last-Translator: Giuseppe Pignataro (Fasbyte01) <rogepix@gmail.com>\n"
"Language-Team: Italian (Italy) (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/it_IT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it_IT\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Un plugin che aggiunge il supporto per Telegram"

25
AppStream/po/nl.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# justin [notsupplied] <inactive+justin50@transifex.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2016-10-19 17:56+0000\n"
"Last-Translator: justin [notsupplied] <inactive+justin50@transifex.com>\n"
"Language-Team: Dutch (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/nl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Een plug-in die ondersteuning voor Telegram toevoegt"

25
AppStream/po/pl_PL.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Piotr Drąg <piotrdrag@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2017-02-27 09:08+0000\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Polish (Poland) (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/pl_PL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pl_PL\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>=14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Wtyczka dodająca obsługę protokołu Telegram"

25
AppStream/po/ru_RU.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Vladimir <TurbaVladimir@yandex.ru>, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2016-02-18 14:45+0000\n"
"Last-Translator: Vladimir <TurbaVladimir@yandex.ru>\n"
"Language-Team: Russian (Russia) (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/ru_RU/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru_RU\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Плагин, добавляющий поддержку Telegram"

25
AppStream/po/sq.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Besnik <besnik@programeshqip.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2016-02-18 14:45+0000\n"
"Last-Translator: Besnik <besnik@programeshqip.org>\n"
"Language-Team: Albanian (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/sq/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sq\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Telegram"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Një shtojcë që shton mbulim për Telegram-in"

View file

@ -0,0 +1,21 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr ""
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr ""

25
AppStream/po/uk.po Normal file
View file

@ -0,0 +1,25 @@
#
# Translators:
# Самохвалов Антон <samant.ua@mail.ru>, 2017
msgid ""
msgstr ""
"Project-Id-Version: telegram-purple\n"
"POT-Creation-Date: 2016-01-07 23:23+0100\n"
"PO-Revision-Date: 2017-03-04 06:36+0000\n"
"Last-Translator: Самохвалов Антон <samant.ua@mail.ru>\n"
"Language-Team: Ukrainian (http://www.transifex.com/telegram-purple-developers/telegram-purple/language/uk/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: uk\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#. (itstool) path: component/name
#: telegram-purple.metainfo.untranslated.xml:9
msgid "Telegram"
msgstr "Телеграм"
#. (itstool) path: component/summary
#: telegram-purple.metainfo.untranslated.xml:10
msgid "A plugin that adds support for Telegram"
msgstr "Плагін, що додає підтримку у Телеграм"

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2015 Jiri Eischmann <eischmann@redhat.com>
It is very important that this file does *not* receive any
Invariant Sections as per GFDL.
-->
<component type="addon">
<id>telegram-purple</id>
<extends>pidgin.desktop</extends>
<name>Telegram</name>
<summary>A plugin that adds support for Telegram</summary>
<url type="homepage">https://github.com/majn/telegram-purple</url>
<url type="bugtracker">https://github.com/majn/telegram-purple/issues/</url>
<metadata_license>GFDL-1.3</metadata_license>
<project_license>GPL-2.0+</project_license>
<update_contact>eischmann_at_redhat.com</update_contact>
</component>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2015 Jiri Eischmann <eischmann@redhat.com>
It is very important that this file does *not* receive any
Invariant Sections as per GFDL.
-->
<component type="addon">
<id>telegram-purple</id>
<extends>pidgin.desktop</extends>
<name>Telegram</name>
<name xml:lang="bg">Telegram</name>
<name xml:lang="cs-CZ">Telegram</name>
<name xml:lang="de-DE">Telegram</name>
<name xml:lang="es">Telegram</name>
<name xml:lang="es-AR">Telegram</name>
<name xml:lang="fr">Telegram</name>
<name xml:lang="it-IT">Telegram</name>
<name xml:lang="nl">Telegram</name>
<name xml:lang="pl-PL">Telegram</name>
<name xml:lang="ru-RU">Telegram</name>
<name xml:lang="sq">Telegram</name>
<name xml:lang="uk">Телеграм</name>
<summary>A plugin that adds support for Telegram</summary>
<summary xml:lang="bg">Добавка, която добавя поддръжка на Telegram</summary>
<summary xml:lang="cs-CZ">Zásuvný modul, který přidá podporu pro Telegram</summary>
<summary xml:lang="de-DE">Plugin zur Unterstützung von Telegram</summary>
<summary xml:lang="es">Un plugin que añade soporte para Telegram</summary>
<summary xml:lang="es-AR">Un plugin que agrega soporte para Telegram</summary>
<summary xml:lang="fr">Une extension qui ajoute le support pour Telegram</summary>
<summary xml:lang="it-IT">Un plugin che aggiunge il supporto per Telegram</summary>
<summary xml:lang="nl">Een plug-in die ondersteuning voor Telegram toevoegt</summary>
<summary xml:lang="pl-PL">Wtyczka dodająca obsługę protokołu Telegram</summary>
<summary xml:lang="ru-RU">Плагин, добавляющий поддержку Telegram</summary>
<summary xml:lang="sq">Një shtojcë që shton mbulim për Telegram-in</summary>
<summary xml:lang="uk">Плагін, що додає підтримку у Телеграм</summary>
<url type="homepage">https://github.com/majn/telegram-purple</url>
<url type="bugtracker">https://github.com/majn/telegram-purple/issues/</url>
<metadata_license>GFDL-1.3</metadata_license>
<project_license>GPL-2.0+</project_license>
<update_contact>eischmann_at_redhat.com</update_contact>
</component>

View file

@ -1,13 +0,0 @@
1.0.5
* listening socket (tcp and unix) for commands
1.0.4
* changed create_group_chat format
* changed search query
* rewritten interface code. Support for escaped characters in quotes
1.0.3
* options to help to run telegram-cli as daemon
1.0.2
* Bug fixes
1.0.1
* Added pfs support. To use it you should add 'pfs_enabled=true' line to config.
* Added export_card/import_card methods

156
CHANGELOG.md Normal file
View file

@ -0,0 +1,156 @@
Changelog
---------
##### 1.3.1
- Stability improvements
- Support auto-loading for documents
- Add support for "typing" in group chats (using group-typing-notifications plugin)
- Add support for /kick command in group chats
##### 1.3.0
- channel/supergroup support
- support sending code tags in markdown "backtick" format (see README for example)
- reduce amount of file-transfer popups in Pidgin, auto-load media in the background
- fix stability issues for the win32 build
- fix multiple crashes in libtgl
##### 1.2.6
- Include libtgl bugfix "use-after-not-created for photos"
- Fix Adium bundle version incompatibillity for newest version
##### 1.2.5
- Include libtgl fix to prevent crashes on certain channel messages
- Improve error handling to be more graceful
##### 1.2.4
- Fix crash on unknown media type
- Fix crash on logout after cancelling a file transfer
##### 1.2.3
- Build: Allow compilation on Windows #52 Thanks Eion!
- Build: Drop dependency on LodePNG, Thanks Ben!
- Build: Gettext is now optional
- Fix issue that prevented to send messages to deleted users in certain cases (#174)
- Fix own user being added to the buddy list in certain cases
- Fix that read recipes of own messages are being displayed (#139)
- Fix encoding inconsistencies with Unicode characters (#177)
- Fix auto-joining for chats (#179)
- Fix client not reconnecting anymore under certain circumstances (#173)
- Fix crash on compat-verification (PullRequest #183)
- Remove pointless "create chat" confirmation dialogue
- Improve logging messages
- Always send read recipes when the user is typing or sending a message
- Improve translation and user messages (#139)
- Use native password prompts (Adium)
##### 1.2.2
- fix some licensing issues by not depending on OpenSSL any longer (thanks Ben!)
- add tons of translations (thanks to anyone helping!)
- fix issue that caused empty files
- fix pidgin not reconnecting after hibernation
- fix adium not reconnecting after hibernation
- fix secret chat fingerprint not being displayed after restart
- fix secret chat name not being displayed after restart
##### 1.2.1
##### Bugfixes
- Fix buggy group chat handling
* Assure that foreign users are always listed by their full name instead of the user ID
* Don't automatically add group chats to buddy list to prevent incompatibillities with some libpurple clients
* Fix issue that caused the buddy list to not be correctly updated on joining / leaving participants
* Fix an issue that caused the user list to be printed on every group chat message in Finch
- Fetch chat information lazily to reduce traffic and prevent flood errors
- Improve input validation for phone numbers
###### Features
- Support leaving chats
- Implement the roomlist-API to allow listing of all active chats
##### Version 1.2.0 (Beta 3)
##### Bugfixes
- Fix error in incoming message handling that caused segmentation faults
- Fix failing audio and video transfers
- Mark messages read on other devices as 'deferred' to avoid needless notifications
- Improved buddy list handling (should avoid "unknown" contacts popping up)
- Many small issues (see commit history)
- Fix issues that caused audio and video downloads to not have a proper file ending
- Fix issue that caused very old unused chats to not be available
###### Features
- Allow creation of new group chats
- Allow joining chats by invite link
- Allow exporting chats by invite link
- Support displaying and sending GIFs
- Support joining chats by invite link
##### Version 1.1.0 (Beta 2)
- update to libtgl 2
- support two-factor authentication
- improve sticker support
- add option to control message read recipes
- many bugfixes
##### Version 1.0.0 (Beta 1)
- Move state files into .purple/telegram-purple directory
- Add extended account settings for controlling history and read notifications
- Improved support for Adium
* fix chat bookmarking
* add custom views for account settings and chat joining
##### Version 0.7
- Support uploads and downloads (with some caveats though):
* Uploads wont contain the current file name but a generic one
* Every file is uploaded as a document or picture, so unfortunately no embedded videos and audio (right now)
* Group chats only support picture uploads since nothing else is supported by the UI
- Fix HTML escaping issues
##### Version 0.6.1
- Fix many stability issues
- Do not readd left chats on login
##### Version 0.6
- Support for secret chats
- Receiving geo messages
##### Version 0.5
- Display incoming photos
- Respect received user and chat property updates
- Support changing own profile picture
- Support adding new contacts
- Display service messages
- Works with libpurple proxy settings
##### TODO:
- Picture Uploads
- Audio, Video and File Transfers

View file

38
HACKING.BUILD.md Normal file
View file

@ -0,0 +1,38 @@
# Hacking on the build system
This list was previously maintained as [issue #242](https://github.com/majn/telegram-purple/issues/242), until we realized that this needs proper version-control. (Duh!)
## Exhaustive list of requirements on the build system:
1. `commit.h` must change whenever it disagrees with the current git commit
1. `commit.h` must not change whenever it agrees with the current git commit
1. Must call `cd tgl && ./configure` with appropriate options whenever `tgl/Makefile` is missing, or notices that `./configure` was run. ("Too often" is acceptable as long as `make && make` isn't violated.)
1. Must call `make -C tgl` whenever this might have any effect. ("Too often" is acceptable as long as `make && make` isn't violated.)
1. Any changes due to `make -C tgl` must cause all necessary rebuilds in telegram-purple during the same invocation of make. ("Too often" is acceptable as long as `make && make` isn't violated.)
1. If `tgl/Makefile.in` is missing, explain that we need submodules, and stop.
1. `make -j12` must work fine
1. Must support out-of-CVS builds.
## While ensuring that:
- Must not `-include tgl/Makefile` as it doesn't really support that, and I'm not going to try and convince @vysheng to do that. Also, it's too fragile. You know how he ticks.
- `make && make` must not create any files in the second run (otherwise, `sudo make install` would become hairy)
- Compatibility with other makes
## Approach:
- `commit.h` is a regular file which depends on a .PHONY target `commit`. Building `commit.h` *only* touches `commit.h` if necessary and possible. (=> 1, 2, half of 8)
- Have a target `tgl/Makefile` which depends on `Makefile`. (=> 3)
- The central target `${PRPL_LIBNAME}` shall depend on the .PHONY `submade`, which depends on `tgl/Makefile`, and essentially executes `make -C tgl`. (=> 4, time constraint of 5)
- All objects of telegram-purple depend on `tgl/libs/libtgl.a`. Rationale: if `tgl/libs/libtgl.a` stays the same, then nothing in tgl changed. If `tgl/libs/libtgl.a` changes, then due to lots of black preprocessor magic within tgl, it can't be safely determined which, if any, objects of telegram-purple can be re-used. Also, if tgl got recompiled (~ 1 minute), then tgp can be recompiled, too (~ 5 seconds). (=> dependency constraint of 5)
- Let `tgl/Makefile` depend on `tgl/Makefile.in`, and put the warning into the rule for the latter. (=> 6)
- The above already implies a dependency DAG that is completely known to make; except at one point: let `tgl/libs/libtgl.a` depend on `submade`, without any own code. Now make ensure thread-safety on it's own. (=> 7)
- Bundle commit.h into the origtar (=> other half of 8)
## Side effects:
- Should be ultimately robust. Then again, that's what I thought about the last few attempts, and they didn't last long.
- This reduces the number of .PHONYs drastically, making it easier to read, and making it easier to prove that `make && make` doesn't change anything.
- Even though `submade` should trigger once and only once, this can handle multiple invocations just fine, too.
- All files dependent on `commit.h` need to be mentioned explicitly as dependents in the Makefile. This is ugly, but (as far as I can see) unavoidable. Thankfully, any errors here will get detected by automated testing.
- We currently use only one GNU make specific extension. See https://github.com/majn/telegram-purple/issues/137#issuecomment-167970054

20
HACKING.md Normal file
View file

@ -0,0 +1,20 @@
# Contributing
This is Open Source Software. We realized that we didn't pass the Patch Test
## What to contribute
Here's a few places to start:
- Report any bugs you find.
- No, seriously! Most of the bugs don't even get reported, or the reporter only writes "Doesn't work for me" and then vanishes.
- ["help wanted" issues](https://github.com/majn/telegram-purple/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+-label%3A%22in-pipeline%22), especially automated testing
- ["secret chat" issues](https://github.com/majn/telegram-purple/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3A%22secret+chats%22+-label%3A%22in-pipeline%22+)
- Portability (especially endianness) of tgl (external project)
- [Issues of tgl](https://github.com/vysheng/tgl/issues) -- lots and lots of false or obsolete reports
- Slim down the size of the generated files in `tgl/auto`, as this currently dominates the build time. Yuk!
- Make sure that the libpurple-devs don't break libpurple any further.
## How to contribute
Write [an issue](https://github.com/majn/telegram-purple/issues/new), shoot us a mail (scrape the address from the git history), or contact us in dev chat (changing URL, see README for that).

339
LICENSE.h
View file

@ -1,339 +0,0 @@
" GNU GENERAL PUBLIC LICENSE\n"
" Version 2, June 1991\n"
"\n"
" Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n"
" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
" Everyone is permitted to copy and distribute verbatim copies\n"
" of this license document, but changing it is not allowed.\n"
"\n"
" Preamble\n"
"\n"
" The licenses for most software are designed to take away your\n"
"freedom to share and change it. By contrast, the GNU General Public\n"
"License is intended to guarantee your freedom to share and change free\n"
"software--to make sure the software is free for all its users. This\n"
"General Public License applies to most of the Free Software\n"
"Foundation's software and to any other program whose authors commit to\n"
"using it. (Some other Free Software Foundation software is covered by\n"
"the GNU Lesser General Public License instead.) You can apply it to\n"
"your programs, too.\n"
"\n"
" When we speak of free software, we are referring to freedom, not\n"
"price. Our General Public Licenses are designed to make sure that you\n"
"have the freedom to distribute copies of free software (and charge for\n"
"this service if you wish), that you receive source code or can get it\n"
"if you want it, that you can change the software or use pieces of it\n"
"in new free programs; and that you know you can do these things.\n"
"\n"
" To protect your rights, we need to make restrictions that forbid\n"
"anyone to deny you these rights or to ask you to surrender the rights.\n"
"These restrictions translate to certain responsibilities for you if you\n"
"distribute copies of the software, or if you modify it.\n"
"\n"
" For example, if you distribute copies of such a program, whether\n"
"gratis or for a fee, you must give the recipients all the rights that\n"
"you have. You must make sure that they, too, receive or can get the\n"
"source code. And you must show them these terms so they know their\n"
"rights.\n"
"\n"
" We protect your rights with two steps: (1) copyright the software, and\n"
"(2) offer you this license which gives you legal permission to copy,\n"
"distribute and/or modify the software.\n"
"\n"
" Also, for each author's protection and ours, we want to make certain\n"
"that everyone understands that there is no warranty for this free\n"
"software. If the software is modified by someone else and passed on, we\n"
"want its recipients to know that what they have is not the original, so\n"
"that any problems introduced by others will not reflect on the original\n"
"authors' reputations.\n"
"\n"
" Finally, any free program is threatened constantly by software\n"
"patents. We wish to avoid the danger that redistributors of a free\n"
"program will individually obtain patent licenses, in effect making the\n"
"program proprietary. To prevent this, we have made it clear that any\n"
"patent must be licensed for everyone's free use or not licensed at all.\n"
"\n"
" The precise terms and conditions for copying, distribution and\n"
"modification follow.\n"
"\n"
" GNU GENERAL PUBLIC LICENSE\n"
" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n"
"\n"
" 0. This License applies to any program or other work which contains\n"
"a notice placed by the copyright holder saying it may be distributed\n"
"under the terms of this General Public License. The \"Program\", below,\n"
"refers to any such program or work, and a \"work based on the Program\"\n"
"means either the Program or any derivative work under copyright law:\n"
"that is to say, a work containing the Program or a portion of it,\n"
"either verbatim or with modifications and/or translated into another\n"
"language. (Hereinafter, translation is included without limitation in\n"
"the term \"modification\".) Each licensee is addressed as \"you\".\n"
"\n"
"Activities other than copying, distribution and modification are not\n"
"covered by this License; they are outside its scope. The act of\n"
"running the Program is not restricted, and the output from the Program\n"
"is covered only if its contents constitute a work based on the\n"
"Program (independent of having been made by running the Program).\n"
"Whether that is true depends on what the Program does.\n"
"\n"
" 1. You may copy and distribute verbatim copies of the Program's\n"
"source code as you receive it, in any medium, provided that you\n"
"conspicuously and appropriately publish on each copy an appropriate\n"
"copyright notice and disclaimer of warranty; keep intact all the\n"
"notices that refer to this License and to the absence of any warranty;\n"
"and give any other recipients of the Program a copy of this License\n"
"along with the Program.\n"
"\n"
"You may charge a fee for the physical act of transferring a copy, and\n"
"you may at your option offer warranty protection in exchange for a fee.\n"
"\n"
" 2. You may modify your copy or copies of the Program or any portion\n"
"of it, thus forming a work based on the Program, and copy and\n"
"distribute such modifications or work under the terms of Section 1\n"
"above, provided that you also meet all of these conditions:\n"
"\n"
" a) You must cause the modified files to carry prominent notices\n"
" stating that you changed the files and the date of any change.\n"
"\n"
" b) You must cause any work that you distribute or publish, that in\n"
" whole or in part contains or is derived from the Program or any\n"
" part thereof, to be licensed as a whole at no charge to all third\n"
" parties under the terms of this License.\n"
"\n"
" c) If the modified program normally reads commands interactively\n"
" when run, you must cause it, when started running for such\n"
" interactive use in the most ordinary way, to print or display an\n"
" announcement including an appropriate copyright notice and a\n"
" notice that there is no warranty (or else, saying that you provide\n"
" a warranty) and that users may redistribute the program under\n"
" these conditions, and telling the user how to view a copy of this\n"
" License. (Exception: if the Program itself is interactive but\n"
" does not normally print such an announcement, your work based on\n"
" the Program is not required to print an announcement.)\n"
"\n"
"These requirements apply to the modified work as a whole. If\n"
"identifiable sections of that work are not derived from the Program,\n"
"and can be reasonably considered independent and separate works in\n"
"themselves, then this License, and its terms, do not apply to those\n"
"sections when you distribute them as separate works. But when you\n"
"distribute the same sections as part of a whole which is a work based\n"
"on the Program, the distribution of the whole must be on the terms of\n"
"this License, whose permissions for other licensees extend to the\n"
"entire whole, and thus to each and every part regardless of who wrote it.\n"
"\n"
"Thus, it is not the intent of this section to claim rights or contest\n"
"your rights to work written entirely by you; rather, the intent is to\n"
"exercise the right to control the distribution of derivative or\n"
"collective works based on the Program.\n"
"\n"
"In addition, mere aggregation of another work not based on the Program\n"
"with the Program (or with a work based on the Program) on a volume of\n"
"a storage or distribution medium does not bring the other work under\n"
"the scope of this License.\n"
"\n"
" 3. You may copy and distribute the Program (or a work based on it,\n"
"under Section 2) in object code or executable form under the terms of\n"
"Sections 1 and 2 above provided that you also do one of the following:\n"
"\n"
" a) Accompany it with the complete corresponding machine-readable\n"
" source code, which must be distributed under the terms of Sections\n"
" 1 and 2 above on a medium customarily used for software interchange; or,\n"
"\n"
" b) Accompany it with a written offer, valid for at least three\n"
" years, to give any third party, for a charge no more than your\n"
" cost of physically performing source distribution, a complete\n"
" machine-readable copy of the corresponding source code, to be\n"
" distributed under the terms of Sections 1 and 2 above on a medium\n"
" customarily used for software interchange; or,\n"
"\n"
" c) Accompany it with the information you received as to the offer\n"
" to distribute corresponding source code. (This alternative is\n"
" allowed only for noncommercial distribution and only if you\n"
" received the program in object code or executable form with such\n"
" an offer, in accord with Subsection b above.)\n"
"\n"
"The source code for a work means the preferred form of the work for\n"
"making modifications to it. For an executable work, complete source\n"
"code means all the source code for all modules it contains, plus any\n"
"associated interface definition files, plus the scripts used to\n"
"control compilation and installation of the executable. However, as a\n"
"special exception, the source code distributed need not include\n"
"anything that is normally distributed (in either source or binary\n"
"form) with the major components (compiler, kernel, and so on) of the\n"
"operating system on which the executable runs, unless that component\n"
"itself accompanies the executable.\n"
"\n"
"If distribution of executable or object code is made by offering\n"
"access to copy from a designated place, then offering equivalent\n"
"access to copy the source code from the same place counts as\n"
"distribution of the source code, even though third parties are not\n"
"compelled to copy the source along with the object code.\n"
"\n"
" 4. You may not copy, modify, sublicense, or distribute the Program\n"
"except as expressly provided under this License. Any attempt\n"
"otherwise to copy, modify, sublicense or distribute the Program is\n"
"void, and will automatically terminate your rights under this License.\n"
"However, parties who have received copies, or rights, from you under\n"
"this License will not have their licenses terminated so long as such\n"
"parties remain in full compliance.\n"
"\n"
" 5. You are not required to accept this License, since you have not\n"
"signed it. However, nothing else grants you permission to modify or\n"
"distribute the Program or its derivative works. These actions are\n"
"prohibited by law if you do not accept this License. Therefore, by\n"
"modifying or distributing the Program (or any work based on the\n"
"Program), you indicate your acceptance of this License to do so, and\n"
"all its terms and conditions for copying, distributing or modifying\n"
"the Program or works based on it.\n"
"\n"
" 6. Each time you redistribute the Program (or any work based on the\n"
"Program), the recipient automatically receives a license from the\n"
"original licensor to copy, distribute or modify the Program subject to\n"
"these terms and conditions. You may not impose any further\n"
"restrictions on the recipients' exercise of the rights granted herein.\n"
"You are not responsible for enforcing compliance by third parties to\n"
"this License.\n"
"\n"
" 7. If, as a consequence of a court judgment or allegation of patent\n"
"infringement or for any other reason (not limited to patent issues),\n"
"conditions are imposed on you (whether by court order, agreement or\n"
"otherwise) that contradict the conditions of this License, they do not\n"
"excuse you from the conditions of this License. If you cannot\n"
"distribute so as to satisfy simultaneously your obligations under this\n"
"License and any other pertinent obligations, then as a consequence you\n"
"may not distribute the Program at all. For example, if a patent\n"
"license would not permit royalty-free redistribution of the Program by\n"
"all those who receive copies directly or indirectly through you, then\n"
"the only way you could satisfy both it and this License would be to\n"
"refrain entirely from distribution of the Program.\n"
"\n"
"If any portion of this section is held invalid or unenforceable under\n"
"any particular circumstance, the balance of the section is intended to\n"
"apply and the section as a whole is intended to apply in other\n"
"circumstances.\n"
"\n"
"It is not the purpose of this section to induce you to infringe any\n"
"patents or other property right claims or to contest validity of any\n"
"such claims; this section has the sole purpose of protecting the\n"
"integrity of the free software distribution system, which is\n"
"implemented by public license practices. Many people have made\n"
"generous contributions to the wide range of software distributed\n"
"through that system in reliance on consistent application of that\n"
"system; it is up to the author/donor to decide if he or she is willing\n"
"to distribute software through any other system and a licensee cannot\n"
"impose that choice.\n"
"\n"
"This section is intended to make thoroughly clear what is believed to\n"
"be a consequence of the rest of this License.\n"
"\n"
" 8. If the distribution and/or use of the Program is restricted in\n"
"certain countries either by patents or by copyrighted interfaces, the\n"
"original copyright holder who places the Program under this License\n"
"may add an explicit geographical distribution limitation excluding\n"
"those countries, so that distribution is permitted only in or among\n"
"countries not thus excluded. In such case, this License incorporates\n"
"the limitation as if written in the body of this License.\n"
"\n"
" 9. The Free Software Foundation may publish revised and/or new versions\n"
"of the General Public License from time to time. Such new versions will\n"
"be similar in spirit to the present version, but may differ in detail to\n"
"address new problems or concerns.\n"
"\n"
"Each version is given a distinguishing version number. If the Program\n"
"specifies a version number of this License which applies to it and \"any\n"
"later version\", you have the option of following the terms and conditions\n"
"either of that version or of any later version published by the Free\n"
"Software Foundation. If the Program does not specify a version number of\n"
"this License, you may choose any version ever published by the Free Software\n"
"Foundation.\n"
"\n"
" 10. If you wish to incorporate parts of the Program into other free\n"
"programs whose distribution conditions are different, write to the author\n"
"to ask for permission. For software which is copyrighted by the Free\n"
"Software Foundation, write to the Free Software Foundation; we sometimes\n"
"make exceptions for this. Our decision will be guided by the two goals\n"
"of preserving the free status of all derivatives of our free software and\n"
"of promoting the sharing and reuse of software generally.\n"
"\n"
" NO WARRANTY\n"
"\n"
" 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n"
"FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n"
"OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n"
"PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n"
"OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n"
"MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n"
"TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n"
"PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n"
"REPAIR OR CORRECTION.\n"
"\n"
" 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n"
"WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n"
"REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n"
"INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n"
"OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n"
"TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n"
"YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n"
"PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n"
"POSSIBILITY OF SUCH DAMAGES.\n"
"\n"
" END OF TERMS AND CONDITIONS\n"
"\n"
" How to Apply These Terms to Your New Programs\n"
"\n"
" If you develop a new program, and you want it to be of the greatest\n"
"possible use to the public, the best way to achieve this is to make it\n"
"free software which everyone can redistribute and change under these terms.\n"
"\n"
" To do so, attach the following notices to the program. It is safest\n"
"to attach them to the start of each source file to most effectively\n"
"convey the exclusion of warranty; and each file should have at least\n"
"the \"copyright\" line and a pointer to where the full notice is found.\n"
"\n"
" <one line to give the program's name and a brief idea of what it does.>\n"
" Copyright (C) <year> <name of author>\n"
"\n"
" This program is free software; you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
" the Free Software Foundation; either version 2 of the License, or\n"
" (at your option) any later version.\n"
"\n"
" This program is distributed in the hope that it will be useful,\n"
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
" GNU General Public License for more details.\n"
"\n"
" You should have received a copy of the GNU General Public License along\n"
" with this program; if not, write to the Free Software Foundation, Inc.,\n"
" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"
"\n"
"Also add information on how to contact you by electronic and paper mail.\n"
"\n"
"If the program is interactive, make it output a short notice like this\n"
"when it starts in an interactive mode:\n"
"\n"
" Gnomovision version 69, Copyright (C) year name of author\n"
" Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n"
" This is free software, and you are welcome to redistribute it\n"
" under certain conditions; type `show c' for details.\n"
"\n"
"The hypothetical commands `show w' and `show c' should show the appropriate\n"
"parts of the General Public License. Of course, the commands you use may\n"
"be called something other than `show w' and `show c'; they could even be\n"
"mouse-clicks or menu items--whatever suits your program.\n"
"\n"
"You should also get your employer (if you work as a programmer) or your\n"
"school, if any, to sign a \"copyright disclaimer\" for the program, if\n"
"necessary. Here is a sample; alter the names:\n"
"\n"
" Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n"
" `Gnomovision' (which makes passes at compilers) written by James Hacker.\n"
"\n"
" <signature of Ty Coon>, 1 April 1989\n"
" Ty Coon, President of Vice\n"
"\n"
"This General Public License does not permit incorporating your program into\n"
"proprietary programs. If your program is a subroutine library, you may\n"
"consider it more useful to permit linking proprietary applications with the\n"
"library. If this is what you want to do, use the GNU Lesser General\n"
"Public License instead of this License.\n"

View file

@ -1,90 +1,234 @@
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Vitaly Valtman, Christopher Althaus, Markus Endres 2014-2015
srcdir=@srcdir@
prefix=@prefix@
datarootdir=@datarootdir@
localedir=@localedir@
gettext_package=@GETTEXT_PACKAGE@
CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@ @OPENSSL_LDFLAGS@
CPPFLAGS=@CPPFLAGS@ @OPENSSL_INCLUDES@
DEFS=@DEFS@
COMPILE_FLAGS=${CFLAGS} ${CPFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC
CFLAGS=@CFLAGS@ @PURPLE_CFLAGS@ @DEFS@ -DENABLE_NLS -DLOCALEDIR='"$(localedir)"' -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-parameter -I${srcdir} -I. -fno-strict-aliasing -fPIC -D_FORTIFY_SOURCE=2
LDFLAGS=@LDFLAGS@ @OPENSSL_LIBS@ @PURPLE_LIBS@ @LIBS@ -rdynamic -ggdb
DIR_PERM=0755
FILE_PERM=0644
EXTRA_LIBS=@LIBS@ @EXTRA_LIBS@ @OPENSSL_LIBS@
LOCAL_LDFLAGS=-rdynamic -ggdb -levent ${EXTRA_LIBS}
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
DEP=${srcdir}/dep
AUTO=${srcdir}/auto
EXE=${srcdir}/bin
OBJ=${srcdir}/objs
LIB=${srcdir}/libs
DIR_LIST=${DEP} ${AUTO} ${EXE} ${OBJ} ${LIB} ${DEP}/auto ${OBJ}/auto
EXE_LIST=${EXE}/generate ${EXE}/tlc ${EXE}/telegram-cli
LIB_LIST=${LIB}/libtgl.a
TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/lua-tg.o
TGL_OBJECTS=${OBJ}/net.o ${OBJ}/mtproto-common.o ${OBJ}/mtproto-client.o ${OBJ}/queries.o ${OBJ}/structures.o ${OBJ}/binlog.o ${OBJ}/auto/auto.o ${OBJ}/tgl.o ${OBJ}/updates.o
TLC_OBJECTS=${OBJ}/tlc.o ${OBJ}/tl-parser.o ${OBJ}/crc32.o
GENERATE_OBJECTS=${OBJ}/generate.o
COMMON_OBJECTS=${OBJ}/tools.o
OBJ_LIST=${TG_OBJECTS} ${TLC_OBJECTS} ${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${TGL_OBJECTS}
OBJ_C=${TLC_OBJECTS} ${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${TGL_OBJECTS}
DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${OBJ_LIST}))
DEPENDENCE_LIST=${DEPENDENCE}
INCLUDE=-I. -I${srcdir}
CC=@CC@
PKG_CONFIG=@PKG_CONFIG@
MSGFMT_PATH=@MSGFMT_PATH@
# Check if -fstack-protector-strong is supported before enabling it
SPUNSUPPORTED = $(shell $(CC) -fstack-protector-strong 2>&1 | grep -c 'stack-protector-strong')
ifeq "$(SPUNSUPPORTED)" "0"
CFLAGS += -fstack-protector-strong
endif
DEP=dep
EXE=bin
OBJ=objs
DIR_LIST=${DEP} ${EXE} ${OBJ}
PLUGIN_OBJECTS=${OBJ}/tgp-net.o ${OBJ}/tgp-timers.o ${OBJ}/msglog.o ${OBJ}/telegram-base.o ${OBJ}/telegram-purple.o ${OBJ}/tgp-2prpl.o ${OBJ}/tgp-structs.o ${OBJ}/tgp-utils.o ${OBJ}/tgp-chat.o ${OBJ}/tgp-ft.o ${OBJ}/tgp-msg.o ${OBJ}/tgp-request.o ${OBJ}/tgp-blist.o ${OBJ}/tgp-info.o
ALL_OBJS=${PLUGIN_OBJECTS}
ifdef MSGFMT_PATH
LOCALES=$(shell cat po/LINGUAS)
LOCALE_MOS=$(addprefix po/,$(addsuffix .mo,$(LOCALES)))
endif
.SUFFIXES:
.SUFFIXES: .c .h .o
all: ${EXE_LIST} ${DIR_LIST} ${LIB_LIST}
create_dirs_and_headers: ${DIR_LIST} ${AUTO}/auto.c ${AUTO}/auto-header.h ${AUTO}/constants.h
PRPL_NAME=telegram-purple.so
PRPL_LIBNAME=${EXE}/${PRPL_NAME}
all: ${PRPL_LIBNAME} $(LOCALE_MOS)
PLUGIN_DIR_PURPLE=$(shell ${PKG_CONFIG} --variable=plugindir purple)
DATA_ROOT_DIR_PURPLE=$(shell ${PKG_CONFIG} --variable=datarootdir purple)
CRYPTO_FLAG=@CRYPTO_FLAG@
### == 'Magic' targets and infrastructure. == ###
# Here be dragons! See https://github.com/majn/telegram-purple/issues/242
# For the full list of requirements, goals, and rationale.
.PHONY: create_dirs
create_dirs: ${DIR_LIST}
${DIR_LIST}:
@test -d $@ || mkdir -p $@
DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${ALL_OBJS}))
DEPENDENCE_LIST=${DEPENDENCE}
-include ${DEPENDENCE_LIST}
${TG_OBJECTS} ${TGL_OBJECTS}: ${AUTO}/constants.h ${AUTO}/auto-header.h
tgl/Makefile.in:
@echo "tgl/Makefile.in not found. Maybe you need to 'git submodule update --init --recursive' ?" && exit 1
${TG_OBJECTS}: ${OBJ}/%.o: %.c | create_dirs_and_headers
${CC} ${INCLUDE} ${COMPILE_FLAGS} -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
tgl/Makefile: tgl/Makefile.in Makefile
cd tgl && ./configure -q ${CRYPTO_FLAG} --disable-extf CFLAGS="@CFLAGS@" LDFLAGS="@LDFLAGS@"
${OBJ_C}: ${OBJ}/%.o: %.c | create_dirs
${CC} ${INCLUDE} ${COMPILE_FLAGS} -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
tgl/libs/libtgl.a: tgl/Makefile
+${MAKE} -C tgl libs/libtgl.a
${EXE}/tlc: ${TLC_OBJECTS} ${COMMON_OBJECTS}
${CC} ${TLC_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -o $@
.PHONY: commit
commit:
${EXE}/telegram-cli: ${TG_OBJECTS} ${COMMON_OBJECTS} ${LIB}/libtgl.a
${CC} ${TG_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -L${LIB} -l tgl -o $@
# The *commands* for commit.h shall always be executed, but the
# *file* commit.h should only be considered to have changed in rare cases.
GIT_COMMIT=$(shell git rev-parse HEAD | cut -c1-10)
commit.h: commit
@./commit.h.gen
${LIB}/libtgl.a: ${TGL_OBJECTS} ${COMMON_OBJECTS}
ar ruv $@ ${TGL_OBJECTS} ${COMMON_OBJECTS}
# Ugly, but necessary, because otherwise commit.h would not get generated:
test/loadtest.c: commit.h
${EXE}/generate: ${GENERATE_OBJECTS} ${COMMON_OBJECTS}
${CC} ${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -o $@
# Ugly, but necessary, because otherwise commit.h would not get generated:
telegram-purple.c: commit.h
${AUTO}/scheme.tlo: ${AUTO}/scheme.tl ${EXE}/tlc
${EXE}/tlc -e $@ ${AUTO}/scheme.tl
${AUTO}/scheme.tl: ${srcdir}/scheme.tl ${srcdir}/encrypted_scheme.tl ${srcdir}/binlog.tl ${srcdir}/append.tl | ${AUTO}
cat $^ > $@
### == 'Normal' build. == ###
${AUTO}/scheme2.tl: ${AUTO}/scheme.tl ${EXE}/tlc
${EXE}/tlc -E ${AUTO}/scheme.tl 2> $@ || ( cat $@ && rm $@ && false )
${PLUGIN_OBJECTS}: ${OBJ}/%.o: ${srcdir}/%.c tgl/libs/libtgl.a | create_dirs
echo $@ && ${CC} ${CFLAGS} ${CPPFLAGS} -I ${srcdir}/tgl -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
${AUTO}/auto.c: ${AUTO}/scheme.tlo ${EXE}/generate
${EXE}/generate ${AUTO}/scheme.tlo > $@
po/%.mo: po/%.po
${MSGFMT_PATH} -cf -o $@ $< >/dev/null 2>&1
${AUTO}/auto-header.h: ${AUTO}/scheme.tlo ${EXE}/generate
${EXE}/generate -H ${AUTO}/scheme.tlo > $@
${PRPL_LIBNAME}: ${PLUGIN_OBJECTS} tgl/libs/libtgl.a | create_dirs
${CC} -shared -o $@ $^ ${LDFLAGS}
${AUTO}/constants.h: ${AUTO}/scheme2.tl ${srcdir}/gen_constants_h.awk
awk -f ${srcdir}/gen_constants_h.awk < $< > $@
clean:
rm -rf ${DIR_LIST} config.log config.status > /dev/null || echo "all clean"
### == noicon_{,un}install targets. Use only if you know that you don't need icons. Note that pidgin uses those files. == ###
.PHONY: noicon_install
noicon_install: $(PRPL_LIBNAME) $(LOCALE_MOS)
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(PLUGIN_DIR_PURPLE)
install -m $(FILE_PERM) $(PRPL_LIBNAME) $(DESTDIR)$(PLUGIN_DIR_PURPLE)/$(PRPL_NAME)
mkdir -m $(DIR_PERM) -p $(DESTDIR)/etc/telegram-purple
install -m $(FILE_PERM) tg-server.tglpub $(DESTDIR)/etc/telegram-purple/server.tglpub
# Assume that the user does not use AppStream if she doesn't want icons
@for lang in $(LOCALES); do \
mkdir -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
echo "installing po/$$lang.mo to $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo"; \
install -m $(FILE_PERM) po/$$lang.mo $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo; \
done
.PHONY: noicon_uninstall
noicon_uninstall:
rm -f $(DESTDIR)$(PLUGIN_DIR_PURPLE)/$(PRPL_NAME)
rm -f $(DESTDIR)/etc/telegram-purple/server.pub # TODO: Remove this in later versions
rm -f $(DESTDIR)/etc/telegram-purple/server.tglpub
# TODO: Delete all installed .mo's, no matter what LINGUAS says.
@for lang in $(LOCALES); do \
echo "removing $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo"; \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo; \
done
### == Main {,un}install targets. This should satisfy most needs. == ###
.PHONY: install
install: noicon_install
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16
install -m $(FILE_PERM) imgs/telegram16.png $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16/telegram.png
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22
install -m $(FILE_PERM) imgs/telegram22.png $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22/telegram.png
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48
install -m $(FILE_PERM) imgs/telegram48.png $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(datarootdir)/appdata
install -m $(FILE_PERM) AppStream/telegram-purple.metainfo.xml $(DESTDIR)$(datarootdir)/appdata/telegram-purple.metainfo.xml
.PHONY: uninstall
uninstall: noicon_uninstall
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16/telegram.png
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22/telegram.png
rm -f $(DESTDIR)$(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
rm -f $(DESTDIR)$(datarootdir)/appdata/telegram-purple.metainfo.xml
### == The local_{,un}install targets, in case you're not root. == ###
.PHONY: local_install
local_install:
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(HOME)/.purple/plugins
install -m $(FILE_PERM) $(PRPL_LIBNAME) $(DESTDIR)$(HOME)/.purple/plugins/$(PRPL_NAME)
# See telegram-base.c, function get_user_pk_path for justification:
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(HOME)/.purple/telegram-purple
install -m $(FILE_PERM) tg-server.tglpub $(DESTDIR)$(HOME)/.purple/telegram-purple/server.tglpub
.PHONY: local_uninstall
local_uninstall:
rm -f $(DESTDIR)$(HOME)/.purple/plugins/$(PRPL_NAME)
rm -f $(DESTDIR)$(HOME)/.purple/telegram-purple/server.tglpub
### == Handling and maintenance. Subject to rapid change, shouldn't be used in scripts. == ###
.PHONY: plugin
plugin: $(PRPL_LIBNAME)
.PHONY: strip
strip: $(PRPL_LIBNAME)
$(STRIP) --strip-unneeded $(PRPL_LIBNAME)
.PHONY: build-nsi
build-nsi: telegram-purple.nsi.awk telegram-purple.nsi.awk-in
awk -f telegram-purple.nsi.awk telegram-purple.nsi.awk-in > telegram-purple.nsi
.PHONY: run
run:
pidgin -d | grep 'telegram\|plugin\|proxy'
.PHONY: debug
debug: install
ddd pidgin
DIST_ERR_MSG="Working directory is not git clean.\
Run 'git status' to show what files are causing this.\
Please note that 'make dist' packages the state in git, not the one on your disk."
SUBMOD_ERR_MSG="Couldn't find tgl/tl-parser/tl-parser.c\
Are all submodules properly initialized and updated?"
# Not PHONY
.git:
@echo "Not in a git folder. Features that require git are disabled."; exit 1
.PHONY: check-clean
check-clean: .git
@test "x" = x"`git status --porcelain`" || (echo ${DIST_ERR_MSG}; exit 1)
@test -r tgl/tl-parser/.git || (echo ${SUBMOD_ERR_MSG}; exit 1)
# Feel free to remove the "check-clean" dependency if you know what you're doing.
.PHONY: dist
dist: check-clean commit.h .git create_dirs
./gen-origtar
### == Cleaning in various flavors == ###
.PHONY: clean-here
clean-here:
rm -rf ${DIR_LIST} $(PRPL_LIBNAME) po/*.mo autom4te.cache AppStream/po/*.mo
-include test/Makefile
.PHONY: clean
clean: clean-here clean-test tgl/Makefile
+${MAKE} -C tgl clean

173
Makefile.mingw Normal file
View file

@ -0,0 +1,173 @@
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Vitaly Valtman, Christopher Althaus, Markus Endres, Eion Robb 2014-2015
srcdir=.
gettext_package=telegram-purple
PURPLE_VERSION = 2.10.11
PIDGIN_TREE_TOP := ../pidgin-$(PURPLE_VERSION)
WIN32_DEV_TOP = $(PIDGIN_TREE_TOP)/../win32-dev
MAKENSIS ?= "$(PROGRAMFILES)/NSIS/makensis.exe"
PLUGIN_VERSION ?= 1.2.2
GMSGFMT ?= $(WIN32_DEV_TOP)/gettext-0.17/bin/msgfmt
CFLAGS=-I$(WIN32_DEV_TOP)/libgcrypt-1.6.3/include -I$(WIN32_DEV_TOP)/libgpg-error-1.12-2/include -I$(WIN32_DEV_TOP)/glib-2.28.8/include -I$(WIN32_DEV_TOP)/glib-2.28.8/include/glib-2.0 -I$(WIN32_DEV_TOP)/glib-2.28.8/lib/glib-2.0/include -I$(PIDGIN_TREE_TOP)/libpurple -I$(WIN32_DEV_TOP)/libwebp-0.4.3-1/include -DHAVE_CONFIG_H -DENABLE_NLS -DPACKAGE_VERSION='"$(PLUGIN_VERSION)"' -Wall -Wextra -Werror -Wno-deprecated-declarations -Wno-unused-parameter -I${srcdir} -I. -fno-strict-aliasing
LDFLAGS=-L$(WIN32_DEV_TOP)/libgcrypt-1.6.3/lib -L$(WIN32_DEV_TOP)/libwebp-0.4.3-1/lib -L$(WIN32_DEV_TOP)/gettext-0.18/bin -L$(PIDGIN_TREE_TOP)/libpurple -L$(WIN32_DEV_TOP)/glib-2.28.8/lib -lpurple -lintl -lglib-2.0 -lwebp -lz -lgcrypt -Wl,--export-all-symbols -ggdb -lws2_32 -static-libgcc
DIR_PERM=0755
FILE_PERM=0644
CC = $(WIN32_DEV_TOP)/mingw/bin/gcc
PKG_CONFIG=
DEP=dep
EXE=bin
OBJ=objs
LIB=libs
DIR_LIST=${DEP} ${EXE} ${OBJ} ${LIB} ${DEP}/lodepng ${OBJ}/lodepng
PLUGIN_OBJECTS=${OBJ}/tgp-net.o ${OBJ}/tgp-timers.o ${OBJ}/msglog.o ${OBJ}/telegram-base.o ${OBJ}/telegram-purple.o ${OBJ}/tgp-2prpl.o ${OBJ}/tgp-structs.o ${OBJ}/tgp-utils.o ${OBJ}/tgp-chat.o ${OBJ}/tgp-ft.o ${OBJ}/tgp-msg.o ${OBJ}/tgp-request.o ${OBJ}/tgp-blist.o ${OBJ}/lodepng/lodepng.o
ALL_OBJS=${PLUGIN_OBJECTS} ${OBJ}/tgp-info.o
LOCALES=$(patsubst %.po, %.mo, $(wildcard po/*.po))
.SUFFIXES:
.SUFFIXES: .c .h .o
PRPL_NAME=libtelegram.dll
PRPL_LIBNAME=${EXE}/${PRPL_NAME}
all: ${PRPL_LIBNAME} ${LOCALES}
PLUGIN_DIR_PURPLE="$(PROGRAMFILES)/Pidgin/plugins"
DATA_ROOT_DIR_PURPLE="$(PROGRAMFILES)/Pidgin"
COPY_ICONS=yes
localedir=$(DATA_ROOT_DIR_PURPLE)/locale
create_dirs: ${DIR_LIST}
${DIR_LIST}:
@test -d $@ || mkdir -p $@
DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${ALL_OBJS}))
DEPENDENCE_LIST=${DEPENDENCE}
-include ${DEPENDENCE_LIST}
# The dependency on tgl/libs/libtgl.a ensures that "make -C tgl" was called,
# and most importantly: It ensures that all automatic headers exist.
${PLUGIN_OBJECTS}: ${OBJ}/%.o: ${srcdir}/%.c ${LIB}/libtgl.a | create_dirs
echo $@ && ${CC} ${CFLAGS} ${CPPFLAGS} -I ${srcdir}/tgl -I ${srcdir}/lodepng -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
tgl/Makefile.mingw: ${srcdir}/Makefile.tgl.mingw
cp $< $@
tgl/libs/libtgl.a: tgl/Makefile.mingw
+make -C tgl -f Makefile.mingw
tgl/config.h: ${srcdir}/config.h.tgl.mingw
cp $< $@
config.h: ${srcdir}/config.h.mingw
cp $< $@
po/%.mo: po/%.po
$(GMSGFMT) -cf -o $@ $<
${LIB}/libtgl.a: tgl/libs/libtgl.a | create_dirs
cp $< $@
${PRPL_LIBNAME}: ${PLUGIN_OBJECTS} ${LIB}/libtgl.a | create_dirs
${CC} -shared -o $@ $^ ${LDFLAGS}
.PHONY: plugin
plugin: $(PRPL_LIBNAME)
.PHONY: strip
strip: $(PRPL_LIBNAME)
$(STRIP) --strip-unneeded $(PRPL_LIBNAME)
.PHONY: install
install: $(PRPL_LIBNAME) $(LOCALES)
mkdir -m $(DIR_PERM) -p $(PLUGIN_DIR_PURPLE)
install -m $(FILE_PERM) $(PRPL_LIBNAME) $(PLUGIN_DIR_PURPLE)/$(PRPL_NAME)
install -m $(FILE_PERM) tg-server.tglpub $(DATA_ROOT_DIR_PURPLE)/server.tglpub
ifeq ($(COPY_ICONS),no)
@echo "Not copying icons due to configure-option --disable-icons."
@echo " If you're using Finch, Empathy, or Telepathy, then this is a good idea."
@echo " If you're using Pidgin, then this is a bad idea."
@echo " If you're using Adium, read the README.md: You're using the wrong build system!"
else
mkdir -m $(DIR_PERM) -p $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16
install -m $(FILE_PERM) imgs/telegram16.png $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16/telegram.png
mkdir -m $(DIR_PERM) -p $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22
install -m $(FILE_PERM) imgs/telegram22.png $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22/telegram.png
mkdir -m $(DIR_PERM) -p $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48
install -m $(FILE_PERM) imgs/telegram48.png $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
endif
@for lang in $(shell cat po/LINGUAS); do \
mkdir -p $(localedir)/$$lang/LC_MESSAGES; \
echo "installing po/$$lang.mo to $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo"; \
install -m $(FILE_PERM) po/$$lang.mo $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo; \
done
.PHONY: uninstall
uninstall:
rm -f $(PLUGIN_DIR_PURPLE)/$(PRPL_NAME)
rm -f $(DATA_ROOT_DIR_PURPLE)/server.tglpub
rm -f $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/16/telegram.png
rm -f $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/22/telegram.png
rm -f $(DATA_ROOT_DIR_PURPLE)/pixmaps/pidgin/protocols/48/telegram.png
# TODO: Delete all installed .mo's, no matter what LINGUAS says.
@for lang in $(shell cat po/LINGUAS); do \
echo "removing $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo"; \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(gettext_package).mo; \
done
.PHONY: local_install
local_install:
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(HOME)/.purple/plugins
install -m $(FILE_PERM) $(PRPL_LIBNAME) $(DESTDIR)$(HOME)/.purple/plugins/$(PRPL_NAME)
# See telegram-base.c, function get_user_pk_path for justification:
mkdir -m $(DIR_PERM) -p $(DESTDIR)$(HOME)/.purple/telegram-purple
install -m $(FILE_PERM) tg-server.tglpub $(DESTDIR)$(HOME)/.purple/telegram-purple/server.tglpub
.PHONY: local_uninstall
local_uninstall:
rm -f $(DESTDIR)$(HOME)/.purple/plugins/$(PRPL_NAME)
rm -f $(DESTDIR)$(HOME)/.purple/telegram-purple/server.tglpub
.PHONY: run
run:
pidgin -d | grep 'telegram\|plugin\|proxy'
.PHONY: debug
debug: install
ddd pidgin
.PHONY: clean-here
clean-here:
rm -rf ${DIR_LIST} $(PRPL_C_OBJS) $(PRPL_LIBNAME) po/*.mo
.PHONY: clean
clean: clean-here tgl/Makefile.mingw
+make -C tgl -f Makefile.mingw clean
.PHONY: installer
installer: telegram-purple.nsi $(PRPL_LIBNAME) $(LOCALES)
$(MAKENSIS) -DPLUGIN_VERSION="$(PLUGIN_VERSION)" -DPRPL_NAME="$(PRPL_NAME)" -DWIN32_DEV_TOP="$(WIN32_DEV_TOP)" telegram-purple.nsi

116
Makefile.tgl.mingw Normal file
View file

@ -0,0 +1,116 @@
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Vitaly Valtman, Christopher Althaus, Markus Endres, Eion Robb 2014-2015
srcdir=.
WIN32_DEV_TOP ?= ../../win32-dev
CFLAGS=-I$(WIN32_DEV_TOP)/libgcrypt-1.6.3/include -I$(WIN32_DEV_TOP)/libgpg-error-1.12-2/include -I$(WIN32_DEV_TOP)/glib-2.28.8/include -DHAVE_CONFIG_H
LDFLAGS=-L$(WIN32_DEV_TOP)/libgcrypt-1.6.3/lib -I$(WIN32_DEV_TOP)/libgpg-error-1.12-2/lib -L$(WIN32_DEV_TOP)/libwebp-0.4.3-1/lib -L$(WIN32_DEV_TOP)/glib-2.28.8/lib -lwebp -lz -lgcrypt -Wl,--export-all-symbols -ggdb
CPPFLAGS=
DEFS=-DHAVE_CONFIG_H
COMPILE_FLAGS=${CFLAGS} ${CPFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter
EXTRA_LIBS=-lz -lgcrypt
LOCAL_LDFLAGS=-ggdb ${EXTRA_LIBS}
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
DEP=dep
AUTO=auto
OBJ=objs
LIB=libs
EXE=bin
DIR_LIST=${DEP} ${DEP}/crypto ${AUTO} ${EXE} ${OBJ} ${OBJ}/crypto ${LIB} ${DEP}/auto ${OBJ}/auto
LIB_LIST=${LIB}/libtgl.a ${LIB}/libtgl.dll
TGL_OBJECTS=${OBJ}/mtproto-common.o ${OBJ}/mtproto-client.o ${OBJ}/mtproto-key.o ${OBJ}/queries.o ${OBJ}/structures.o ${OBJ}/binlog.o ${OBJ}/tgl.o ${OBJ}/updates.o ${OBJ}/tg-mime-types.o ${OBJ}/mtproto-utils.o ${OBJ}/crypto/bn_openssl.o ${OBJ}/crypto/bn_altern.o ${OBJ}/crypto/rsa_pem_openssl.o ${OBJ}/crypto/rsa_pem_altern.o ${OBJ}/crypto/md5_openssl.o ${OBJ}/crypto/md5_altern.o ${OBJ}/crypto/sha_openssl.o ${OBJ}/crypto/sha_altern.o ${OBJ}/crypto/aes_openssl.o ${OBJ}/crypto/aes_altern.o
TGL_OBJECTS_AUTO=${OBJ}/auto/auto-skip.o ${OBJ}/auto/auto-fetch.o ${OBJ}/auto/auto-store.o ${OBJ}/auto/auto-autocomplete.o ${OBJ}/auto/auto-types.o ${OBJ}/auto/auto-fetch-ds.o ${OBJ}/auto/auto-free-ds.o ${OBJ}/auto/auto-store-ds.o ${OBJ}/auto/auto-print-ds.o
TLD_OBJECTS=${OBJ}/dump-tl-file.o
GENERATE_OBJECTS=${OBJ}/generate.o
COMMON_OBJECTS=${OBJ}/tools.o ${OBJ}/crypto/rand_openssl.o ${OBJ}/crypto/rand_altern.o ${OBJ}/crypto/err_openssl.o ${OBJ}/crypto/err_altern.o
OBJ_C=${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${TGL_OBJECTS} ${TLD_OBJECTS}
DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${OBJ_C}))
DEPENDENCE_LIST=${DEPENDENCE}
INCLUDE=-I. -I${srcdir}
CC=$(WIN32_DEV_TOP)/mingw/bin/gcc
.SUFFIXES:
.SUFFIXES: .c .h .o
all: ${LIB_LIST}
create_dirs_and_headers: ${DIR_LIST} ${AUTO}/auto-skip.h ${AUTO}/auto-fetch.h ${AUTO}/auto-store.h ${AUTO}/auto-autocomplete.h ${AUTO}/auto-types.h
create_dirs: ${DIR_LIST}
dump-tl: ${EXE}/dump-tl-file
#include ${srcdir}/Makefile.tl-parser
${DIR_LIST}:
@test -d $@ || mkdir -p $@
-include ${DEPENDENCE_LIST}
${TGL_OBJECTS}: ${AUTO}/constants.h ${AUTO}/auto-skip.h ${AUTO}/auto-fetch.h ${AUTO}/auto-store.h ${AUTO}/auto-autocomplete.h ${AUTO}/auto-types.h ${AUTO}/auto-fetch-ds.h ${AUTO}/auto-free-ds.h ${AUTO}/auto-store-ds.h ${AUTO}/auto-print-ds.h
${OBJ_C}: ${OBJ}/%.o: ${srcdir}/%.c | create_dirs
${CC} ${INCLUDE} ${COMPILE_FLAGS} -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
${TGL_OBJECTS_AUTO}: ${OBJ}/auto/%.o: ${AUTO}/%.c | create_dirs
${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
${LIB}/libtgl.a: ${TGL_OBJECTS} ${COMMON_OBJECTS} ${TGL_OBJECTS_AUTO}
rm -f $@ && ar ruv $@ $^
${LIB}/libtgl.dll: ${TGL_OBJECTS} ${COMMON_OBJECTS} ${TGL_OBJECTS_AUTO}
${CC} -shared -o $@ $^ ${LINK_FLAGS}
${EXE}/generate: ${GENERATE_OBJECTS} ${COMMON_OBJECTS}
${CC} ${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -o $@
${AUTO}/scheme.tlo: ${AUTO}/scheme.tl ${EXE}/tl-parser
${EXE}/tl-parser -e $@ ${AUTO}/scheme.tl
${AUTO}/scheme.tl: ${srcdir}/scheme.tl ${srcdir}/encrypted_scheme.tl ${srcdir}/binlog.tl ${srcdir}/mtproto.tl ${srcdir}/append.tl | ${AUTO}
cat $^ > $@
${AUTO}/scheme2.tl: ${AUTO}/scheme.tl ${EXE}/tl-parser
${EXE}/tl-parser -E ${AUTO}/scheme.tl 2> $@ || ( cat $@ && rm $@ && false )
${AUTO}/auto.c: ${AUTO}/scheme.tlo ${EXE}/generate
${EXE}/generate ${AUTO}/scheme.tlo > $@
${AUTO}/auto-%.c: ${AUTO}/scheme.tlo ${EXE}/generate auto/constants.h ${AUTO}/auto-%.h | create_dirs_and_headers
${EXE}/generate -g $(patsubst ${AUTO}/auto-%.c,%,$@) ${AUTO}/scheme.tlo > $@ || ( rm $@ && false )
${AUTO}/auto-%.h: ${AUTO}/scheme.tlo ${EXE}/generate
${EXE}/generate -g $(patsubst ${AUTO}/auto-%.h,%-header,$@) ${AUTO}/scheme.tlo > $@ || ( rm $@ && false )
${AUTO}/constants.h: ${AUTO}/scheme2.tl ${srcdir}/gen_constants_h.awk
awk -f ${srcdir}/gen_constants_h.awk < $< > $@
${EXE}/dump-tl-file: ${OBJ}/auto/auto.o ${TLD_OBJECTS}
${CC} ${OBJ}/auto/auto.o ${TLD_OBJECTS} ${LINK_FLAGS} -o $@
clean:
rm -rf ${DIR_LIST}

View file

@ -1,78 +0,0 @@
To use lua with client you should write lua script. You can specify it from config ("lua_script" option) or from command_line [-s].
It should have several functions:
on_binlog_replay_end() - it is called when replay of old events end. Any updates prior this call were already received by this client
some time ago.
on_get_difference_end() - it is called after first get_difference call. So we received all updates after last client execute.
on_our_id(our_id) - Informs about id of currently logged in user.
on_msg_receive(msg) - it is called when we receive new msg (!! may be called before on_binlog_replay_end, than it is old msg).
on_user_update(user,what_changed) - updated info about user. what_changed is array of strings.
on_chat_update(user,what_changed) - updated info about user. what_changed is array of strings.
on_secret_chat_update(user,what_changed) - updated info about user. what_changed is array of strings.
Also, you can call several functions. Each this function last two arguments, are cb_function and cb_extra.
These functions may return false immidiately if something is bad with args, or return true and call cb_function in future.
cb_function would have two or three arguments: first cb_extra, second success (1 or 0), third result (if applicable).
If you want to pass msg to function, you should pass it's id.
If you want to pass peer to function, you should pass it's print_name.
Or, you can pass string user#id<id> chat#id<id> and secret_chat#id<id> as peer. It is in some cases better. For example if you want to postpone and you are afraid, that print_name would be changed in the meantime.
Function_list (arguments are listed aside from cb_function and cb_extra, :
get_contact_list ()
get_dialog_list ()
rename_chat (chat, new_name)
chat_set_photo (chat, file)
send_msg (peer, text)
fwd_msg (peer, msg)
send_photo (peer, file)
send_video (peer, file)
send_audio (peer, file)
send_document (peer, file)
send_text (peer, file)
load_photo(msg)
load_video(msg)
load_video_thumb(msg)
load_audio(msg)
load_document(msg)
load_document_thumb(msg)
chat_info (chat)
user_info (user)
get_history (peer, limit)
chat_add_user (chat, user)
chat_del_user (chat, user)
add_contactt (phone, first_name, last_name)
rename_contactt (phone, first_name, last_name)
msg_search (peer, text)
msg_global_search (text)
mark_read (peer)
set_profile_photo (file)
create_secret_chat (user)
create_group_chat (user, name)
delete_msg (msg)
restore_msg (number)
status_online ()
status_offline ()
Also, you have function
postpone (cb_function, cb_extra, timeout). It will call your cb_function in specified number of seconds (number of seconds may be double).

145
README.es
View file

@ -1,145 +0,0 @@
## Telegram messenger CLI [![Build Status](https://travis-ci.org/vysheng/tg.png)](https://travis-ci.org/vysheng/tg)
!!!! May be outdated. Please refer to english README as more actual.
Interfaz de línea de comandos para: [Telegram](http://telegram.org). Usa interfaz readline.
### Documentación del API y el protocolo
La documentación del APi de Telegram está disponible aquí: http://core.telegram.org/api
La documentación del protocolo MTproto está disponible aquí: http://core.telegram.org/mtproto
### Instalación
Clona el Repositorio GitHub
$ git clone https://github.com/vysheng/tg.git && cd tg
o descarga y descomprime el zip
$ wget https://github.com/vysheng/tg/archive/master.zip -O tg-master.zip
$ unzip tg-master.zip && cd tg-master
#### Linux
Librerías requeridas: readline openssl y (si desea usar config) libconfig y liblua.
Si no deseas usarlo, pasa las siguientes opciones --disable-libconfig y --disable-liblua respectivamente.
En Ubuntu usa:
$ sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev
En gentoo:
$ sudo emerge -av sys-libs/readline dev-libs/libconfig dev-libs/openssl dev-lang/lua
En Fedora:
$ sudo yum install lua-devel openssl-devel libconfig-devel readline-devel
Por defecto Makefile utiliza liblua5.2 de ubuntu. Si utilizas una versión diferente de liblua o linux, tienes que ejecutar el script ./configure o recibirás un error de compilación extraño.
Entonces
$ ./configure
$ make
#### Mac OS X
El cliente depende de [librería readline](http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html) y [libconfig](http://www.hyperrealm.com/libconfig/), las cuales no están incluídas en OS X por defecto. Debes instalar estas librerías de forma manual, usando por ejemplo [Homebrew](http://brew.sh/).
$ brew install libconfig
$ brew install readline
$ brew install lua
$ export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.2.4/include"
$ export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.2.4/lib"
$ ./configure && make
Gracias a [@jfontan](https://github.com/vysheng/tg/issues/3#issuecomment-28293731) por esta solución.
#### FreeBSD
Instalar estos puertos:
* devel/libconfig
* devel/libexecinfo
Entonces construir:
$ env CC=clang CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure
$ make
#### Otros UNIX
Si logras ejecutarlo en otros UNIX, por favor házmelo saber.
### Uso
./telegram -k <clave-servidor-público>
Por defecto la clave pública se almacena en la misma carpeta con el nombre tg-server.pub o en /etc/telegram/server.pub, si no lo es, indica dónde encontrarlo:
./telegram -k tg-server.pub
El Cliente soporta completamiento con TAB e historial de comandos.
Peer se refiere al nombre del contacto o de diálogo y se puede acceder por completamiento con Tab.
Para los contactos de usuario el peer es el Nombre <guión bajo> Apellido con todos los espacios cambiados a guiones bajos.
Para los chats es su título con todos los espacios cambiados a guiones bajos.
Para los chats encriptados es <marca de exclamación> <guión bajo> Nombre <guión bajo> Apellido con todos los espacios cambiados a guiones bajos.
Si dos o más peers tienen el mismo nombre, una almohadilla y un número es añadido al nombre. (por ejemplo A_B,A_B#1,A_B#2 y así sucesivamente).
### Comandos soportados
#### Mensajería
* **msg** \<peer\> texto - envía el mensaje a este usuario.
* **fwd** \<usuario\> \<numero-mensaje\> - reenviar un mensaje al usuario. Puedes ver los número de mensajes iniciando el Cliente con -N.
* **chat_with_peer** \<peer\> - inicia un chat con este usuario. /exit o /quit para salir de este modo.
* **add_contact** \<numero-teléfono\> \<nombre\> \<apellido\> - intenta añadir este contacto a la lista de contactos.
* **rename_contact** \<usuario\> \<nombre\> \<apellido\> - intenta renombrar el contacto. Si tienes otro dispositivo será una pelea.
* **mark_read** \<peer\> - marca todos los mensajes como recibidos de ese usuario.
#### Multimedia
* **send_photo** \<peer\> \<nombre-archivo-foto\> - manda una foto al usuario.
* **send_video** \<peer\> \<nombre-archivo-video\> - envia un video al usuario.
* **send_text** \<peer\> \<nombre-archivo-texto> - envia un archivo de texto como un mensaje en plano.
* **load_photo**/load_video/load_video_thumb \<numero-mensaje\> - carga foto/video indicado del directorio de descarga.
* **view_photo**/view_video/view_video_thumb \<numero-mensaje\> - carga foto/video indicado del directorio de descarga y lo abre con el visor por defecto del sistema.
#### Opciones de chat de grupo
* **chat_info** \<chat\> - imprime información del chat.
* **chat_add_user** \<chat\> \<usuario\> - agrega un usuario al chat.
* **chat_del_user** \<chat\> \<usuario\> - elimina un usuario del chat.
* **rename_chat** \<chat\> \<nuevo-nombre\> - cambia el nombre al chat.
#### Search
* **search** \<peer\> patrón - busca el patrón indicado en los mensajes con ese usuario.
* **global_search** patrón - busca el patrón indicado en todos los mensajes.
#### Chat secreto
* **create_secret_chat** \<user\> - crea un chat secreto con el usuario indicado.
* **visualize_key** \<secret_chat\> - Muestra la clave de cifrado. Debes compararla con la del otro usuario.
#### Estadísticas e información varia.
* **user_info** \<user\> - muestra información sobre el usuario.
* **history** \<peer\> [limit] - muestra el historial (y la marca como leído). Limite por defecto = 40.
* **dialog_list** - muestra información acerca del dialogo
* **contact_list** - muestra información acerca de tu lista de contactos.
* **suggested_contacts** - muestra información sobre sus contactos, tiene un máximo de amigos comunes.
* **stats** - solo para depuración.
* **show_license** - muestra la licencia GPLv2.
* **help** - imprime esta ayuda.

397
README.md
View file

@ -1,190 +1,339 @@
## Telegram messenger CLI [![Build Status](https://travis-ci.org/vysheng/tg.png)](https://travis-ci.org/vysheng/tg)
Telegram-Purple Unofficial (Beta)
=================================
Command-line interface for [Telegram](http://telegram.org). Uses readline interface.
Telegram-purple is a Libpurple protocol plugin that adds support for the Telegram messenger.
### API, Protocol documentation
I keep getting many questions about this plugin in my E-mail, so I've created a [telegram group chat](https://goo.gl/VudXys) for
telegram-purple related discussions or questions.
Documentation for Telegram API is available here: http://core.telegram.org/api
Installation
------------
Documentation for MTproto protocol is available here: http://core.telegram.org/mtproto
If you are just interested in using the plugin you probably want to use one of the following binary distributions. Please note that I do not control most of those package sources and the version may lag behind.
### Upgrading to version 1.0
If your platform is not supported or you want to contribute by testing or development, scroll down to "Building form Source".
First of all, the binary is now in ./bin folder and is named telegram-cli. So be careful, not to use old binary.
Second, config folder is now ${HOME}/.telegram-cli
#### OSX (Adium)
Third, database is not compatible with older versions, so you'll have to login again.
1. Download and execute the [Telegram-Adium bundle] (https://github.com/majn/telegram-purple/releases/download/v1.3.0/telegram-adium-1.3.0.AdiumLibpurplePlugin.zip)
2. Restart Adium
Fourth, in peer_name '#' are substitued to '@'. (Not applied to appending of '#%d' in case of two peers having same name).
#### Windows
### Installation
Eion Robb provides a binary for Windows users:
Clone GitHub Repository
1. Download and execute the setup from http://eion.robbmob.com/telegram/
2. Restart Pidgin
git clone https://github.com/vysheng/tg.git && cd tg
#### Fedora (22, 23)
or download and extract zip
The package is available in the Fedora 22 and 23 testing repositories:
wget https://github.com/vysheng/tg/archive/master.zip -O tg-master.zip
unzip tg-master.zip && cd tg-master
dnf config-manager --set-enabled updates-testing
dnf install purple-telegram
#### Linux and BSDs
Install libs: readline or libedit, openssl and (if you want to use config) libconfig and liblua.
If you do not want to use them pass options --disable-libconfig and --disable-liblua respectively.
#### Arch Linux (AUR)
On Ubuntu/Debian use:
https://aur.archlinux.org/packages/telegram-purple/
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev
On gentoo:
#### Debian
sudo emerge -av sys-libs/readline dev-libs/libconfig dev-libs/openssl dev-lang/lua dev-libs/libevent
At the time of writing, the package hasn't been accepted yet.
Please first check if it's already available to you: `sudo apt-get install telegram-purple`
On Fedora:
If this doesn't work because the package doesn't exist (yet), please build it from source.
sudo yum install lua-devel openssl-devel libconfig-devel readline-devel
On FreeBSD:
Building From Source
--------------------
pkg install libconfig libexecinfo lua52
Below, you will find the instructions for how to build the libpurple protocol plugin from source.
On OpenBSD:
#### 1. Clone
pkg_add libconfig libexecinfo lua
This repository has submodules, so you need to clone recursively.
Then,
./configure
make
git clone --recursive https://github.com/majn/telegram-purple
cd telegram-purple
#### Other methods to install on linux
On Gentoo: use ebuild provided.
#### 1b. Cloning if you're a packager
On Arch: https://aur.archlinux.org/packages/telegram-git/
If you are unsure about whether you need this, then you are not a
packager and don't have any use for this.
#### Mac OS X
If you need an "orig-tarball", it can be generated by `make dist`. Note
that this automatically generates an appropriate version number like
`1.2.4-58-g8e3cebf`. You can truncate the git suffix (`-g8e3cebf`). If
the `-58` part exists, it means that you're using a development
version, which is probably not what you want. If you still want to
package this, please leave the commit number (i.e., `58`) intact, as
this indicates that this version is in fact much further than just
`1.2.4`.
The client depends on [readline library](http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html) and [libconfig](http://www.hyperrealm.com/libconfig/), which are not included in OS X by default. You have to install these libraries manually.
If using [Homebrew](http://brew.sh/):
#### 2. Fetch all dependencies
brew install libconfig
brew install readline
brew install lua
export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.2.4/include"
export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.2.4/lib"
./configure && make
##### Fedora
Thanks to [@jfontan](https://github.com/vysheng/tg/issues/3#issuecomment-28293731) for this solution.
sudo dnf install gcc gettext libgcrypt-devel libwebp-devel libpurple-devel zlib-devel
If using [MacPorts](https://www.macports.org):
sudo port install libconfig-hr
sudo port install readline
sudo port install lua51
export CFLAGS="-I/usr/local/include -I/opt/local/include"
export LDFLAGS="-L/usr/local/lib -L/opt/local/lib/"
./configure && make
Install these ports:
##### Debian / Ubuntu
* devel/libconfig
* devel/libexecinfo
* lang/lua52
We are working on a Debian package! Please first check if it's already available to you: `sudo apt-get install telegram-purple`
Then build:
If the above works, then you should stop here: It is now installed.
env CC=clang CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib LUA=/usr/local/bin/lua52 LUA_INCLUDE=-I/usr/local/include/lua52 LUA_LIB=-llua-5.2 ./configure
make
If the above fails: Don't worry, just continue building it by yourself. Next you need to install these dependencies:
#### Other UNIX
sudo apt-get install libgcrypt20-dev libpurple-dev libwebp-dev gettext build-essential
If you manage to launch it on other UNIX, please let me know.
### Contacts
If you would like to ask a question, you can write to my telegram or to the github (or both). To contact me via telegram, you should use import_card method with argument 000653bf:0738ca5d:5521fbac:29246815:a27d0cda
##### OpenSUSE
sudo zypper install gcc glib glib-devel libpurple libpurple-devel zlib-devel libwebp-devel
### Usage
And the development files for gcrypt, probably `gcrypt-devel` or something. (FIXME)
bin/telegram-cli -k <public-server-key>
By default public key is stored in the same folder named tg-server.pub or in /etc/telegram-cli/server.pub, if it's not, specify where to find it:
bin/telegram-cli -k tg-server.pub
#### 3. Compile and install
Client support TAB completion and command history.
If libwebp is not available, you can disable sticker support by calling ./configure --disable-libweb instead.
Please note that this is usually not necessary.
Peer refers to the name of the contact or dialog and can be accessed by TAB completion.
For user contacts peer name is Name <underscore> Lastname with all spaces changed to underscores.
For chats it is it's title with all spaces changed to underscores
For encrypted chats it is <Exсlamation mark> <underscore> Name <underscore> Lastname with all spaces changed to underscores.
./configure
make
sudo make install
If two or more peers have same name, <sharp>number is appended to the name. (for example A_B, A_B#1, A_B#2 and so on)
### Supported commands
#### Messaging
Pulling Updates
---------------
* **msg** \<peer\> Text - sends message to this peer
* **fwd** \<user\> \<msg-seqno\> - forward message to user. You can see message numbers starting client with -N
* **chat_with_peer** \<peer\> starts one on one chat session with this peer. /exit or /quit to end this mode.
* **add_contact** \<phone-number\> \<first-name\> \<last-name\> - tries to add contact to contact-list by phone
* **rename_contact** \<user\> \<first-name\> \<last-name\> - tries to rename contact. If you have another device it will be a fight
* **mark_read** \<peer\> - mark read all received messages with peer
* **delete_msg** \<msg-seqno\> - deletes message (not completly, though)
* **restore_msg** \<msg-seqno\> - restores delete message. Impossible for secret chats. Only possible short time (one hour, I think) after deletion
This repository contains submodules, and a simple pull just won't be enough to update all the submodules files. Pull new changes with:
#### Multimedia
* **send_photo** \<peer\> \<photo-file-name\> - sends photo to peer
* **send_video** \<peer\> \<video-file-name\> - sends video to peer
* **send_text** \<peer\> \<text-file-name> - sends text file as plain messages
* **load_photo**/load_video/load_video_thumb/load_audio/load_document/load_document_thumb \<msg-seqno\> - loads photo/video/audio/document to download dir
* **view_photo**/view_video/view_video_thumb/view_audio/view_document/view_document_thumb \<msg-seqno\> - loads photo/video to download dir and starts system default viewer
* **fwd_media** \<msg-seqno\> send media in your message. Use this to prevent sharing info about author of media (though, it is possible to determine user_id from media itself, it is not possible get access_hash of this user)
* **set_profile_photo** \<photo-file-name\> - sets userpic. Photo should be square, or server will cut biggest central square part
git pull
git submodule sync # just in case the configuration has changed
git submodule update --recursive
#### Group chat options
Usage
-----
* **chat_info** \<chat\> - prints info about chat
* **chat_add_user** \<chat\> \<user\> - add user to chat
* **chat_del_user** \<chat\> \<user\> - remove user from chat
* **rename_chat** \<chat\> \<new-name\>
* **create_group_chat** \<user\> \<chat topic\> - creates a groupchat with user, use chat_add_user to add more users
* **chat_set_photo** \<chat\> \<photo-file-name\> - sets group chat photo. Same limits as for profile photos.
#### First Login
#### Search
The username is your current phone number, including your full country prefix. For Germany, this would be '+49', resulting in a user name like '+49151123456'. Telegram will verify your phone number by sending you a code via SMS. You will be prompted for this code, once that happens.
* **search** \<peer\> pattern - searches pattern in messages with peer
* **global_search** pattern - searches pattern in all messages
#### Buddy List
#### Secret chat
Like in the official Telegram apps, the displayed buddy list consists of all active conversations.
* **create_secret_chat** \<user\> - creates secret chat with this user
* **visualize_key** \<secret_chat\> - prints visualization of encryption key. You should compare it to your partner's one
* **set_ttl** \<secret_chat\> \<ttl\> - sets ttl to secret chat. Though client does ignore it, client on other end can make use of it
* **accept_secret_chat** \<secret_chat\> - manually accept secret chat (only useful when starting with -E key)
##### Foreign Users
#### Stats and various info
Foreign users, like for example people you only know through a group chat but never had any conversation with, will not be part of your buddy list by default. You can add those users to the buddy list by clicking on "Add contact..." in the users context menu.
* **user_info** \<user\> - prints info about user
* **history** \<peer\> [limit] - prints history (and marks it as read). Default limit = 40
* **dialog_list** - prints info about your dialogs
* **contact_list** - prints info about users in your contact list
* **suggested_contacts** - print info about contacts, you have max common friends
* **stats** - just for debugging
* **show_license** - prints contents of GPLv2
* **help** - prints this help
#### Using secret chats
#### Card
* **export_card** - print your 'card' that anyone can later use to import your contact
* **import_card** \<card\> - gets user by card. You can write messages to him after that.
You can use Telegram secret chats with this plugin, they will show up as a new buddy with a '!' in front of the buddy name.
#### Other
* **quit** - quit
* **safe_quit** - wait for all queries to end then quit
One caveat of secret chats in Telegram is that they can only have one endpoint, this is a limitation of the protocol. This means that if you create a secret chat in Pidgin you will not be able to use that chat on your phone. You will be asked whether to accept each secret chat, so you can always choose to accept the chat on a different device if you want. You can set a default behavior for dealing with secret chats (Accept or Decline) in the account settings, if you don't want that prompt to appear every time.
Self destructive messages will be ignored, since I don't know any way to delete them from the conversation and the history.
##### Confirming the key authenticity
Click on the buddy in the buddy list and click on "Show Info" to visualize the key fingerprint.
##### Initiate secret chats
To initiate a secret chat from Pidgin, click on a Buddy in the Buddy List and hit "Start Secret Chat"
##### Deleting secret chats
If you delete a secret chat from the buddy list, it will be terminated and no longer be usable.
#### Unicode Emojis for Pidgin
The Telegram phone applications for iOS and Android make use of standardized Unicode smileys (called [Emojis](https://en.wikipedia.org/wiki/Emoji)). Pidgin
does not display those smileys natively, but you can install a custom smiley theme like (https://github.com/stv0g/unicode-emoji) or (https://github.com/VxJasonxV/emoji-for-pidgin) and activate it under Settings > Themes > Smiley Theme.
#### Code-Tags
Since 1.3.0 it is possible to write messages in monospaced fonts using the markdown backtick syntax.
##### Example
``` if (true) {
// do smth
}```
##### Result
if (true) {
// do smth
}
Building the Adium Plugin
-------------------------
Compiling with XCode is a little bit problematic, since it requires you to compile Adium first to get the necessary framework files. My advice is to just use the [prebuilt bundle](https://github.com/majn/telegram-purple/releases), but if you really want to do it, follow these steps:
1. Get the Adium source, compile it with XCode and copy the build output into telegram-adium/Frameworks/Adium. It should contain at least Adium.framework, AdiumLibpurple.framework and AIUitilies.framework
2. Open the Adium source code, go to ./Frameworks and copy libglib.framework and libpurple.framework into telegram-adium/Frameworks/Adium
3. Build the tgl submodule and delete libtgl.so from libs/ (it should only contain libtgl.a)
4. Install libwebp, libgcrypt and gnupg with homebrew:
brew install webp
brew install libgcrypt libgpg-error
5. If you already downloaded libwebp/libgcrypt in previous builds make sure that the binaries are up-to-date
brew update
brew upgrade webp libgcrypt
6. Install with homebrew and move it into the appropriate directory so that XCode can find them. Note that the versions might differ, use the one that is
mkdir -p ./telegram-adium/Frameworks/Adium
cp /usr/local/Cellar/webp/0.4.3/lib/libwebp.a ./telegram-adium/Frameworks
cp /usr/local/Cellar/libgcrypt/1.6.4/lib/libgcrypt.20.dylib ./telegram-adium/Frameworks/Adium
cp /usr/local/Cellar/libgpg-error/1.20_1/lib/libgpg-error.0.dylib ./telegram-adium/Frameworks/Adium
7. Update the paths in the dylibs, to assure that the resulting binary will load them form within the bundle.
cd ./telegram-adium/Frameworks/Adium
install_name_tool -id "@loader_path/../Resources/libgcrypt.20.dylib" ./libgcrypt.20.dylib
install_name_tool -id "@loader_path/../Resources/libgpg-error.0.dylib" ./libgpg-error.0.dylib
install_name_tool -change "/usr/local/lib/libgpg-error.0.dylib" "@loader_path/../Resources/libgpg-error.0.dylib" ./libgcrypt.20.dylib
7. Build the XCode-Project and execute the created bundle
Building the Debian Package
---------------------------
If you just need a `.deb`, simply do:
sudo apt-get install debhelper
git checkout debian-master
git submodule update --recursive
fakeroot ./debian/rules binary
And you're done! The `.deb` is in the directory at which you started.
To show some info about it, try this:
dpkg --info telegram-purple_*.deb
`debian-master` always points to a version that was submitted to Debian. (Note that this doesn't exist yet, as we haven't released to Debian yet.)
`debian-develop` is the candidate for the next submission.
#### Debian Maintainers ####
If you're a maintainer (if you're not sure, then you aren't a
maintainer), you need to produce a lot more files than that.
Here's how you can generate a `.orig.tar.gz`:
make dist
Note that these are incompatible with the old `debian/genorigtar.sh`
tarballs, and can't be made compatible easily. If you need the tarball
from "back then", see the documentation there.
This command requires the original tar to exist (and will fail otherwise,
although the error message will be misleading) will build all further files,
specifically `.debian.tar.xz`, `.dsc`, `.deb`, and `.changes`:
dpkg-buildpackage
For the upload, you should use `pbuilder` and similar to build the package
in a more minimalistic environment. That covers the official part of the work-flow.
Of course, you can call small parts of the build process directly, in order to avoid
overhead like rebuilding. For example, if you only need the `.debian.tar.xz`
and `.dsc` files, do this:
make dist
false # Move tar to parent directory, by hand
dpkg-source -b .
Discussion / Help
-----------------
#### Custom pubkeys
As we want to avoid OpenSSL, it has become necessary to replace the PEM file format. This means that if you use a custom pubkey (which you really REALLY shouldn't be doing), you have to adapt, sorry.
We no longer ship `tg-server.pub` (old format), but instead `tg-server.tglpub` (new format). If you have a `.pub` and want to continue using telegram-purple, please use this (hopefully highly portable) tool: [pem2bignum](https://github.com/BenWiederhake/pem2bignum)
You can also write your own conversion tool if you prefer. The format is really simple:
1. `e`, the public exponent, encoded as big endian 32 bit fixed length (e.g. `0x00 01 00 01` for 65537)
2. `n_len`, the length of `n` in bytes, encoded as big endian 32 bit fixed length (e.g. `0x00 00 01 00` for a 2048-bit = 256-byte key)
3. `n_raw`, the raw modulus, encoded as big endian, using the previously indicated length (e.g. `0xC1 50 02 3E [248 bytes omitted] 21 79 25 1F` in the case of telegram's public RSA key.)
If you are interested in developing a non-OpenSSL-licensed converter, look into [insane-triangle-banana](https://github.com/BenWiederhake/insane-triangle-banana).
FAQ
---
- I receive pictures in a chat, but they aren't showing up
* A: Make sure that you don't have a plugin like "Conversation Colors" that strips HTML from messages and removes the pictures.
- I receive RPC_CALL_FAIL_401: SESSION REVOKED
* A: This basically means your session has been terminated but the program
doesn't handle terminated sessions properly yet. You have to clean the
~/.purple/telegram-purple/$PHONENUMBER directory to fix this issue.
For Arch Linux users that use Bitlbee you can find this directory in
`/var/lib/bitlbee/purple/telegram-purple/`
#### Group chat
Telegram group chat for telegram-purple or libtgl related discussions or questions:
- https://goo.gl/VudXys
Submitting Bug Reports
----------------------
**IMPORTANT**: if you report bugs PLEASE make sure to always **include as much information as possible**. This should always include **at least the telegram-purple version and (if possible) commit**, where you got telegram-purple from (Source build, package repository, etc.), the Pidgin version (if you use a different messenger please state that too!) and your OS Version.
If you describe some issue please be as precise as possible. Descriptions like "XY doesn't work" will not help me. Describe what you are doing what kind of issue you are experiencing: "If I click on X, Y happens, but instead I would expect Z to happen".
For error reports please include the application logs. To get Pidgin to print a log, [start it from command line, specifying the -d option](https://developer.pidgin.im/wiki/GetABacktrace#TheEasyWay). **ATTENTION**: This log will contain personal information like your phone number, message content or contact or chat names. If you plan on uploading it somewhere public mask those entries in the log.
Bug reports regarding crashes should include a backtrace if possible, there is extended documentation available on [how to get a backtrace for crashes](https://developer.pidgin.im/wiki/GetABacktrace)
Empathy / libtelepathy
----------------------
Empathy doesn't natively support libpurple plugins since its based on libtelepathy, but there is a compatibillity layer called telepathy-haze that can be used to execute libpurple
plugins. This means that you can basically run this plugin thanks to telepathy-haze but you will usually get less features and worse usability compared to real libpurple clients. If you use Empathy (or anything else based on libtelepathy) I recommend [telepathy-morse](https://projects.kde.org/projects/playground/network/telepathy/telepathy-morse/repository) which is a connection manager written specifically for your messenger.
Authors
-------
Telegram-Purple was written by:
- Matthias Jentsch <mtthsjntsch@gmail.com>
- Vitaly Valtman
- Ben Wiederhake <Ben.Wiederhake@gmail.com>
- Christopher Althaus <althaus.christopher@gmail.com>
Acknowledgements
----------------
This software is based on the library [Libtgl](https://github.com/vysheng/tgl), which was written by Vitaly Valtman <mail@vysheng.ru> and others, see (https://github.com/vysheng/tgl/)

View file

@ -1,2 +0,0 @@
decryptedMessageMediaVideoL12#4cee6ef3 thumb:bytes thumb_w:int thumb_h:int duration:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
decryptedMessageMediaAudioL12#6080758f duration:int size:int key:bytes iv:bytes = DecryptedMessageMedia;

View file

@ -1,437 +0,0 @@
/*
This file is part of tgl-library
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright Vitaly Valtman 2014
*/
#include "mtproto-common.h"
#include <string.h>
static int cur_token_len;
static char *cur_token;
static int cur_token_real_len;
static int cur_token_quoted;
static int multiline_output = 1;
static int multiline_offset;
static int multiline_offset_size = 2;
static int disable_field_names;
#define expect_token(token,len) \
if (len != cur_token_len || memcmp (cur_token, token, cur_token_len)) { return -1; } \
local_next_token ();
#define expect_token_ptr(token,len) \
if (len != cur_token_len || memcmp (cur_token, token, cur_token_len)) { return 0; } \
local_next_token ();
#define expect_token_autocomplete(token,len) \
if (cur_token_len == -3 && len >= cur_token_real_len && !memcmp (cur_token, token, cur_token_real_len)) { set_autocomplete_string (token); return -1; }\
if (len != cur_token_len || memcmp (cur_token, token, cur_token_len)) { return -1; } \
local_next_token ();
#define expect_token_ptr_autocomplete(token,len) \
if (cur_token_len == -3 && len >= cur_token_real_len && !memcmp (cur_token, token, cur_token_real_len)) { set_autocomplete_string (token); return 0; }\
if (len != cur_token_len || memcmp (cur_token, token, cur_token_len)) { return 0; } \
local_next_token ();
static int autocomplete_mode;
static char *autocomplete_string;
static int (*autocomplete_fun)(const char *, int, int, char **);
static void set_autocomplete_string (const char *s) {
if (autocomplete_string) { free (autocomplete_string); }
autocomplete_string = strdup (s);
assert (autocomplete_string);
autocomplete_mode = 1;
}
static void set_autocomplete_type (int (*f)(const char *, int, int, char **)) {
autocomplete_fun = f;
autocomplete_mode = 2;
}
static int is_int (void) {
if (cur_token_len <= 0) { return 0; }
char c = cur_token[cur_token_len];
cur_token[cur_token_len] = 0;
char *p = 0;
if (strtoll (cur_token, &p, 10)) {}
cur_token[cur_token_len] = c;
return p == cur_token + cur_token_len;
}
static long long get_int (void) {
if (cur_token_len <= 0) { return 0; }
char c = cur_token[cur_token_len];
cur_token[cur_token_len] = 0;
char *p = 0;
long long val = strtoll (cur_token, &p, 0);
cur_token[cur_token_len] = c;
return val;
}
static int is_double (void) {
if (cur_token_len <= 0) { return 0; }
char c = cur_token[cur_token_len];
cur_token[cur_token_len] = 0;
char *p = 0;
if (strtod (cur_token, &p)) {}
cur_token[cur_token_len] = c;
return p == cur_token + cur_token_len;
}
static double get_double (void) {
if (cur_token_len <= 0) { return 0; }
char c = cur_token[cur_token_len];
cur_token[cur_token_len] = 0;
char *p = 0;
double val = strtod (cur_token, &p);
cur_token[cur_token_len] = c;
return val;
}
static struct paramed_type *paramed_type_dup (struct paramed_type *P) {
if (ODDP (P)) { return P; }
struct paramed_type *R = malloc (sizeof (*R));
assert (R);
R->type = malloc (sizeof (*R->type));
assert (R->type);
memcpy (R->type, P->type, sizeof (*P->type));
R->type->id = strdup (P->type->id);
assert (R->type->id);
if (P->type->params_num) {
R->params = malloc (sizeof (void *) * P->type->params_num);
assert (R->params);
int i;
for (i = 0; i < P->type->params_num; i++) {
R->params[i] = paramed_type_dup (P->params[i]);
}
}
return R;
}
void tgl_paramed_type_free (struct paramed_type *P) {
if (ODDP (P)) { return; }
if (P->type->params_num) {
int i;
for (i = 0; i < P->type->params_num; i++) {
tgl_paramed_type_free (P->params[i]);
}
free (P->params);
}
free (P->type->id);
free (P->type);
free (P);
}
static char *buffer_pos, *buffer_end;
static int is_wspc (char c) {
return c <= 32 && c > 0;
}
static void skip_wspc (void) {
while (buffer_pos < buffer_end && is_wspc (*buffer_pos)) {
buffer_pos ++;
}
}
static int is_letter (char c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '.' || c == '_' || c == '-';
}
static char exp_buffer[1 << 25];;
static int exp_buffer_pos;
static inline int is_hex (char c) {
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
}
static inline int hex2dec (char c) {
if (c >= '0' && c <= '9') { return c - '0'; }
else { return c - 'a' + 10; }
}
static void expand_backslashed (char *s, int len) {
int backslashed = 0;
exp_buffer_pos = 0;
int i = 0;
while (i < len) {
assert (i + 3 <= (1 << 25));
if (backslashed) {
backslashed = 0;
switch (s[i ++]) {
case 'n':
exp_buffer[exp_buffer_pos ++] = '\n';
break;
case 'r':
exp_buffer[exp_buffer_pos ++] = '\r';
break;
case 't':
exp_buffer[exp_buffer_pos ++] = '\t';
break;
case 'b':
exp_buffer[exp_buffer_pos ++] = '\b';
break;
case 'a':
exp_buffer[exp_buffer_pos ++] = '\a';
break;
case '\\':
exp_buffer[exp_buffer_pos ++] = '\\';
break;
case 'x':
if (i + 2 > len || !is_hex (s[i]) || !is_hex (s[i + 1])) {
exp_buffer_pos = -1;
return;
}
exp_buffer[exp_buffer_pos ++] = hex2dec (s[i]) * 16 + hex2dec (s[i + 1]);
i += 2;
break;
default:
break;
}
} else {
if (s[i] == '\\') {
backslashed = 1;
i ++;
} else {
exp_buffer[exp_buffer_pos ++] = s[i ++];
}
}
}
}
static void local_next_token (void) {
skip_wspc ();
cur_token_quoted = 0;
if (buffer_pos >= buffer_end) {
cur_token_len = -3;
cur_token_real_len = 0;
return;
}
char c = *buffer_pos;
if (is_letter (c)) {
cur_token = buffer_pos;
while (buffer_pos < buffer_end && is_letter (*buffer_pos)) {
buffer_pos ++;
}
if (buffer_pos < buffer_end) {
cur_token_len = buffer_pos - cur_token;
} else {
cur_token_real_len = buffer_pos - cur_token;
cur_token_len = -3;
}
return;
} else if (c == '"') {
cur_token_quoted = 1;
cur_token = buffer_pos ++;
int backslashed = 0;
while (buffer_pos < buffer_end && (*buffer_pos != '"' || backslashed)) {
if (*buffer_pos == '\\') {
backslashed ^= 1;
} else {
backslashed = 0;
}
buffer_pos ++;
}
if (*buffer_pos == '"') {
buffer_pos ++;
expand_backslashed (cur_token + 1, buffer_pos - cur_token - 2);
if (exp_buffer_pos < 0) {
cur_token_len = -2;
} else {
cur_token_len = exp_buffer_pos;
cur_token = exp_buffer;
}
} else {
cur_token_len = -2;
}
return;
} else {
if (c) {
cur_token = buffer_pos ++;
cur_token_len = 1;
} else {
cur_token_len = -3;
cur_token_real_len = 0;
}
}
}
#define MAX_FVARS 100
static struct paramed_type *fvars[MAX_FVARS];
static int fvars_pos;
static void add_var_to_be_freed (struct paramed_type *P) {
assert (fvars_pos < MAX_FVARS);
fvars[fvars_pos ++] = P;
}
static void free_vars_to_be_freed (void) {
int i;
for (i = 0; i < fvars_pos; i++) {
tgl_paramed_type_free (fvars[i]);
}
fvars_pos = 0;
}
int tglf_extf_autocomplete (const char *text, int text_len, int index, char **R, char *data, int data_len) {
if (index == -1) {
buffer_pos = data;
buffer_end = data + data_len;
autocomplete_mode = 0;
local_next_token ();
struct paramed_type *P = autocomplete_function_any ();
free_vars_to_be_freed ();
if (P) { tgl_paramed_type_free (P); }
}
if (autocomplete_mode == 0) { return -1; }
int len = strlen (text);
if (autocomplete_mode == 1) {
if (index >= 0) { return -1; }
index = 0;
if (!strncmp (text, autocomplete_string, len)) {
*R = strdup (autocomplete_string);
assert (*R);
return index;
} else {
return -1;
}
} else {
return autocomplete_fun (text, len, index, R);
}
}
struct paramed_type *tglf_extf_store (const char *data, int data_len) {
buffer_pos = (char *)data;
buffer_end = (char *)(data + data_len);
local_next_token ();
return store_function_any ();
}
#define OUT_BUF_SIZE (1 << 25)
static char out_buf[OUT_BUF_SIZE];
static int out_buf_pos;
#define eprintf(...) \
do { \
out_buf_pos += snprintf (out_buf + out_buf_pos, OUT_BUF_SIZE - out_buf_pos, __VA_ARGS__);\
assert (out_buf_pos < OUT_BUF_SIZE);\
} while (0)\
static int valid_utf8_char (const char *str) {
unsigned char c = (unsigned char) *str;
int n = 0;
if ((c & 0x80) == 0x00) {
n = 0;
} else if ((c & 0xe0) == 0xc0) {
n = 1;
} else if ((c & 0xf0) == 0xe0) {
n = 2;
} else if ((c & 0xf8) == 0xf0) {
n = 3;
} else if ((c & 0xfc) == 0xf8) {
n = 4;
} else if ((c & 0xfe) == 0xfc) {
n = 5;
} else {
return -1;
}
int i;
for (i = 0; i < n; i ++) {
if ((((unsigned char)(str[i + 1])) & 0xc0) != 0x80) {
return -1;
}
}
return n + 1;
}
static void print_escaped_string (const char *str, int len) {
eprintf ("\"");
const char *end = str + len;
while (str < end) {
int n = valid_utf8_char (str);
if (n < 0) {
eprintf ("\\x%02x", (int)(unsigned char)*str);
str ++;
} else if (n >= 2) {
int i;
for (i = 0; i < n; i++) {
eprintf ("%c", *(str ++));
}
} else if (((unsigned char)*str) >= ' ' && *str != '"' && *str != '\\') {
eprintf ("%c", *str);
str ++;
} else {
switch (*str) {
case '\n':
eprintf("\\n");
break;
case '\r':
eprintf("\\r");
break;
case '\t':
eprintf("\\t");
break;
case '\b':
eprintf("\\b");
break;
case '\a':
eprintf("\\a");
break;
case '\\':
eprintf ("\\\\");
break;
case '"':
eprintf ("\\\"");
break;
default:
eprintf ("\\x%02x", (int)(unsigned char)*str);
break;
}
str ++;
}
}
eprintf ("\"");
}
static void print_offset (void) {
int i;
for (i = 0; i < multiline_offset; i++) {
eprintf (" ");
}
}
char *tglf_extf_fetch (struct paramed_type *T) {
out_buf_pos = 0;
fetch_type_any (T);
return out_buf;
}

48
auto.h
View file

@ -1,48 +0,0 @@
/*
This file is part of tgl-library
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright Vitaly Valtman 2014
*/
#ifndef __AUTO_H__
#define __AUTO_H__
struct tl_type_descr {
unsigned name;
char *id;
int params_num;
long long params_types;
};
struct paramed_type {
struct tl_type_descr *type;
struct paramed_type **params;
};
#define NAME_ARRAY 0x89932ad9
#define TYPE_TO_PARAM(NAME) (&(struct paramed_type) {.type = &tl_type_## NAME, .params=0})
#define TYPE_TO_PARAM_1(NAME,PARAM1) (&(struct paramed_type) {.type = &tl_type_## NAME, .params=(struct paramed_type *[1]){PARAM1}})
#define ODDP(x) (((long)(x)) & 1)
#define EVENP(x) (!ODDP(x))
#define INT2PTR(x) (void *)(long)(((long)x) * 2 + 1)
#define PTR2INT(x) ((((long)x) - 1) / 2)
void tgl_paramed_type_free (struct paramed_type *P);
#include "auto/auto-header.h"
#endif

16
autogen.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
set -e
autoreconf
(
cd po
export XGETTEXT="xgettext -kP_:1,2"
intltool-update --pot
## Translations are managed at https://www.transifex.com/telegram-purple-developers/telegram-purple/
## To update the .po files, download it from there, since intltool, msginit, and transifex produce slightly different files, and I'd like to avoid gigantic git diffs that only change indentation or similar things.
)
test -r Makefile || (echo "Autoreconf didn't create Makefile?!"; exit 1)
make --quiet build-nsi

614
ax_lua.m4
View file

@ -1,614 +0,0 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_lua.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_LUA[([MINIMUM-VERSION], [TOO-BIG-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
# AX_LUA_HEADERS[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
# AX_LUA_LIBS[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
# AX_LUA_READLINE[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])]
#
# DESCRIPTION
#
# Detect a Lua interpreter, optionally specifying a minimum and maximum
# version number. Set up important Lua paths, such as the directories in
# which to install scripts and modules (shared libraries).
#
# Also detect Lua headers and libraries. The Lua version contained in the
# header is checked to match the Lua interpreter version exactly. When
# searching for Lua libraries, the version number is used as a suffix.
# This is done with the goal of supporting multiple Lua installs (5.1 and
# 5.2 side-by-side).
#
# A note on compatibility with previous versions: This file has been
# mostly rewritten for serial 18. Most developers should be able to use
# these macros without needing to modify configure.ac. Care has been taken
# to preserve each macro's behavior, but there are some differences:
#
# 1) AX_WITH_LUA is deprecated; it now expands to the exact same thing as
# AX_PROG_LUA with no arguments.
#
# 2) AX_LUA_HEADERS now checks that the version number defined in lua.h
# matches the interpreter version. AX_LUA_HEADERS_VERSION is therefore
# unnecessary, so it is deprecated and does not expand to anything.
#
# 3) The configure flag --with-lua-suffix no longer exists; the user
# should instead specify the LUA precious variable on the command line.
# See the AX_PROG_LUA description for details.
#
# Please read the macro descriptions below for more information.
#
# This file was inspired by Andrew Dalke's and James Henstridge's
# python.m4 and Tom Payne's, Matthieu Moy's, and Reuben Thomas's ax_lua.m4
# (serial 17). Basically, this file is a mash-up of those two files. I
# like to think it combines the best of the two!
#
# AX_PROG_LUA: Search for the Lua interpreter, and set up important Lua
# paths. Adds precious variable LUA, which may contain the path of the Lua
# interpreter. If LUA is blank, the user's path is searched for an
# suitable interpreter.
#
# If MINIMUM-VERSION is supplied, then only Lua interpreters with a
# version number greater or equal to MINIMUM-VERSION will be accepted. If
# TOO-BIG- VERSION is also supplied, then only Lua interpreters with a
# version number greater or equal to MINIMUM-VERSION and less than
# TOO-BIG-VERSION will be accepted.
#
# Version comparisons require the AX_COMPARE_VERSION macro, which is
# provided by ax_compare_version.m4 from the Autoconf Archive.
#
# The Lua version number, LUA_VERSION, is found from the interpreter, and
# substituted. LUA_PLATFORM is also found, but not currently supported (no
# standard representation).
#
# Finally, the macro finds four paths:
#
# luadir Directory to install Lua scripts.
# pkgluadir $luadir/$PACKAGE
# luaexecdir Directory to install Lua modules.
# pkgluaexecdir $luaexecdir/$PACKAGE
#
# These paths a found based on $prefix, $exec_prefix, Lua's package.path,
# and package.cpath. The first path of package.path beginning with $prefix
# is selected as luadir. The first path of package.cpath beginning with
# $exec_prefix is used as luaexecdir. This should work on all reasonable
# Lua installations. If a path cannot be determined, a default path is
# used. Of course, the user can override these later when invoking make.
#
# luadir Default: $prefix/share/lua/$LUA_VERSION
# luaexecdir Default: $exec_prefix/lib/lua/$LUA_VERSION
#
# These directories can be used by Automake as install destinations. The
# variable name minus 'dir' needs to be used as a prefix to the
# appropriate Automake primary, e.g. lua_SCRIPS or luaexec_LIBRARIES.
#
# If an acceptable Lua interpreter is found, then ACTION-IF-FOUND is
# performed, otherwise ACTION-IF-NOT-FOUND is preformed. If ACTION-IF-NOT-
# FOUND is blank, then it will default to printing an error. To prevent
# the default behavior, give ':' as an action.
#
# AX_LUA_HEADERS: Search for Lua headers. Requires that AX_PROG_LUA be
# expanded before this macro. Adds precious variable LUA_INCLUDE, which
# may contain Lua specific include flags, e.g. -I/usr/include/lua5.1. If
# LUA_INCLUDE is blank, then this macro will attempt to find suitable
# flags.
#
# LUA_INCLUDE can be used by Automake to compile Lua modules or
# executables with embedded interpreters. The *_CPPFLAGS variables should
# be used for this purpose, e.g. myprog_CPPFLAGS = $(LUA_INCLUDE).
#
# This macro searches for the header lua.h (and others). The search is
# performed with a combination of CPPFLAGS, CPATH, etc, and LUA_INCLUDE.
# If the search is unsuccessful, then some common directories are tried.
# If the headers are then found, then LUA_INCLUDE is set accordingly.
#
# The paths automatically searched are:
#
# * /usr/include/luaX.Y
# * /usr/include/lua/X.Y
# * /usr/include/luaXY
# * /usr/local/include/luaX.Y
# * /usr/local/include/lua-X.Y
# * /usr/local/include/lua/X.Y
# * /usr/local/include/luaXY
#
# (Where X.Y is the Lua version number, e.g. 5.1.)
#
# The Lua version number found in the headers is always checked to match
# the Lua interpreter's version number. Lua headers with mismatched
# version numbers are not accepted.
#
# If headers are found, then ACTION-IF-FOUND is performed, otherwise
# ACTION-IF-NOT-FOUND is performed. If ACTION-IF-NOT-FOUND is blank, then
# it will default to printing an error. To prevent the default behavior,
# set the action to ':'.
#
# AX_LUA_LIBS: Search for Lua libraries. Requires that AX_PROG_LUA be
# expanded before this macro. Adds precious variable LUA_LIB, which may
# contain Lua specific linker flags, e.g. -llua5.1. If LUA_LIB is blank,
# then this macro will attempt to find suitable flags.
#
# LUA_LIB can be used by Automake to link Lua modules or executables with
# embedded interpreters. The *_LIBADD and *_LDADD variables should be used
# for this purpose, e.g. mymod_LIBADD = $(LUA_LIB).
#
# This macro searches for the Lua library. More technically, it searches
# for a library containing the function lua_load. The search is performed
# with a combination of LIBS, LIBRARY_PATH, and LUA_LIB.
#
# If the search determines that some linker flags are missing, then those
# flags will be added to LUA_LIB.
#
# If libraries are found, then ACTION-IF-FOUND is performed, otherwise
# ACTION-IF-NOT-FOUND is performed. If ACTION-IF-NOT-FOUND is blank, then
# it will default to printing an error. To prevent the default behavior,
# set the action to ':'.
#
# AX_LUA_READLINE: Search for readline headers and libraries. Requires the
# AX_LIB_READLINE macro, which is provided by ax_lib_readline.m4 from the
# Autoconf Archive.
#
# If a readline compatible library is found, then ACTION-IF-FOUND is
# performed, otherwise ACTION-IF-NOT-FOUND is performed.
#
# LICENSE
#
# Copyright (c) 2013 Tim Perkins <tprk77@gmail.com>
# Copyright (c) 2013 Reuben Thomas <rrt@sc3d.org>
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 21
dnl =========================================================================
dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION],
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl =========================================================================
AC_DEFUN([AX_PROG_LUA],
[
dnl Make LUA a precious variable.
AC_ARG_VAR([LUA], [The Lua interpreter, e.g. /usr/bin/lua5.1])
dnl Find a Lua interpreter.
m4_define_default([_AX_LUA_INTERPRETER_LIST],
[lua lua5.2 lua52 lua5.1 lua51 lua50])
m4_if([$1], [],
[ dnl No version check is needed. Find any Lua interpreter.
AS_IF([test "x$LUA" = 'x'],
[AC_PATH_PROGS([LUA], [_AX_LUA_INTERPRETER_LIST], [:])])
ax_display_LUA='lua'
dnl At least check if this is a Lua interpreter.
AC_MSG_CHECKING([if $LUA is a Lua interpreter])
_AX_LUA_CHK_IS_INTRP([$LUA],
[AC_MSG_RESULT([yes])],
[ AC_MSG_RESULT([no])
AC_MSG_ERROR([not a Lua interpreter])
])
],
[ dnl A version check is needed.
AS_IF([test "x$LUA" != 'x'],
[ dnl Check if this is a Lua interpreter.
AC_MSG_CHECKING([if $LUA is a Lua interpreter])
_AX_LUA_CHK_IS_INTRP([$LUA],
[AC_MSG_RESULT([yes])],
[ AC_MSG_RESULT([no])
AC_MSG_ERROR([not a Lua interpreter])
])
dnl Check the version.
m4_if([$2], [],
[_ax_check_text="whether $LUA version >= $1"],
[_ax_check_text="whether $LUA version >= $1, < $2"])
AC_MSG_CHECKING([$_ax_check_text])
_AX_LUA_CHK_VER([$LUA], [$1], [$2],
[AC_MSG_RESULT([yes])],
[ AC_MSG_RESULT([no])
AC_MSG_ERROR([version is out of range for specified LUA])])
ax_display_LUA=$LUA
],
[ dnl Try each interpreter until we find one that satisfies VERSION.
m4_if([$2], [],
[_ax_check_text="for a Lua interpreter with version >= $1"],
[_ax_check_text="for a Lua interpreter with version >= $1, < $2"])
AC_CACHE_CHECK([$_ax_check_text],
[ax_cv_pathless_LUA],
[ for ax_cv_pathless_LUA in _AX_LUA_INTERPRETER_LIST none; do
test "x$ax_cv_pathless_LUA" = 'xnone' && break
_AX_LUA_CHK_IS_INTRP([$ax_cv_pathless_LUA], [], [continue])
_AX_LUA_CHK_VER([$ax_cv_pathless_LUA], [$1], [$2], [break])
done
])
dnl Set $LUA to the absolute path of $ax_cv_pathless_LUA.
AS_IF([test "x$ax_cv_pathless_LUA" = 'xnone'],
[LUA=':'],
[AC_PATH_PROG([LUA], [$ax_cv_pathless_LUA])])
ax_display_LUA=$ax_cv_pathless_LUA
])
])
AS_IF([test "x$LUA" = 'x:'],
[ dnl Run any user-specified action, or abort.
m4_default([$4], [AC_MSG_ERROR([cannot find suitable Lua interpreter])])
],
[ dnl Query Lua for its version number.
AC_CACHE_CHECK([for $ax_display_LUA version], [ax_cv_lua_version],
[ ax_cv_lua_version=`$LUA -e "print(_VERSION)" | \
sed "s|^Lua \(.*\)|\1|" | \
grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"`
])
AS_IF([test "x$ax_cv_lua_version" = 'x'],
[AC_MSG_ERROR([invalid Lua version number])])
AC_SUBST([LUA_VERSION], [$ax_cv_lua_version])
AC_SUBST([LUA_SHORT_VERSION], [`echo "$LUA_VERSION" | sed 's|\.||'`])
dnl The following check is not supported:
dnl At times (like when building shared libraries) you may want to know
dnl which OS platform Lua thinks this is.
AC_CACHE_CHECK([for $ax_display_LUA platform], [ax_cv_lua_platform],
[ax_cv_lua_platform=`$LUA -e "print('unknown')"`])
AC_SUBST([LUA_PLATFORM], [$ax_cv_lua_platform])
dnl Use the values of $prefix and $exec_prefix for the corresponding
dnl values of LUA_PREFIX and LUA_EXEC_PREFIX. These are made distinct
dnl variables so they can be overridden if need be. However, the general
dnl consensus is that you shouldn't need this ability.
AC_SUBST([LUA_PREFIX], ['${prefix}'])
AC_SUBST([LUA_EXEC_PREFIX], ['${exec_prefix}'])
dnl Lua provides no way to query the script directory, and instead
dnl provides LUA_PATH. However, we should be able to make a safe educated
dnl guess. If the built-in search path contains a directory which is
dnl prefixed by $prefix, then we can store scripts there. The first
dnl matching path will be used.
AC_CACHE_CHECK([for $ax_display_LUA script directory],
[ax_cv_lua_luadir],
[ AS_IF([test "x$prefix" = 'xNONE'],
[ax_lua_prefix=$ac_default_prefix],
[ax_lua_prefix=$prefix])
dnl Initialize to the default path.
ax_cv_lua_luadir="$LUA_PREFIX/share/lua/$LUA_VERSION"
dnl Try to find a path with the prefix.
_AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_prefix], [package.path])
AS_IF([test "x$ax_lua_prefixed_path" != 'x'],
[ dnl Fix the prefix.
_ax_strip_prefix=`echo "$ax_lua_prefix" | sed 's|.|.|g'`
ax_cv_lua_luadir=`echo "$ax_lua_prefixed_path" | \
sed "s,^$_ax_strip_prefix,$LUA_PREFIX,"`
])
])
AC_SUBST([luadir], [$ax_cv_lua_luadir])
AC_SUBST([pkgluadir], [\${luadir}/$PACKAGE])
dnl Lua provides no way to query the module directory, and instead
dnl provides LUA_PATH. However, we should be able to make a safe educated
dnl guess. If the built-in search path contains a directory which is
dnl prefixed by $exec_prefix, then we can store modules there. The first
dnl matching path will be used.
AC_CACHE_CHECK([for $ax_display_LUA module directory],
[ax_cv_lua_luaexecdir],
[ AS_IF([test "x$exec_prefix" = 'xNONE'],
[ax_lua_exec_prefix=$ax_lua_prefix],
[ax_lua_exec_prefix=$exec_prefix])
dnl Initialize to the default path.
ax_cv_lua_luaexecdir="$LUA_EXEC_PREFIX/lib/lua/$LUA_VERSION"
dnl Try to find a path with the prefix.
_AX_LUA_FND_PRFX_PTH([$LUA],
[$ax_lua_exec_prefix], [package.cpathd])
AS_IF([test "x$ax_lua_prefixed_path" != 'x'],
[ dnl Fix the prefix.
_ax_strip_prefix=`echo "$ax_lua_exec_prefix" | sed 's|.|.|g'`
ax_cv_lua_luaexecdir=`echo "$ax_lua_prefixed_path" | \
sed "s,^$_ax_strip_prefix,$LUA_EXEC_PREFIX,"`
])
])
AC_SUBST([luaexecdir], [$ax_cv_lua_luaexecdir])
AC_SUBST([pkgluaexecdir], [\${luaexecdir}/$PACKAGE])
dnl Run any user specified action.
$3
])
])
dnl AX_WITH_LUA is now the same thing as AX_PROG_LUA.
AC_DEFUN([AX_WITH_LUA],
[
AC_MSG_WARN([[$0 is deprecated, please use AX_PROG_LUA]])
AX_PROG_LUA
])
dnl =========================================================================
dnl _AX_LUA_CHK_IS_INTRP(PROG, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
dnl =========================================================================
AC_DEFUN([_AX_LUA_CHK_IS_INTRP],
[
dnl Just print _VERSION because all Lua interpreters have this global.
AS_IF([$1 -e "print('Hello ' .. _VERSION .. '!')" &>/dev/null],
[$2], [$3])
])
dnl =========================================================================
dnl _AX_LUA_CHK_VER(PROG, MINIMUM-VERSION, [TOO-BIG-VERSION],
dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE])
dnl =========================================================================
AC_DEFUN([_AX_LUA_CHK_VER],
[
_ax_test_ver=`$1 -e "print(_VERSION)" 2>/dev/null | \
sed "s|^Lua \(.*\)|\1|" | grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"`
AS_IF([test "x$_ax_test_ver" = 'x'],
[_ax_test_ver='0'])
AX_COMPARE_VERSION([$_ax_test_ver], [ge], [$2])
m4_if([$3], [], [],
[ AS_IF([$ax_compare_version],
[AX_COMPARE_VERSION([$_ax_test_ver], [lt], [$3])])
])
AS_IF([$ax_compare_version], [$4], [$5])
])
dnl =========================================================================
dnl _AX_LUA_FND_PRFX_PTH(PROG, PREFIX, LUA-PATH-VARIABLE)
dnl =========================================================================
AC_DEFUN([_AX_LUA_FND_PRFX_PTH],
[
dnl Invokes the Lua interpreter PROG to print the path variable
dnl LUA-PATH-VARIABLE, usually package.path or package.cpath. Paths are
dnl then matched against PREFIX. The first path to begin with PREFIX is set
dnl to ax_lua_prefixed_path.
ax_lua_prefixed_path=''
_ax_package_paths=`$1 -e 'print($3)' 2>/dev/null | sed 's|;|\n|g'`
dnl Try the paths in order, looking for the prefix.
for _ax_package_path in $_ax_package_paths; do
dnl Copy the path, up to the use of a Lua wildcard.
_ax_path_parts=`echo "$_ax_package_path" | sed 's|/|\n|g'`
_ax_reassembled=''
for _ax_path_part in $_ax_path_parts; do
echo "$_ax_path_part" | grep '\?' >/dev/null && break
_ax_reassembled="$_ax_reassembled/$_ax_path_part"
done
dnl Check the path against the prefix.
_ax_package_path=$_ax_reassembled
if echo "$_ax_package_path" | grep "^$2" >/dev/null; then
dnl Found it.
ax_lua_prefixed_path=$_ax_package_path
break
fi
done
])
dnl =========================================================================
dnl AX_LUA_HEADERS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl =========================================================================
AC_DEFUN([AX_LUA_HEADERS],
[
dnl Check for LUA_VERSION.
AC_MSG_CHECKING([if LUA_VERSION is defined])
AS_IF([test "x$LUA_VERSION" != 'x'],
[AC_MSG_RESULT([yes])],
[ AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot check Lua headers without knowing LUA_VERSION])
])
dnl Make LUA_INCLUDE a precious variable.
AC_ARG_VAR([LUA_INCLUDE], [The Lua includes, e.g. -I/usr/include/lua5.1])
dnl Some default directories to search.
LUA_SHORT_VERSION=`echo "$LUA_VERSION" | sed 's|\.||'`
m4_define_default([_AX_LUA_INCLUDE_LIST],
[ /usr/include/lua$LUA_VERSION \
/usr/include/lua/$LUA_VERSION \
/usr/include/lua$LUA_SHORT_VERSION \
/usr/local/include/lua$LUA_VERSION \
/usr/local/include/lua-$LUA_VERSION \
/usr/local/include/lua/$LUA_VERSION \
/usr/local/include/lua$LUA_SHORT_VERSION \
])
dnl Try to find the headers.
_ax_lua_saved_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
CPPFLAGS=$_ax_lua_saved_cppflags
dnl Try some other directories if LUA_INCLUDE was not set.
AS_IF([test "x$LUA_INCLUDE" = 'x' &&
test "x$ac_cv_header_lua_h" != 'xyes'],
[ dnl Try some common include paths.
for _ax_include_path in _AX_LUA_INCLUDE_LIST; do
test ! -d "$_ax_include_path" && continue
AC_MSG_CHECKING([for Lua headers in])
AC_MSG_RESULT([$_ax_include_path])
AS_UNSET([ac_cv_header_lua_h])
AS_UNSET([ac_cv_header_lualib_h])
AS_UNSET([ac_cv_header_lauxlib_h])
AS_UNSET([ac_cv_header_luaconf_h])
_ax_lua_saved_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$_ax_include_path"
AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
CPPFLAGS=$_ax_lua_saved_cppflags
AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
[ LUA_INCLUDE="-I$_ax_include_path"
break
])
done
])
AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
[ dnl Make a program to print LUA_VERSION defined in the header.
dnl TODO This probably shouldn't be a runtime test.
AC_CACHE_CHECK([for Lua header version],
[ax_cv_lua_header_version],
[ _ax_lua_saved_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
AC_RUN_IFELSE(
[ AC_LANG_SOURCE([[
#include <lua.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char ** argv)
{
if(argc > 1) printf("%s", LUA_VERSION);
exit(EXIT_SUCCESS);
}
]])
],
[ ax_cv_lua_header_version=`./conftest$EXEEXT p | \
sed "s|^Lua \(.*\)|\1|" | \
grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"`
],
[ax_cv_lua_header_version='unknown'])
CPPFLAGS=$_ax_lua_saved_cppflags
])
dnl Compare this to the previously found LUA_VERSION.
AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION])
AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"],
[ AC_MSG_RESULT([yes])
ax_header_version_match='yes'
],
[ AC_MSG_RESULT([no])
ax_header_version_match='no'
])
])
dnl Was LUA_INCLUDE specified?
AS_IF([test "x$ax_header_version_match" != 'xyes' &&
test "x$LUA_INCLUDE" != 'x'],
[AC_MSG_ERROR([cannot find headers for specified LUA_INCLUDE])])
dnl Test the final result and run user code.
AS_IF([test "x$ax_header_version_match" = 'xyes'], [$1],
[m4_default([$2], [AC_MSG_ERROR([cannot find Lua includes])])])
])
dnl AX_LUA_HEADERS_VERSION no longer exists, use AX_LUA_HEADERS.
AC_DEFUN([AX_LUA_HEADERS_VERSION],
[
AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS]])
])
dnl =========================================================================
dnl AX_LUA_LIBS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl =========================================================================
AC_DEFUN([AX_LUA_LIBS],
[
dnl TODO Should this macro also check various -L flags?
dnl Check for LUA_VERSION.
AC_MSG_CHECKING([if LUA_VERSION is defined])
AS_IF([test "x$LUA_VERSION" != 'x'],
[AC_MSG_RESULT([yes])],
[ AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot check Lua libs without knowing LUA_VERSION])
])
dnl Make LUA_LIB a precious variable.
AC_ARG_VAR([LUA_LIB], [The Lua library, e.g. -llua5.1])
AS_IF([test "x$LUA_LIB" != 'x'],
[ dnl Check that LUA_LIBS works.
_ax_lua_saved_libs=$LIBS
LIBS="$LIBS $LUA_LIB"
AC_SEARCH_LIBS([lua_load], [],
[_ax_found_lua_libs='yes'],
[_ax_found_lua_libs='no'])
LIBS=$_ax_lua_saved_libs
dnl Check the result.
AS_IF([test "x$_ax_found_lua_libs" != 'xyes'],
[AC_MSG_ERROR([cannot find libs for specified LUA_LIB])])
],
[ dnl First search for extra libs.
_ax_lua_extra_libs=''
_ax_lua_saved_libs=$LIBS
LIBS="$LIBS $LUA_LIB"
AC_SEARCH_LIBS([exp], [m])
AC_SEARCH_LIBS([dlopen], [dl])
LIBS=$_ax_lua_saved_libs
AS_IF([test "x$ac_cv_search_exp" != 'xno' &&
test "x$ac_cv_search_exp" != 'xnone required'],
[_ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_exp"])
AS_IF([test "x$ac_cv_search_dlopen" != 'xno' &&
test "x$ac_cv_search_dlopen" != 'xnone required'],
[_ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_dlopen"])
dnl Try to find the Lua libs.
_ax_lua_saved_libs=$LIBS
LIBS="$LIBS $LUA_LIB"
AC_SEARCH_LIBS([lua_load],
[ lua$LUA_VERSION \
lua$LUA_SHORT_VERSION \
lua-$LUA_VERSION \
lua-$LUA_SHORT_VERSION \
lua],
[_ax_found_lua_libs='yes'],
[_ax_found_lua_libs='no'],
[$_ax_lua_extra_libs])
LIBS=$_ax_lua_saved_libs
AS_IF([test "x$ac_cv_search_lua_load" != 'xno' &&
test "x$ac_cv_search_lua_load" != 'xnone required'],
[LUA_LIB="$ac_cv_search_lua_load $_ax_lua_extra_libs"])
])
dnl Test the result and run user code.
AS_IF([test "x$_ax_found_lua_libs" = 'xyes'], [$1],
[m4_default([$2], [AC_MSG_ERROR([cannot find Lua libs])])])
])
dnl =========================================================================
dnl AX_LUA_READLINE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl =========================================================================
AC_DEFUN([AX_LUA_READLINE],
[
AX_LIB_READLINE
AS_IF([test "x$ac_cv_header_readline_readline_h" != 'x' &&
test "x$ac_cv_header_readline_history_h" != 'x'],
[ LUA_LIBS_CFLAGS="-DLUA_USE_READLINE $LUA_LIBS_CFLAGS"
$1
],
[$2])
])

2132
binlog.c

File diff suppressed because it is too large Load diff

View file

@ -1,99 +0,0 @@
/*
This file is part of tgl-library
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright Vitaly Valtman 2013-2014
*/
#ifndef __BINLOG_H__
#define __BINLOG_H__
//#include "structures.h"
#include "tgl.h"
void bl_do_set_auth_key_id (int num, unsigned char *buf);
void bl_do_dc_option (int id, int l1, const char *name, int l2, const char *ip, int port);
void bl_do_set_our_id (int id);
void bl_do_user_add (int id, const char *f, int fl, const char *l, int ll, long long access_token, const char *p, int pl, int contact);
void bl_do_user_delete (struct tgl_user *U);
void bl_do_set_user_profile_photo (struct tgl_user *U, long long photo_id, struct tgl_file_location *big, struct tgl_file_location *small);
void bl_do_user_set_name (struct tgl_user *U, const char *f, int fl, const char *l, int ll);
void bl_do_user_set_access_hash (struct tgl_user *U, long long access_token);
void bl_do_user_set_phone (struct tgl_user *U, const char *p, int pl);
void bl_do_user_set_friend (struct tgl_user *U, int friend);
void bl_do_user_set_full_photo (struct tgl_user *U, const int *start, int len);
void bl_do_user_set_blocked (struct tgl_user *U, int blocked);
void bl_do_user_set_real_name (struct tgl_user *U, const char *f, int fl, const char *l, int ll);
void bl_do_encr_chat_delete (struct tgl_secret_chat *U);
void bl_do_encr_chat_requested (struct tgl_secret_chat *U, long long access_hash, int date, int admin_id, int user_id, unsigned char g_key[], unsigned char nonce[]);
void bl_do_encr_chat_create (int id, int user_id, int admin_id, char *name, int name_len);
void bl_do_encr_chat_set_access_hash (struct tgl_secret_chat *U, long long access_hash);
void bl_do_encr_chat_set_date (struct tgl_secret_chat *U, int date);
void bl_do_encr_chat_set_state (struct tgl_secret_chat *U, enum tgl_secret_chat_state state);
void bl_do_encr_chat_set_ttl (struct tgl_secret_chat *U, int ttl);
void bl_do_encr_chat_set_layer (struct tgl_secret_chat *U, int layer);
void bl_do_encr_chat_accepted (struct tgl_secret_chat *U, const unsigned char g_key[], const unsigned char nonce[], long long key_fingerprint);
void bl_do_encr_chat_set_key (struct tgl_secret_chat *E, unsigned char key[], long long key_fingerprint);
void bl_do_encr_chat_init (int id, int user_id, unsigned char random[], unsigned char g_a[]);
void bl_do_dc_signed (int id);
void bl_do_set_working_dc (int num);
void bl_do_set_dh_params (int root, unsigned char prime[], int version);
void bl_do_set_pts (int pts);
void bl_do_set_qts (int qts);
void bl_do_set_seq (int seq);
void bl_do_set_date (int date);
void bl_do_create_chat (struct tgl_chat *C, int y, const char *s, int l, int users_num, int date, int version, struct tgl_file_location *big, struct tgl_file_location *small);
void bl_do_chat_forbid (struct tgl_chat *C, int on);
void bl_do_chat_set_title (struct tgl_chat *C, const char *s, int l);
void bl_do_chat_set_photo (struct tgl_chat *C, struct tgl_file_location *big, struct tgl_file_location *small);
void bl_do_chat_set_date (struct tgl_chat *C, int date);
void bl_do_chat_set_set_in_chat (struct tgl_chat *C, int on);
void bl_do_chat_set_version (struct tgl_chat *C, int version, int user_num);
void bl_do_chat_set_admin (struct tgl_chat *C, int admin);
void bl_do_chat_set_participants (struct tgl_chat *C, int version, int user_num, struct tgl_chat_user *users);
void bl_do_chat_set_full_photo (struct tgl_chat *U, const int *start, int len);
void bl_do_chat_add_user (struct tgl_chat *C, int version, int user, int inviter, int date);
void bl_do_chat_del_user (struct tgl_chat *C, int version, int user);
void bl_do_create_message_text (int msg_id, int from_id, int to_type, int to_id, int date, int unread, int l, const char *s);
void bl_do_create_message_text_fwd (int msg_id, int from_id, int to_type, int to_id, int date, int fwd, int fwd_date, int unread, int l, const char *s);
void bl_do_create_message_service (int msg_id, int from_id, int to_type, int to_id, int date, int unread, const int *data, int len);
void bl_do_create_message_service_fwd (int msg_id, int from_id, int to_type, int to_id, int date, int fwd, int fwd_date, int unread, const int *data, int len);
void bl_do_create_message_media (int msg_id, int from_id, int to_type, int to_id, int date, int unread, int l, const char *s, const int *data, int len);
void bl_do_create_message_media_encr_pending (long long msg_id, int from_id, int to_type, int to_id, int date, int l, const char *s, const int *data, int len);
void bl_do_create_message_media_encr_sent (long long msg_id, const int *data, int len);
void bl_do_create_message_media_fwd (int msg_id, int from_id, int to_type, int to_id, int date, int fwd, int fwd_date, int unread, int l, const char *s, const int *data, int len);
void bl_do_create_message_media_encr (long long msg_id, int from_id, int to_type, int to_id, int date, int l, const char *s, const int *data, int len, const int *data2, int len2);
void bl_do_create_message_service_encr (long long msg_id, int from_id, int to_type, int to_id, int date, const int *data, int len);
void bl_do_send_message_text (long long msg_id, int from_id, int to_type, int to_id, int date, int l, const char *s);
void bl_do_send_message_action_encr (long long msg_id, int from_id, int to_type, int to_id, int date, int l, const int *s);
void bl_do_set_unread (struct tgl_message *M, int unread);
void bl_do_set_message_sent (struct tgl_message *M);
void bl_do_set_msg_id (struct tgl_message *M, int id);
void bl_do_delete_msg (struct tgl_message *M);
void bl_do_msg_seq_update (long long id);
void bl_do_msg_update (long long id);
void bl_do_reset_authorization (void);
//void bl_do_add_dc (int id, const char *ip, int l, int port, long long auth_key_id, const char *auth_key);
#endif

View file

@ -1,79 +0,0 @@
---types---
binlog.fileLocation dc:int volume:long local_id:int secret:long = binlog.FileLocation;
binlog.chatParticipant user:int inviter:int date:int = binlog.ChatParticipant;
binlog.start = binlog.Update;
binlog.dcOption id:int name:string ip:string port:int = binlog.Update;
binlog.authKey dc:int key_id:long key:64*[int] = binlog.Update;
binlog.defaultDc dc:int = binlog.Update;
binlog.ourId id:int = binlog.Update;
binlog.dcSigned id:int = binlog.Update;
binlog.dcSalt id:int salt:long = binlog.Update;
binlog.setDhParams root:int prime:64*[int] version:int = binlog.Update;
binlog.setPts pts:int = binlog.Update;
binlog.setQts qts:int = binlog.Update;
binlog.setDate date:int = binlog.Update;
binlog.setSeq seq:int = binlog.Update;
binlog.userAdd id:int first_name:string last_name:string hash:long phone:string is_contact:int = binlog.Update;
binlog.userDelete id:int = binlog.Update;
binlog.userSetAccessHash id:int hash:long = binlog.Update;
binlog.userSetPhone id:int phone:string = binlog.Update;
binlog.userSetFriend id:int friend:int = binlog.Update;
binlog.userSetFullPhoto id:int photo:Photo = binlog.Update;
binlog.userSetBlocked id:int blocked:int = binlog.Update;
binlog.userSetRealName id:int real_first_name:string real_last_name:string = binlog.Update;
binlog.userSetName id:int first_name:string last_name:string = binlog.Update;
binlog.userSetPhoto id:int photo:UserProfilePhoto = binlog.Update;
binlog.encrChatDelete id:int = binlog.Update;
binlog.encrChatRequested id:int hash:long date:int admin:int user:int key:64*[int] nonce:64*[int] = binlog.Update;
binlog.encrChatAccepted id:int key:64*[int] nonce:64*[int] fingerprint:long = binlog.Update;
binlog.encrChatInit id:int user:int key:64*[int] g_key:64*[int] = binlog.Update;
binlog.encrChatCreate id:int user_id:int admin_id:int name:string = binlog.Update;
binlog.encrChatSetAccessHash id:int hash:long = binlog.Update;
binlog.encrChatSetDate id:int date:int = binlog.Update;
binlog.encrChatSetTtl id:int ttl:int = binlog.Update;
binlog.encrChatSetLayer id:int layer:int = binlog.Update;
binlog.encrChatSetState id:int state:int = binlog.Update;
binlog.encrChatSetKey id:int key:64*[int] fingerprint:long = binlog.Update;
binlog.chatCreate id:int flags:int title:string user_num:int date:int version:int photo_big:%binlog.FileLocation photo_small:%binlog.FileLocation = binlog.Update;
binlog.chatChangeFlags id:int set_flags:int clear_flags:int = binlog.Update;
binlog.chatSetTitle id:int title:string = binlog.Update;
binlog.chatSetPhoto id:int photo_big:%binlog.FileLocation photo_small:%binlog.FileLocation = binlog.Update;
binlog.chatSetDate id:int date:int = binlog.Update;
binlog.chatSetVersion id:int version:int users_num:int = binlog.Update;
binlog.chatSetAdmin id:int admin:int = binlog.Update;
binlog.chatSetParticipants id:int version:int participants:%(Vector %binlog.ChatParticipant) = binlog.Update;
binlog.chatSetFullPhoto id:int photo:Photo = binlog.Update;
binlog.chatAddParticipant id:int version:int user:%binlog.ChatParticipant = binlog.Update;
binlog.chatDelParticipant id:int version:int user:int = binlog.Update;
binlog.createMessageText id:int from_id:int to_type:int to_id:int date:int unread:int text:string = binlog.Update;
binlog.sendMessageText id:long from_id:int to_type:int to_id:int date:int text:string = binlog.Update;
binlog.sendMessageActionEncr id:long from_id:int to_type:int to_id:int date:int action:DecryptedMessageAction = binlog.Update;
binlog.createMessageTextFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int unread:int text:string = binlog.Update;
binlog.createMessageMedia id:int from_id:int to_type:int to_id:int date:int unread:int text:string media:MessageMedia = binlog.Update;
binlog.createMessageMediaEncr id:long from_id:int to_type:int to_id:int date:int text:string media:DecryptedMessageMedia file:EncryptedFile = binlog.Update;
binlog.createMessageMediaEncrPending id:long from_id:int to_type:int to_id:int date:int text:string media:DecryptedMessageMedia = binlog.Update;
binlog.createMessageMediaEncrSent id:long file:EncryptedFile = binlog.Update;
binlog.createMessageMediaFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int unread:int text:string media:MessageMedia = binlog.Update;
binlog.createMessageService id:int from_id:int to_type:int to_id:int date:int unread:int action:MessageAction = binlog.Update;
binlog.createMessageServiceEncr id:long from_id:int to_type:int to_id:int date:int action:DecryptedMessageAction = binlog.Update;
binlog.createMessageServiceFwd id:int from_id:int to_type:int to_id:int date:int fwd_from_id:int fwd_date:int unread:int action:MessageAction = binlog.Update;
binlog.messageSetUnread id:int = binlog.Update;
binlog.messageSetUnreadLong id:long = binlog.Update;
binlog.setMessageSent id:long = binlog.Update;
binlog.setMsgId old_id:long new_id:int = binlog.Update;
binlog.deleteMsg id:long = binlog.Update;
binlog.msgSeqUpdate id:long = binlog.Update;
binlog.msgUpdate id:long = binlog.Update;
binlog.resetAuthorization = binlog.Update;
//binlog.addDc id:int ip:string port:int auth_key_id:long auth_key:64*[int] = binlog.Update;

45
commit.h.gen Executable file
View file

@ -0,0 +1,45 @@
#!/bin/sh
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Ben Wiederhake 2016
set -e
if ! (command -v git && git status) >/dev/null 2>&1
then
if test -r commit.h
then
echo "No git available. Assuming everything is up-to-date."
exit 0
else
echo >&2 "No git available. Can't reconstruct commit.h"
exit 1
fi
fi
GIT_COMMIT=`git rev-parse HEAD | cut -c1-10`
if grep -scq "${GIT_COMMIT}" commit.h
then
echo "commit.h is up-to-date"
else
echo "Refresh commit.h"
echo "#ifndef GIT_COMMIT" > commit.h
echo "# define GIT_COMMIT \"${GIT_COMMIT}\"" >> commit.h
echo "#endif" >> commit.h
fi

View file

@ -1,91 +1,45 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Use libevent v1 */
#undef EVENT_V1
/* Use libevent v2 */
#undef EVENT_V2
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
/* Define the gettext package to be used */
#undef GETTEXT_PACKAGE
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `endpwent' function. */
#undef HAVE_ENDPWENT
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <lauxlib.h> header file. */
#undef HAVE_LAUXLIB_H
/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
#undef HAVE_LIBGCRYPT
/* Define to 1 if you have the `config' library (-lconfig). */
#undef HAVE_LIBCONFIG
/* Define to 1 if you have the `rt' library (-lrt). */
#undef HAVE_LIBRT
/* Define to 1 if you have the `event' library (-levent). */
#undef HAVE_LIBEVENT
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `webp' library (-lwebp). */
#undef HAVE_LIBWEBP
/* Define to 1 if you have `z' library (-lz) */
#undef HAVE_LIBZ
/* Define to 1 if you have the <luaconf.h> header file. */
#undef HAVE_LUACONF_H
/* Define to 1 if you have the <lualib.h> header file. */
#undef HAVE_LUALIB_H
/* Define to 1 if you have the <lua.h> header file. */
#undef HAVE_LUA_H
/* Define to 1 if you have the <mach/mach.h> header file. */
#undef HAVE_MACH_MACH_H
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the `mkdir' function. */
#undef HAVE_MKDIR
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@ -101,33 +55,21 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the `uname' function. */
#undef HAVE_UNAME
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if the system has the `__builtin_bswap32' built-in function */
#undef HAVE___BUILTIN_BSWAP32
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@ -146,32 +88,11 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Use custom prog name */
#undef PROG_NAME
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* use lua */
#undef USE_LUA
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t

116
config.h.mingw Normal file
View file

@ -0,0 +1,116 @@
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Vitaly Valtman, Christopher Althaus, Markus Endres, Eion Robb 2014-2015
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define the gettext package to be used */
#define GETTEXT_PACKAGE "telegram-purple"
#define ENABLE_NLS 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
/* #undef HAVE_ARPA_INET_H */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
#define HAVE_LIBGCRYPT 1
/* Define to 1 if you have the `rt' library (-lrt). */
/* #undef HAVE_LIBRT */
/* Define to 1 if you have the `webp' library (-lwebp). */
#define HAVE_LIBWEBP 1
/* Define to 1 if you have `z' library (-lz) */
#define HAVE_LIBZ 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the <netdb.h> header file. */
/* #undef HAVE_NETDB_H */
/* Define to 1 if you have the <netinet/in.h> header file. */
/* #undef HAVE_NETINET_IN_H */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
/* #undef HAVE_SYS_SOCKET_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "telegram-purple"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME PACKAGE_NAME
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to rpl_malloc if the replacement function should be used. */
/* #undef malloc */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

185
config.h.tgl.mingw Normal file
View file

@ -0,0 +1,185 @@
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Vitaly Valtman, Christopher Althaus, Markus Endres, Eion Robb 2014-2015
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* disable extf queries */
/* #undef DISABLE_EXTF */
/* Use libevent v1 */
/* #undef EVENT_V1 */
/* Use libevent v2 */
/* #undef EVENT_V2 */
/* Define to 1 if you have the `alarm' function. */
#define HAVE_ALARM 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
/* #undef HAVE_ARPA_INET_H */
/* Define to 1 if you have the `endpwent' function. */
/* #undef HAVE_ENDPWENT */
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `event' library (-levent). */
/* #undef HAVE_LIBEVENT */
/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
#define HAVE_LIBGCRYPT 1
/* Define to 1 if you have `z' library (-lz) */
#define HAVE_LIBZ 1
/* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef HAVE_MACH_MACH_H */
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the `mkdir' function. */
#define HAVE_MKDIR 1
/* Define to 1 if you have the <netdb.h> header file. */
/* #undef HAVE_NETDB_H */
/* Define to 1 if you have the <netinet/in.h> header file. */
/* #undef HAVE_NETINET_IN_H */
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#define HAVE_REALLOC 1
/* Define to 1 if you have the `select' function. */
/* #undef HAVE_SELECT */
/* Define to 1 if you have the `socket' function. */
/* #undef HAVE_SOCKET */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strndup' function. */
/* #undef HAVE_STRNDUP */
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
/* #undef HAVE_SYS_SOCKET_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <termios.h> header file. */
/* #undef HAVE_TERMIOS_H */
/* Define to 1 if you have the `uname' function. */
/* #undef HAVE_UNAME */
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if the system has the `__builtin_bswap32' built-in function */
#define HAVE___BUILTIN_BSWAP32 1
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "telegram-cli"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "telegram-cli 1.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "telegram-cli"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.0"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* avoid OpenSSL entirely, use libgcrypt instead (this can't read *.pub files,
though.) */
#define TGL_AVOID_OPENSSL 1
/* fixed for correct valgrind work */
/* #undef VALGRIND_FIXES */
/* Define to `int' if <sys/types.h> doesn't define. */
#define gid_t int
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to rpl_malloc if the replacement function should be used. */
/* #undef malloc */
/* Define to rpl_realloc if the replacement function should be used. */
/* #undef realloc */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `int' if <sys/types.h> doesn't define. */
#define uid_t int

View file

@ -1,66 +0,0 @@
# This is an empty config file
# Feel free to put something here
default_profile = "binlog";
test_dc1 = {
config_directory = ".telegram/test_dc1";
test = true;
msg_num = true;
binlog_enabled = true;
};
binlog = {
config_directory = ".telegram/binlog";
test = false;
msg_num = true;
binlog_enabled = true;
log_level = 2;
};
binlog_mts = {
config_directory = ".telegram/binlog_mts";
test = false;
msg_num = true;
binlog_enabled = true;
log_level = 2;
};
mega = {
config_directory = ".telegram/mega";
test = false;
msg_num = true;
binlog_enabled = true;
log_level = 2;
};
new = {
config_directory = ".telegram/new";
test = false;
msg_num = true;
};
production = {
config_directory = ".telegram/production";
test = false;
msg_num = true;
};
test = {
config_directory = ".telegram/test";
test = true;
msg_num = true;
};
test1 = {
config_directory = ".telegram/test1";
msg_num = true;
binlog_enabled = true;
};
test2 = {
config_directory = ".telegram/test2";
msg_num = true;
binlog_enabled = true;
};

2975
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -1,122 +1,101 @@
AC_PREREQ([2.68])
AC_INIT([telegram-cli], [1.0])
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Vitaly Valtman, Christopher Althaus, Markus Endres 2014-2015
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([telegram-purple], [1.3.1])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
m4_include([ax_lua.m4])
m4_include([m4_ax_check_openssl.m4])
m4_include([m4_ax_check_zlib.m4])
m4_include([m4-ax_gcc_builtin.m4])
m4_include([m4_ax_pkg_config.m4])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
# BSD locations for headers and libraries from packages, Linux locations for self-compiled stuff.
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
AC_CHECK_LIB([rt], [clock_gettime])
# Checks for libraries.
AC_CHECK_LIB([m], [sqrt])
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_SEARCH_LIBS([backtrace], [execinfo])
AC_CHECK_LIB([event], [event_base_new], [], [AC_MSG_ERROR([no libevent found])])
AC_ARG_ENABLE([gcrypt],
AS_HELP_STRING([--disable-gcrypt], [Disable gcrypt, use OpenSSL instead. DO NOT DISTRIBUTE BINARIES!]))
EVENT_VER=""
AC_CHECK_HEADER(event2/event.h, [AC_DEFINE([EVENT_V2], [1], [Use libevent v2])], [
AC_CHECK_HEADER(event.h, [AC_DEFINE([EVENT_V1], [1], [Use libevent v1])], [AC_MSG_ERROR([no libevent found])])
AS_IF([test "x$enable_gcrypt" != "xno"], [
# Even though tgl/configure will do this too, still call our own libgcrypt check to assure that -lgcrypt is added to our makefile
AC_CHECK_LIB([gcrypt], [gcry_mpi_snatch], [], [
echo "no libgcrypt >= 1.60 found. If its not available try --disable-gcrypt to link against openssl, but in that case YOU MAY NOT REDISTRIBUTE THE BINARY due to licensing restrictions."
exit -1
])
AC_SUBST([CRYPTO_FLAG], [--disable-openssl])
], [
AX_CHECK_OPENSSL([], [No openssl found.])
])
EXTRA_LIBS=""
# OPENSSL_INCLUDES to the include directives required
# OPENSSL_LIBS to the -l directives required
# OPENSSL_LDFLAGS to the -L or -R flags required
AX_CHECK_OPENSSL(,[AC_MSG_ERROR([No openssl found])])
AX_CHECK_ZLIB(, [AC_MSG_ERROR([No zlib found])])
AC_CHECK_LIB([readline], [rl_save_prompt], [ EXTRA_LIBS="${EXTRA_LIBS} -lreadline" ; ], [AC_MSG_ERROR([no libreadline found])])
PKG_CHECK_MODULES([PURPLE], [purple])
AC_MSG_CHECKING([for libconfig])
AC_ARG_ENABLE(libconfig,[--enable-libconfig/--disable-libconfig],
[
if test "x$enableval" = "xno" ; then
AC_MSG_RESULT([disabled])
else
AC_MSG_CHECKING([for libwebp])
AC_ARG_ENABLE([libwebp],
AS_HELP_STRING([--disable-libwebp], [Disable libwebp, stickers won't be displayed in the chat]))
AS_IF([test "x$enable_libwebp" != "xno"], [
AC_MSG_RESULT([enabled])
AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
fi
],[
AC_MSG_RESULT([enabled])
AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
AC_CHECK_LIB([webp], [WebPDecodeRGBA], [], [AC_MSG_ERROR([no libwebp found, try --disable-libwebp, but stickers won't be displayed in the chat])])
])
AC_MSG_CHECKING([for liblua])
AC_ARG_ENABLE(liblua,[--enable-liblua/--disable-liblua],
[
if test "x$enableval" = "xno" ; then
AC_MSG_RESULT([disabled])
else
AC_MSG_RESULT([enabled])
AX_PROG_LUA([],[],
[
AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Try --disable-liblua])])
AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Try --disable-liblua])])
[EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
[CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
AC_DEFINE(USE_LUA,1,[use lua])
],
[
AC_MSG_ERROR([No lua found. Try --disable-liblua])
])
fi
],[
AC_MSG_RESULT([enabled])
AX_PROG_LUA([],[],
[
AX_LUA_HEADERS([],[AC_MSG_ERROR([No lua headers found. Try --disable-liblua])])
AX_LUA_LIBS([],[AC_MSG_ERROR([No lua libs found. Try --disable-liblua])])
[EXTRA_LIBS="${EXTRA_LIBS} ${LUA_LIB}" ; ]
[CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" ; ]
AC_DEFINE(USE_LUA,1,[use lua])
],
[
AC_MSG_ERROR([No lua found. Try --disable-liblua])
])
])
AC_ARG_ENABLE([icons],
AS_HELP_STRING([--disable-icons], [Unsupported option. Use 'make noicon_install' instead.]))
AS_IF([test "x$enable_icons" == "xno"], [
AC_MSG_ERROR([--disable-icons is now obsolete. Please use 'make noicon_install' for the same effect.])
])
#check for custom prog name
AC_ARG_WITH(progname,[--with-progname=<name>],
[
if test "x$with_progname" = "xno" ; then
AC_MSG_RESULT([default])
elif test "x$with_progname" = "xyes" ; then
AC_MSG_RESULT([default])
else
AC_MSG_RESULT(["$with_progname"])
AC_DEFINE_UNQUOTED([PROG_NAME], ["$with_progname"], [Use custom prog name])
fi
],[
AC_MSG_RESULT([default])
])
# Checks for header files.
AC_CHECK_HEADERS([execinfo.h fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h])
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_C_INLINE
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([alarm endpwent memset memmove mkdir select socket strdup strndup uname])
AC_CHECK_FUNCS([memset strdup])
AX_GCC_BUILTIN(__builtin_bswap32)
AC_SUBST(PURPLE_CFLAGS)
AC_SUBST(PURPLE_CPPFLAGS)
AC_SUBST(PURPLE_LIBS)
AC_ARG_ENABLE([translation],
AS_HELP_STRING([--disable-translation], [Disable gettext translation]))
AS_IF([test "x$enable_translation" != "xno"], [
AC_CHECK_PROG(CHECK_GETTEXT, msgfmt, "yes", "no", $PATH)
if test x"$CHECK_GETTEXT" != x"yes" ; then
AC_MSG_ERROR([no gettext found, use --disable-translation if you dont need it.])
fi
AC_SUBST(MSGFMT_PATH, $(which msgfmt))
])
# Define the domain name for the translated words
GETTEXT_PACKAGE=$PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used])
AC_SUBST(EXTRA_LIBS)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

668
crc32.c
View file

@ -1,668 +0,0 @@
/*
This file is part of VK/KittenPHP-DB-Engine Library.
VK/KittenPHP-DB-Engine Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
VK/KittenPHP-DB-Engine Library 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with VK/KittenPHP-DB-Engine Library. If not, see <http://www.gnu.org/licenses/>.
Copyright 2009-2012 Vkontakte Ltd
2009-2012 Nikolai Durov
2009-2012 Andrei Lopatin
2012 Anton Maydell
*/
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include "config.h"
#ifdef HAVE_CONFIG_H
#include "crc32.h"
#endif
#ifndef HAVE___BUILTIN_BSWAP32
static inline unsigned __builtin_bswap32(unsigned x) {
return ((x << 24) & 0xff000000 ) |
((x << 8) & 0x00ff0000 ) |
((x >> 8) & 0x0000ff00 ) |
((x >> 24) & 0x000000ff );
}
#endif
unsigned int crc32_table[256] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
unsigned int crc32_table2[256] =
{
0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3,
0x646cc504, 0x7d77f445, 0x565aa786, 0x4f4196c7,
0xc8d98a08, 0xd1c2bb49, 0xfaefe88a, 0xe3f4d9cb,
0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, 0x87981ccf,
0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192,
0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496,
0x821b9859, 0x9b00a918, 0xb02dfadb, 0xa936cb9a,
0xe6775d5d, 0xff6c6c1c, 0xd4413fdf, 0xcd5a0e9e,
0x958424a2, 0x8c9f15e3, 0xa7b24620, 0xbea97761,
0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265,
0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69,
0x39316bae, 0x202a5aef, 0x0b07092c, 0x121c386d,
0xdf4636f3, 0xc65d07b2, 0xed705471, 0xf46b6530,
0xbb2af3f7, 0xa231c2b6, 0x891c9175, 0x9007a034,
0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38,
0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c,
0xf0794f05, 0xe9627e44, 0xc24f2d87, 0xdb541cc6,
0x94158a01, 0x8d0ebb40, 0xa623e883, 0xbf38d9c2,
0x38a0c50d, 0x21bbf44c, 0x0a96a78f, 0x138d96ce,
0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca,
0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97,
0xded79850, 0xc7cca911, 0xece1fad2, 0xf5facb93,
0x7262d75c, 0x6b79e61d, 0x4054b5de, 0x594f849f,
0x160e1258, 0x0f152319, 0x243870da, 0x3d23419b,
0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864,
0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60,
0xad24e1af, 0xb43fd0ee, 0x9f12832d, 0x8609b26c,
0xc94824ab, 0xd05315ea, 0xfb7e4629, 0xe2657768,
0x2f3f79f6, 0x362448b7, 0x1d091b74, 0x04122a35,
0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31,
0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d,
0x838a36fa, 0x9a9107bb, 0xb1bc5478, 0xa8a76539,
0x3b83984b, 0x2298a90a, 0x09b5fac9, 0x10aecb88,
0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, 0x74c20e8c,
0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180,
0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484,
0x71418a1a, 0x685abb5b, 0x4377e898, 0x5a6cd9d9,
0x152d4f1e, 0x0c367e5f, 0x271b2d9c, 0x3e001cdd,
0xb9980012, 0xa0833153, 0x8bae6290, 0x92b553d1,
0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5,
0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a,
0xca6b79ed, 0xd37048ac, 0xf85d1b6f, 0xe1462a2e,
0x66de36e1, 0x7fc507a0, 0x54e85463, 0x4df36522,
0x02b2f3e5, 0x1ba9c2a4, 0x30849167, 0x299fa026,
0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b,
0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f,
0x2c1c24b0, 0x350715f1, 0x1e2a4632, 0x07317773,
0x4870e1b4, 0x516bd0f5, 0x7a468336, 0x635db277,
0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, 0xe0d7848d,
0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189,
0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85,
0x674f9842, 0x7e54a903, 0x5579fac0, 0x4c62cb81,
0x8138c51f, 0x9823f45e, 0xb30ea79d, 0xaa1596dc,
0xe554001b, 0xfc4f315a, 0xd7626299, 0xce7953d8,
0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4,
0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0,
0x5e7ef3ec, 0x4765c2ad, 0x6c48916e, 0x7553a02f,
0x3a1236e8, 0x230907a9, 0x0824546a, 0x113f652b,
0x96a779e4, 0x8fbc48a5, 0xa4911b66, 0xbd8a2a27,
0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23,
0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e,
0x70d024b9, 0x69cb15f8, 0x42e6463b, 0x5bfd777a,
0xdc656bb5, 0xc57e5af4, 0xee530937, 0xf7483876,
0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, 0x9324fd72,
};
unsigned int crc32_table1[256] =
{
0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59,
0x0709a8dc, 0x06cbc2eb, 0x048d7cb2, 0x054f1685,
0x0e1351b8, 0x0fd13b8f, 0x0d9785d6, 0x0c55efe1,
0x091af964, 0x08d89353, 0x0a9e2d0a, 0x0b5c473d,
0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29,
0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5,
0x1235f2c8, 0x13f798ff, 0x11b126a6, 0x10734c91,
0x153c5a14, 0x14fe3023, 0x16b88e7a, 0x177ae44d,
0x384d46e0, 0x398f2cd7, 0x3bc9928e, 0x3a0bf8b9,
0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065,
0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901,
0x3157bf84, 0x3095d5b3, 0x32d36bea, 0x331101dd,
0x246be590, 0x25a98fa7, 0x27ef31fe, 0x262d5bc9,
0x23624d4c, 0x22a0277b, 0x20e69922, 0x2124f315,
0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71,
0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad,
0x709a8dc0, 0x7158e7f7, 0x731e59ae, 0x72dc3399,
0x7793251c, 0x76514f2b, 0x7417f172, 0x75d59b45,
0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, 0x7ccf6221,
0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd,
0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9,
0x6bb5866c, 0x6a77ec5b, 0x68315202, 0x69f33835,
0x62af7f08, 0x636d153f, 0x612bab66, 0x60e9c151,
0x65a6d7d4, 0x6464bde3, 0x662203ba, 0x67e0698d,
0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579,
0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5,
0x46c49a98, 0x4706f0af, 0x45404ef6, 0x448224c1,
0x41cd3244, 0x400f5873, 0x4249e62a, 0x438b8c1d,
0x54f16850, 0x55330267, 0x5775bc3e, 0x56b7d609,
0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5,
0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1,
0x5deb9134, 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d,
0xe1351b80, 0xe0f771b7, 0xe2b1cfee, 0xe373a5d9,
0xe63cb35c, 0xe7fed96b, 0xe5b86732, 0xe47a0d05,
0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461,
0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd,
0xfd13b8f0, 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9,
0xfa1a102c, 0xfbd87a1b, 0xf99ec442, 0xf85cae75,
0xf300e948, 0xf2c2837f, 0xf0843d26, 0xf1465711,
0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd,
0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339,
0xde71f5bc, 0xdfb39f8b, 0xddf521d2, 0xdc374be5,
0xd76b0cd8, 0xd6a966ef, 0xd4efd8b6, 0xd52db281,
0xd062a404, 0xd1a0ce33, 0xd3e6706a, 0xd2241a5d,
0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049,
0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895,
0xcb4dafa8, 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1,
0xcc440774, 0xcd866d43, 0xcfc0d31a, 0xce02b92d,
0x91af9640, 0x906dfc77, 0x922b422e, 0x93e92819,
0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5,
0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1,
0x98b56f24, 0x99770513, 0x9b31bb4a, 0x9af3d17d,
0x8d893530, 0x8c4b5f07, 0x8e0de15e, 0x8fcf8b69,
0x8a809dec, 0x8b42f7db, 0x89044982, 0x88c623b5,
0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1,
0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d,
0xa9e2d0a0, 0xa820ba97, 0xaa6604ce, 0xaba46ef9,
0xaeeb787c, 0xaf29124b, 0xad6fac12, 0xacadc625,
0xa7f18118, 0xa633eb2f, 0xa4755576, 0xa5b73f41,
0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d,
0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89,
0xb2cddb0c, 0xb30fb13b, 0xb1490f62, 0xb08b6555,
0xbbd72268, 0xba15485f, 0xb853f606, 0xb9919c31,
0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, 0xbe9834ed,
};
unsigned int crc32_table0[256] = {
0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee,
0x8f629757, 0x37def032, 0x256b5fdc, 0x9dd738b9,
0xc5b428ef, 0x7d084f8a, 0x6fbde064, 0xd7018701,
0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, 0x58631056,
0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871,
0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26,
0x95ad7f70, 0x2d111815, 0x3fa4b7fb, 0x8718d09e,
0x1acfe827, 0xa2738f42, 0xb0c620ac, 0x087a47c9,
0xa032af3e, 0x188ec85b, 0x0a3b67b5, 0xb28700d0,
0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787,
0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f,
0xeae41086, 0x525877e3, 0x40edd80d, 0xf851bf68,
0xf02bf8a1, 0x48979fc4, 0x5a22302a, 0xe29e574f,
0x7f496ff6, 0xc7f50893, 0xd540a77d, 0x6dfcc018,
0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0,
0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7,
0x9b14583d, 0x23a83f58, 0x311d90b6, 0x89a1f7d3,
0x1476cf6a, 0xaccaa80f, 0xbe7f07e1, 0x06c36084,
0x5ea070d2, 0xe61c17b7, 0xf4a9b859, 0x4c15df3c,
0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b,
0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c,
0x446f98f5, 0xfcd3ff90, 0xee66507e, 0x56da371b,
0x0eb9274d, 0xb6054028, 0xa4b0efc6, 0x1c0c88a3,
0x81dbb01a, 0x3967d77f, 0x2bd27891, 0x936e1ff4,
0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed,
0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba,
0xfe92dfec, 0x462eb889, 0x549b1767, 0xec277002,
0x71f048bb, 0xc94c2fde, 0xdbf98030, 0x6345e755,
0x6b3fa09c, 0xd383c7f9, 0xc1366817, 0x798a0f72,
0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825,
0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d,
0x21e91f24, 0x99557841, 0x8be0d7af, 0x335cb0ca,
0xed59b63b, 0x55e5d15e, 0x47507eb0, 0xffec19d5,
0x623b216c, 0xda874609, 0xc832e9e7, 0x708e8e82,
0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a,
0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d,
0xbd40e1a4, 0x05fc86c1, 0x1749292f, 0xaff54e4a,
0x322276f3, 0x8a9e1196, 0x982bbe78, 0x2097d91d,
0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, 0x6a4166a5,
0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2,
0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb,
0xc2098e52, 0x7ab5e937, 0x680046d9, 0xd0bc21bc,
0x88df31ea, 0x3063568f, 0x22d6f961, 0x9a6a9e04,
0x07bda6bd, 0xbf01c1d8, 0xadb46e36, 0x15080953,
0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174,
0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623,
0xd8c66675, 0x607a0110, 0x72cfaefe, 0xca73c99b,
0x57a4f122, 0xef189647, 0xfdad39a9, 0x45115ecc,
0x764dee06, 0xcef18963, 0xdc44268d, 0x64f841e8,
0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf,
0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907,
0x3c9b51be, 0x842736db, 0x96929935, 0x2e2efe50,
0x2654b999, 0x9ee8defc, 0x8c5d7112, 0x34e11677,
0xa9362ece, 0x118a49ab, 0x033fe645, 0xbb838120,
0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98,
0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf,
0xd67f4138, 0x6ec3265d, 0x7c7689b3, 0xc4caeed6,
0x591dd66f, 0xe1a1b10a, 0xf3141ee4, 0x4ba87981,
0x13cb69d7, 0xab770eb2, 0xb9c2a15c, 0x017ec639,
0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e,
0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949,
0x090481f0, 0xb1b8e695, 0xa30d497b, 0x1bb12e1e,
0x43d23e48, 0xfb6e592d, 0xe9dbf6c3, 0x516791a6,
0xccb0a91f, 0x740cce7a, 0x66b96194, 0xde0506f1,
};
unsigned crc32_partial_old (const void *data, int len, unsigned crc) {
const char *p = data;
for (; len > 0; len--) {
crc = crc32_table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
}
return crc;
}
/*
unsigned crc32_partial_fast (const void *data, int len, unsigned crc) {
const int *p = (const int *) data;
int x;
for (x = (len >> 2); x > 0; x--) {
crc ^= *p++;
crc = crc32_table0[crc & 0xff] ^ crc32_table1[(crc & 0xff00) >> 8] ^ crc32_table2[(crc & 0xff0000) >> 16] ^ crc32_table[crc >> 24];
}
const char *q = (const char *) p;
switch (len & 3) {
case 3:
crc = crc32_table[(crc ^ *q++) & 0xff] ^ (crc >> 8);
case 2:
crc = crc32_table[(crc ^ *q++) & 0xff] ^ (crc >> 8);
case 1:
crc = crc32_table[(crc ^ *q++) & 0xff] ^ (crc >> 8);
}
return crc;
}
*/
unsigned crc32_partial (const void *data, int len, unsigned crc) {
const int *p = (const int *) data;
int x;
#define DO_ONE(v) crc ^= v; crc = crc32_table0[crc & 0xff] ^ crc32_table1[(crc & 0xff00) >> 8] ^ crc32_table2[(crc & 0xff0000) >> 16] ^ crc32_table[crc >> 24];
#define DO_FOUR(p) DO_ONE((p)[0]); DO_ONE((p)[1]); DO_ONE((p)[2]); DO_ONE((p)[3]);
for (x = (len >> 5); x > 0; x--) {
DO_FOUR (p);
DO_FOUR (p + 4);
p += 8;
}
if (len & 16) {
DO_FOUR (p);
p += 4;
}
if (len & 8) {
DO_ONE (p[0]);
DO_ONE (p[1]);
p += 2;
}
if (len & 4) {
DO_ONE (*p++);
}
/*
for (x = (len >> 2) & 7; x > 0; x--) {
DO_ONE (*p++);
}
*/
#undef DO_ONE
#undef DO_FOUR
const char *q = (const char *) p;
if (len & 2) {
crc = crc32_table[(crc ^ q[0]) & 0xff] ^ (crc >> 8);
crc = crc32_table[(crc ^ q[1]) & 0xff] ^ (crc >> 8);
q += 2;
}
if (len & 1) {
crc = crc32_table[(crc ^ *q++) & 0xff] ^ (crc >> 8);
}
return crc;
}
unsigned compute_crc32 (const void *data, int len) {
return crc32_partial (data, len, -1) ^ -1;
}
unsigned long long crc64_table[256] = {
0x0000000000000000LL, 0xb32e4cbe03a75f6fLL, 0xf4843657a840a05bLL, 0x47aa7ae9abe7ff34LL,
0x7bd0c384ff8f5e33LL, 0xc8fe8f3afc28015cLL, 0x8f54f5d357cffe68LL, 0x3c7ab96d5468a107LL,
0xf7a18709ff1ebc66LL, 0x448fcbb7fcb9e309LL, 0x0325b15e575e1c3dLL, 0xb00bfde054f94352LL,
0x8c71448d0091e255LL, 0x3f5f08330336bd3aLL, 0x78f572daa8d1420eLL, 0xcbdb3e64ab761d61LL,
0x7d9ba13851336649LL, 0xceb5ed8652943926LL, 0x891f976ff973c612LL, 0x3a31dbd1fad4997dLL,
0x064b62bcaebc387aLL, 0xb5652e02ad1b6715LL, 0xf2cf54eb06fc9821LL, 0x41e11855055bc74eLL,
0x8a3a2631ae2dda2fLL, 0x39146a8fad8a8540LL, 0x7ebe1066066d7a74LL, 0xcd905cd805ca251bLL,
0xf1eae5b551a2841cLL, 0x42c4a90b5205db73LL, 0x056ed3e2f9e22447LL, 0xb6409f5cfa457b28LL,
0xfb374270a266cc92LL, 0x48190ecea1c193fdLL, 0x0fb374270a266cc9LL, 0xbc9d3899098133a6LL,
0x80e781f45de992a1LL, 0x33c9cd4a5e4ecdceLL, 0x7463b7a3f5a932faLL, 0xc74dfb1df60e6d95LL,
0x0c96c5795d7870f4LL, 0xbfb889c75edf2f9bLL, 0xf812f32ef538d0afLL, 0x4b3cbf90f69f8fc0LL,
0x774606fda2f72ec7LL, 0xc4684a43a15071a8LL, 0x83c230aa0ab78e9cLL, 0x30ec7c140910d1f3LL,
0x86ace348f355aadbLL, 0x3582aff6f0f2f5b4LL, 0x7228d51f5b150a80LL, 0xc10699a158b255efLL,
0xfd7c20cc0cdaf4e8LL, 0x4e526c720f7dab87LL, 0x09f8169ba49a54b3LL, 0xbad65a25a73d0bdcLL,
0x710d64410c4b16bdLL, 0xc22328ff0fec49d2LL, 0x85895216a40bb6e6LL, 0x36a71ea8a7ace989LL,
0x0adda7c5f3c4488eLL, 0xb9f3eb7bf06317e1LL, 0xfe5991925b84e8d5LL, 0x4d77dd2c5823b7baLL,
0x64b62bcaebc387a1LL, 0xd7986774e864d8ceLL, 0x90321d9d438327faLL, 0x231c512340247895LL,
0x1f66e84e144cd992LL, 0xac48a4f017eb86fdLL, 0xebe2de19bc0c79c9LL, 0x58cc92a7bfab26a6LL,
0x9317acc314dd3bc7LL, 0x2039e07d177a64a8LL, 0x67939a94bc9d9b9cLL, 0xd4bdd62abf3ac4f3LL,
0xe8c76f47eb5265f4LL, 0x5be923f9e8f53a9bLL, 0x1c4359104312c5afLL, 0xaf6d15ae40b59ac0LL,
0x192d8af2baf0e1e8LL, 0xaa03c64cb957be87LL, 0xeda9bca512b041b3LL, 0x5e87f01b11171edcLL,
0x62fd4976457fbfdbLL, 0xd1d305c846d8e0b4LL, 0x96797f21ed3f1f80LL, 0x2557339fee9840efLL,
0xee8c0dfb45ee5d8eLL, 0x5da24145464902e1LL, 0x1a083bacedaefdd5LL, 0xa9267712ee09a2baLL,
0x955cce7fba6103bdLL, 0x267282c1b9c65cd2LL, 0x61d8f8281221a3e6LL, 0xd2f6b4961186fc89LL,
0x9f8169ba49a54b33LL, 0x2caf25044a02145cLL, 0x6b055fede1e5eb68LL, 0xd82b1353e242b407LL,
0xe451aa3eb62a1500LL, 0x577fe680b58d4a6fLL, 0x10d59c691e6ab55bLL, 0xa3fbd0d71dcdea34LL,
0x6820eeb3b6bbf755LL, 0xdb0ea20db51ca83aLL, 0x9ca4d8e41efb570eLL, 0x2f8a945a1d5c0861LL,
0x13f02d374934a966LL, 0xa0de61894a93f609LL, 0xe7741b60e174093dLL, 0x545a57dee2d35652LL,
0xe21ac88218962d7aLL, 0x5134843c1b317215LL, 0x169efed5b0d68d21LL, 0xa5b0b26bb371d24eLL,
0x99ca0b06e7197349LL, 0x2ae447b8e4be2c26LL, 0x6d4e3d514f59d312LL, 0xde6071ef4cfe8c7dLL,
0x15bb4f8be788911cLL, 0xa6950335e42fce73LL, 0xe13f79dc4fc83147LL, 0x521135624c6f6e28LL,
0x6e6b8c0f1807cf2fLL, 0xdd45c0b11ba09040LL, 0x9aefba58b0476f74LL, 0x29c1f6e6b3e0301bLL,
0xc96c5795d7870f42LL, 0x7a421b2bd420502dLL, 0x3de861c27fc7af19LL, 0x8ec62d7c7c60f076LL,
0xb2bc941128085171LL, 0x0192d8af2baf0e1eLL, 0x4638a2468048f12aLL, 0xf516eef883efae45LL,
0x3ecdd09c2899b324LL, 0x8de39c222b3eec4bLL, 0xca49e6cb80d9137fLL, 0x7967aa75837e4c10LL,
0x451d1318d716ed17LL, 0xf6335fa6d4b1b278LL, 0xb199254f7f564d4cLL, 0x02b769f17cf11223LL,
0xb4f7f6ad86b4690bLL, 0x07d9ba1385133664LL, 0x4073c0fa2ef4c950LL, 0xf35d8c442d53963fLL,
0xcf273529793b3738LL, 0x7c0979977a9c6857LL, 0x3ba3037ed17b9763LL, 0x888d4fc0d2dcc80cLL,
0x435671a479aad56dLL, 0xf0783d1a7a0d8a02LL, 0xb7d247f3d1ea7536LL, 0x04fc0b4dd24d2a59LL,
0x3886b22086258b5eLL, 0x8ba8fe9e8582d431LL, 0xcc0284772e652b05LL, 0x7f2cc8c92dc2746aLL,
0x325b15e575e1c3d0LL, 0x8175595b76469cbfLL, 0xc6df23b2dda1638bLL, 0x75f16f0cde063ce4LL,
0x498bd6618a6e9de3LL, 0xfaa59adf89c9c28cLL, 0xbd0fe036222e3db8LL, 0x0e21ac88218962d7LL,
0xc5fa92ec8aff7fb6LL, 0x76d4de52895820d9LL, 0x317ea4bb22bfdfedLL, 0x8250e80521188082LL,
0xbe2a516875702185LL, 0x0d041dd676d77eeaLL, 0x4aae673fdd3081deLL, 0xf9802b81de97deb1LL,
0x4fc0b4dd24d2a599LL, 0xfceef8632775faf6LL, 0xbb44828a8c9205c2LL, 0x086ace348f355aadLL,
0x34107759db5dfbaaLL, 0x873e3be7d8faa4c5LL, 0xc094410e731d5bf1LL, 0x73ba0db070ba049eLL,
0xb86133d4dbcc19ffLL, 0x0b4f7f6ad86b4690LL, 0x4ce50583738cb9a4LL, 0xffcb493d702be6cbLL,
0xc3b1f050244347ccLL, 0x709fbcee27e418a3LL, 0x3735c6078c03e797LL, 0x841b8ab98fa4b8f8LL,
0xadda7c5f3c4488e3LL, 0x1ef430e13fe3d78cLL, 0x595e4a08940428b8LL, 0xea7006b697a377d7LL,
0xd60abfdbc3cbd6d0LL, 0x6524f365c06c89bfLL, 0x228e898c6b8b768bLL, 0x91a0c532682c29e4LL,
0x5a7bfb56c35a3485LL, 0xe955b7e8c0fd6beaLL, 0xaeffcd016b1a94deLL, 0x1dd181bf68bdcbb1LL,
0x21ab38d23cd56ab6LL, 0x9285746c3f7235d9LL, 0xd52f0e859495caedLL, 0x6601423b97329582LL,
0xd041dd676d77eeaaLL, 0x636f91d96ed0b1c5LL, 0x24c5eb30c5374ef1LL, 0x97eba78ec690119eLL,
0xab911ee392f8b099LL, 0x18bf525d915feff6LL, 0x5f1528b43ab810c2LL, 0xec3b640a391f4fadLL,
0x27e05a6e926952ccLL, 0x94ce16d091ce0da3LL, 0xd3646c393a29f297LL, 0x604a2087398eadf8LL,
0x5c3099ea6de60cffLL, 0xef1ed5546e415390LL, 0xa8b4afbdc5a6aca4LL, 0x1b9ae303c601f3cbLL,
0x56ed3e2f9e224471LL, 0xe5c372919d851b1eLL, 0xa26908783662e42aLL, 0x114744c635c5bb45LL,
0x2d3dfdab61ad1a42LL, 0x9e13b115620a452dLL, 0xd9b9cbfcc9edba19LL, 0x6a978742ca4ae576LL,
0xa14cb926613cf817LL, 0x1262f598629ba778LL, 0x55c88f71c97c584cLL, 0xe6e6c3cfcadb0723LL,
0xda9c7aa29eb3a624LL, 0x69b2361c9d14f94bLL, 0x2e184cf536f3067fLL, 0x9d36004b35545910LL,
0x2b769f17cf112238LL, 0x9858d3a9ccb67d57LL, 0xdff2a94067518263LL, 0x6cdce5fe64f6dd0cLL,
0x50a65c93309e7c0bLL, 0xe388102d33392364LL, 0xa4226ac498dedc50LL, 0x170c267a9b79833fLL,
0xdcd7181e300f9e5eLL, 0x6ff954a033a8c131LL, 0x28532e49984f3e05LL, 0x9b7d62f79be8616aLL,
0xa707db9acf80c06dLL, 0x14299724cc279f02LL, 0x5383edcd67c06036LL, 0xe0ada17364673f59LL
};
unsigned long long crc64_partial (const void *data, int len, unsigned long long crc) {
const char *p = data;
for (; len > 0; len--) {
crc = crc64_table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
}
return crc;
}
unsigned long long crc64 (const void *data, int len) {
return crc64_partial (data, len, -1LL) ^ -1LL;
}
static unsigned gf32_matrix_times (unsigned *matrix, unsigned vector) {
unsigned sum = 0;
while (vector) {
if (vector & 1) {
sum ^= *matrix;
}
vector >>= 1;
matrix++;
}
return sum;
}
static void gf32_matrix_square (unsigned *square, unsigned *matrix) {
int n = 0;
do {
square[n] = gf32_matrix_times (matrix, matrix[n]);
} while (++n < 32);
}
unsigned compute_crc32_combine (unsigned crc1, unsigned crc2, int len2) {
assert (len2 < (1 << 29));
static int power_buf_initialized = 0;
static unsigned power_buf[1024];
int n;
/* degenerate case (also disallow negative lengths) */
if (len2 <= 0) {
return crc1;
}
if (!power_buf_initialized) {
power_buf[0] = 0xedb88320UL;
for (n = 0; n < 31; n++) {
power_buf[n+1] = 1U << n;
}
for (n = 1; n < 32; n++) {
gf32_matrix_square (power_buf + (n << 5), power_buf + ((n - 1) << 5));
}
power_buf_initialized = 1;
}
unsigned int *p = power_buf + 64;
do {
p += 32;
if (len2 & 1) {
crc1 = gf32_matrix_times (p, crc1);
}
len2 >>= 1;
} while (len2);
return crc1 ^ crc2;
}
/********************************* crc32 repair ************************/
struct fcb_table_entry {
unsigned p; //zeta ^ k
int i;
};
static inline unsigned gf32_mod (unsigned long long r, int high_bit) {
int j = high_bit;
for (j = high_bit; j >= 32; j--) {
if ((1ULL << j) & r) {
r ^= 0x04C11DB7ULL << (j - 32);
}
}
return (unsigned) r;
}
static unsigned gf32_mult (unsigned a, unsigned b) {
int i;
const unsigned long long m = b;
unsigned long long r = 0;
for (i = 0; i < 32; i++) {
if (a & (1U << i)) {
r ^= m << i;
}
}
return gf32_mod (r, 62);
}
static unsigned gf32_shl (unsigned int a, int shift) {
unsigned long long r = a;
r <<= shift;
return gf32_mod (r, 31 + shift);
}
static unsigned gf32_pow (unsigned a, int k) {
if (!k) { return 1; }
unsigned x = gf32_pow (gf32_mult (a, a), k >> 1);
if (k & 1) {
x = gf32_mult (x, a);
}
return x;
}
static int cmp_fcb_table_entry (const void *a, const void *b) {
const struct fcb_table_entry *x = a;
const struct fcb_table_entry *y = b;
if (x->p < y->p) { return -1; }
if (x->p > y->p) { return 1; }
if (x->i < y->i) { return -1; }
if (x->i > y->i) { return 1; }
return 0;
}
#define GROUP_SWAP(x,m,s) ((x & m) << s) | ((x & (~m)) >> s)
static unsigned revbin (unsigned x) {
x = GROUP_SWAP(x,0x55555555U,1);
x = GROUP_SWAP(x,0x33333333U,2);
x = GROUP_SWAP(x,0x0f0f0f0fU,4);
x = __builtin_bswap32 (x);
return x;
}
#undef GROUP_SWAP
static inline unsigned xmult (unsigned a) {
unsigned r = a << 1;
if (a & (1U<<31)) {
r ^= 0x04C11DB7U;
}
return r;
}
static int find_corrupted_bit (int size, unsigned d) {
int i, j;
size += 4;
d = revbin (d);
int n = size << 3;
int r = (int) (sqrt (n) + 0.5);
struct fcb_table_entry *T = calloc (r, sizeof (struct fcb_table_entry));
assert (T != NULL);
T[0].i = 0;
T[0].p = 1;
for (i = 1; i < r; i++) {
T[i].i = i;
T[i].p = xmult (T[i-1].p);
}
assert (xmult (0x82608EDB) == 1);
qsort (T, r, sizeof (T[0]), cmp_fcb_table_entry);
unsigned q = gf32_pow (0x82608EDB, r);
unsigned A[32];
for (i = 0; i < 32; i++) {
A[i] = gf32_shl (q, i);
}
unsigned x = d;
int max_j = n / r, res = -1;
for (j = 0; j <= max_j; j++) {
int a = -1, b = r;
while (b - a > 1) {
int c = ((a + b) >> 1);
if (T[c].p <= x) { a = c; } else { b = c; }
}
if (a >= 0 && T[a].p == x) {
res = T[a].i + r * j;
break;
}
x = gf32_matrix_times (A, x);
}
free (T);
return res;
}
static int repair_bit (unsigned char *input, int l, int k) {
if (k < 0) {
return -1;
}
int idx = k >> 5, bit = k & 31, i = (l - 1) - (idx - 1) * 4;
while (bit >= 8) {
i--;
bit -= 8;
}
if (i < 0) {
return -2;
}
if (i >= l) {
return -3;
}
int j = 7 - bit;
input[i] ^= 1 << j;
return 0;
}
int crc32_check_and_repair (void *input, int l, unsigned *input_crc32, int force_exit) {
unsigned computed_crc32 = compute_crc32 (input, l);
const unsigned crc32_diff = computed_crc32 ^ (*input_crc32);
if (!crc32_diff) {
return 0;
}
int k = find_corrupted_bit (l, crc32_diff);
int r = repair_bit (input, l, k);
if (!r) {
assert (compute_crc32 (input, l) == *input_crc32);
return 1;
}
if (!(crc32_diff & (crc32_diff - 1))) { /* crc32_diff is power of 2 */
*input_crc32 = computed_crc32;
return 2;
}
assert (!force_exit);
*input_crc32 = computed_crc32;
return -1;
}

59
crc32.h
View file

@ -1,59 +0,0 @@
/*
This file is part of VK/KittenPHP-DB-Engine Library.
VK/KittenPHP-DB-Engine Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
VK/KittenPHP-DB-Engine Library 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with VK/KittenPHP-DB-Engine Library. If not, see <http://www.gnu.org/licenses/>.
Copyright 2009-2012 Vkontakte Ltd
2009-2012 Nikolai Durov
2009-2012 Andrei Lopatin
2012 Anton Maydell
*/
#ifndef __CRC32_H__
#define __CRC32_H__
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned int crc32_table[256];
unsigned crc32_partial (const void *data, int len, unsigned crc);
//unsigned crc32_partial_fast (const void *data, int len, unsigned crc);
//unsigned crc32_partial_fastest (const void *data, int len, unsigned crc);
unsigned compute_crc32 (const void *data, int len);
unsigned compute_crc32_combine (unsigned crc1, unsigned crc2, int len2);
extern unsigned long long crc64_table[256];
unsigned long long crc64_partial (const void *data, int len, unsigned long long crc);
unsigned long long crc64 (const void *data, int len);
//unsigned gf32_matrix_times (unsigned *matrix, unsigned vector);
/* crc32_check_and_repair returns
0 : Cyclic redundancy check is ok
1 : Cyclic redundancy check fails, but we fix one bit in input
2 : Cyclic redundancy check fails, but we fix one bit in input_crc32
-1 : Cyclic redundancy check fails, no repair possible.
In this case *input_crc32 will be equal crc32 (input, l)
Case force_exit == 1 (case 1, 2: kprintf call, case -1: assert fail).
*/
int crc32_check_and_repair (void *input, int l, unsigned *input_crc32, int force_exit);
#ifdef __cplusplus
}
#endif
#endif

5
debian/changelog vendored
View file

@ -1,5 +0,0 @@
telegram-cli (0.1-1) unstable; urgency=low
* Initial release (Closes #737563)
-- Cleto Martín <cleto@debian.org> Mon, 03 Feb 2014 20:00:03 +0000

1
debian/clean vendored
View file

@ -1 +0,0 @@
Makefile

1
debian/compat vendored
View file

@ -1 +0,0 @@
9

36
debian/control vendored
View file

@ -1,36 +0,0 @@
Source: telegram-cli
Section: net
Priority: optional
Maintainer: Cleto Martín <cleto@debian.org>
Build-Depends: debhelper (>= 8.0.0),
autotools-dev,
autoconf-archive,
libreadline-dev,
libconfig-dev,
libssl-dev,
lua5.2,
liblua5.2-dev
Standards-Version: 3.9.4
Homepage: https://github.com/vysheng/tg
Vcs-Git: git://github.com/vysheng/tg.git
Vcs-Browser: https://github.com/vysheng/tg
Package: telegram-cli
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Command-line interface for Telegram messenger
Telegram messenger is a cloud-based instant messaging designed for
smart phones and similar to Whatsapp but more flexible, and
powerful. You can send messages, photos, videos and documents to
people who are in your phone contacts (and have Telegram). Telegram
also supports secret chats whose provide a private (encrypted) way of
communication.
.
This package contains a command-line based client for Telegram with
the following features:
* Colored terminal messages.
* Message management: history, stats, etc.
* Group chat: create and manage groups.
* Secret chat: secured and encrypted conversations.
* Contact management: add/edit/remove contacts.
* Multimedia support: send/load photos and videos.

28
debian/copyright vendored
View file

@ -1,28 +0,0 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: telegram-cli
Source: https://github.com/vysheng/tg
Files: *
Copyright: 2013 Vitaly Valtman
License: GPL-2.0+
Files: debian/*
Copyright: 2014 Cleto Martín <cleto@debian.org>
License: GPL-2.0+
License: GPL-2.0+
This package 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 2 of the License, or
(at your option) any later version.
.
This package 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 this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

1
debian/docs vendored
View file

@ -1 +0,0 @@
README.md

1
debian/install vendored
View file

@ -1 +0,0 @@
telegram usr/bin

17
debian/rules vendored
View file

@ -1,17 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
VERSION=$(shell dpkg-parsechangelog | sed -n 's/^Version: //p' | cut -f1 -d'-')
PACKAGE_NAME=$(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
%:
dh $@ --with autotools-dev
build-orig:
mkdir -p $(PACKAGE_NAME)-$(VERSION)
tar --exclude=ax_lua.m4 --exclude=debian --exclude=\.pc \
--exclude=$(PACKAGE_NAME)-$(VERSION) -cf - . \
| ( cd $(PACKAGE_NAME)-$(VERSION) && tar xf - )
tar -cf ../$(PACKAGE_NAME)_$(VERSION).orig.tar $(PACKAGE_NAME)-$(VERSION)
$(RM) -r $(PACKAGE_NAME)-$(VERSION)
xz ../$(PACKAGE_NAME)_$(VERSION).orig.tar

View file

@ -1 +0,0 @@
3.0 (quilt)

4
debian/watch vendored
View file

@ -1,4 +0,0 @@
version=3
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/tg-$1\.tar\.gz/ \
https://github.com/vysheng/tg/tags .*/v?(\d\S*)\.tar\.gz

View file

@ -1 +0,0 @@
encrypted_scheme16.tl

View file

@ -1,22 +0,0 @@
---types---
decryptedMessageLayer#99a438cf layer:int message:DecryptedMessage = DecryptedMessageLayer;
decryptedMessage#1f814f1f random_id:long random_bytes:bytes message:string media:DecryptedMessageMedia = DecryptedMessage;
decryptedMessageService#aa48327d random_id:long random_bytes:bytes action:DecryptedMessageAction = DecryptedMessage;
decryptedMessageMediaEmpty#89f5c4a = DecryptedMessageMedia;
decryptedMessageMediaPhoto#32798a8c thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
//decryptedMessageMediaVideo#4cee6ef3 thumb:bytes thumb_w:int thumb_h:int duration:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
decryptedMessageMediaGeoPoint#35480a59 lat:double long:double = DecryptedMessageMedia;
decryptedMessageMediaContact#588a0a97 phone_number:string first_name:string last_name:string user_id:int = DecryptedMessageMedia;
decryptedMessageActionSetMessageTTL#a1733aec ttl_seconds:int = DecryptedMessageAction;
decryptedMessageMediaDocument#b095434b thumb:bytes thumb_w:int thumb_h:int file_name:string mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
//decryptedMessageMediaAudio#6080758f duration:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
decryptedMessageMediaVideo#524a415d thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
decryptedMessageMediaAudio#57e0a9cb duration:int mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
decryptedMessageActionReadMessages#c4f40be random_ids:Vector<long> = DecryptedMessageAction;
decryptedMessageActionDeleteMessages#65614304 random_ids:Vector<long> = DecryptedMessageAction;
decryptedMessageActionScreenshotMessages#8ac1f475 random_ids:Vector<long> = DecryptedMessageAction;
decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction;
decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction;
---functions---

View file

@ -1,43 +0,0 @@
#ifndef __EVENT_OLD_H__
#define __EVENT_OLD_H__
#include <assert.h>
#define BEV_EVENT_READ EVBUFFER_READ
#define BEV_EVENT_WRITE EVBUFFER_WRITE
#define BEV_EVENT_EOF EVBUFFER_EOF
#define BEV_EVENT_ERROR EVBUFFER_ERROR
#define BEV_EVENT_TIMEOUT EVBUFFER_TIMEOUT
typedef int evutil_socket_t;
static inline struct event *event_new (struct event_base *base, int fd, int what, void(*callback)(int, short, void *), void *arg) __attribute__ ((unused));
static inline struct event *event_new (struct event_base *base, int fd, int what, void(*callback)(int, short, void *), void *arg) {
struct event *ev = malloc (sizeof (*ev));
event_set (ev, fd, what, callback, arg);
event_base_set (base, ev);
return ev;
}
static inline struct event *evtimer_new (struct event_base *base, void(*callback)(int, short, void *), void *arg) __attribute__ ((unused));
static inline struct event *evtimer_new (struct event_base *base, void(*callback)(int, short, void *), void *arg) {
struct event *ev = malloc (sizeof (*ev));
event_set (ev, -1, 0, callback, arg);
event_base_set (base, ev);
return ev;
}
static void event_free (struct event *ev) __attribute__ ((unused));
static void event_free (struct event *ev) {
event_del (ev);
free (ev);
}
static struct bufferevent *bufferevent_socket_new (struct event_base *base, int fd, int flags) __attribute__ ((unused));
static struct bufferevent *bufferevent_socket_new (struct event_base *base, int fd, int flags) {
assert (!flags);
struct bufferevent *bev = bufferevent_new(fd, 0, 0, 0, 0);
bufferevent_base_set (base, bev);
return bev;
}
#endif

53
gen-origtar Executable file
View file

@ -0,0 +1,53 @@
#!/bin/sh
# This file is part of telegram-purple
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#
# Copyright Matthias Jentsch, Ben Wiederhake 2016
set -e
# -- Cleanup possibly left-over artifacts
rm -f bin/tgl_tl-parser.tar bin/tgl.tar bin/commit.h.tar bin/result.tar bin/result.tar.gz
# -- Create parts
# Abuse the "bin" dir for temporary files.
( cd tgl/tl-parser && git archive --prefix=telegram-purple/tgl/tl-parser/ --output=../../bin/tgl_tl-parser.tar HEAD )
( cd tgl && git archive --prefix=telegram-purple/tgl/ --output=../bin/tgl.tar HEAD )
git archive --prefix=telegram-purple/ --output=bin/result.tar HEAD
# This is a lot of options. Here's why.
# --sort --mtime --owner --group => be reproducible (same commit produces binarily identical files)
# --transform => be in the same "tar-folder" as the rest
# (absence of --numeric-ids) => have identical behavior as git-archive
# --mode=664 => have identical behavior as git-archive
# http://www.gelato.unsw.edu.au/archives/git/0701/36326.html
# This is hacky. TODO: Find a better way to unify permissions.
tar --sort=name --mtime="1970-01-01 00:00Z" --owner=root --group=root --transform s%^%telegram-purple/% --mode=664 -cf bin/commit.h.tar commit.h
# -- Concatenate it all
tar --concatenate -f bin/result.tar bin/tgl.tar
tar --concatenate -f bin/result.tar bin/tgl_tl-parser.tar
tar --concatenate -f bin/result.tar bin/commit.h.tar
gzip -n bin/result.tar
# -- Determine name and move
TARNAME="telegram-purple_`git describe --tags | sed s/^v// `.orig.tar.gz"
# "mv -f" means "overwrite, if necessary"
echo mv -f bin/result.tar.gz $TARNAME
mv -f bin/result.tar.gz $TARNAME
# -- Cleanup (never fail)
rm -f bin/tgl_tl-parser.tar bin/tgl.tar bin/commit.h.tar bin/result.tar bin/result.tar.gz || true

View file

@ -1,37 +0,0 @@
BEGIN {
print "/*";
print " This file is part of telegram-client.";
print "";
print " Telegram-client is free software: you can redistribute it and/or modify";
print " it under the terms of the GNU General Public License as published by";
print " the Free Software Foundation, either version 2 of the License, or";
print " (at your option) any later version.";
print "";
print " Telegram-client is distributed in the hope that it will be useful,";
print " but WITHOUT ANY WARRANTY; without even the implied warranty of";
print " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the";
print " GNU General Public License for more details.";
print "";
print " You should have received a copy of the GNU General Public License";
print " along with this telegram-client. If not, see <http://www.gnu.org/licenses/>.";
print "";
print " Copyright Vitaly Valtman 2013";
print "*/";
print "#ifndef CONSTANTS_H";
print "#define CONSTANTS_H";
}
// {
if (split ($1, a, "#") == 2) {
gsub (/[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/, "_&", a[1]);
gsub (/[.]/, "_", a[1]);
if (a[2] in h) {
print "ERROR: Duplicate magic " a[2] " for define " a[1] " and " h[a[2]] >"/dev/stderr/"
exit 1;
}
h[a[2]] = a[1];
print "#define", "CODE_" tolower(a[1]), "0x" a[2];
}
}
END {
print "#endif";
}

1812
generate.c

File diff suppressed because it is too large Load diff

View file

@ -1,171 +0,0 @@
/*
This file is part of tgl-libary/generate
Tgl-library/generate 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 2 of the License, or
(at your option) any later version.
Tgl-library/generate 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 this tgl-library/generate. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2014
It is derivative work of VK/KittenPHP-DB-Engine (https://github.com/vk-com/kphp-kdb/)
Copyright 2012-2013 Vkontakte Ltd
2012-2013 Vitaliy Valtman
*/
#ifndef __GENERATE_H__
#define __GENERATE_H__
struct tl_combinator;
struct tl_type {
// struct tl_type_methods *methods;
char *id;
char *print_id;
unsigned name;
int arity;
int flags;
int constructors_num;
struct tl_combinator **constructors;
long long params_types;
int extra;
};
#define NODE_TYPE_TYPE 1
#define NODE_TYPE_NAT_CONST 2
#define NODE_TYPE_VAR_TYPE 3
#define NODE_TYPE_VAR_NUM 4
#define NODE_TYPE_ARRAY 5
#define MAX_COMBINATOR_VARS 64
#define NAME_VAR_NUM 0x70659eff
#define NAME_VAR_TYPE 0x2cecf817
#define NAME_INT 0xa8509bda
#define NAME_LONG 0x22076cba
#define NAME_DOUBLE 0x2210c154
#define NAME_STRING 0xb5286e24
#define NAME_VECTOR 0x1cb5c415
#define NAME_MAYBE_TRUE 0x3f9c8ef8
#define NAME_MAYBE_FALSE 0x27930a7b
#define NAME_BOOL_FALSE 0xbc799737
#define NAME_BOOL_TRUE 0x997275b5
#define FLAG_OPT_VAR (1 << 17)
#define FLAG_EXCL (1 << 18)
#define FLAG_OPT_FIELD (1 << 20)
#define FLAG_NOVAR (1 << 21)
#define FLAG_BARE 1
#define FLAGS_MASK ((1 << 16) - 1)
#define FLAG_DEFAULT_CONSTRUCTOR (1 << 25)
#define FLAG_NOCONS (1 << 1)
extern struct tl_tree_methods tl_nat_const_methods;
extern struct tl_tree_methods tl_nat_const_full_methods;
extern struct tl_tree_methods tl_pnat_const_full_methods;
extern struct tl_tree_methods tl_array_methods;
extern struct tl_tree_methods tl_type_methods;
extern struct tl_tree_methods tl_parray_methods;
extern struct tl_tree_methods tl_ptype_methods;
extern struct tl_tree_methods tl_var_num_methods;
extern struct tl_tree_methods tl_var_type_methods;
extern struct tl_tree_methods tl_pvar_num_methods;
extern struct tl_tree_methods tl_pvar_type_methods;
#define TL_IS_NAT_VAR(x) (((long)x) & 1)
#define TL_TREE_METHODS(x) (TL_IS_NAT_VAR (x) ? &tl_nat_const_methods : ((struct tl_tree *)(x))->methods)
#define DEC_REF(x) (TL_TREE_METHODS(x)->dec_ref ((void *)x))
#define INC_REF(x) (TL_TREE_METHODS(x)->inc_ref ((void *)x))
#define TYPE(x) (TL_TREE_METHODS(x)->type ((void *)x))
typedef unsigned long long tl_tree_hash_t;
struct tl_tree;
struct tl_tree_methods {
int (*type)(struct tl_tree *T);
int (*eq)(struct tl_tree *T, struct tl_tree *U);
void (*inc_ref)(struct tl_tree *T);
void (*dec_ref)(struct tl_tree *T);
};
struct tl_tree {
int ref_cnt;
int flags;
//tl_tree_hash_t hash;
struct tl_tree_methods *methods;
};
/*
struct tl_tree_nat_const {
struct tl_tree self;
int value;
};*/
struct tl_tree_type {
struct tl_tree self;
struct tl_type *type;
int children_num;
struct tl_tree **children;
};
struct tl_tree_array {
struct tl_tree self;
struct tl_tree *multiplicity;
int args_num;
struct arg **args;
};
struct tl_tree_var_type {
struct tl_tree self;
int var_num;
};
struct tl_tree_var_num {
struct tl_tree self;
int var_num;
int dif;
};
struct tl_tree_nat_const {
struct tl_tree self;
long long value;
};
struct arg {
char *id;
int var_num;
int flags;
int exist_var_num;
int exist_var_bit;
struct tl_tree *type;
};
struct tl_combinator {
//struct tl_combinator_methods *methods;
char *id;
char *print_id;
unsigned name;
int is_fun;
int var_num;
int args_num;
struct arg **args;
struct tl_tree *result;
void **IP;
void **fIP;
int IP_len;
int fIP_len;
};
#endif

View file

@ -1 +0,0 @@
EBUILD telegram-cli-9999.ebuild 665 SHA256 446cf5cd54f60485dda2f47e5c027b78f182053ef88cd09d7327603e2d5f3d86 SHA512 8a3673de91ec60e89391956523a4b61872161a23a7e0babdbd90cbdd8602104ba1855d09bd0af1d2092890eb202f498750610bf71e3bd0562e37ec984deb333e WHIRLPOOL e943b8870f461c62e3dc7f061dcad264c25758d1d50a0c34f5232d3be6ae26e9dd2ca1289e65b6153ff5b8800194969f1c53e3adc81aa4e47bf25c2f7e6aab7c

View file

@ -1,33 +0,0 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=5
EGIT_REPO_URI="https://github.com/vysheng/tg.git"
EGIT_BRANCH="test"
inherit git-2
IUSE="lua"
DESCRIPTION="Command line interface client for Telegram"
HOMEPAGE="https://github.com/vysheng/tg"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND="sys-libs/zlib
sys-libs/readline
dev-libs/libconfig
dev-libs/openssl
dev-libs/libevent
lua? ( dev-lang/lua )"
src_configure() {
econf $(use_enable lua liblua )
}
src_install() {
newbin bin/telegram-cli telegram-cli
insinto /etc/telegram-cli/
newins tg-server.pub server.pub
}

BIN
imgs/telegram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
imgs/telegram16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

BIN
imgs/telegram22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

BIN
imgs/telegram48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1,24 +0,0 @@
/*
This file is part of telegram-client.
Telegram-client 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 2 of the License, or
(at your option) any later version.
Telegram-client 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 this telegram-client. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013
*/
#ifndef __INCLUDE_H__
#define __INCLUDE_H__
#define UU __attribute__ ((unused))
#endif

527
install-sh Executable file
View file

@ -0,0 +1,527 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load diff

View file

@ -1,86 +0,0 @@
/*
This file is part of telegram-cli.
Telegram-cli 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 2 of the License, or
(at your option) any later version.
Telegram-cli 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 this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
*/
#ifndef __INTERFACE_H__
#define __INTERFACE_H__
#include "structures.h"
#include "tgl-layout.h"
#define COLOR_RED "\033[0;31m"
#define COLOR_REDB "\033[1;31m"
#define COLOR_NORMAL "\033[0m"
#define COLOR_GREEN "\033[32;1m"
#define COLOR_GREY "\033[37;1m"
#define COLOR_YELLOW "\033[33;1m"
#define COLOR_BLUE "\033[34;1m"
#define COLOR_MAGENTA "\033[35;1m"
#define COLOR_CYAN "\033[36;1m"
#define COLOR_LCYAN "\033[0;36m"
#define COLOR_INVERSE "\033[7m"
char *get_default_prompt (void);
char *complete_none (const char *text, int state);
char **complete_text (char *text, int start, int end);
void interpreter (char *line);
void interpreter_ex (char *line, void *ex);
void rprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2)));
void logprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2)));
#define vlogprintf(v,...) \
do { \
if (tgl_state.verbosity >= (v)) {\
logprintf (__VA_ARGS__);\
}\
} while (0);\
//void hexdump (int *in_ptr, int *in_end);
struct bufferevent;
struct in_ev {
struct bufferevent *bev;
char in_buf[4096];
int in_buf_pos;
int refcnt;
int error;
int fd;
};
struct tgl_message;
struct in_ev;
void print_message (struct in_ev *ev, struct tgl_message *M);
void print_chat_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C);
void print_user_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *U);
void print_encr_chat_name_full (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C);
void print_encr_chat_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C);
//void print_media (struct tgl_message_media *M);
//
void pop_color (void);
void push_color (const char *color);
void print_start (void);
void print_end (void);
void print_date_full (struct in_ev *ev, long t);
void print_date (struct in_ev *ev, long t);
void play_sound (void);
void update_prompt (void);
void set_interface_callbacks (void);
#endif

854
loop.c
View file

@ -1,854 +0,0 @@
/*
This file is part of telegram-cli.
Telegram-cli 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 2 of the License, or
(at your option) any later version.
Telegram-cli 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 this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define _GNU_SOURCE
#define READLINE_CALLBACKS
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef READLINE_GNU
#include <readline/readline.h>
#include <readline/history.h>
#else
#include <readline/readline.h>
#include <readline/history.h>
#endif
#include <errno.h>
#include <poll.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <netinet/in.h>
#ifdef EVENT_V2
#include <event2/event.h>
#include <event2/bufferevent.h>
#else
#include <event.h>
#include "event-old.h"
#endif
#include "interface.h"
#include "telegram.h"
#include "loop.h"
#include "lua-tg.h"
#include "tgl.h"
#include "binlog.h"
int verbosity;
extern int readline_disabled;
int binlog_read;
extern char *default_username;
extern char *auth_token;
void set_default_username (const char *s);
extern int binlog_enabled;
extern int unknown_user_list_pos;
extern int unknown_user_list[];
int register_mode;
extern int safe_quit;
extern int sync_from_start;
extern int disable_output;
extern int reset_authorization;
extern int sfd;
extern int usfd;
void got_it (char *line, int len);
void write_state_file (void);
static char *line_buffer;
static int line_buffer_size;
static int line_buffer_pos;
static int delete_stdin_event;
extern volatile int sigterm_cnt;
static void stdin_read_callback_all (int arg, short what, struct event *self) {
if (!readline_disabled) {
if (((long)arg) & 1) {
rl_callback_read_char ();
} else {
char *line = 0;
size_t len = 0;
assert (getline (&line, &len, stdin) >= 0);
got_it (line, strlen (line));
}
} else {
while (1) {
if (line_buffer_pos == line_buffer_size) {
line_buffer = realloc (line_buffer, line_buffer_size * 2 + 100);
assert (line_buffer);
line_buffer_size = line_buffer_size * 2 + 100;
assert (line_buffer);
}
int r = read (0, line_buffer + line_buffer_pos, line_buffer_size - line_buffer_pos);
//logprintf ("r = %d, size = %d, pos = %d, what = 0x%x, fd = %d\n", r, line_buffer_size, line_buffer_pos, (int)what, fd);
if (r < 0) {
perror ("read");
break;
}
if (r == 0) {
//struct event *ev = event_base_get_running_event (tgl_state.ev_base);
//event_del (ev);
//event_del (self);
delete_stdin_event = 1;
break;
}
line_buffer_pos += r;
while (1) {
int p = 0;
while (p < line_buffer_pos && line_buffer[p] != '\n') { p ++; }
if (p < line_buffer_pos) {
if (((long)arg) & 1) {
line_buffer[p] = 0;
interpreter (line_buffer);
} else {
got_it (line_buffer, p + 1);
}
memmove (line_buffer, line_buffer + p + 1, line_buffer_pos - p - 1);
line_buffer_pos -= (p + 1);
} else {
break;
}
}
break;
}
}
}
static void stdin_read_callback_char (evutil_socket_t fd, short what, void *arg) {
stdin_read_callback_all (1, what, arg);
}
static void stdin_read_callback_line (evutil_socket_t fd, short what, void *arg) {
stdin_read_callback_all (2, what, arg);
}
struct event *term_ev = 0;
void net_loop (int flags, int (*is_end)(void)) {
delete_stdin_event = 0;
if (verbosity >= E_DEBUG) {
logprintf ("Starting netloop\n");
}
if (flags & 3) {
if (flags & 1) {
term_ev = event_new (tgl_state.ev_base, 0, EV_READ | EV_PERSIST, stdin_read_callback_char, 0);
} else {
term_ev = event_new (tgl_state.ev_base, 0, EV_READ | EV_PERSIST, stdin_read_callback_line, 0);
}
event_add (term_ev, 0);
}
int last_get_state = time (0);
while (!is_end || !is_end ()) {
event_base_loop (tgl_state.ev_base, EVLOOP_ONCE);
if (term_ev && delete_stdin_event) {
event_free (term_ev);
term_ev = 0;
}
#ifdef USE_LUA
lua_do_all ();
#endif
if (safe_quit && !tgl_state.active_queries) {
printf ("All done. Exit\n");
do_halt (0);
}
if (sigterm_cnt > 0) {
do_halt (0);
}
if (time (0) - last_get_state > 3600) {
tgl_do_lookup_state ();
last_get_state = time (0);
}
write_state_file ();
update_prompt ();
if (unknown_user_list_pos) {
int i;
for (i = 0; i < unknown_user_list_pos; i++) {
tgl_do_get_user_info (TGL_MK_USER (unknown_user_list[i]), 0, 0, 0);
}
unknown_user_list_pos = 0;
}
}
if (term_ev) {
event_free (term_ev);
term_ev = 0;
}
if (verbosity >= E_DEBUG) {
logprintf ("End of netloop\n");
}
}
char **_s;
size_t *_l;
int got_it_ok;
void got_it (char *line, int len) {
assert (len > 0);
line[-- len] = 0; // delete end of line
*_s = line;
*_l = len;
got_it_ok = 1;
}
int is_got_it (void) {
return got_it_ok;
}
int net_getline (char **s, size_t *l) {
fflush (stdout);
// rl_already_prompted = 1;
got_it_ok = 0;
_s = s;
_l = l;
// rl_callback_handler_install (0, got_it);
net_loop (2, is_got_it);
return 0;
}
int main_loop (void) {
net_loop (1, 0);
return 0;
}
struct tgl_dc *cur_a_dc;
int is_authorized (void) {
return tgl_authorized_dc (cur_a_dc);
}
int all_authorized (void) {
int i;
for (i = 0; i <= tgl_state.max_dc_num; i++) if (tgl_state.DC_list[i]) {
if (!tgl_authorized_dc (tgl_state.DC_list[i])) {
return 0;
}
}
return 1;
}
int config_got;
int got_config (void) {
return config_got;
}
void on_get_config (void *extra, int success) {
if (!success) {
logprintf ("Can not get config.\n");
do_halt (1);
}
config_got = 1;
}
int should_register;
char *hash;
void sign_in_callback (void *extra, int success, int registered, const char *mhash) {
if (!success) {
logprintf ("Can not send code\n");
do_halt (1);
}
should_register = !registered;
hash = strdup (mhash);
assert (hash);
}
int signed_in_ok;
void sign_in_result (void *extra, int success, struct tgl_user *U) {
if (!success) {
logprintf ("Can not login\n");
do_halt (1);
}
signed_in_ok = 1;
}
int signed_in (void) {
return signed_in_ok;
}
int sent_code (void) {
return hash != 0;
}
int dc_signed_in (void) {
return tgl_signed_dc (cur_a_dc);
}
void export_auth_callback (void *DC, int success) {
if (!success) {
logprintf ("Can not export auth\n");
do_halt (1);
}
}
int d_got_ok;
void get_difference_callback (void *extra, int success) {
assert (success);
d_got_ok = 1;
}
int dgot (void) {
return d_got_ok;
}
int zero[512];
int readline_active;
int new_dc_num;
int wait_dialog_list;
extern struct tgl_update_callback upd_cb;
#define DC_SERIALIZED_MAGIC 0x868aa81d
#define STATE_FILE_MAGIC 0x28949a93
#define SECRET_CHAT_FILE_MAGIC 0x37a1988a
char *get_auth_key_filename (void);
char *get_state_filename (void);
char *get_secret_chat_filename (void);
void read_state_file (void) {
if (binlog_enabled) { return; }
int state_file_fd = open (get_state_filename (), O_CREAT | O_RDWR, 0600);
if (state_file_fd < 0) {
return;
}
int version, magic;
if (read (state_file_fd, &magic, 4) < 4) { close (state_file_fd); return; }
if (magic != (int)STATE_FILE_MAGIC) { close (state_file_fd); return; }
if (read (state_file_fd, &version, 4) < 4) { close (state_file_fd); return; }
assert (version >= 0);
int x[4];
if (read (state_file_fd, x, 16) < 16) {
close (state_file_fd);
return;
}
int pts = x[0];
int qts = x[1];
int seq = x[2];
int date = x[3];
close (state_file_fd);
bl_do_set_seq (seq);
bl_do_set_pts (pts);
bl_do_set_qts (qts);
bl_do_set_date (date);
}
void write_state_file (void) {
if (binlog_enabled) { return; }
static int wseq;
static int wpts;
static int wqts;
static int wdate;
if (wseq >= tgl_state.seq && wpts >= tgl_state.pts && wqts >= tgl_state.qts && wdate >= tgl_state.date) { return; }
wseq = tgl_state.seq; wpts = tgl_state.pts; wqts = tgl_state.qts; wdate = tgl_state.date;
int state_file_fd = open (get_state_filename (), O_CREAT | O_RDWR, 0600);
if (state_file_fd < 0) {
logprintf ("Can not write state file '%s': %m\n", get_state_filename ());
do_halt (1);
}
int x[6];
x[0] = STATE_FILE_MAGIC;
x[1] = 0;
x[2] = wpts;
x[3] = wqts;
x[4] = wseq;
x[5] = wdate;
assert (write (state_file_fd, x, 24) == 24);
close (state_file_fd);
}
void write_dc (struct tgl_dc *DC, void *extra) {
int auth_file_fd = *(int *)extra;
if (!DC) {
int x = 0;
assert (write (auth_file_fd, &x, 4) == 4);
return;
} else {
int x = 1;
assert (write (auth_file_fd, &x, 4) == 4);
}
assert (DC->has_auth);
assert (write (auth_file_fd, &DC->port, 4) == 4);
int l = strlen (DC->ip);
assert (write (auth_file_fd, &l, 4) == 4);
assert (write (auth_file_fd, DC->ip, l) == l);
assert (write (auth_file_fd, &DC->auth_key_id, 8) == 8);
assert (write (auth_file_fd, DC->auth_key, 256) == 256);
}
void write_auth_file (void) {
if (binlog_enabled) { return; }
int auth_file_fd = open (get_auth_key_filename (), O_CREAT | O_RDWR, 0600);
assert (auth_file_fd >= 0);
int x = DC_SERIALIZED_MAGIC;
assert (write (auth_file_fd, &x, 4) == 4);
assert (write (auth_file_fd, &tgl_state.max_dc_num, 4) == 4);
assert (write (auth_file_fd, &tgl_state.dc_working_num, 4) == 4);
tgl_dc_iterator_ex (write_dc, &auth_file_fd);
assert (write (auth_file_fd, &tgl_state.our_id, 4) == 4);
close (auth_file_fd);
}
void write_secret_chat (tgl_peer_t *_P, void *extra) {
struct tgl_secret_chat *P = (void *)_P;
if (tgl_get_peer_type (P->id) != TGL_PEER_ENCR_CHAT) { return; }
if (P->state != sc_ok) { return; }
int *a = extra;
int fd = a[0];
a[1] ++;
int id = tgl_get_peer_id (P->id);
assert (write (fd, &id, 4) == 4);
//assert (write (fd, &P->flags, 4) == 4);
int l = strlen (P->print_name);
assert (write (fd, &l, 4) == 4);
assert (write (fd, P->print_name, l) == l);
assert (write (fd, &P->user_id, 4) == 4);
assert (write (fd, &P->admin_id, 4) == 4);
assert (write (fd, &P->date, 4) == 4);
assert (write (fd, &P->ttl, 4) == 4);
assert (write (fd, &P->layer, 4) == 4);
assert (write (fd, &P->access_hash, 8) == 8);
assert (write (fd, &P->state, 4) == 4);
assert (write (fd, &P->key_fingerprint, 8) == 8);
assert (write (fd, &P->key, 256) == 256);
}
void write_secret_chat_file (void) {
if (binlog_enabled) { return; }
int secret_chat_fd = open (get_secret_chat_filename (), O_CREAT | O_RDWR, 0600);
assert (secret_chat_fd >= 0);
int x = SECRET_CHAT_FILE_MAGIC;
assert (write (secret_chat_fd, &x, 4) == 4);
x = 0;
assert (write (secret_chat_fd, &x, 4) == 4); // version
assert (write (secret_chat_fd, &x, 4) == 4); // num
int y[2];
y[0] = secret_chat_fd;
y[1] = 0;
tgl_peer_iterator_ex (write_secret_chat, y);
lseek (secret_chat_fd, 8, SEEK_SET);
assert (write (secret_chat_fd, &y[1], 4) == 4);
close (secret_chat_fd);
}
void read_dc (int auth_file_fd, int id, unsigned ver) {
int port = 0;
assert (read (auth_file_fd, &port, 4) == 4);
int l = 0;
assert (read (auth_file_fd, &l, 4) == 4);
assert (l >= 0 && l < 100);
char ip[100];
assert (read (auth_file_fd, ip, l) == l);
ip[l] = 0;
long long auth_key_id;
static unsigned char auth_key[256];
assert (read (auth_file_fd, &auth_key_id, 8) == 8);
assert (read (auth_file_fd, auth_key, 256) == 256);
//bl_do_add_dc (id, ip, l, port, auth_key_id, auth_key);
bl_do_dc_option (id, 2, "DC", l, ip, port);
bl_do_set_auth_key_id (id, auth_key);
bl_do_dc_signed (id);
}
void empty_auth_file (void) {
char *ip = tgl_state.test_mode ? TG_SERVER_TEST : TG_SERVER;
bl_do_dc_option (tgl_state.test_mode ? TG_SERVER_TEST_DC : TG_SERVER_DC, 0, "", strlen (ip), ip, 443);
bl_do_set_working_dc (tgl_state.test_mode ? TG_SERVER_TEST_DC : TG_SERVER_DC);
}
int need_dc_list_update;
void read_auth_file (void) {
if (binlog_enabled) { return; }
int auth_file_fd = open (get_auth_key_filename (), O_CREAT | O_RDWR, 0600);
if (auth_file_fd < 0) {
empty_auth_file ();
return;
}
assert (auth_file_fd >= 0);
unsigned x;
unsigned m;
if (read (auth_file_fd, &m, 4) < 4 || (m != DC_SERIALIZED_MAGIC)) {
close (auth_file_fd);
empty_auth_file ();
return;
}
assert (read (auth_file_fd, &x, 4) == 4);
assert (x > 0);
int dc_working_num;
assert (read (auth_file_fd, &dc_working_num, 4) == 4);
int i;
for (i = 0; i <= (int)x; i++) {
int y;
assert (read (auth_file_fd, &y, 4) == 4);
if (y) {
read_dc (auth_file_fd, i, m);
}
}
bl_do_set_working_dc (dc_working_num);
int our_id;
int l = read (auth_file_fd, &our_id, 4);
if (l < 4) {
assert (!l);
}
if (our_id) {
bl_do_set_our_id (our_id);
}
close (auth_file_fd);
}
void read_secret_chat (int fd) {
int id, l, user_id, admin_id, date, ttl, layer, state;
long long access_hash, key_fingerprint;
static char s[1000];
static unsigned char key[256];
assert (read (fd, &id, 4) == 4);
//assert (read (fd, &flags, 4) == 4);
assert (read (fd, &l, 4) == 4);
assert (l > 0 && l < 1000);
assert (read (fd, s, l) == l);
assert (read (fd, &user_id, 4) == 4);
assert (read (fd, &admin_id, 4) == 4);
assert (read (fd, &date, 4) == 4);
assert (read (fd, &ttl, 4) == 4);
assert (read (fd, &layer, 4) == 4);
assert (read (fd, &access_hash, 8) == 8);
assert (read (fd, &state, 4) == 4);
assert (read (fd, &key_fingerprint, 8) == 8);
assert (read (fd, &key, 256) == 256);
bl_do_encr_chat_create (id, user_id, admin_id, s, l);
struct tgl_secret_chat *P = (void *)tgl_peer_get (TGL_MK_ENCR_CHAT (id));
assert (P && (P->flags & FLAG_CREATED));
bl_do_encr_chat_set_date (P, date);
bl_do_encr_chat_set_ttl (P, ttl);
bl_do_encr_chat_set_layer (P, layer);
bl_do_encr_chat_set_access_hash (P, access_hash);
bl_do_encr_chat_set_state (P, state);
bl_do_encr_chat_set_key (P, key, key_fingerprint);
}
void read_secret_chat_file (void) {
if (binlog_enabled) { return; }
int secret_chat_fd = open (get_secret_chat_filename (), O_RDWR, 0600);
if (secret_chat_fd < 0) { return; }
//assert (secret_chat_fd >= 0);
int x;
if (read (secret_chat_fd, &x, 4) < 4) { close (secret_chat_fd); return; }
if (x != SECRET_CHAT_FILE_MAGIC) { close (secret_chat_fd); return; }
assert (read (secret_chat_fd, &x, 4) == 4);
assert (!x); // version
assert (read (secret_chat_fd, &x, 4) == 4);
assert (x >= 0);
while (x --> 0) {
read_secret_chat (secret_chat_fd);
}
close (secret_chat_fd);
}
void dlist_cb (void *callback_extra, int success, int size, tgl_peer_id_t peers[], int last_msg_id[], int unread_count[]) {
d_got_ok = 1;
}
static void read_incoming (struct bufferevent *bev, void *_arg) {
vlogprintf (E_WARNING, "Read from incoming connection\n");
struct in_ev *ev = _arg;
assert (ev->bev == bev);
ev->in_buf_pos += bufferevent_read (bev, ev->in_buf + ev->in_buf_pos, 4096 - ev->in_buf_pos);
while (1) {
int pos = 0;
int ok = 0;
while (pos < ev->in_buf_pos) {
if (ev->in_buf[pos] == '\n') {
if (!ev->error) {
ev->in_buf[pos] = 0;
interpreter_ex (ev->in_buf, ev);
} else {
ev->error = 0;
}
ok = 1;
ev->in_buf_pos -= (pos + 1);
memmove (ev->in_buf, ev->in_buf + pos + 1, ev->in_buf_pos);
pos = 0;
} else {
pos ++;
}
}
if (ok) {
ev->in_buf_pos += bufferevent_read (bev, ev->in_buf + ev->in_buf_pos, 4096 - ev->in_buf_pos);
} else {
if (ev->in_buf_pos == 4096) {
ev->error = 1;
}
break;
}
}
}
static void event_incoming (struct bufferevent *bev, short what, void *_arg) {
struct in_ev *ev = _arg;
if (what & (BEV_EVENT_EOF | BEV_EVENT_ERROR)) {
vlogprintf (E_WARNING, "Closing incoming connection\n");
assert (ev->fd >= 0);
close (ev->fd);
bufferevent_free (bev);
ev->bev = 0;
if (!--ev->refcnt) { free (ev); }
}
}
static void accept_incoming (evutil_socket_t efd, short what, void *arg) {
vlogprintf (E_WARNING, "Accepting incoming connection\n");
unsigned clilen;
struct sockaddr_in cli_addr;
int fd = accept (efd, (struct sockaddr *)&cli_addr, &clilen);
assert (fd >= 0);
struct bufferevent *bev = bufferevent_socket_new (tgl_state.ev_base, fd, 0);
struct in_ev *e = malloc (sizeof (*e));
e->bev = bev;
e->refcnt = 1;
e->in_buf_pos = 0;
e->error = 0;
e->fd = fd;
bufferevent_setcb (bev, read_incoming, 0, event_incoming, e);
bufferevent_enable(bev, EV_READ|EV_WRITE);
}
int loop (void) {
//on_start ();
tgl_set_callback (&upd_cb);
//tgl_state.temp_key_expire_time = 60;
tgl_init ();
if (binlog_enabled) {
double t = tglt_get_double_time ();
if (verbosity >= E_DEBUG) {
logprintf ("replay log start\n");
}
tgl_replay_log ();
if (verbosity >= E_DEBUG) {
logprintf ("replay log end in %lf seconds\n", tglt_get_double_time () - t);
}
tgl_reopen_binlog_for_writing ();
} else {
read_auth_file ();
read_state_file ();
read_secret_chat_file ();
}
binlog_read = 1;
#ifdef USE_LUA
lua_binlog_end ();
#endif
if (sfd >= 0) {
struct event *ev = event_new (tgl_state.ev_base, sfd, EV_READ | EV_PERSIST, accept_incoming, 0);
event_add (ev, 0);
}
if (usfd >= 0) {
struct event *ev = event_new (tgl_state.ev_base, usfd, EV_READ | EV_PERSIST, accept_incoming, 0);
event_add (ev, 0);
}
update_prompt ();
if (reset_authorization) {
tgl_peer_t *P = tgl_peer_get (TGL_MK_USER (tgl_state.our_id));
if (P && P->user.phone && reset_authorization == 1) {
set_default_username (P->user.phone);
}
bl_do_reset_authorization ();
}
net_loop (0, all_authorized);
int i;
for (i = 0; i <= tgl_state.max_dc_num; i++) if (tgl_state.DC_list[i] && !tgl_authorized_dc (tgl_state.DC_list[i])) {
assert (0);
}
if (!tgl_signed_dc (tgl_state.DC_working)) {
if (disable_output) {
fprintf (stderr, "Can not login without output\n");
do_halt (1);
}
if (!default_username) {
size_t size = 0;
char *user = 0;
if (!user) {
printf ("Telephone number (with '+' sign): ");
if (net_getline (&user, &size) == -1) {
perror ("getline()");
do_halt (1);
}
set_default_username (user);
}
}
tgl_do_send_code (default_username, sign_in_callback, 0);
net_loop (0, sent_code);
if (verbosity >= E_DEBUG) {
logprintf ("%s\n", should_register ? "phone not registered" : "phone registered");
}
if (!should_register) {
char *code = 0;
size_t size = 0;
printf ("Code from sms (if you did not receive an SMS and want to be called, type \"call\"): ");
while (1) {
if (net_getline (&code, &size) == -1) {
perror ("getline()");
do_halt (1);
}
if (!strcmp (code, "call")) {
printf ("You typed \"call\", switching to phone system.\n");
tgl_do_phone_call (default_username, hash, 0, 0);
printf ("Calling you! Code: ");
continue;
}
if (tgl_do_send_code_result (default_username, hash, code, sign_in_result, 0) >= 0) {
break;
}
printf ("Invalid code. Try again: ");
free (code);
}
} else {
printf ("User is not registered. Do you want to register? [Y/n] ");
char *code;
size_t size;
if (net_getline (&code, &size) == -1) {
perror ("getline()");
do_halt (1);
}
if (!*code || *code == 'y' || *code == 'Y') {
printf ("Ok, starting registartion.\n");
} else {
printf ("Then try again\n");
do_halt (1);
}
char *first_name;
printf ("First name: ");
if (net_getline (&first_name, &size) == -1) {
perror ("getline()");
do_halt (1);
}
char *last_name;
printf ("Last name: ");
if (net_getline (&last_name, &size) == -1) {
perror ("getline()");
do_halt (1);
}
printf ("Code from sms (if you did not receive an SMS and want to be called, type \"call\"): ");
while (1) {
if (net_getline (&code, &size) == -1) {
perror ("getline()");
do_halt (1);
}
if (!strcmp (code, "call")) {
printf ("You typed \"call\", switching to phone system.\n");
tgl_do_phone_call (default_username, hash, 0, 0);
printf ("Calling you! Code: ");
continue;
}
if (tgl_do_send_code_result_auth (default_username, hash, code, first_name, last_name, sign_in_result, 0) >= 0) {
break;
}
printf ("Invalid code. Try again: ");
free (code);
}
}
net_loop (0, signed_in);
//bl_do_dc_signed (tgl_state.DC_working);
}
for (i = 0; i <= tgl_state.max_dc_num; i++) if (tgl_state.DC_list[i] && !tgl_signed_dc (tgl_state.DC_list[i])) {
tgl_do_export_auth (i, export_auth_callback, (void*)(long)tgl_state.DC_list[i]);
cur_a_dc = tgl_state.DC_list[i];
net_loop (0, dc_signed_in);
assert (tgl_signed_dc (tgl_state.DC_list[i]));
}
write_auth_file ();
fflush (stdout);
fflush (stderr);
//read_state_file ();
//read_secret_chat_file ();
set_interface_callbacks ();
tglm_send_all_unsent ();
tgl_do_get_difference (sync_from_start, get_difference_callback, 0);
net_loop (0, dgot);
assert (!(tgl_state.locks & TGL_LOCK_DIFF));
tgl_state.started = 1;
if (wait_dialog_list) {
d_got_ok = 0;
tgl_do_get_dialog_list (dlist_cb, 0);
net_loop (0, dgot);
}
#ifdef USE_LUA
lua_diff_end ();
#endif
/*tgl_do_get_dialog_list (get_dialogs_callback, 0);
if (wait_dialog_list) {
dialog_list_got = 0;
net_loop (0, dlgot);
}*/
return main_loop ();
}

27
loop.h
View file

@ -1,27 +0,0 @@
/*
This file is part of telegram-cli.
Telegram-cli 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 2 of the License, or
(at your option) any later version.
Telegram-cli 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 this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
*/
#ifndef __LOOP_H__
#define __LOOP_H__
int loop (void);
void do_halt (int error);
void net_loop (int flags, int (*end)(void));
void write_auth_file (void);
void write_state_file (void);
void write_secret_chat_file (void);
#endif

1448
lua-tg.c

File diff suppressed because it is too large Load diff

View file

@ -1,35 +0,0 @@
/*
This file is part of telegram-cli.
Telegram-cli 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 2 of the License, or
(at your option) any later version.
Telegram-cli 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 this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
*/
#ifndef __LUA_TG_H__
#define __LUA_TG_H__
#include <string.h>
#include "lua-tg.h"
#include "tgl.h"
void lua_init (const char *file);
void lua_new_msg (struct tgl_message *M);
void lua_our_id (int id);
void lua_secret_chat_update (struct tgl_secret_chat *U, unsigned flags);
void lua_user_update (struct tgl_user *U, unsigned flags);
void lua_chat_update (struct tgl_chat *C, unsigned flags);
void lua_binlog_end (void);
void lua_diff_end (void);
void lua_do_all (void);
#endif

View file

@ -1,168 +0,0 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_gcc_builtin.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_GCC_BUILTIN(BUILTIN)
#
# DESCRIPTION
#
# This macro checks if the compiler supports one of GCC's built-in
# functions; many other compilers also provide those same built-ins.
#
# The BUILTIN parameter is the name of the built-in function.
#
# If BUILTIN is supported define HAVE_<BUILTIN>. Keep in mind that since
# builtins usually start with two underscores they will be copied over
# into the HAVE_<BUILTIN> definition (e.g. HAVE___BUILTIN_EXPECT for
# __builtin_expect()).
#
# The macro caches its result in the ax_cv_have_<BUILTIN> variable (e.g.
# ax_cv_have___builtin_expect).
#
# The macro currently supports the following built-in functions:
#
# __builtin_assume_aligned
# __builtin_bswap32
# __builtin_bswap64
# __builtin_choose_expr
# __builtin___clear_cache
# __builtin_clrsb
# __builtin_clrsbl
# __builtin_clrsbll
# __builtin_clz
# __builtin_clzl
# __builtin_clzll
# __builtin_complex
# __builtin_constant_p
# __builtin_ctz
# __builtin_ctzl
# __builtin_ctzll
# __builtin_expect
# __builtin_ffs
# __builtin_ffsl
# __builtin_ffsll
# __builtin_fpclassify
# __builtin_huge_val
# __builtin_huge_valf
# __builtin_huge_vall
# __builtin_inf
# __builtin_infd128
# __builtin_infd32
# __builtin_infd64
# __builtin_inff
# __builtin_infl
# __builtin_isinf_sign
# __builtin_nan
# __builtin_nand128
# __builtin_nand32
# __builtin_nand64
# __builtin_nanf
# __builtin_nanl
# __builtin_nans
# __builtin_nansf
# __builtin_nansl
# __builtin_object_size
# __builtin_parity
# __builtin_parityl
# __builtin_parityll
# __builtin_popcount
# __builtin_popcountl
# __builtin_popcountll
# __builtin_powi
# __builtin_powif
# __builtin_powil
# __builtin_prefetch
# __builtin_trap
# __builtin_types_compatible_p
# __builtin_unreachable
#
# Unsuppored built-ins will be tested with an empty parameter set and the
# result of the check might be wrong or meaningless so use with care.
#
# LICENSE
#
# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 2
AC_DEFUN([AX_GCC_BUILTIN], [
AS_VAR_PUSHDEF([ac_var], [ax_cv_have_$1])
AC_CACHE_CHECK([for $1], [ac_var], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [
m4_case([$1],
[__builtin_assume_aligned], [$1("", 0)],
[__builtin_bswap32], [$1(0)],
[__builtin_bswap64], [$1(0)],
[__builtin_choose_expr], [$1(0, 0, 0)],
[__builtin___clear_cache], [$1("", "")],
[__builtin_clrsb], [$1(0)],
[__builtin_clrsbl], [$1(0)],
[__builtin_clrsbll], [$1(0)],
[__builtin_clz], [$1(0)],
[__builtin_clzl], [$1(0)],
[__builtin_clzll], [$1(0)],
[__builtin_complex], [$1(0.0, 0.0)],
[__builtin_constant_p], [$1(0)],
[__builtin_ctz], [$1(0)],
[__builtin_ctzl], [$1(0)],
[__builtin_ctzll], [$1(0)],
[__builtin_expect], [$1(0, 0)],
[__builtin_ffs], [$1(0)],
[__builtin_ffsl], [$1(0)],
[__builtin_ffsll], [$1(0)],
[__builtin_fpclassify], [$1(0, 1, 2, 3, 4, 0.0)],
[__builtin_huge_val], [$1()],
[__builtin_huge_valf], [$1()],
[__builtin_huge_vall], [$1()],
[__builtin_inf], [$1()],
[__builtin_infd128], [$1()],
[__builtin_infd32], [$1()],
[__builtin_infd64], [$1()],
[__builtin_inff], [$1()],
[__builtin_infl], [$1()],
[__builtin_isinf_sign], [$1(0.0)],
[__builtin_nan], [$1("")],
[__builtin_nand128], [$1("")],
[__builtin_nand32], [$1("")],
[__builtin_nand64], [$1("")],
[__builtin_nanf], [$1("")],
[__builtin_nanl], [$1("")],
[__builtin_nans], [$1("")],
[__builtin_nansf], [$1("")],
[__builtin_nansl], [$1("")],
[__builtin_object_size], [$1("", 0)],
[__builtin_parity], [$1(0)],
[__builtin_parityl], [$1(0)],
[__builtin_parityll], [$1(0)],
[__builtin_popcount], [$1(0)],
[__builtin_popcountl], [$1(0)],
[__builtin_popcountll], [$1(0)],
[__builtin_powi], [$1(0, 0)],
[__builtin_powif], [$1(0, 0)],
[__builtin_powil], [$1(0, 0)],
[__builtin_prefetch], [$1("")],
[__builtin_trap], [$1()],
[__builtin_types_compatible_p], [$1(int, int)],
[__builtin_unreachable], [$1()],
[m4_warn([syntax], [Unsupported built-in $1, the test may fail])
$1()]
)
])],
[AS_VAR_SET([ac_var], [yes])],
[AS_VAR_SET([ac_var], [no])])
])
AS_IF([test yes = AS_VAR_GET([ac_var])],
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1), 1,
[Define to 1 if the system has the `$1' built-in function])], [])
AS_VAR_POPDEF([ac_var])
])

214
m4_ax_pkg_config.m4 Normal file
View file

@ -0,0 +1,214 @@
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# only at the first occurence in configure.ac, so if the first place
# it's called might be skipped (such as if it is within an "if", you
# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED
# -----------------------------
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
#
# Note that if there is a possibility the first call to
# PKG_CHECK_MODULES might not happen, you should be sure to include an
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])# PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable pkgconfigdir as the location where a module
# should install pkg-config .pc files. By default the directory is
# $libdir/pkgconfig, but the default can be changed by passing
# DIRECTORY. The user can override through the --with-pkgconfigdir
# parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable noarch_pkgconfigdir as the location where a
# module should install arch-independent pkg-config .pc files. By
# default the directory is $datadir/pkgconfig, but the default can be
# changed by passing DIRECTORY. The user can override through the
# --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
# Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR

821
main.c
View file

@ -1,821 +0,0 @@
/*
This file is part of telegram-cli.
Telegram-cli 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 2 of the License, or
(at your option) any later version.
Telegram-cli 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 this telegram-cli. If not, see <http://www.gnu.org/licenses/>.
Copyright Vitaly Valtman 2013-2014
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <termios.h>
#include <unistd.h>
#include <assert.h>
#if (READLINE == GNU)
#include <readline/readline.h>
#else
#include <editline/readline.h>
#endif
#ifdef EVENT_V2
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#else
#include <event.h>
#include "event-old.h"
#endif
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <time.h>
#include <fcntl.h>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include <signal.h>
#ifdef HAVE_LIBCONFIG
#include <libconfig.h>
#endif
#include <grp.h>
#include <arpa/inet.h>
#include "telegram.h"
#include "loop.h"
#include "interface.h"
#include "tools.h"
#ifdef USE_LUA
# include "lua-tg.h"
#endif
#include "tgl.h"
#define PROGNAME "telegram-cli"
#define VERSION "0.07"
#define CONFIG_DIRECTORY "." PROG_NAME
#define CONFIG_FILE "config"
#define AUTH_KEY_FILE "auth"
#define STATE_FILE "state"
#define SECRET_CHAT_FILE "secret"
#define DOWNLOADS_DIRECTORY "downloads"
#define BINLOG_FILE "binlog"
#define CONFIG_DIRECTORY_MODE 0700
#define DEFAULT_CONFIG_CONTENTS \
"# This is an empty config file\n" \
"# Feel free to put something here\n"
int verbosity;
int msg_num_mode;
char *default_username;
char *config_filename;
char *prefix;
char *auth_file_name;
char *state_file_name;
char *secret_chat_file_name;
char *downloads_directory;
char *config_directory;
char *binlog_file_name;
char *lua_file;
int binlog_enabled;
extern int log_level;
int sync_from_start;
int allow_weak_random;
int disable_colors;
int readline_disabled;
int disable_output;
int reset_authorization;
int port;
void set_default_username (const char *s) {
if (default_username) {
tfree_str (default_username);
}
default_username = tstrdup (s);
}
/* {{{ TERMINAL */
static struct termios term_in, term_out;
static int term_set_in;
static int term_set_out;
void get_terminal_attributes (void) {
if (tcgetattr (STDIN_FILENO, &term_in) < 0) {
} else {
term_set_in = 1;
}
if (tcgetattr (STDOUT_FILENO, &term_out) < 0) {
} else {
term_set_out = 1;
}
}
void set_terminal_attributes (void) {
if (term_set_in) {
if (tcsetattr (STDIN_FILENO, 0, &term_in) < 0) {
perror ("tcsetattr()");
}
}
if (term_set_out) {
if (tcsetattr (STDOUT_FILENO, 0, &term_out) < 0) {
perror ("tcsetattr()");
}
}
}
/* }}} */
char *get_home_directory (void) {
static char *home_directory = NULL;
if (home_directory != NULL) {
return home_directory;
}
struct passwd *current_passwd;
uid_t user_id;
setpwent ();
user_id = getuid ();
while ((current_passwd = getpwent ())) {
if (current_passwd->pw_uid == user_id) {
home_directory = tstrdup (current_passwd->pw_dir);
break;
}
}
endpwent ();
if (home_directory == NULL) {
home_directory = tstrdup (".");
}
return home_directory;
}
char *get_config_directory (void) {
char *config_directory;
tasprintf (&config_directory, "%s/" CONFIG_DIRECTORY, get_home_directory ());
return config_directory;
}
char *get_config_filename (void) {
return config_filename;
}
char *get_auth_key_filename (void) {
return auth_file_name;
}
char *get_state_filename (void) {
return state_file_name;
}
char *get_secret_chat_filename (void) {
return secret_chat_file_name;
}
char *get_downloads_directory (void) {
return downloads_directory;
}
char *get_binlog_file_name (void) {
return binlog_file_name;
}
char *make_full_path (char *s) {
if (*s != '/') {
char *t = s;
tasprintf (&s, "%s/%s", get_home_directory (), s);
tfree_str (t);
}
return s;
}
void check_type_sizes (void) {
if (sizeof (int) != 4u) {
logprintf ("sizeof (int) isn't equal 4.\n");
exit (1);
}
if (sizeof (char) != 1u) {
logprintf ("sizeof (char) isn't equal 1.\n");
exit (1);
}
}
void running_for_first_time (void) {
check_type_sizes ();
if (config_filename) {
return; // Do not create custom config file
}
tasprintf (&config_filename, "%s/%s/%s", get_home_directory (), CONFIG_DIRECTORY, CONFIG_FILE);
config_filename = make_full_path (config_filename);
int config_file_fd;
char *config_directory = get_config_directory ();
//char *downloads_directory = get_downloads_directory ();
if (!mkdir (config_directory, CONFIG_DIRECTORY_MODE)) {
if (!disable_output) {
printf ("[%s] created\n", config_directory);
}
}
tfree_str (config_directory);
config_directory = NULL;
// see if config file is there
if (access (config_filename, R_OK) != 0) {
// config file missing, so touch it
config_file_fd = open (config_filename, O_CREAT | O_RDWR, 0600);
if (config_file_fd == -1) {
perror ("open[config_file]");
exit (EXIT_FAILURE);
}
if (write (config_file_fd, DEFAULT_CONFIG_CONTENTS, strlen (DEFAULT_CONFIG_CONTENTS)) <= 0) {
perror ("write[config_file]");
exit (EXIT_FAILURE);
}
close (config_file_fd);
/*int auth_file_fd = open (get_auth_key_filename (), O_CREAT | O_RDWR, 0600);
int x = -1;
assert (write (auth_file_fd, &x, 4) == 4);
close (auth_file_fd);
printf ("[%s] created\n", config_filename);*/
/* create downloads directory */
/*if (mkdir (downloads_directory, 0755) !=0) {
perror ("creating download directory");
exit (EXIT_FAILURE);
}*/
}
}
#ifdef HAVE_LIBCONFIG
void parse_config_val (config_t *conf, char **s, char *param_name, const char *default_name, const char *path) {
static char buf[1000];
int l = 0;
if (prefix) {
l = strlen (prefix);
memcpy (buf, prefix, l);
buf[l ++] = '.';
}
*s = 0;
const char *r = 0;
strcpy (buf + l, param_name);
config_lookup_string (conf, buf, &r);
if (r) {
if (path) {
tasprintf (s, "%s/%s", path, r);
} else {
*s = tstrdup (r);
}
} else {
if (path && default_name) {
tasprintf (s, "%s/%s", path, default_name);
} else {
*s = default_name ? tstrdup (default_name) : 0;
}
}
}
void parse_config (void) {
//config_filename = make_full_path (config_filename);
config_t conf;
config_init (&conf);
if (config_read_file (&conf, config_filename) != CONFIG_TRUE) {
fprintf (stderr, "Can not read config '%s': error '%s' on the line %d\n", config_filename, config_error_text (&conf), config_error_line (&conf));
exit (2);
}
if (!prefix) {
config_lookup_string (&conf, "default_profile", (void *)&prefix);
}
static char buf[1000];
int l = 0;
if (prefix) {
l = strlen (prefix);
memcpy (buf, prefix, l);
buf[l ++] = '.';
}
int test_mode = 0;
strcpy (buf + l, "test");
config_lookup_bool (&conf, buf, &test_mode);
if (test_mode) {
tgl_set_test_mode ();
}
strcpy (buf + l, "log_level");
long long t = log_level;
config_lookup_int (&conf, buf, (void *)&t);
log_level = t;
if (!msg_num_mode) {
strcpy (buf + l, "msg_num");
config_lookup_bool (&conf, buf, &msg_num_mode);
}
parse_config_val (&conf, &config_directory, "config_directory", CONFIG_DIRECTORY, 0);
config_directory = make_full_path (config_directory);
parse_config_val (&conf, &auth_file_name, "auth_file", AUTH_KEY_FILE, config_directory);
parse_config_val (&conf, &downloads_directory, "downloads", DOWNLOADS_DIRECTORY, config_directory);
if (!lua_file) {
parse_config_val (&conf, &lua_file, "lua_script", 0, config_directory);
}
strcpy (buf + l, "binlog_enabled");
config_lookup_bool (&conf, buf, &binlog_enabled);
int pfs_enabled = 0;
strcpy (buf + l, "pfs_enabled");
config_lookup_bool (&conf, buf, &pfs_enabled);
if (pfs_enabled) {
tgl_enable_pfs ();
}
if (binlog_enabled) {
parse_config_val (&conf, &binlog_file_name, "binlog", BINLOG_FILE, config_directory);
tgl_set_binlog_mode (1);
tgl_set_binlog_path (binlog_file_name);
} else {
tgl_set_binlog_mode (0);
parse_config_val (&conf, &state_file_name, "state_file", STATE_FILE, config_directory);
parse_config_val (&conf, &secret_chat_file_name, "secret", SECRET_CHAT_FILE, config_directory);
//tgl_set_auth_file_path (auth_file_name);
}
tgl_set_download_directory (downloads_directory);
if (!mkdir (config_directory, CONFIG_DIRECTORY_MODE)) {
if (!disable_output) {
printf ("[%s] created\n", config_directory);
}
}
if (!mkdir (downloads_directory, CONFIG_DIRECTORY_MODE)) {
if (!disable_output) {
printf ("[%s] created\n", downloads_directory);
}
}
config_destroy (&conf);
}
#else
void parse_config (void) {
if (!disable_output) {
printf ("libconfig not enabled\n");
}
tasprintf (&downloads_directory, "%s/%s/%s", get_home_directory (), CONFIG_DIRECTORY, DOWNLOADS_DIRECTORY);
if (binlog_enabled) {
tasprintf (&binlog_file_name, "%s/%s/%s", get_home_directory (), CONFIG_DIRECTORY, BINLOG_FILE);
tgl_set_binlog_mode (1);
tgl_set_binlog_path (binlog_file_name);
} else {
tgl_set_binlog_mode (0);
//tgl_set_auth_file_path (auth_file_name;
tasprintf (&auth_file_name, "%s/%s/%s", get_home_directory (), CONFIG_DIRECTORY, AUTH_KEY_FILE);
tasprintf (&state_file_name, "%s/%s/%s", get_home_directory (), CONFIG_DIRECTORY, STATE_FILE);
tasprintf (&secret_chat_file_name, "%s/%s/%s", get_home_directory (), CONFIG_DIRECTORY, SECRET_CHAT_FILE);
}
tgl_set_download_directory (downloads_directory);
}
#endif
void inner_main (void) {
loop ();
}
void usage (void) {
printf ("%s Usage\n", PROGNAME);
printf (" -u specify username (would not be asked during authorization)\n");
printf (" -k specify location of public key (possible multiple entries)\n");
printf (" -v increase verbosity (0-ERROR 1-WARNIN 2-NOTICE 3+-DEBUG-levels)\n");
printf (" -N message num mode\n");
#ifdef HAVE_LIBCONFIG
printf (" -c config file name\n");
printf (" -p use specified profile\n");
#else
printf (" -B enable binlog\n");
#endif
printf (" -l log level\n");
printf (" -f during authorization fetch all messages since registration\n");
printf (" -E diable auto accept of encrypted chats\n");
#ifdef USE_LUA
printf (" -s lua script file\n");
#endif
printf (" -W send dialog_list query and wait for answer before reading input\n");
printf (" -C disable color output\n");
printf (" -R disable readline\n");
printf (" -d daemon mode\n");
printf (" -L <log-name> log file name\n");
printf (" -U <user-name> change uid after start\n");
printf (" -G <group-name> change gid after start\n");
printf (" -D disable output\n");
printf (" -P <port> port to listen for input commands\n");
printf (" -S <socket-name> unix socket to create\n");
exit (1);
}
//extern char *rsa_public_key_name;
//extern int default_dc_num;
char *log_net_file;
FILE *log_net_f;
int register_mode;
int disable_auto_accept;
int wait_dialog_list;
char *logname;
int daemonize;
void reopen_logs (void) {
int fd;
fflush (stdout);
fflush (stderr);
if ((fd = open ("/dev/null", O_RDWR, 0)) != -1) {
dup2 (fd, 0);
dup2 (fd, 1);
dup2 (fd, 2);
if (fd > 2) {
close (fd);
}
}
if (logname && (fd = open (logname, O_WRONLY|O_APPEND|O_CREAT, 0640)) != -1) {
dup2 (fd, 1);
dup2 (fd, 2);
if (fd > 2) {
close (fd);
}
}
}
static void sigusr1_handler (const int sig) {
fprintf(stderr, "got SIGUSR1, rotate logs.\n");
reopen_logs ();
signal (SIGUSR1, sigusr1_handler);
}
static void sighup_handler (const int sig) {
fprintf(stderr, "got SIGHUP.\n");
signal (SIGHUP, sighup_handler);
}
char *set_user_name;
char *set_group_name;
int change_user_group () {
char *username = set_user_name;
char *groupname = set_group_name;
struct passwd *pw;
/* lose root privileges if we have them */
if (getuid() == 0 || geteuid() == 0) {
if (username == 0 || *username == '\0') {
username = "telegramd";
}
if ((pw = getpwnam (username)) == 0) {
fprintf (stderr, "change_user_group: can't find the user %s to switch to\n", username);
return -1;
}
gid_t gid = pw->pw_gid;
if (setgroups (1, &gid) < 0) {
fprintf (stderr, "change_user_group: failed to clear supplementary groups list: %m\n");
return -1;
}
if (groupname) {
struct group *g = getgrnam (groupname);
if (g == NULL) {
fprintf (stderr, "change_user_group: can't find the group %s to switch to\n", groupname);
return -1;
}
gid = g->gr_gid;
}
if (setgid (gid) < 0) {
fprintf (stderr, "change_user_group: setgid (%d) failed. %m\n", (int) gid);
return -1;
}
if (setuid (pw->pw_uid) < 0) {
fprintf (stderr, "change_user_group: failed to assume identity of user %s\n", username);
return -1;
}
}
return 0;
}
char *unix_socket;
void args_parse (int argc, char **argv) {
int opt = 0;
while ((opt = getopt (argc, argv, "u:hk:vNl:fEwWCRdL:DU:G:qP:S:"
#ifdef HAVE_LIBCONFIG
"c:p:"
#else
"B"
#endif
#ifdef USE_LUA
"s:"
#endif
)) != -1) {
switch (opt) {
case 'u':
set_default_username (optarg);
break;
case 'k':
//rsa_public_key_name = tstrdup (optarg);
tgl_set_rsa_key (optarg);
break;
case 'v':
tgl_incr_verbosity ();
verbosity ++;
break;
case 'N':
msg_num_mode ++;
break;
#ifdef HAVE_LIBCONFIG
case 'c':
config_filename = tstrdup (optarg);
break;
case 'p':
prefix = tstrdup (optarg);
assert (strlen (prefix) <= 100);
break;
#else
case 'B':
binlog_enabled = 1;
break;
#endif
case 'l':
log_level = atoi (optarg);
break;
case 'f':
sync_from_start = 1;
break;
case 'E':
disable_auto_accept = 1;
break;
case 'w':
allow_weak_random = 1;
break;
#ifdef USE_LUA
case 's':
lua_file = strdup (optarg);
break;
#endif
case 'W':
wait_dialog_list = 1;
break;
case 'C':
disable_colors ++;
break;
case 'R':
readline_disabled ++;
break;
case 'd':
daemonize ++;
break;
case 'L':
logname = optarg;
break;
case 'U':
set_user_name = optarg;
break;
case 'G':
set_group_name = optarg;
break;
case 'D':
disable_output ++;
break;
case 'q':
reset_authorization ++;
break;
case 'P':
port = atoi (optarg);
break;
case 'S':
unix_socket = optarg;
break;
case 'h':
default:
usage ();
break;
}
}
}
#ifdef HAVE_EXECINFO_H
void print_backtrace (void) {
void *buffer[255];
const int calls = backtrace (buffer, sizeof (buffer) / sizeof (void *));
backtrace_symbols_fd (buffer, calls, 1);
}
#else
void print_backtrace (void) {
if (write (1, "No libexec. Backtrace disabled\n", 32) < 0) {
// Sad thing
}
}
#endif
int sfd;
int usfd;
void termination_signal_handler (int signum) {
if (!readline_disabled) {
rl_free_line_state ();
rl_cleanup_after_signal ();
}
if (write (1, "SIGNAL received\n", 18) < 0) {
// Sad thing
}
if (unix_socket) {
unlink (unix_socket);
}
if (usfd > 0) {
close (usfd);
}
if (sfd > 0) {
close (sfd);
}
print_backtrace ();
exit (EXIT_FAILURE);
}
volatile int sigterm_cnt;
void sig_term_handler (int signum __attribute__ ((unused))) {
signal (signum, termination_signal_handler);
//set_terminal_attributes ();
if (write (1, "SIGTERM/SIGINT received\n", 25) < 0) {
// Sad thing
}
if (tgl_state.ev_base) {
event_base_loopbreak(tgl_state.ev_base);
}
sigterm_cnt ++;
}
void do_halt (int error) {
if (!readline_disabled) {
rl_free_line_state ();
rl_cleanup_after_signal ();
}
if (write (1, "halt\n", 5) < 0) {
// Sad thing
}
if (unix_socket) {
unlink (unix_socket);
}
if (usfd > 0) {
close (usfd);
}
if (sfd > 0) {
close (sfd);
}
exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
}
int main (int argc, char **argv) {
signal (SIGSEGV, termination_signal_handler);
signal (SIGABRT, termination_signal_handler);
signal (SIGBUS, termination_signal_handler);
signal (SIGQUIT, termination_signal_handler);
signal (SIGFPE, termination_signal_handler);
signal (SIGPIPE, SIG_IGN);
signal (SIGTERM, sig_term_handler);
signal (SIGINT, sig_term_handler);
rl_catch_signals = 0;
log_level = 10;
args_parse (argc, argv);
change_user_group ();
if (port > 0) {
struct sockaddr_in serv_addr;
sfd = socket (AF_INET, SOCK_STREAM, 0);
if (sfd < 0) {
perror ("socket");
exit(1);
}
memset (&serv_addr, 0, sizeof (serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl (0x7f000001);
serv_addr.sin_port = htons (port);
if (bind (sfd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) {
perror ("bind");
exit(1);
}
listen (sfd, 5);
} else {
sfd = -1;
}
if (unix_socket) {
assert (strlen (unix_socket) < 100);
struct sockaddr_un serv_addr;
usfd = socket (AF_UNIX, SOCK_STREAM, 0);
if (usfd < 0) {
perror ("socket");
exit(1);
}
memset (&serv_addr, 0, sizeof (serv_addr));
serv_addr.sun_family = AF_UNIX;
snprintf (serv_addr.sun_path, 108, "%s", unix_socket);
if (bind (usfd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) {
perror ("bind");
exit(1);
}
listen (usfd, 5);
} else {
usfd = -1;
}
if (daemonize) {
signal (SIGHUP, sighup_handler);
reopen_logs ();
}
signal (SIGUSR1, sigusr1_handler);
if (!disable_output) {
printf (
"Telegram-cli version " TGL_VERSION ", Copyright (C) 2013-2014 Vitaly Valtman\n"
"Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.\n"
"This is free software, and you are welcome to redistribute it\n"
"under certain conditions; type `show_license' for details.\n"
);
}
running_for_first_time ();
parse_config ();
tgl_set_rsa_key ("/etc/" PROG_NAME "/server.pub");
tgl_set_rsa_key ("tg-server.pub");
get_terminal_attributes ();
#ifdef USE_LUA
if (lua_file) {
lua_init (lua_file);
}
#endif
inner_main ();
return 0;
}

172
msglog.c Normal file
View file

@ -0,0 +1,172 @@
/*
This file is part of telegram-purple
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
Copyright Matthias Jentsch 2014-2015
*/
#include <stdio.h>
#include <stdarg.h>
#include "telegram-purple.h"
/*
msglog.c: Convenience methods for logging to libpurple log
*/
void log_level_printf (const char* format, va_list ap, int level) {
char buffer[256];
vsnprintf (buffer, sizeof(buffer), format, ap);
int last = (int)strlen (buffer) - 1;
if (last >= 2 && buffer[last] == '\n') {
buffer[last] = '\0';
}
purple_debug (level, PLUGIN_ID, "%s\n", buffer);
}
void debug(const char* format, ...) {
va_list ap;
va_start (ap, format);
log_level_printf (format, ap, PURPLE_DEBUG_MISC);
va_end (ap);
}
void info(const char* format, ...) {
va_list ap;
va_start (ap, format);
log_level_printf (format, ap, PURPLE_DEBUG_INFO);
va_end (ap);
}
void warning(const char* format, ...) {
va_list ap;
va_start (ap, format);
log_level_printf (format, ap, PURPLE_DEBUG_WARNING);
va_end (ap);
}
void failure(const char* format, ...) {
va_list ap;
va_start (ap, format);
log_level_printf (format, ap, PURPLE_DEBUG_ERROR);
va_end (ap);
}
void fatal(const char* format, ...) {
va_list ap;
va_start (ap, format);
log_level_printf (format, ap, PURPLE_DEBUG_FATAL);
va_end (ap);
info ("\n");
}
const char *print_flags (const char **names, int len, unsigned flags) {
static char *text = NULL;
if (text) {
g_free (text);
text = NULL;
}
int i;
for (i = 0; i < len; i ++) {
if (flags & 1) {
char *new;
if (text) {
new = g_strconcat (text, " ", names[i], NULL);
g_free (text);
} else {
new = g_strdup (names[i]);
}
text = new;
}
flags >>= 1;
}
return (const char*)text;
}
const char *print_flags_peer (unsigned flags) {
const char *names[] = {
"CREATED",
"HAS_PHOTO",
"DELETED",
"OFFICIAL",
"KICKED",
"ADMIN",
"CREATOR",
"LEFT",
"DEACTIVATED"
};
return print_flags (names, 9, flags);
}
const char *print_flags_channel (unsigned flags) {
static char *text;
if (text) {
g_free (text);
text = NULL;
}
const char *names[] = {
"BROADCAST",
"EDITOR",
"MODERATOR",
"MEGAGROUP"
};
text = g_strdup (print_flags_peer (flags));
char *old = text;
text = g_strconcat (text, " ", print_flags (names, 4, flags >> 16), NULL);
g_free (old);
return text;
}
const char *print_flags_user (unsigned flags) {
static char *text;
if (text) {
g_free (text);
text = NULL;
}
const char *names[] = {
"CONTACT",
"MUTUAL_CONTACT",
"BLOCKED",
"SELF",
"BOT"
};
text = g_strdup (print_flags_peer (flags));
char *old = text;
text = g_strconcat (text, " ", print_flags (names, 5, flags >> 16), NULL);
g_free (old);
return text;
}
const char *print_flags_update (unsigned flags) {
const char *names[] = {
"CREATED",
"DELETED",
"PHONE",
"CONTACT",
"PHOTO",
"BLOCKED",
"REAL_NAME",
"NAME",
"REQUESTED",
"WORKING",
"FLAGS",
"TITLE",
"ADMIN",
"MEMBERS",
"ACCESS_HASH",
"USERNAME"
};
return print_flags (names, 16, flags);
}

30
msglog.h Normal file
View file

@ -0,0 +1,30 @@
/*
This file is part of telegram-purple
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
Copyright Matthias Jentsch 2014-2015
*/
#include <stdarg.h>
void debug(const char* format, ...);
void info(const char* format, ...);
void warning(const char* format, ...);
void failure(const char* format, ...);
void fatal(const char* format, ...);
const char *print_flags_update (unsigned update);
const char *print_flags_channel (unsigned flags);
const char *print_flags_peer (unsigned flags);
const char *print_flags_user (unsigned flags);

File diff suppressed because it is too large Load diff

View file

@ -1,60 +0,0 @@
/*
This file is part of tgl-library
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright Nikolay Durov, Andrey Lopatin 2012-2013
Vitaly Valtman 2013-2014
*/
#ifndef __MTPROTO_CLIENT_H__
#define __MTPROTO_CLIENT_H__
//#include "net.h"
#include <openssl/bn.h>
//void on_start (void);
//..long long encrypt_send_message (struct connection *c, int *msg, int msg_ints, int useful);
//void dc_authorize (struct tgl_dc *DC);
//void work_update (struct connection *c, long long msg_id);
//void work_update_binlog (void);
//int check_g (unsigned char p[256], BIGNUM *g);
//int check_g_bn (BIGNUM *p, BIGNUM *g);
//int check_DH_params (BIGNUM *p, int g);
//void secure_random (void *s, int l);
#include "tgl.h"
struct connection;
struct tgl_dc;
//#include "queries.h"
#define TG_APP_HASH "36722c72256a24c1225de00eb6a1ca74"
#define TG_APP_ID 2899
#define ACK_TIMEOUT 1
#define MAX_DC_ID 10
struct connection;
long long tglmp_encrypt_send_message (struct connection *c, int *msg, int msg_ints, int flags);
void tglmp_dc_create_session (struct tgl_dc *DC);
int tglmp_check_g (unsigned char p[256], BIGNUM *g);
int tglmp_check_DH_params (BIGNUM *p, int g);
struct tgl_dc *tglmp_alloc_dc (int id, char *ip, int port);
void tglmp_regenerate_temp_auth_key (struct tgl_dc *D);
void tgln_insert_msg_id (struct tgl_session *S, long long id);
void tglmp_on_start (void);
void tgl_dc_authorize (struct tgl_dc *DC);
void tgls_free_dc (struct tgl_dc *DC);
void tgls_free_pubkey (void);
#endif

View file

@ -1,394 +0,0 @@
/*
This file is part of tgl-library
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright Nikolay Durov, Andrey Lopatin 2012-2013
Vitaly Valtman 2013-2014
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define _FILE_OFFSET_BITS 64
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <netdb.h>
#include <openssl/bn.h>
#include <openssl/rand.h>
#include <openssl/pem.h>
#include <openssl/aes.h>
#include <openssl/sha.h>
#include "mtproto-common.h"
#include "include.h"
#include "tools.h"
#ifdef __MACH__
#include <mach/clock.h>
#include <mach/mach.h>
#endif
static int __packet_buffer[PACKET_BUFFER_SIZE + 16];
int *tgl_packet_ptr;
int *tgl_packet_buffer = __packet_buffer + 16;
static long long rsa_encrypted_chunks, rsa_decrypted_chunks;
//int verbosity;
static int get_random_bytes (unsigned char *buf, int n) {
int r = 0, h = open ("/dev/random", O_RDONLY | O_NONBLOCK);
if (h >= 0) {
r = read (h, buf, n);
if (r > 0) {
vlogprintf (E_DEBUG, "added %d bytes of real entropy to secure random numbers seed\n", r);
} else {
r = 0;
}
close (h);
}
if (r < n) {
h = open ("/dev/urandom", O_RDONLY);
if (h < 0) {
return r;
}
int s = read (h, buf + r, n - r);
close (h);
if (s > 0) {
r += s;
}
}
if (r >= (int) sizeof (long)) {
*(long *)buf ^= lrand48 ();
srand48 (*(long *)buf);
}
return r;
}
/* RDTSC */
#if defined(__i386__)
#define HAVE_RDTSC
static __inline__ unsigned long long rdtsc (void) {
unsigned long long int x;
__asm__ volatile ("rdtsc" : "=A" (x));
return x;
}
#elif defined(__x86_64__)
#define HAVE_RDTSC
static __inline__ unsigned long long rdtsc (void) {
unsigned hi, lo;
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
return ((unsigned long long) lo) | (((unsigned long long) hi) << 32);
}
#endif
void tgl_prng_seed (const char *password_filename, int password_length) {
struct timespec T;
tgl_my_clock_gettime (CLOCK_REALTIME, &T);
RAND_add (&T, sizeof (T), 4.0);
#ifdef HAVE_RDTSC
unsigned long long r = rdtsc ();
RAND_add (&r, 8, 4.0);
#endif
unsigned short p = getpid ();
RAND_add (&p, sizeof (p), 0.0);
p = getppid ();
RAND_add (&p, sizeof (p), 0.0);
unsigned char rb[32];
int s = get_random_bytes (rb, 32);
if (s > 0) {
RAND_add (rb, s, s);
}
memset (rb, 0, sizeof (rb));
if (password_filename && password_length > 0) {
int fd = open (password_filename, O_RDONLY);
if (fd < 0) {
vlogprintf (E_WARNING, "Warning: fail to open password file - \"%s\", %m.\n", password_filename);
} else {
unsigned char *a = talloc0 (password_length);
int l = read (fd, a, password_length);
if (l < 0) {
vlogprintf (E_WARNING, "Warning: fail to read password file - \"%s\", %m.\n", password_filename);
} else {
vlogprintf (E_DEBUG, "read %d bytes from password file.\n", l);
RAND_add (a, l, l);
}
close (fd);
tfree_secure (a, password_length);
}
}
tgl_state.BN_ctx = BN_CTX_new ();
ensure_ptr (tgl_state.BN_ctx);
}
int tgl_serialize_bignum (BIGNUM *b, char *buffer, int maxlen) {
int itslen = BN_num_bytes (b);
int reqlen;
if (itslen < 254) {
reqlen = itslen + 1;
} else {
reqlen = itslen + 4;
}
int newlen = (reqlen + 3) & -4;
int pad = newlen - reqlen;
reqlen = newlen;
if (reqlen > maxlen) {
return -reqlen;
}
if (itslen < 254) {
*buffer++ = itslen;
} else {
*(int *)buffer = (itslen << 8) + 0xfe;
buffer += 4;
}
int l = BN_bn2bin (b, (unsigned char *)buffer);
assert (l == itslen);
buffer += l;
while (pad --> 0) {
*buffer++ = 0;
}
return reqlen;
}
long long tgl_do_compute_rsa_key_fingerprint (RSA *key) {
static char tempbuff[4096];
static unsigned char sha[20];
assert (key->n && key->e);
int l1 = tgl_serialize_bignum (key->n, tempbuff, 4096);
assert (l1 > 0);
int l2 = tgl_serialize_bignum (key->e, tempbuff + l1, 4096 - l1);
assert (l2 > 0 && l1 + l2 <= 4096);
SHA1 ((unsigned char *)tempbuff, l1 + l2, sha);
return *(long long *)(sha + 12);
}
void tgl_out_cstring (const char *str, long len) {
assert (len >= 0 && len < (1 << 24));
assert ((char *) packet_ptr + len + 8 < (char *) (packet_buffer + PACKET_BUFFER_SIZE));
char *dest = (char *) packet_ptr;
if (len < 254) {
*dest++ = len;
} else {
*packet_ptr = (len << 8) + 0xfe;
dest += 4;
}
memcpy (dest, str, len);
dest += len;
while ((long) dest & 3) {
*dest++ = 0;
}
packet_ptr = (int *) dest;
}
void tgl_out_cstring_careful (const char *str, long len) {
assert (len >= 0 && len < (1 << 24));
assert ((char *) packet_ptr + len + 8 < (char *) (packet_buffer + PACKET_BUFFER_SIZE));
char *dest = (char *) packet_ptr;
if (len < 254) {
dest++;
if (dest != str) {
memmove (dest, str, len);
}
dest[-1] = len;
} else {
dest += 4;
if (dest != str) {
memmove (dest, str, len);
}
*packet_ptr = (len << 8) + 0xfe;
}
dest += len;
while ((long) dest & 3) {
*dest++ = 0;
}
packet_ptr = (int *) dest;
}
void tgl_out_data (const void *data, long len) {
assert (len >= 0 && len < (1 << 24) && !(len & 3));
assert ((char *) packet_ptr + len + 8 < (char *) (packet_buffer + PACKET_BUFFER_SIZE));
memcpy (packet_ptr, data, len);
packet_ptr += len >> 2;
}
int *tgl_in_ptr, *tgl_in_end;
int tgl_fetch_bignum (BIGNUM *x) {
int l = prefetch_strlen ();
if (l < 0) {
return l;
}
char *str = fetch_str (l);
assert (BN_bin2bn ((unsigned char *) str, l, x) == x);
return l;
}
int tgl_pad_rsa_encrypt (char *from, int from_len, char *to, int size, BIGNUM *N, BIGNUM *E) {
int pad = (255000 - from_len - 32) % 255 + 32;
int chunks = (from_len + pad) / 255;
int bits = BN_num_bits (N);
assert (bits >= 2041 && bits <= 2048);
assert (from_len > 0 && from_len <= 2550);
assert (size >= chunks * 256);
assert (RAND_pseudo_bytes ((unsigned char *) from + from_len, pad) >= 0);
int i;
BIGNUM x, y;
BN_init (&x);
BN_init (&y);
rsa_encrypted_chunks += chunks;
for (i = 0; i < chunks; i++) {
BN_bin2bn ((unsigned char *) from, 255, &x);
assert (BN_mod_exp (&y, &x, E, N, tgl_state.BN_ctx) == 1);
unsigned l = 256 - BN_num_bytes (&y);
assert (l <= 256);
memset (to, 0, l);
BN_bn2bin (&y, (unsigned char *) to + l);
to += 256;
}
BN_free (&x);
BN_free (&y);
return chunks * 256;
}
int tgl_pad_rsa_decrypt (char *from, int from_len, char *to, int size, BIGNUM *N, BIGNUM *D) {
if (from_len < 0 || from_len > 0x1000 || (from_len & 0xff)) {
return -1;
}
int chunks = (from_len >> 8);
int bits = BN_num_bits (N);
assert (bits >= 2041 && bits <= 2048);
assert (size >= chunks * 255);
int i;
BIGNUM x, y;
BN_init (&x);
BN_init (&y);
for (i = 0; i < chunks; i++) {
++rsa_decrypted_chunks;
BN_bin2bn ((unsigned char *) from, 256, &x);
assert (BN_mod_exp (&y, &x, D, N, tgl_state.BN_ctx) == 1);
int l = BN_num_bytes (&y);
if (l > 255) {
BN_free (&x);
BN_free (&y);
return -1;
}
assert (l >= 0 && l <= 255);
memset (to, 0, 255 - l);
BN_bn2bin (&y, (unsigned char *) to + 255 - l);
to += 255;
}
BN_free (&x);
BN_free (&y);
return chunks * 255;
}
static unsigned char aes_key_raw[32], aes_iv[32];
static AES_KEY aes_key;
void tgl_init_aes_unauth (const char server_nonce[16], const char hidden_client_nonce[32], int encrypt) {
static unsigned char buffer[64], hash[20];
memcpy (buffer, hidden_client_nonce, 32);
memcpy (buffer + 32, server_nonce, 16);
SHA1 (buffer, 48, aes_key_raw);
memcpy (buffer + 32, hidden_client_nonce, 32);
SHA1 (buffer, 64, aes_iv + 8);
memcpy (buffer, server_nonce, 16);
memcpy (buffer + 16, hidden_client_nonce, 32);
SHA1 (buffer, 48, hash);
memcpy (aes_key_raw + 20, hash, 12);
memcpy (aes_iv, hash + 12, 8);
memcpy (aes_iv + 28, hidden_client_nonce, 4);
if (encrypt == AES_ENCRYPT) {
AES_set_encrypt_key (aes_key_raw, 32*8, &aes_key);
} else {
AES_set_decrypt_key (aes_key_raw, 32*8, &aes_key);
}
memset (aes_key_raw, 0, sizeof (aes_key_raw));
}
void tgl_init_aes_auth (char auth_key[192], char msg_key[16], int encrypt) {
static unsigned char buffer[48], hash[20];
// sha1_a = SHA1 (msg_key + substr (auth_key, 0, 32));
// sha1_b = SHA1 (substr (auth_key, 32, 16) + msg_key + substr (auth_key, 48, 16));
// sha1_с = SHA1 (substr (auth_key, 64, 32) + msg_key);
// sha1_d = SHA1 (msg_key + substr (auth_key, 96, 32));
// aes_key = substr (sha1_a, 0, 8) + substr (sha1_b, 8, 12) + substr (sha1_c, 4, 12);
// aes_iv = substr (sha1_a, 8, 12) + substr (sha1_b, 0, 8) + substr (sha1_c, 16, 4) + substr (sha1_d, 0, 8);
memcpy (buffer, msg_key, 16);
memcpy (buffer + 16, auth_key, 32);
SHA1 (buffer, 48, hash);
memcpy (aes_key_raw, hash, 8);
memcpy (aes_iv, hash + 8, 12);
memcpy (buffer, auth_key + 32, 16);
memcpy (buffer + 16, msg_key, 16);
memcpy (buffer + 32, auth_key + 48, 16);
SHA1 (buffer, 48, hash);
memcpy (aes_key_raw + 8, hash + 8, 12);
memcpy (aes_iv + 12, hash, 8);
memcpy (buffer, auth_key + 64, 32);
memcpy (buffer + 32, msg_key, 16);
SHA1 (buffer, 48, hash);
memcpy (aes_key_raw + 20, hash + 4, 12);
memcpy (aes_iv + 20, hash + 16, 4);
memcpy (buffer, msg_key, 16);
memcpy (buffer + 16, auth_key + 96, 32);
SHA1 (buffer, 48, hash);
memcpy (aes_iv + 24, hash, 8);
if (encrypt == AES_ENCRYPT) {
AES_set_encrypt_key (aes_key_raw, 32*8, &aes_key);
} else {
AES_set_decrypt_key (aes_key_raw, 32*8, &aes_key);
}
memset (aes_key_raw, 0, sizeof (aes_key_raw));
}
int tgl_pad_aes_encrypt (char *from, int from_len, char *to, int size) {
int padded_size = (from_len + 15) & -16;
assert (from_len > 0 && padded_size <= size);
if (from_len < padded_size) {
assert (RAND_pseudo_bytes ((unsigned char *) from + from_len, padded_size - from_len) >= 0);
}
AES_ige_encrypt ((unsigned char *) from, (unsigned char *) to, padded_size, &aes_key, aes_iv, AES_ENCRYPT);
return padded_size;
}
int tgl_pad_aes_decrypt (char *from, int from_len, char *to, int size) {
if (from_len <= 0 || from_len > size || (from_len & 15)) {
return -1;
}
AES_ige_encrypt ((unsigned char *) from, (unsigned char *) to, from_len, &aes_key, aes_iv, AES_DECRYPT);
return from_len;
}

View file

@ -1,387 +0,0 @@
/*
This file is part of tgl-library
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright Nikolay Durov, Andrey Lopatin 2012-2013
Vitaly Valtman 2013-2014
*/
#ifndef __MTPROTO_COMMON_H__
#define __MTPROTO_COMMON_H__
#include <string.h>
#include <openssl/rsa.h>
#include <openssl/bn.h>
#include <openssl/aes.h>
#include <stdio.h>
#include <assert.h>
//#include "interface.h"
#include "tools.h"
#include "auto/constants.h"
#include "tgl.h"
#include "tgl-inner.h"
/* DH key exchange protocol data structures */
#define CODE_req_pq 0x60469778
#define CODE_resPQ 0x05162463
#define CODE_req_DH_params 0xd712e4be
#define CODE_p_q_inner_data 0x83c95aec
#define CODE_p_q_inner_data_temp 0x3c6a84d4
#define CODE_server_DH_inner_data 0xb5890dba
#define CODE_server_DH_params_fail 0x79cb045d
#define CODE_server_DH_params_ok 0xd0e8075c
#define CODE_set_client_DH_params 0xf5045f1f
#define CODE_client_DH_inner_data 0x6643b654
#define CODE_dh_gen_ok 0x3bcbf734
#define CODE_dh_gen_retry 0x46dc1fb9
#define CODE_dh_gen_fail 0xa69dae02
#define CODE_bind_auth_key_inner 0x75a3f765
/* service messages */
#define CODE_rpc_result 0xf35c6d01
#define CODE_rpc_error 0x2144ca19
#define CODE_msg_container 0x73f1f8dc
#define CODE_msg_copy 0xe06046b2
#define CODE_msgs_ack 0x62d6b459
#define CODE_bad_msg_notification 0xa7eff811
#define CODE_bad_server_salt 0xedab447b
#define CODE_msgs_state_req 0xda69fb52
#define CODE_msgs_state_info 0x04deb57d
#define CODE_msgs_all_info 0x8cc0d131
#define CODE_new_session_created 0x9ec20908
#define CODE_msg_resend_req 0x7d861a08
#define CODE_ping 0x7abe77ec
#define CODE_pong 0x347773c5
#define CODE_destroy_session 0xe7512126
#define CODE_destroy_session_ok 0xe22045fc
#define CODE_destroy_session_none 0x62d350c9
#define CODE_destroy_sessions 0x9a6face8
#define CODE_destroy_sessions_res 0xa8164668
#define CODE_get_future_salts 0xb921bd04
#define CODE_future_salt 0x0949d9dc
#define CODE_future_salts 0xae500895
#define CODE_rpc_drop_answer 0x58e4a740
#define CODE_rpc_answer_unknown 0x5e2ad36e
#define CODE_rpc_answer_dropped_running 0xcd78e586
#define CODE_rpc_answer_dropped 0xa43ad8b7
#define CODE_msg_detailed_info 0x276d3ec6
#define CODE_msg_new_detailed_info 0x809db6df
#define CODE_ping_delay_disconnect 0xf3427b8c
#define CODE_gzip_packed 0x3072cfa1
#define CODE_input_peer_notify_settings_old 0x3cf4b1be
#define CODE_peer_notify_settings_old 0xddbcd4a5
#define CODE_user_profile_photo_old 0x990d1493
#define CODE_config_old 0x232d5905
#define CODE_msg_new_detailed_info 0x809db6df
#define CODE_msg_detailed_info 0x276d3ec6
/* not really a limit, for struct encrypted_message only */
// #define MAX_MESSAGE_INTS 16384
#define MAX_MESSAGE_INTS 1048576
#define MAX_PROTO_MESSAGE_INTS 1048576
#define PACKET_BUFFER_SIZE (16384 * 100 + 16) // temp fix
#pragma pack(push,4)
struct encrypted_message {
// unencrypted header
long long auth_key_id;
char msg_key[16];
// encrypted part, starts with encrypted header
long long server_salt;
long long session_id;
// long long auth_key_id2; // removed
// first message follows
long long msg_id;
int seq_no;
int msg_len; // divisible by 4
int message[MAX_MESSAGE_INTS];
};
#pragma pack(pop)
//BN_CTX *BN_ctx;
void tgl_prng_seed (const char *password_filename, int password_length);
int tgl_serialize_bignum (BIGNUM *b, char *buffer, int maxlen);
long long tgl_do_compute_rsa_key_fingerprint (RSA *key);
#define packet_buffer tgl_packet_buffer
#define packet_ptr tgl_packet_ptr
extern int *tgl_packet_buffer;
extern int *tgl_packet_ptr;
static inline void out_ints (const int *what, int len) {
assert (packet_ptr + len <= packet_buffer + PACKET_BUFFER_SIZE);
memcpy (packet_ptr, what, len * 4);
packet_ptr += len;
}
static inline void out_int (int x) {
assert (packet_ptr + 1 <= packet_buffer + PACKET_BUFFER_SIZE);
*packet_ptr++ = x;
}
static inline void out_long (long long x) {
assert (packet_ptr + 2 <= packet_buffer + PACKET_BUFFER_SIZE);
*(long long *)packet_ptr = x;
packet_ptr += 2;
}
static inline void out_double (double x) {
assert (packet_ptr + 2 <= packet_buffer + PACKET_BUFFER_SIZE);
*(double *)packet_ptr = x;
packet_ptr += 2;
}
static inline void clear_packet (void) {
packet_ptr = packet_buffer;
}
void tgl_out_cstring (const char *str, long len);
void tgl_out_cstring_careful (const char *str, long len);
void tgl_out_data (const void *data, long len);
#define out_cstring tgl_out_cstring
#define out_cstring_careful tgl_out_cstring_careful
#define out_data tgl_out_data
static inline void out_string (const char *str) {
out_cstring (str, strlen (str));
}
static inline void out_bignum (BIGNUM *n) {
int l = tgl_serialize_bignum (n, (char *)packet_ptr, (PACKET_BUFFER_SIZE - (packet_ptr - packet_buffer)) * 4);
assert (l > 0);
packet_ptr += l >> 2;
}
#define in_ptr tgl_in_ptr
#define in_end tgl_in_end
extern int *tgl_in_ptr, *tgl_in_end;
//void fetch_pts (void);
//void fetch_qts (void);
//void fetch_date (void);
//void fetch_seq (void);
static inline int prefetch_strlen (void) {
if (in_ptr >= in_end) {
return -1;
}
unsigned l = *in_ptr;
if ((l & 0xff) < 0xfe) {
l &= 0xff;
return (in_end >= in_ptr + (l >> 2) + 1) ? (int)l : -1;
} else if ((l & 0xff) == 0xfe) {
l >>= 8;
return (l >= 254 && in_end >= in_ptr + ((l + 7) >> 2)) ? (int)l : -1;
} else {
return -1;
}
}
static inline char *fetch_str (int len) {
assert (len >= 0);
vlogprintf (E_DEBUG + 3, "fetch_string: len = %d\n", len);
if (len < 254) {
char *str = (char *) in_ptr + 1;
in_ptr += 1 + (len >> 2);
return str;
} else {
char *str = (char *) in_ptr + 4;
in_ptr += (len + 7) >> 2;
return str;
}
}
static inline char *fetch_str_dup (void) {
int l = prefetch_strlen ();
assert (l >= 0);
int i;
char *s = fetch_str (l);
for (i = 0; i < l; i++) {
if (!s[i]) { break; }
}
char *r = talloc (i + 1);
memcpy (r, s, i);
r[i] = 0;
return r;
}
static inline int fetch_update_str (char **s) {
if (!*s) {
*s = fetch_str_dup ();
return 1;
}
int l = prefetch_strlen ();
char *r = fetch_str (l);
if (memcmp (*s, r, l) || (*s)[l]) {
tfree_str (*s);
*s = talloc (l + 1);
memcpy (*s, r, l);
(*s)[l] = 0;
return 1;
}
return 0;
}
static inline int fetch_update_int (int *value) {
if (*value == *in_ptr) {
in_ptr ++;
return 0;
} else {
*value = *(in_ptr ++);
return 1;
}
}
static inline int fetch_update_long (long long *value) {
if (*value == *(long long *)in_ptr) {
in_ptr += 2;
return 0;
} else {
*value = *(long long *)(in_ptr);
in_ptr += 2;
return 1;
}
}
static inline int set_update_int (int *value, int new_value) {
if (*value == new_value) {
return 0;
} else {
*value = new_value;
return 1;
}
}
static inline void fetch_skip (int n) {
in_ptr += n;
assert (in_ptr <= in_end);
}
static inline void fetch_skip_str (void) {
int l = prefetch_strlen ();
assert (l >= 0);
fetch_str (l);
}
static inline long have_prefetch_ints (void) {
return in_end - in_ptr;
}
int tgl_fetch_bignum (BIGNUM *x);
#define fetch_bignum tgl_fetch_bignum
static inline int fetch_int (void) {
assert (in_ptr + 1 <= in_end);
vlogprintf (E_DEBUG + 3, "fetch_int: 0x%08x (%d)\n", *in_ptr, *in_ptr);
return *(in_ptr ++);
}
static inline int fetch_bool (void) {
vlogprintf (E_DEBUG + 3, "fetch_bool: 0x%08x (%d)\n", *in_ptr, *in_ptr);
assert (in_ptr + 1 <= in_end);
assert (*(in_ptr) == (int)CODE_bool_true || *(in_ptr) == (int)CODE_bool_false);
return *(in_ptr ++) == (int)CODE_bool_true;
}
static inline int prefetch_int (void) {
assert (in_ptr < in_end);
return *(in_ptr);
}
static inline void prefetch_data (void *data, int size) {
assert (in_ptr + (size >> 2) <= in_end);
memcpy (data, in_ptr, size);
}
static inline void fetch_data (void *data, int size) {
assert (in_ptr + (size >> 2) <= in_end);
memcpy (data, in_ptr, size);
assert (!(size & 3));
in_ptr += (size >> 2);
}
static inline long long fetch_long (void) {
assert (in_ptr + 2 <= in_end);
long long r = *(long long *)in_ptr;
in_ptr += 2;
return r;
}
static inline double fetch_double (void) {
assert (in_ptr + 2 <= in_end);
double r = *(double *)in_ptr;
in_ptr += 2;
return r;
}
static inline void fetch_ints (void *data, int count) {
assert (in_ptr + count <= in_end);
memcpy (data, in_ptr, 4 * count);
in_ptr += count;
}
static inline void fetch256 (void *buf) {
int l = prefetch_strlen ();
assert (l >= 0);
char *s = fetch_str (l);
if (l < 256) {
memcpy (buf + 256 - l, s, l);
} else {
memcpy (buf, s + (l - 256), 256);
}
}
static inline int in_remaining (void) {
return 4 * (in_end - in_ptr);
}
//int get_random_bytes (unsigned char *buf, int n);
int tgl_pad_rsa_encrypt (char *from, int from_len, char *to, int size, BIGNUM *N, BIGNUM *E);
int tgl_pad_rsa_decrypt (char *from, int from_len, char *to, int size, BIGNUM *N, BIGNUM *D);
//extern long long rsa_encrypted_chunks, rsa_decrypted_chunks;
//extern unsigned char aes_key_raw[32], aes_iv[32];
//extern AES_KEY aes_key;
void tgl_init_aes_unauth (const char server_nonce[16], const char hidden_client_nonce[32], int encrypt);
void tgl_init_aes_auth (char auth_key[192], char msg_key[16], int encrypt);
int tgl_pad_aes_encrypt (char *from, int from_len, char *to, int size);
int tgl_pad_aes_decrypt (char *from, int from_len, char *to, int size);
/*
static inline void hexdump_in (void) {
hexdump (in_ptr, in_end);
}
static inline void hexdump_out (void) {
hexdump (packet_buffer, packet_ptr);
}*/
#ifdef __MACH__
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#endif
#endif

View file

@ -1,106 +0,0 @@
/*
This file is part of tgl-library
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright Vitaly Valtman 2013-2014
*/
// Just sample jpg file 90x90
int thumb_file_size = (82 * 6 - 2) * 4;
int thumb_file [] = {
0xe0ffd8ff, 0x464a1000, 0x01004649, 0x64000101, 0x00006400, 0xa002e2ff,
0x5f434349, 0x464f5250, 0x00454c49, 0x00000101, 0x636c9002, 0x3004736d,
0x6e6d0000, 0x47527274, 0x59582042, 0xdd07205a, 0x04000b00, 0x1b001600,
0x63612400, 0x50417073, 0x00004c50, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x0100d6f6, 0x00000000, 0x636c2dd3,
0x0000736d, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x65640b00, 0x00006373, 0x00000801, 0x70633800, 0x00007472, 0x00004001,
0x74774e00, 0x00007470, 0x00009001, 0x68631400, 0x00006461, 0x0000a401,
0x58722c00, 0x00005a59, 0x0000d001, 0x58621400, 0x00005a59, 0x0000e401,
0x58671400, 0x00005a59, 0x0000f801, 0x54721400, 0x00004352, 0x00000c02,
0x54672000, 0x00004352, 0x00002c02, 0x54622000, 0x00004352, 0x00004c02,
0x68632000, 0x00006d72, 0x00006c02, 0x6c6d2400, 0x00006375, 0x00000000,
0x00000100, 0x6e650c00, 0x00005355, 0x00001c00, 0x73001c00, 0x47005200,
0x20004200, 0x75006200, 0x6c006900, 0x2d007400, 0x6e006900, 0x6c6d0000,
0x00006375, 0x00000000, 0x00000100, 0x6e650c00, 0x00005355, 0x00003200,
0x4e001c00, 0x20006f00, 0x6f006300, 0x79007000, 0x69007200, 0x68006700,
0x2c007400, 0x75002000, 0x65007300, 0x66002000, 0x65007200, 0x6c006500,
0x00007900, 0x59580000, 0x0000205a, 0x00000000, 0x0100d6f6, 0x00000000,
0x66732dd3, 0x00003233, 0x01000000, 0x00004a0c, 0xffffe305, 0x00002af3,
0x00009b07, 0xffff87fd, 0xffffa2fb, 0x0000a3fd, 0x0000d803, 0x595894c0,
0x0000205a, 0x00000000, 0x0000946f, 0x0000ee38, 0x59589003, 0x0000205a,
0x00000000, 0x00009d24, 0x0000830f, 0x5958beb6, 0x0000205a, 0x00000000,
0x0000a562, 0x000090b7, 0x6170de18, 0x00006172, 0x03000000, 0x02000000,
0x00006666, 0x0000a7f2, 0x0000590d, 0x0000d013, 0x61705b0a, 0x00006172,
0x03000000, 0x02000000, 0x00006666, 0x0000a7f2, 0x0000590d, 0x0000d013,
0x61705b0a, 0x00006172, 0x03000000, 0x02000000, 0x00006666, 0x0000a7f2,
0x0000590d, 0x0000d013, 0x68635b0a, 0x00006d72, 0x03000000, 0x00000000,
0x0000d7a3, 0x00007b54, 0x0000cd4c, 0x00009a99, 0x00006626, 0xdbff5c0f,
0x14004300, 0x0f120f0e, 0x1112140d, 0x14161712, 0x21331f18, 0x1f1c1c1f,
0x252f2d3f, 0x4e414a33, 0x4841494d, 0x765c5246, 0x6f575264, 0x66484658,
0x7a6f688c, 0x8485847d, 0x9b91634f, 0x769a808f, 0xff7f8481, 0x014300db,
0x1f171716, 0x213c1f1b, 0x547f3c21, 0x7f7f5448, 0x7f7f7f7f, 0x7f7f7f7f,
0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f,
0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x1100c0ff, 0x005a0008,
0x2201035a, 0x01110200, 0xff011103, 0x001900c4, 0x01010101, 0x00000101,
0x00000000, 0x00000000, 0x02030400, 0xc4ff0605, 0x00103600, 0x02010401,
0x06050304, 0x00000306, 0x01000000, 0x11030200, 0x05211204, 0x13514131,
0x32146122, 0x23918171, 0x72423424, 0x432515a1, 0xa2827444, 0xc4fff0b3,
0x01011400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1400c4ff,
0x00000111, 0x00000000, 0x00000000, 0x00000000, 0xdaff0000, 0x01030c00,
0x03110200, 0x003f0011, 0x404434fb, 0xbcb4875c, 0x006b38b0, 0x03dcdb12,
0xf4637f74, 0xe519f153, 0x09d7c5c7, 0x47d29160, 0x20692f18, 0xd06d786a,
0x53f7f922, 0x17b3e260, 0x2fe8668c, 0x1786a473, 0x9775efbd, 0xe917e43a,
0x1d0a1bb0, 0x114d0f82, 0x14651110, 0x35f299ed, 0xe9b09680, 0xf5a4fc2f,
0xe975bd03, 0xb506737b, 0x04444440, 0x5c444044, 0x8e8dedbd, 0xc61adc7b,
0x689c738b, 0x92a0dc01, 0x58e2b77f, 0x7bfb37d1, 0xb5b5e79d, 0xdbf968cc,
0xead3f48d, 0x38ed1313, 0xdea77c86, 0xae089963, 0xc743435a, 0x403fe4ce,
0x392ee1b9, 0xed39e718, 0xd6517e2d, 0x7fc4aa03, 0xb7ad7590, 0x77e7e6ab,
0x34bf705d, 0x7c77ca53, 0x3dea1299, 0x7fb0bcf4, 0x241fadc5, 0x95a7a816,
0x13fbe6f3, 0x3182b135, 0xd1b4b224, 0x1b0d48a2, 0xbf9d26d8, 0x82dc3640,
0x63569a2a, 0xbbd224c3, 0xb9b4714c, 0x1680aec6, 0x3d311856, 0x9b59be91,
0x09876ca6, 0x61d86564, 0x5a9f06d2, 0x36f51b0d, 0x8682e476, 0xacb1b131,
0xd1584363, 0x00456b4d, 0x22d2053b, 0x22202202, 0xf3f30222, 0xe3e513e5,
0xf1e6e1f0, 0x2380496e, 0x5fdcdb68, 0x549b3a27, 0x825e6a6c, 0x6522028b,
0xaf91ccc8, 0x341cf26b, 0x58dbc4b5, 0xf2289add, 0x0854ddbd, 0x0b9247d5,
0xf02b5c54, 0x3f917f92, 0xaf56affd, 0xe3760637, 0x05cebde0, 0xed4c76ce,
0x3cef1b63, 0x7fd8aff8, 0xa0c902ea, 0x7e730d0a, 0x435834f3, 0x26edbb76,
0xd3ec00fd, 0x76d48efa, 0xa8560f2d, 0x0e766331, 0xd319993c, 0x20243209,
0x61b7e6c8, 0x998331d0, 0x640ee802, 0x47a3d493, 0xfab99413, 0x4fd871f1,
0xe9443792, 0x627e051c, 0xd8f3051c, 0x2f28f558, 0x64b51745, 0x1b2bfee3,
0xb8783953, 0x9900fff6, 0xd8176a65, 0x5a3bf56a, 0x1b331fdb, 0x64b3572f,
0xd59a3643, 0xaf3abce1, 0x11dd20bd, 0x01111110, 0x5c141011, 0xb3e3083f,
0xd9b19cc4, 0x17edb20e, 0xa78e9aa1, 0x4ef4de06, 0x00c0bfe7, 0x7e1e442d,
0x9221fe38, 0xedb5c7dc, 0x6338078a, 0x62495b8d, 0xc11d9b8c, 0x49e81b16,
0x51d02bea, 0x3eb86d70, 0xc8bc4f13, 0xa10ec758, 0xd40751c0, 0x5ac94710,
0xc4c8b080, 0x95492b83, 0x975ee696, 0xb7bd96b4, 0x17379cce, 0x82e856e8,
0xe4c2c82a, 0x398e935f, 0x632437ea, 0x7c9c87d2, 0xdc1ddb7c, 0x65a80a48,
0x2309f164, 0x51fab475, 0x081dc11d, 0xda45573b, 0x6622f3f3, 0x48f1b214,
0x676c4edb, 0x243468c7, 0x00ffde60, 0xf1630350, 0xa0076c1d, 0x8f2c0c8b,
0x2383c26b, 0x361a8f4e, 0xaceea6c9, 0x01dd5a5d, 0x11111011, 0xc3780c04,
0xbf093ee2, 0xc7972c0b, 0x00d99040, 0xc0c20eb7, 0x659d3bd4, 0x269ab85e,
0x468e114f, 0x11ad4fdb, 0x83d083d8, 0x8c52f4bd, 0x3c9664bf, 0xa4f9c77c,
0x22a68876, 0xadb18784, 0xf480be83, 0x885a00ea, 0x220e0a88, 0xc303e4f6,
0xc866e058, 0xdddbd661, 0xdf395db1, 0xbad64343, 0xe6e65b03, 0x668e81c3,
0xad619e98, 0xeeb94563, 0xd4d19a3c, 0x3316ce95, 0x9d65f1e1, 0x3bf324fe,
0x0e468f53, 0xc386068c, 0xa89e24f7, 0xf0c7c73b, 0xb60e391f, 0x1b8827cb,
0x58601954, 0xc54f90f9, 0x80886ec5, 0x88088888, 0x1b7bb980, 0xb4c71c23,
0xe6148e39, 0xb12358b8, 0xbd08225d, 0x0ffef085, 0x72b4f025, 0x635ce389,
0xb90277e4, 0x0d05e000, 0x9bf9dbb9, 0x8e749fbc, 0x7ee6abbf, 0x4ddbf4af,
0x728df7f3, 0x10b59adf, 0xe3c38f49, 0xb23c638a, 0xdb3d9349, 0x66899a64,
0x00004dd5, 0xf51b5adf, 0x2220a255, 0xd9ff0f22};

1
po/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/*.mo

11
po/LINGUAS Normal file
View file

@ -0,0 +1,11 @@
bg
cs_CZ
de_DE
es_AR
fr
it_IT
nl
pl_PL
ru_RU
sq
uk

6
po/LINGUAS.BAD Normal file
View file

@ -0,0 +1,6 @@
# This file lists translations that are too bad or incomplete for installation.
# If you would like to improve the state of this, please see the translation page:
# https://www.transifex.com/telegram-purple-developers/telegram-purple/
da # < 55% complete
pt_BR # < 75% complete

11
po/POTFILES.in Normal file
View file

@ -0,0 +1,11 @@
# List of source files containing translatable strings.
telegram-base.c
telegram-purple.c
tgp-2prpl.c
tgp-msg.c
tgp-net.c
tgp-request.c
tgp-utils.c
tgp-chat.c

614
po/bg.po Normal file
View file

@ -0,0 +1,614 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-31 22:53+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Любомир Василев <lyubomirv@abv.bg>, 2016\n"
"Language-Team: Bulgarian (https://www.transifex.com/telegram-purple-developers/teams/53149/bg/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: bg\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../telegram-base.c:500
msgid "Couldn't create group"
msgstr "Неуспешно създаване на група"
#: ../telegram-base.c:501
msgid "Please select at least one other user."
msgstr "Моля, изберете поне един друг потребител:"
#: ../telegram-base.c:555
msgid "Query Failed"
msgstr "Заявката беше неуспешна"
#: ../telegram-purple.c:162
msgid "Secret chat ready."
msgstr "Тайният разговор е готов."
#: ../telegram-purple.c:170
msgid "Secret chat terminated."
msgstr "Тайният разговор беше приключен."
#: ../telegram-purple.c:182
msgid "Telegram"
msgstr "Telegram"
#: ../telegram-purple.c:229
msgid "Message marked as read."
msgstr "Съобщението е отбелязано като прочетено."
#: ../telegram-purple.c:339
#, c-format
msgid "Invite link: %s"
msgstr "Връзка за покана: %s"
#. FIXME: Can TGLCHF_MODERATOR export links?
#: ../telegram-purple.c:350
msgid "Creating chat link failed"
msgstr "Създаването на връзка беше неуспешно"
#: ../telegram-purple.c:351
msgid "You need to be admin of the group to do that."
msgstr "Само администраторите на групата могат да правят това."
#: ../telegram-purple.c:416
msgid "Chat joined"
msgstr "Присъединихте се към разговора"
#: ../telegram-purple.c:417
msgid "Chat added to list of chat rooms."
msgstr "Разговорът беше добавен към списъка от стаи за разговори."
#: ../telegram-purple.c:443
msgid "Start secret chat..."
msgstr "Започване на таен разговор…"
#. Generate Public Link
#: ../telegram-purple.c:450
msgid "Invite users by link..."
msgstr "Покана на потребители чрез връзка…"
#. Delete self from chat
#: ../telegram-purple.c:458
msgid "Delete and exit..."
msgstr "Изтриване и изход…"
#: ../telegram-purple.c:546
#, c-format
msgid "Unable to sign on as %s: file (public key) not found."
msgstr "Неуспешно вписване като %s: файлът (публичният ключ) не беше открит."
#: ../telegram-purple.c:550
#, c-format
msgid ""
"Make sure telegram-purple is installed properly,\n"
"including the .tglpub file.\n"
"If you're running SELinux (e.g. when using Tails),\n"
"try 'make local_install', or simply copy\n"
"%1$s to %2$s."
msgstr ""
"Уверете се, че „telegram-purple“ е инсталирано правилно,\n"
"включително файлът „.tglpub“.\n"
"Ако използвате SELinux (наприбер при използване на „Tails“),\n"
"опитайте „make local_install“ или просто копирайте\n"
"%1$s в %2$s."
#: ../telegram-purple.c:572
#, c-format
msgid ""
"Unable to sign on as %s: problem in the underlying library 'tgl'. Please "
"submit a bug report with the debug log."
msgstr ""
"Неуспешно вписване като %s: има проблем с вътрешната библиотека „tgl“. Моля,"
" изпратете доклад за грешката, заедно с журнала."
#: ../telegram-purple.c:576
msgid "Problem in tgl"
msgstr "Проблем в „tgl“"
#. TRANSLATORS: Please fill in your own prefix!
#: ../telegram-purple.c:584
#, c-format
msgid ""
"Unable to sign on as %s: phone number lacks country prefix. Numbers must "
"start with the full international prefix code, e.g. +1 for USA."
msgstr ""
"Неуспешно вписване като %s: телефонният код не съдържа код на страната. "
"Номерата трябва да започват с пълния международен телефонен код на страната,"
" например +359 за България."
#: ../telegram-purple.c:589
msgid "Incomplete phone number"
msgstr "Непълен телефонен номер"
#: ../telegram-purple.c:642
msgid "Secret chat was already deleted"
msgstr "Тайният разговор вече е изтрит"
#: ../telegram-purple.c:644
msgid "Secret chat is not ready"
msgstr "Тайният разговор не е готов"
#: ../telegram-purple.c:652
msgid "Only the creator of a channel can post messages."
msgstr "Само създателят на канала може да публикува съобщения."
#: ../telegram-purple.c:695
msgid "Cannot invite buddy to chat"
msgstr "Неуспешно канене на приятел в разговора"
#: ../telegram-purple.c:696
msgid "Specified user does not exist."
msgstr "Посоченият потребител не съществува."
#: ../telegram-purple.c:709
msgid "phone no. (+ country prefix)"
msgstr "тел. номер (+ код на страната)"
#. Login
#: ../telegram-purple.c:817
msgid "Password (two factor authentication)"
msgstr "Парола (двустепенно удостоверяване)"
#: ../telegram-purple.c:822
msgid ""
"Fallback SMS verification\n"
"(Helps when not using Pidgin and you aren't being prompted for the code)"
msgstr ""
"Резервно удостоверяване чрез КС\n"
"(Помага, когато не използвате „Pidgin“ и от Вас не се изисква кода)"
#: ../telegram-purple.c:828
msgid "always"
msgstr "винаги"
#: ../telegram-purple.c:829
msgid "never"
msgstr "никога"
#: ../telegram-purple.c:830
msgid "ask"
msgstr "питане всеки път"
#: ../telegram-purple.c:832
msgid "Accept secret chats"
msgstr "Приемане на тайни разговори"
#: ../telegram-purple.c:836
msgid "Display buddies offline after (days)"
msgstr "Показване на приятелите извън линия след (брой дни)"
#: ../telegram-purple.c:840
msgid ""
"Don't fetch history older than (days)\n"
"(0 for unlimited)"
msgstr ""
"Да не се изтегля историята, по-стара от (брой дни)\n"
"(0 = неограничено)"
#. Media
#: ../telegram-purple.c:845
msgid "Autoload media size (kb)"
msgstr "Размер за авто. зареждане на медийни файлове (кбит)"
#. Chats
#: ../telegram-purple.c:850
msgid "Add all group chats to buddy list"
msgstr "Добавяне на всички групови разговори в списъка с приятели"
#. Read notifications
#: ../telegram-purple.c:855
msgid "Display notices of receipt"
msgstr "Показване на уведомления за получаване"
#: ../telegram-purple.c:859
msgid "Send notices of receipt when present"
msgstr "Изпращане на уведомления за получаване при присъствие"
#: ../telegram-purple.c:884
msgid "Telegram Protocol Plugin."
msgstr "Добавка за протокола „Telegram“."
#: ../tgp-msg.c:58
#, c-format
msgid "%2$s created chat %1$s."
msgstr "%2$s създаде разговор %1$s."
#: ../tgp-msg.c:61
#, c-format
msgid "%2$s changed title to %1$s."
msgstr "%2$s промени заглавието на „%1$s“."
#: ../tgp-msg.c:64
#, c-format
msgid "%s changed photo."
msgstr "%s промени снимката си."
#: ../tgp-msg.c:67
#, c-format
msgid "%s deleted photo."
msgstr "%s изтри снимка."
#: ../tgp-msg.c:75
#, c-format
msgid "%1$s added user %2$s by link."
msgstr "%1$s добави потребителя %2$s чрез връзка."
#: ../tgp-msg.c:90
#, c-format
msgid "%2$s added user %1$s."
msgstr "%2$s добави потребителя %1$s."
#: ../tgp-msg.c:114 ../tgp-msg.c:131
#, c-format
msgid "%2$s deleted user %1$s."
msgstr "%2$s изтри потребителя %1$s."
#: ../tgp-msg.c:138
#, c-format
msgid "%2$s set self destruction timer to %1$d second."
msgid_plural "%2$s set self destruction timer to %1$d seconds."
msgstr[0] "%2$s настрои брояч за самоунищожение на %1$d секунда."
msgstr[1] "%2$s настрои брояч за самоунищожение на %1$d секунди."
#: ../tgp-msg.c:144
#, c-format
msgid "%2$s marked %1$d message read."
msgid_plural "%2$s marked %1$d messages read."
msgstr[0] "%2$s отбеляза %1$d съобщение като прочетено."
msgstr[1] "%2$s отбеляза %1$d съобщения като прочетени."
#: ../tgp-msg.c:150
#, c-format
msgid "%2$s deleted %1$d message."
msgid_plural "%2$s deleted %1$d messages."
msgstr[0] "%2$s изтри %1$d съобщение."
msgstr[1] "%2$s изтри %1$d съобщения."
#: ../tgp-msg.c:156
#, c-format
msgid "%2$s made a screenshot of %1$d message."
msgid_plural "%2$s made a screenshot of %1$d messages."
msgstr[0] "%2$s направи снимка на %1$d съобщение."
msgstr[1] "%2$s направи снимка на %1$d съобщения."
#: ../tgp-msg.c:162
#, c-format
msgid "Channel %1$s created"
msgstr "Каналът „%1$s“ беше създаден"
#. FIXME: check if this makes sense
#: ../tgp-msg.c:165 ../tgp-chat.c:124 ../tgp-chat.c:576
msgid "Telegram Channels"
msgstr "Канали в Telegram"
#: ../tgp-msg.c:191
msgid "Sending message failed."
msgstr "Неуспешно изпращане на съобщението."
#: ../tgp-msg.c:253
msgid "Sending image failed."
msgstr "Неуспешно изпращане на изображениео."
#: ../tgp-msg.c:417
#, c-format
msgid "%s sent a sticker."
msgstr "%s изпрати стикер."
#: ../tgp-msg.c:463
msgid "failed loading message"
msgstr "неуспешно зареждане на съобщение"
#: ../tgp-msg.c:498
msgid "[animation]"
msgstr "[анимация]"
#: ../tgp-msg.c:515
msgid "[audio]"
msgstr "[звук]"
#: ../tgp-msg.c:515
msgid "[video]"
msgstr "[видео]"
#: ../tgp-msg.c:604
#, c-format
msgid "<b>Forwarded message from: %s</b><br>%s"
msgstr "<b>Препратено съобщение от: %s</b><br>%s"
#. FIXME: sometimes users aren't part of the response when receiving a
#. forwarded message
#: ../tgp-msg.c:607
#, c-format
msgid "<b>Forwarded message:</b><br>%s"
msgstr "<b>Препратено съобщение:</b><br>%s"
#: ../tgp-msg.c:720
msgid "loading document or picture failed"
msgstr "неуспешно зареждане на документ или изображение"
#: ../tgp-net.c:281
msgid "Cannot connect to main server"
msgstr "Неуспешно свързване с главния сървър"
#: ../tgp-net.c:322
msgid "Cannot connect to server: Ping timeout."
msgstr "Неуспешно свързване със сървъра. Изтече времето за изчакване."
#: ../tgp-net.c:365
msgid "Lost connection to the server..."
msgstr "Връзката със сървъра беше прекъсната…"
#: ../tgp-request.c:51
msgid ""
"Telegram wants to verify your identity. Please enter the login code that you"
" have received via SMS."
msgstr ""
"Telegram иска да потвърди самоличността Ви. Моля, въведете кода за влизане, "
"който трябва да сте получили чрез КС."
#: ../tgp-request.c:54
msgid "Login code"
msgstr "Код за влизане"
#: ../tgp-request.c:54
msgid "Enter login code"
msgstr "Въведете кода за влизане"
#: ../tgp-request.c:54
msgid "the code"
msgstr "кодът"
#: ../tgp-request.c:54 ../tgp-request.c:104 ../tgp-request.c:198
#: ../tgp-request.c:233 ../tgp-request.c:263
msgid "OK"
msgstr "Добре"
#: ../tgp-request.c:55 ../tgp-request.c:104 ../tgp-request.c:123
#: ../tgp-request.c:199 ../tgp-request.c:234 ../tgp-request.c:264
msgid "Cancel"
msgstr "Отказ"
#: ../tgp-request.c:95
msgid "Registration"
msgstr "Регистрация"
#: ../tgp-request.c:96
msgid "First name"
msgstr "Собствено име"
#: ../tgp-request.c:99
msgid "Last name"
msgstr "Фамилия"
#: ../tgp-request.c:103
msgid "Register"
msgstr "Регистриране"
#: ../tgp-request.c:103
msgid "Please register your phone number."
msgstr "Моля, регистрирайте телефонния си номер"
#. purple_request API not available
#: ../tgp-request.c:108
msgid ""
"Phone number is not registered. Please register your phone on a different "
"client."
msgstr ""
"Телефонният номер не е регистриран. Моля, регистрирайте телефона си чрез "
"друг клиент."
#: ../tgp-request.c:110
msgid "Not registered"
msgstr "Нерегистриран"
#: ../tgp-request.c:122
msgid "Password needed"
msgstr "Нужна е парола"
#: ../tgp-request.c:122
msgid "Enter password for two factor authentication"
msgstr "Въведете парола за двустепенно удостоверяване"
#: ../tgp-request.c:123
msgid "Ok"
msgstr "Добре"
#: ../tgp-request.c:125
msgid ""
"No password set for two factor authentication. Please enter it in the "
"extended settings."
msgstr ""
"Няма зададена парола за двустепенно удостоверяване. Моля, въведете я в "
"разширените настройки."
#: ../tgp-request.c:127
msgid "Password invalid"
msgstr "Паролата е грешна"
#: ../tgp-request.c:150
#, c-format
msgid "Accept secret chat '%s' on this device?"
msgstr "Приемане на тайния разговор „%s“ на това устройство?"
#: ../tgp-request.c:151
msgid "Secret chat"
msgstr "Таен разговор"
#: ../tgp-request.c:151
msgid ""
"Secret chats can only have one end point. If you accept a secret chat on "
"this device, its messages will not be available anywhere else. If you "
"decline, you can still accept the chat on other devices."
msgstr ""
"Тайните разговори могат да се провеждат само на едно устройство. Ако "
"приемете таен разговор на това устройство, той няма да бъде достъпен никъде "
"другаде. Ако откажете, ще можете да го приемете на друго устройство."
#: ../tgp-request.c:182
msgid ""
"Invite at least one additional user by specifying\n"
" their full name (autocompletion available).\n"
"You can add more users once the chat was created."
msgstr ""
"Поканете поне още един потребител, като посочите\n"
" пълното му име (разполагате с авт. допълване).\n"
"Можете да добавите повече потребители и след началото на разговора."
#: ../tgp-request.c:185 ../tgp-request.c:189 ../tgp-request.c:193
msgid "Username"
msgstr "Потребителско име"
#: ../tgp-request.c:198
msgid "Create group chat"
msgstr "Създаване на групов разговор"
#: ../tgp-request.c:198
msgid "Invite users"
msgstr "Канене на потребители"
#: ../tgp-request.c:217 ../tgp-request.c:232
msgid "Change password"
msgstr "Промяна на паролата"
#: ../tgp-request.c:219
msgid "Current"
msgstr "Текуща"
#: ../tgp-request.c:223 ../tgp-request.c:253
msgid "Password"
msgstr "Парола"
#: ../tgp-request.c:227 ../tgp-request.c:257
msgid "Confirm"
msgstr "Потвърждаване"
#: ../tgp-request.c:251 ../tgp-request.c:262
msgid "New password"
msgstr "Нова парола"
#. if we arrive here for the second time the specified phone number is not
#. valid. We do not
#. ask for the phone number directly, cause in that case the account would
#. still be created
#. named with the invalid phone number, even though the login will work
#: ../tgp-request.c:300
msgid "Invalid phone number"
msgstr "Грешен телефонен номер"
#: ../tgp-request.c:301
msgid ""
"Please enter only numbers in the international phone number format, a leading + following by the country prefix and the phone number.\n"
"Do not use any other special chars."
msgstr ""
"Моля, въвеждайте само цифри във формата за международен телефонен номер: знака +, следван от кода на страната и телефонния номер.\n"
"Не използвайте други специални знаци."
#: ../tgp-request.c:370
msgid "Leave Chat"
msgstr "Напускане на разговора"
#: ../tgp-request.c:372
msgid "Do you want to leave this chat permantently?"
msgstr "Наистина ли искате да напуснете този разговор завинаги?"
#: ../tgp-request.c:377
msgid "Abort Secret Chat"
msgstr "Край на тайния разговор"
#: ../tgp-request.c:379
msgid "Do you want to terminate this secret chat permantently?"
msgstr "Наистина ли искате да прекратите този таен разговор завинаги?"
#: ../tgp-request.c:384
msgid "Delete Contact"
msgstr "Изтриване на контакта"
#: ../tgp-request.c:386
msgid "Do you want to remove this user from your global contact list?"
msgstr ""
"Наистина ли искате да премахнете този потребител от общия си списък с "
"контакти?"
#: ../tgp-request.c:401
msgid "Leave Channel"
msgstr "Напускане на канала"
#: ../tgp-request.c:403
msgid "Do you want to leave this channel?"
msgstr "Наистина ли искате да напуснете този канал?"
#. This should be the language's timestamp format. This is preceded by a
#. colon.
#: ../tgp-utils.c:27
msgid "%d.%m.%Y %H:%M"
msgstr "%d.%m.%Y %H:%M"
#. This is preceded by a colon.
#: ../tgp-utils.c:48
msgid "recently"
msgstr "наскоро"
#. This is preceded by a colon.
#: ../tgp-utils.c:52
msgid "last week"
msgstr "последната седмица"
#. This is preceded by a colon.
#: ../tgp-utils.c:56
msgid "last month"
msgstr "последния месец"
#. This is preceded by a colon. It refers to a point on time.
#: ../tgp-utils.c:60
msgid "unknown"
msgstr "неизвестно"
#: ../tgp-chat.c:108 ../tgp-chat.c:582
msgid "Telegram Chats"
msgstr "Разговори в Telegram"
#: ../tgp-chat.c:113
msgid "You have already left this chat."
msgstr "Вече сте напуснали този разговор"
#: ../tgp-chat.c:224
msgid "Subject:"
msgstr "Тема:"
#: ../tgp-chat.c:230
msgid "Invite link:"
msgstr "Връзка за покана:"
#: ../tgp-chat.c:236
msgid "Chat ID:"
msgstr "Ид. на разговора:"
#: ../tgp-chat.c:342
msgid "Supergroup"
msgstr "Надгрупа"
#: ../tgp-chat.c:342
msgid "Channel"
msgstr "Канал"
#: ../tgp-chat.c:345
msgid "Group"
msgstr "Група"
#: ../tgp-chat.c:367
msgid "Users in chat"
msgstr "Потребители в разговора"
#: ../tgp-chat.c:370
msgid "Type"
msgstr "Вид"

616
po/cs_CZ.po Normal file
View file

@ -0,0 +1,616 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-31 22:53+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Jiri Eischmann <jiri@eischmann.cz>, 2017\n"
"Language-Team: Czech (Czech Republic) (https://www.transifex.com/telegram-purple-developers/teams/53149/cs_CZ/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs_CZ\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: ../telegram-base.c:500
msgid "Couldn't create group"
msgstr "Nelze vytvořit skupinu"
#: ../telegram-base.c:501
msgid "Please select at least one other user."
msgstr "Prosím vyberte alespoň jednoho dalšího uživatele."
#: ../telegram-base.c:555
msgid "Query Failed"
msgstr "Dotaz selhal"
#: ../telegram-purple.c:162
msgid "Secret chat ready."
msgstr "Tajný chat připraven."
#: ../telegram-purple.c:170
msgid "Secret chat terminated."
msgstr "Tajný chat ukončen."
#: ../telegram-purple.c:182
msgid "Telegram"
msgstr "Telegram"
#: ../telegram-purple.c:229
msgid "Message marked as read."
msgstr "Zpráva označena jako přečtená."
#: ../telegram-purple.c:339
#, c-format
msgid "Invite link: %s"
msgstr "Odkaz pozvánky: %s"
#. FIXME: Can TGLCHF_MODERATOR export links?
#: ../telegram-purple.c:350
msgid "Creating chat link failed"
msgstr "Vytváření odkazu pro chat selhalo"
#: ../telegram-purple.c:351
msgid "You need to be admin of the group to do that."
msgstr "K tomuto úkonu potřebujete být administrátorem skupiny."
#: ../telegram-purple.c:416
msgid "Chat joined"
msgstr "Připojeno k chatu"
#: ../telegram-purple.c:417
msgid "Chat added to list of chat rooms."
msgstr "Chat přidán do seznamu chatovacích místností"
#: ../telegram-purple.c:443
msgid "Start secret chat..."
msgstr "Začít tajný chat..."
#. Generate Public Link
#: ../telegram-purple.c:450
msgid "Invite users by link..."
msgstr "Pozvat uživatele odkazem..."
#. Delete self from chat
#: ../telegram-purple.c:458
msgid "Delete and exit..."
msgstr "Smazat a ukončit..."
#: ../telegram-purple.c:546
#, c-format
msgid "Unable to sign on as %s: file (public key) not found."
msgstr "Nelze se přihlásit jako %s: soubor (veřejný klíč) nenalezen."
#: ../telegram-purple.c:550
#, c-format
msgid ""
"Make sure telegram-purple is installed properly,\n"
"including the .tglpub file.\n"
"If you're running SELinux (e.g. when using Tails),\n"
"try 'make local_install', or simply copy\n"
"%1$s to %2$s."
msgstr ""
"Ověřte, jestli je telegram-purple nainstalován správně\n"
"včetně souboru .tglpub.\n"
"Pokud používáte SELinux (například při použití Tails),\n"
"zkuste 'make local_install', nebo jen nakopírujte\n"
"%1$s do %2$s."
#: ../telegram-purple.c:572
#, c-format
msgid ""
"Unable to sign on as %s: problem in the underlying library 'tgl'. Please "
"submit a bug report with the debug log."
msgstr ""
"Nelze se přihlásit jako %s: problém v použité knihovně \"tgl\". Prosím "
"nahlaste chybu včetně chybového protokolu."
#: ../telegram-purple.c:576
msgid "Problem in tgl"
msgstr "Problém v tgl"
#. TRANSLATORS: Please fill in your own prefix!
#: ../telegram-purple.c:584
#, c-format
msgid ""
"Unable to sign on as %s: phone number lacks country prefix. Numbers must "
"start with the full international prefix code, e.g. +1 for USA."
msgstr ""
"Nelze se přihlásit jako %s: telefonnímu číslu chybí předčíslí země. Čísla "
"musí začínat s plným mezinárodním předčíslím, např. +420 pro Českou "
"republiku."
#: ../telegram-purple.c:589
msgid "Incomplete phone number"
msgstr "Nekompletní telefonní číslo"
#: ../telegram-purple.c:642
msgid "Secret chat was already deleted"
msgstr "Tajný chat byl již smazán"
#: ../telegram-purple.c:644
msgid "Secret chat is not ready"
msgstr "Tajný chat není připraven"
#: ../telegram-purple.c:652
msgid "Only the creator of a channel can post messages."
msgstr "Pouze tvůrce kanálu může zasílat zprávy."
#: ../telegram-purple.c:695
msgid "Cannot invite buddy to chat"
msgstr "Nelze pozvat kamaráda do chatu"
#: ../telegram-purple.c:696
msgid "Specified user does not exist."
msgstr "Zadaný uživatel neexistuje."
#: ../telegram-purple.c:709
msgid "phone no. (+ country prefix)"
msgstr "telefonní číslo (+ předčíslí země)"
#. Login
#: ../telegram-purple.c:817
msgid "Password (two factor authentication)"
msgstr "Heslo (dvoufaktorová autentizace)"
#: ../telegram-purple.c:822
msgid ""
"Fallback SMS verification\n"
"(Helps when not using Pidgin and you aren't being prompted for the code)"
msgstr ""
"Záložní ověřovací SMS\n"
"(Pomáhá, když nepoužíváte Pidgin a nejste vyzváni k zadání kódu)"
#: ../telegram-purple.c:828
msgid "always"
msgstr "vždy"
#: ../telegram-purple.c:829
msgid "never"
msgstr "nikdy"
#: ../telegram-purple.c:830
msgid "ask"
msgstr "zeptat se"
#: ../telegram-purple.c:832
msgid "Accept secret chats"
msgstr "Přijímat tajné chaty"
#: ../telegram-purple.c:836
msgid "Display buddies offline after (days)"
msgstr "Zobrazit odpojené kamarády po (dny)"
#: ../telegram-purple.c:840
msgid ""
"Don't fetch history older than (days)\n"
"(0 for unlimited)"
msgstr ""
"Nestahovat historii starší než (dny)\n"
"(0 pro neomezeně)"
#. Media
#: ../telegram-purple.c:845
msgid "Autoload media size (kb)"
msgstr "Velikost automaticky nahraných médií (kb)"
#. Chats
#: ../telegram-purple.c:850
msgid "Add all group chats to buddy list"
msgstr "Přidat všechny chatovací skupiny do seznamu kamarádů"
#. Read notifications
#: ../telegram-purple.c:855
msgid "Display notices of receipt"
msgstr "Zobrazit oznámení o doručení"
#: ../telegram-purple.c:859
msgid "Send notices of receipt when present"
msgstr "V přítomnosti zasílat oznámení o doručení"
#: ../telegram-purple.c:884
msgid "Telegram Protocol Plugin."
msgstr "Zásuvný modul protokolu Telegram."
#: ../tgp-msg.c:58
#, c-format
msgid "%2$s created chat %1$s."
msgstr "%2$s vytvořil(a) chat %1$s."
#: ../tgp-msg.c:61
#, c-format
msgid "%2$s changed title to %1$s."
msgstr "%2$s změnil(a) titulek na %1$s."
#: ../tgp-msg.c:64
#, c-format
msgid "%s changed photo."
msgstr "%s změnil(a) fotografii."
#: ../tgp-msg.c:67
#, c-format
msgid "%s deleted photo."
msgstr "%s smazal(a) fotografii."
#: ../tgp-msg.c:75
#, c-format
msgid "%1$s added user %2$s by link."
msgstr "%1$s přidal(a) uživatele %2$s odkazem."
#: ../tgp-msg.c:90
#, c-format
msgid "%2$s added user %1$s."
msgstr "%2$s přidal(a) uživatele %1$s."
#: ../tgp-msg.c:114 ../tgp-msg.c:131
#, c-format
msgid "%2$s deleted user %1$s."
msgstr "%2$s smazal(a) uživatele %1$s."
#: ../tgp-msg.c:138
#, c-format
msgid "%2$s set self destruction timer to %1$d second."
msgid_plural "%2$s set self destruction timer to %1$d seconds."
msgstr[0] "%2$s nastavil(a) sebedestrukční časovač na %1$d sekundu."
msgstr[1] "%2$s nastavil(a) sebedestrukční časovač na %1$d sekundy."
msgstr[2] "%2$s nastavil(a) sebedestrukční časovač na %1$d sekund."
#: ../tgp-msg.c:144
#, c-format
msgid "%2$s marked %1$d message read."
msgid_plural "%2$s marked %1$d messages read."
msgstr[0] "%2$s označil(a) %1$d zprávu jako přečtenou."
msgstr[1] "%2$s označil(a) %1$d zprávy jako přečtené."
msgstr[2] "%2$s označil(a) %1$d zpráv jako přečtené."
#: ../tgp-msg.c:150
#, c-format
msgid "%2$s deleted %1$d message."
msgid_plural "%2$s deleted %1$d messages."
msgstr[0] "%2$s smazal(a) %1$d zprávu."
msgstr[1] "%2$s smazal(a) %1$d zprávy."
msgstr[2] "%2$s smazal(a) %1$d zpráv."
#: ../tgp-msg.c:156
#, c-format
msgid "%2$s made a screenshot of %1$d message."
msgid_plural "%2$s made a screenshot of %1$d messages."
msgstr[0] "%2$s vytvořil(a) screenshot %1$d zprávy."
msgstr[1] "%2$s vytvořil(a) screenshot %1$d zpráv."
msgstr[2] "%2$s vytvořil(a) screenshot %1$d zpráv."
#: ../tgp-msg.c:162
#, c-format
msgid "Channel %1$s created"
msgstr "Kanál %1$s vytvořen"
#. FIXME: check if this makes sense
#: ../tgp-msg.c:165 ../tgp-chat.c:124 ../tgp-chat.c:576
msgid "Telegram Channels"
msgstr "Kanály Telegramu"
#: ../tgp-msg.c:191
msgid "Sending message failed."
msgstr "Odeslání zprávy selhalo."
#: ../tgp-msg.c:253
msgid "Sending image failed."
msgstr "Odeslání obrázku selhalo."
#: ../tgp-msg.c:417
#, c-format
msgid "%s sent a sticker."
msgstr "%s odeslal nálepku."
#: ../tgp-msg.c:463
msgid "failed loading message"
msgstr "selhalo načítání zprávy"
#: ../tgp-msg.c:498
msgid "[animation]"
msgstr "[animace]"
#: ../tgp-msg.c:515
msgid "[audio]"
msgstr "[audio]"
#: ../tgp-msg.c:515
msgid "[video]"
msgstr "[video]"
#: ../tgp-msg.c:604
#, c-format
msgid "<b>Forwarded message from: %s</b><br>%s"
msgstr "<b>Zpráva přeposlaná od:%s</b><br>%s"
#. FIXME: sometimes users aren't part of the response when receiving a
#. forwarded message
#: ../tgp-msg.c:607
#, c-format
msgid "<b>Forwarded message:</b><br>%s"
msgstr "<b>Přeposlaná zpráva:</b><br>%s"
#: ../tgp-msg.c:720
msgid "loading document or picture failed"
msgstr "nahrávání dokumentu nebo obrázku sehlalo"
#: ../tgp-net.c:281
msgid "Cannot connect to main server"
msgstr "Nelze se připojit k hlavnímu serveru"
#: ../tgp-net.c:322
msgid "Cannot connect to server: Ping timeout."
msgstr "Nelze se připojit k serveru: Vypršel časový limit pingu"
#: ../tgp-net.c:365
msgid "Lost connection to the server..."
msgstr "Ztraceno spojení se serverem..."
#: ../tgp-request.c:51
msgid ""
"Telegram wants to verify your identity. Please enter the login code that you"
" have received via SMS."
msgstr ""
"Telegram potřebuje ověřit identitu. Prosím zadejte přihlašovací kód, který "
"jste obdrželi v SMS."
#: ../tgp-request.c:54
msgid "Login code"
msgstr "Přihlašovací kód"
#: ../tgp-request.c:54
msgid "Enter login code"
msgstr "Zadejte přihlašovací kód"
#: ../tgp-request.c:54
msgid "the code"
msgstr "kód"
#: ../tgp-request.c:54 ../tgp-request.c:104 ../tgp-request.c:198
#: ../tgp-request.c:233 ../tgp-request.c:263
msgid "OK"
msgstr "OK"
#: ../tgp-request.c:55 ../tgp-request.c:104 ../tgp-request.c:123
#: ../tgp-request.c:199 ../tgp-request.c:234 ../tgp-request.c:264
msgid "Cancel"
msgstr "Zrušit"
#: ../tgp-request.c:95
msgid "Registration"
msgstr "Registrace"
#: ../tgp-request.c:96
msgid "First name"
msgstr "Jméno"
#: ../tgp-request.c:99
msgid "Last name"
msgstr "Příjmení"
#: ../tgp-request.c:103
msgid "Register"
msgstr "Registrovat"
#: ../tgp-request.c:103
msgid "Please register your phone number."
msgstr "Prosím zaregistrujte své telefonní číslo."
#. purple_request API not available
#: ../tgp-request.c:108
msgid ""
"Phone number is not registered. Please register your phone on a different "
"client."
msgstr ""
"Telefonní číslo není zaregistrované. Prosím zaregistrujte své telefonní "
"číslo v jiné aplikaci."
#: ../tgp-request.c:110
msgid "Not registered"
msgstr "Neregistrován"
#: ../tgp-request.c:122
msgid "Password needed"
msgstr "Vyžadováno heslo"
#: ../tgp-request.c:122
msgid "Enter password for two factor authentication"
msgstr "Zadejte heslo pro dvoufaktorovou autentizaci"
#: ../tgp-request.c:123
msgid "Ok"
msgstr "Ok"
#: ../tgp-request.c:125
msgid ""
"No password set for two factor authentication. Please enter it in the "
"extended settings."
msgstr ""
"Není zadáno heslo pro dvoufaktorovou autentizaci. Prosím zadejte jej v "
"pokročilém nastavení."
#: ../tgp-request.c:127
msgid "Password invalid"
msgstr "Neplatné heslo"
#: ../tgp-request.c:150
#, c-format
msgid "Accept secret chat '%s' on this device?"
msgstr "Přijmout tajný chat '%s' na tomto zařízení?"
#: ../tgp-request.c:151
msgid "Secret chat"
msgstr "Tajný chat"
#: ../tgp-request.c:151
msgid ""
"Secret chats can only have one end point. If you accept a secret chat on "
"this device, its messages will not be available anywhere else. If you "
"decline, you can still accept the chat on other devices."
msgstr ""
"Tajný chat může mít pouze jeden koncový bod. Pokud přijmete tajný chat na "
"tomto zařízení, zprávy nebudou dostupné nikde jinde. Pokud odmítnete, můžete"
" stále přijmout chat na jiném zařízení."
#: ../tgp-request.c:182
msgid ""
"Invite at least one additional user by specifying\n"
" their full name (autocompletion available).\n"
"You can add more users once the chat was created."
msgstr ""
"Pozvěte minimálně jednoho dalšího uživatele tím,\n"
"že zadáte jeho celé jméno (automatické doplňování dostupné).\n"
"Můžete přidat více uživatelů po té, co je chat vytvořen."
#: ../tgp-request.c:185 ../tgp-request.c:189 ../tgp-request.c:193
msgid "Username"
msgstr "Uživatelské jméno"
#: ../tgp-request.c:198
msgid "Create group chat"
msgstr "Vytvořit skupinový chat"
#: ../tgp-request.c:198
msgid "Invite users"
msgstr "Pozvat uživatele"
#: ../tgp-request.c:217 ../tgp-request.c:232
msgid "Change password"
msgstr "Změnit heslo"
#: ../tgp-request.c:219
msgid "Current"
msgstr "Aktuální"
#: ../tgp-request.c:223 ../tgp-request.c:253
msgid "Password"
msgstr "Heslo"
#: ../tgp-request.c:227 ../tgp-request.c:257
msgid "Confirm"
msgstr "Potvrdit"
#: ../tgp-request.c:251 ../tgp-request.c:262
msgid "New password"
msgstr "Nové heslo"
#. if we arrive here for the second time the specified phone number is not
#. valid. We do not
#. ask for the phone number directly, cause in that case the account would
#. still be created
#. named with the invalid phone number, even though the login will work
#: ../tgp-request.c:300
msgid "Invalid phone number"
msgstr "Neplatné telefonní číslo"
#: ../tgp-request.c:301
msgid ""
"Please enter only numbers in the international phone number format, a leading + following by the country prefix and the phone number.\n"
"Do not use any other special chars."
msgstr ""
"Prosím zadejte pouze čísla v mezinárodním telefonním formátu, počáteční + následované mezinárodním předčíslím a telefonním číslem.\n"
"Nepoužívejte žádné jiné speciální znaky."
#: ../tgp-request.c:370
msgid "Leave Chat"
msgstr "Opustit chat"
#: ../tgp-request.c:372
msgid "Do you want to leave this chat permantently?"
msgstr "Chcete tento chat opustit trvale?"
#: ../tgp-request.c:377
msgid "Abort Secret Chat"
msgstr "Ukončit tajný chat"
#: ../tgp-request.c:379
msgid "Do you want to terminate this secret chat permantently?"
msgstr "Chcete ukončit tento tajný chat trvale?"
#: ../tgp-request.c:384
msgid "Delete Contact"
msgstr "Smazat kontant"
#: ../tgp-request.c:386
msgid "Do you want to remove this user from your global contact list?"
msgstr "Chcete tohoto uživatele odstranit ze seznamu kontaktů?"
#: ../tgp-request.c:401
msgid "Leave Channel"
msgstr "Opustit kanál"
#: ../tgp-request.c:403
msgid "Do you want to leave this channel?"
msgstr "Chcete opustit tento kanál?"
#. This should be the language's timestamp format. This is preceded by a
#. colon.
#: ../tgp-utils.c:27
msgid "%d.%m.%Y %H:%M"
msgstr "%d.%m.%Y %H:%M"
#. This is preceded by a colon.
#: ../tgp-utils.c:48
msgid "recently"
msgstr "nedávno"
#. This is preceded by a colon.
#: ../tgp-utils.c:52
msgid "last week"
msgstr "poslední týden"
#. This is preceded by a colon.
#: ../tgp-utils.c:56
msgid "last month"
msgstr "poslední měsíc"
#. This is preceded by a colon. It refers to a point on time.
#: ../tgp-utils.c:60
msgid "unknown"
msgstr "neznámé"
#: ../tgp-chat.c:108 ../tgp-chat.c:582
msgid "Telegram Chats"
msgstr "Chaty Telegramu"
#: ../tgp-chat.c:113
msgid "You have already left this chat."
msgstr "Již jste tento chat opistili."
#: ../tgp-chat.c:224
msgid "Subject:"
msgstr "Předmět:"
#: ../tgp-chat.c:230
msgid "Invite link:"
msgstr "Odkaz pozvánky:"
#: ../tgp-chat.c:236
msgid "Chat ID:"
msgstr "ID Chatu:"
#: ../tgp-chat.c:342
msgid "Supergroup"
msgstr "Superskupina"
#: ../tgp-chat.c:342
msgid "Channel"
msgstr "Kanál"
#: ../tgp-chat.c:345
msgid "Group"
msgstr "Skupina"
#: ../tgp-chat.c:367
msgid "Users in chat"
msgstr "Uživatelé v chatu"
#: ../tgp-chat.c:370
msgid "Type"
msgstr "Typ"

588
po/da.po Normal file
View file

@ -0,0 +1,588 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-31 22:53+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: TitanusEramius <titanus@aptget.dk>, 2016\n"
"Language-Team: Danish (https://www.transifex.com/telegram-purple-developers/teams/53149/da/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: da\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../telegram-base.c:500
msgid "Couldn't create group"
msgstr "Kunne ikke lave gruppe"
#: ../telegram-base.c:501
msgid "Please select at least one other user."
msgstr "Vælg mindst én anden bruger."
#: ../telegram-base.c:555
msgid "Query Failed"
msgstr "Forespørgsel fejlede"
#: ../telegram-purple.c:162
msgid "Secret chat ready."
msgstr "Hemmelig chat klar."
#: ../telegram-purple.c:170
msgid "Secret chat terminated."
msgstr "Hemmelig chat afsluttet."
#: ../telegram-purple.c:182
msgid "Telegram"
msgstr "Telegram"
#: ../telegram-purple.c:229
msgid "Message marked as read."
msgstr "Besked markeret som læst."
#: ../telegram-purple.c:339
#, c-format
msgid "Invite link: %s"
msgstr "Invitationslink: %s"
#. FIXME: Can TGLCHF_MODERATOR export links?
#: ../telegram-purple.c:350
msgid "Creating chat link failed"
msgstr "Oprettelse af chatlink fejlede"
#: ../telegram-purple.c:351
msgid "You need to be admin of the group to do that."
msgstr ""
#: ../telegram-purple.c:416
msgid "Chat joined"
msgstr "Chat tilsluttet"
#: ../telegram-purple.c:417
msgid "Chat added to list of chat rooms."
msgstr "Chat tilføjet listen af chatrum."
#: ../telegram-purple.c:443
msgid "Start secret chat..."
msgstr "Start hemmelig chat..."
#. Generate Public Link
#: ../telegram-purple.c:450
msgid "Invite users by link..."
msgstr "Invitér brugere med link..."
#. Delete self from chat
#: ../telegram-purple.c:458
msgid "Delete and exit..."
msgstr "Slet og afslut..."
#: ../telegram-purple.c:546
#, c-format
msgid "Unable to sign on as %s: file (public key) not found."
msgstr ""
#: ../telegram-purple.c:550
#, c-format
msgid ""
"Make sure telegram-purple is installed properly,\n"
"including the .tglpub file.\n"
"If you're running SELinux (e.g. when using Tails),\n"
"try 'make local_install', or simply copy\n"
"%1$s to %2$s."
msgstr ""
#: ../telegram-purple.c:572
#, c-format
msgid ""
"Unable to sign on as %s: problem in the underlying library 'tgl'. Please "
"submit a bug report with the debug log."
msgstr ""
#: ../telegram-purple.c:576
msgid "Problem in tgl"
msgstr "Problem i tgl"
#. TRANSLATORS: Please fill in your own prefix!
#: ../telegram-purple.c:584
#, c-format
msgid ""
"Unable to sign on as %s: phone number lacks country prefix. Numbers must "
"start with the full international prefix code, e.g. +1 for USA."
msgstr ""
#: ../telegram-purple.c:589
msgid "Incomplete phone number"
msgstr "Ugyldigt telefonnummer"
#: ../telegram-purple.c:642
msgid "Secret chat was already deleted"
msgstr "Hemmelig chat er allerede slettet"
#: ../telegram-purple.c:644
msgid "Secret chat is not ready"
msgstr "Hemmelig chat er ikke klar"
#: ../telegram-purple.c:652
msgid "Only the creator of a channel can post messages."
msgstr "Kun den der opretter en kanal kan skrive beskeder."
#: ../telegram-purple.c:695
msgid "Cannot invite buddy to chat"
msgstr "Kan ikke invitere ven til chat"
#: ../telegram-purple.c:696
msgid "Specified user does not exist."
msgstr "Angivet bruger eksisterer ikke."
#: ../telegram-purple.c:709
msgid "phone no. (+ country prefix)"
msgstr "Telefon nr. (+ landekode)"
#. Login
#: ../telegram-purple.c:817
msgid "Password (two factor authentication)"
msgstr "Kodeord (to-vejs godkendelse)"
#: ../telegram-purple.c:822
msgid ""
"Fallback SMS verification\n"
"(Helps when not using Pidgin and you aren't being prompted for the code)"
msgstr ""
#: ../telegram-purple.c:828
msgid "always"
msgstr "altid"
#: ../telegram-purple.c:829
msgid "never"
msgstr "aldrig"
#: ../telegram-purple.c:830
msgid "ask"
msgstr "spørg"
#: ../telegram-purple.c:832
msgid "Accept secret chats"
msgstr "Acceptér hemmelige chats"
#: ../telegram-purple.c:836
msgid "Display buddies offline after (days)"
msgstr "Vis venner som offline efter (dage)"
#: ../telegram-purple.c:840
msgid ""
"Don't fetch history older than (days)\n"
"(0 for unlimited)"
msgstr ""
"Hent ikke historie ældre end (dage)\n"
"(0 for ubegrænset)"
#. Media
#: ../telegram-purple.c:845
msgid "Autoload media size (kb)"
msgstr ""
#. Chats
#: ../telegram-purple.c:850
msgid "Add all group chats to buddy list"
msgstr ""
#. Read notifications
#: ../telegram-purple.c:855
msgid "Display notices of receipt"
msgstr "Vis modtagelseskvittering"
#: ../telegram-purple.c:859
msgid "Send notices of receipt when present"
msgstr ""
#: ../telegram-purple.c:884
msgid "Telegram Protocol Plugin."
msgstr ""
#: ../tgp-msg.c:58
#, c-format
msgid "%2$s created chat %1$s."
msgstr "%2$s oprettede chat %1$s."
#: ../tgp-msg.c:61
#, c-format
msgid "%2$s changed title to %1$s."
msgstr "%2$s ændrede titel til %1$s."
#: ../tgp-msg.c:64
#, c-format
msgid "%s changed photo."
msgstr "%s ændrede foto."
#: ../tgp-msg.c:67
#, c-format
msgid "%s deleted photo."
msgstr "%s slettede foto."
#: ../tgp-msg.c:75
#, c-format
msgid "%1$s added user %2$s by link."
msgstr "%1$s tilføjede bruger %2$s med link."
#: ../tgp-msg.c:90
#, c-format
msgid "%2$s added user %1$s."
msgstr "%2$s tilføjede bruger %1$s."
#: ../tgp-msg.c:114 ../tgp-msg.c:131
#, c-format
msgid "%2$s deleted user %1$s."
msgstr "%2$s slettede bruger %1$s."
#: ../tgp-msg.c:138
#, c-format
msgid "%2$s set self destruction timer to %1$d second."
msgid_plural "%2$s set self destruction timer to %1$d seconds."
msgstr[0] ""
msgstr[1] ""
#: ../tgp-msg.c:144
#, c-format
msgid "%2$s marked %1$d message read."
msgid_plural "%2$s marked %1$d messages read."
msgstr[0] ""
msgstr[1] ""
#: ../tgp-msg.c:150
#, c-format
msgid "%2$s deleted %1$d message."
msgid_plural "%2$s deleted %1$d messages."
msgstr[0] ""
msgstr[1] ""
#: ../tgp-msg.c:156
#, c-format
msgid "%2$s made a screenshot of %1$d message."
msgid_plural "%2$s made a screenshot of %1$d messages."
msgstr[0] ""
msgstr[1] ""
#: ../tgp-msg.c:162
#, c-format
msgid "Channel %1$s created"
msgstr ""
#. FIXME: check if this makes sense
#: ../tgp-msg.c:165 ../tgp-chat.c:124 ../tgp-chat.c:576
msgid "Telegram Channels"
msgstr ""
#: ../tgp-msg.c:191
msgid "Sending message failed."
msgstr ""
#: ../tgp-msg.c:253
msgid "Sending image failed."
msgstr "Afsendelse af billede fejlede."
#: ../tgp-msg.c:417
#, c-format
msgid "%s sent a sticker."
msgstr ""
#: ../tgp-msg.c:463
msgid "failed loading message"
msgstr ""
#: ../tgp-msg.c:498
msgid "[animation]"
msgstr ""
#: ../tgp-msg.c:515
msgid "[audio]"
msgstr ""
#: ../tgp-msg.c:515
msgid "[video]"
msgstr ""
#: ../tgp-msg.c:604
#, c-format
msgid "<b>Forwarded message from: %s</b><br>%s"
msgstr ""
#. FIXME: sometimes users aren't part of the response when receiving a
#. forwarded message
#: ../tgp-msg.c:607
#, c-format
msgid "<b>Forwarded message:</b><br>%s"
msgstr ""
#: ../tgp-msg.c:720
msgid "loading document or picture failed"
msgstr ""
#: ../tgp-net.c:281
msgid "Cannot connect to main server"
msgstr ""
#: ../tgp-net.c:322
msgid "Cannot connect to server: Ping timeout."
msgstr ""
#: ../tgp-net.c:365
msgid "Lost connection to the server..."
msgstr ""
#: ../tgp-request.c:51
msgid ""
"Telegram wants to verify your identity. Please enter the login code that you"
" have received via SMS."
msgstr ""
#: ../tgp-request.c:54
msgid "Login code"
msgstr "Log ind kode"
#: ../tgp-request.c:54
msgid "Enter login code"
msgstr "Indtast log ind kode"
#: ../tgp-request.c:54
msgid "the code"
msgstr "koden"
#: ../tgp-request.c:54 ../tgp-request.c:104 ../tgp-request.c:198
#: ../tgp-request.c:233 ../tgp-request.c:263
msgid "OK"
msgstr "OK"
#: ../tgp-request.c:55 ../tgp-request.c:104 ../tgp-request.c:123
#: ../tgp-request.c:199 ../tgp-request.c:234 ../tgp-request.c:264
msgid "Cancel"
msgstr "Afbryd"
#: ../tgp-request.c:95
msgid "Registration"
msgstr "Registrering"
#: ../tgp-request.c:96
msgid "First name"
msgstr "Fornavn"
#: ../tgp-request.c:99
msgid "Last name"
msgstr "Efternavn"
#: ../tgp-request.c:103
msgid "Register"
msgstr "Registrér"
#: ../tgp-request.c:103
msgid "Please register your phone number."
msgstr "Registrér venligst dit telefonnummer"
#. purple_request API not available
#: ../tgp-request.c:108
msgid ""
"Phone number is not registered. Please register your phone on a different "
"client."
msgstr ""
#: ../tgp-request.c:110
msgid "Not registered"
msgstr ""
#: ../tgp-request.c:122
msgid "Password needed"
msgstr ""
#: ../tgp-request.c:122
msgid "Enter password for two factor authentication"
msgstr "Indtast kodeord til to-vejs godkendelse"
#: ../tgp-request.c:123
msgid "Ok"
msgstr ""
#: ../tgp-request.c:125
msgid ""
"No password set for two factor authentication. Please enter it in the "
"extended settings."
msgstr ""
"Intet kodeord sat til to-vejs godkendelse. Indtast det venligst i de "
"udvidede indstillinger."
#: ../tgp-request.c:127
msgid "Password invalid"
msgstr "Ugyldigt kodeord"
#: ../tgp-request.c:150
#, c-format
msgid "Accept secret chat '%s' on this device?"
msgstr ""
#: ../tgp-request.c:151
msgid "Secret chat"
msgstr ""
#: ../tgp-request.c:151
msgid ""
"Secret chats can only have one end point. If you accept a secret chat on "
"this device, its messages will not be available anywhere else. If you "
"decline, you can still accept the chat on other devices."
msgstr ""
#: ../tgp-request.c:182
msgid ""
"Invite at least one additional user by specifying\n"
" their full name (autocompletion available).\n"
"You can add more users once the chat was created."
msgstr ""
#: ../tgp-request.c:185 ../tgp-request.c:189 ../tgp-request.c:193
msgid "Username"
msgstr "Brugernavn"
#: ../tgp-request.c:198
msgid "Create group chat"
msgstr "Lav gruppechat"
#: ../tgp-request.c:198
msgid "Invite users"
msgstr "Invitér brugere"
#: ../tgp-request.c:217 ../tgp-request.c:232
msgid "Change password"
msgstr ""
#: ../tgp-request.c:219
msgid "Current"
msgstr ""
#: ../tgp-request.c:223 ../tgp-request.c:253
msgid "Password"
msgstr "Kodeord"
#: ../tgp-request.c:227 ../tgp-request.c:257
msgid "Confirm"
msgstr ""
#: ../tgp-request.c:251 ../tgp-request.c:262
msgid "New password"
msgstr ""
#. if we arrive here for the second time the specified phone number is not
#. valid. We do not
#. ask for the phone number directly, cause in that case the account would
#. still be created
#. named with the invalid phone number, even though the login will work
#: ../tgp-request.c:300
msgid "Invalid phone number"
msgstr "Ugyldigt telefonnummer"
#: ../tgp-request.c:301
msgid ""
"Please enter only numbers in the international phone number format, a leading + following by the country prefix and the phone number.\n"
"Do not use any other special chars."
msgstr ""
#: ../tgp-request.c:370
msgid "Leave Chat"
msgstr ""
#: ../tgp-request.c:372
msgid "Do you want to leave this chat permantently?"
msgstr ""
#: ../tgp-request.c:377
msgid "Abort Secret Chat"
msgstr ""
#: ../tgp-request.c:379
msgid "Do you want to terminate this secret chat permantently?"
msgstr ""
#: ../tgp-request.c:384
msgid "Delete Contact"
msgstr ""
#: ../tgp-request.c:386
msgid "Do you want to remove this user from your global contact list?"
msgstr ""
#: ../tgp-request.c:401
msgid "Leave Channel"
msgstr ""
#: ../tgp-request.c:403
msgid "Do you want to leave this channel?"
msgstr ""
#. This should be the language's timestamp format. This is preceded by a
#. colon.
#: ../tgp-utils.c:27
msgid "%d.%m.%Y %H:%M"
msgstr "%d.%m.%Y %H:%M"
#. This is preceded by a colon.
#: ../tgp-utils.c:48
msgid "recently"
msgstr "for nyligt"
#. This is preceded by a colon.
#: ../tgp-utils.c:52
msgid "last week"
msgstr "sidste uge"
#. This is preceded by a colon.
#: ../tgp-utils.c:56
msgid "last month"
msgstr "sidste måned"
#. This is preceded by a colon. It refers to a point on time.
#: ../tgp-utils.c:60
msgid "unknown"
msgstr "ukendt"
#: ../tgp-chat.c:108 ../tgp-chat.c:582
msgid "Telegram Chats"
msgstr ""
#: ../tgp-chat.c:113
msgid "You have already left this chat."
msgstr "Du har allerede forladt denne chat."
#: ../tgp-chat.c:224
msgid "Subject:"
msgstr "Emne:"
#: ../tgp-chat.c:230
msgid "Invite link:"
msgstr "Invitationslink:"
#: ../tgp-chat.c:236
msgid "Chat ID:"
msgstr "Chat ID:"
#: ../tgp-chat.c:342
msgid "Supergroup"
msgstr ""
#: ../tgp-chat.c:342
msgid "Channel"
msgstr ""
#: ../tgp-chat.c:345
msgid "Group"
msgstr ""
#: ../tgp-chat.c:367
msgid "Users in chat"
msgstr ""
#: ../tgp-chat.c:370
msgid "Type"
msgstr ""

Some files were not shown because too many files have changed in this diff Show more