Commit graph

607 commits

Author SHA1 Message Date
poljar (Damir Jelić)
9b25026a3a Don't reconnect on a timeout, disconnect does this already. 2018-02-21 17:07:57 +01:00
poljar (Damir Jelić)
2f4137933f Reformat the source tree using yapf. 2018-02-21 17:04:03 +01:00
poljar (Damir Jelić)
81e078173a Add support for python2 type json exceptions. 2018-02-20 13:40:25 +01:00
poljar (Damir Jelić)
bd808e4bc2 Don't use the object hook functionality of the json module.
The json module runs the object hook for every json object contained in
the json string.

This could lead to unexpected object creation if the string contains
more than a single object.
2018-02-20 13:40:25 +01:00
poljar (Damir Jelić)
779e346fb3 Use the propper reference for server buffer merges. 2018-02-20 13:40:25 +01:00
poljar (Damir Jelić)
ed16113afe Style issues. 2018-02-20 12:40:23 +01:00
poljar (Damir Jelić)
1c47dff7ae Readd redacted message printing to the backlog event. 2018-02-20 12:35:26 +01:00
poljar (Damir Jelić)
ee2bcc69cb Add sanitize_token() function. 2018-02-20 10:59:44 +01:00
poljar (Damir Jelić)
2741a7807d Reset the send/receive buffers and the http parser on disconnects. 2018-02-20 10:12:14 +01:00
poljar (Damir Jelić)
b04c952107 Fix the type info for sanitize_id(). 2018-02-16 15:22:10 +01:00
poljar (Damir Jelić)
3b77689c7d Add initial backlog event.
The backlog event currently only supports non redacted messages.
2018-02-16 15:15:56 +01:00
poljar (Damir Jelić)
afd595b780 Clear the send queue when disconnected as well. 2018-02-15 15:28:01 +01:00
poljar (Damir Jelić)
fc25fe54c9 Check the type while sanitizing a ID. 2018-02-14 15:09:11 +01:00
poljar (Damir Jelić)
1466531d48 Drop the dot in error event messages.
Synapse has incosistent error messages, some contain a full stop while
some don't, to avoid double dots remove our dot.
2018-02-14 14:53:07 +01:00
poljar (Damir Jelić)
272e82aa76 Add invite event class. 2018-02-14 14:52:21 +01:00
poljar (Damir Jelić)
32babecb33 Change the empty dict check condition in the leave event. 2018-02-14 14:22:20 +01:00
poljar (Damir Jelić)
a4a8e448a7 Change the join API to allow joins using aliases. 2018-02-14 14:21:56 +01:00
poljar (Damir Jelić)
8c23028c8b Execute the send and join events on an 403 error. 2018-02-14 13:50:54 +01:00
poljar (Damir Jelić)
9577472ad2 Add join event class. 2018-02-14 13:48:00 +01:00
poljar (Damir Jelić)
2a0cccc191 Add redaction event class. 2018-02-14 13:00:18 +01:00
poljar (Damir Jelić)
3232f61f7e Add a ID sanitization function.
Json allows certain control characters inside of strings. Filter those
out for identifiers.
2018-02-14 12:40:41 +01:00
poljar (Damir Jelić)
4537635db3 Add topic event class. 2018-02-14 11:51:57 +01:00
poljar (Damir Jelić)
e4f042a6a7 Don't make message sending failures fatal. 2018-02-14 11:33:28 +01:00
poljar (Damir Jelić)
1029ce5c1b Refactor event error handling. 2018-02-14 11:11:54 +01:00
poljar (Damir Jelić)
6b23dee045 Add SendEvent class. 2018-02-13 15:50:30 +01:00
poljar (Damir Jelić)
bafa7d23b7 Move the login decode function to the parent class. 2018-02-13 14:06:17 +01:00
poljar (Damir Jelić)
d045bc4368 Construct the login event while parsing the json. 2018-02-13 13:06:30 +01:00
poljar (Damir Jelić)
e9c388ca4d Add event classes. 2018-02-13 11:38:49 +01:00
poljar (Damir Jelić)
7da03db7c1 Return from the timer callback if we're scheduling a reconnect. 2018-02-13 10:15:05 +01:00
poljar (Damir Jelić)
f85a5df052 Reset the lag if we're disconnecting. 2018-02-13 10:14:43 +01:00
poljar (Damir Jelić)
f78bd95d3f Move the json decoding into the MatrixMessage class. 2018-02-13 10:13:40 +01:00
poljar (Damir Jelić)
390d08b229 Move the sync and login functions into the server class. 2018-02-12 14:53:19 +01:00
poljar (Damir Jelić)
da13abc5fa Remove unused get_transaction_id() function. 2018-02-12 14:41:45 +01:00
poljar (Damir Jelić)
6f97ba1425 Rename MatrixGenericMessage class. 2018-02-12 14:20:18 +01:00
poljar (Damir Jelić)
49b356f510 Remove MatrixMessage class. 2018-02-12 14:17:36 +01:00
poljar (Damir Jelić)
8b21e9957d Add invite message class. 2018-02-12 14:15:08 +01:00
poljar (Damir Jelić)
7be29e2b3f Add join/part message class. 2018-02-12 14:14:53 +01:00
poljar (Damir Jelić)
dbf7df2e84 Add backlog message class. 2018-02-12 13:22:48 +01:00
poljar (Damir Jelić)
aa625f0962 Add redaction message class. 2018-02-12 13:03:32 +01:00
poljar (Damir Jelić)
d0c695dc09 Add topic message class. 2018-02-12 12:51:33 +01:00
poljar (Damir Jelić)
7f9c09c16b Add sync message class. 2018-02-12 12:27:45 +01:00
poljar (Damir Jelić)
bc6db177a8 Add login message class. 2018-02-12 12:27:20 +01:00
poljar (Damir Jelić)
b22deceb00 Mypy fixes. 2018-02-12 10:56:28 +01:00
poljar (Damir Jelić)
7ab59ec636 Start separating messages into their own subclasses. 2018-02-12 10:55:27 +01:00
poljar (Damir Jelić)
1ad643f206 Fix buffer unmerging if we only have one server. 2018-02-12 10:41:12 +01:00
poljar (Damir Jelić)
9af4d65b67 Catch the socket error upon socket shutdown. 2018-02-10 15:36:31 +01:00
poljar (Damir Jelić)
6b87994a94 Rework of the color handling, add a Formatted class. 2018-02-10 15:34:40 +01:00
poljar (Damir Jelić)
4c9069a8b1 Make the room_id part of the kwargs in the MatrixMessage class. 2018-02-08 15:49:20 +01:00
poljar (Damir Jelić)
1a804a4dc3 Get rid of the data argument from the MatrixMessage constructor. 2018-02-08 14:54:03 +01:00
poljar (Damir Jelić)
ef99a13806 Get rid of extra_data in the MatrixMessage class. 2018-02-08 14:40:20 +01:00
poljar (Damir Jelić)
39c8591926 Refactor the SEND message type. 2018-02-08 14:19:09 +01:00
poljar (Damir Jelić)
f83e02df13 Get rid of the extra_id in the MatrixMessage class. 2018-02-08 13:37:48 +01:00
poljar (Damir Jelić)
51102dd171 No need to check for the event type in the topic message. 2018-02-08 13:07:33 +01:00
poljar (Damir Jelić)
268111fbfc Final fix for buffer name bar item. 2018-02-08 11:20:41 +01:00
poljar (Damir Jelić)
5c2c5a655c Improve lag handling. 2018-02-08 10:58:33 +01:00
poljar (Damir Jelić)
e39fa57f83 Fix server buffer merging if no server buffers are created. 2018-02-07 12:43:35 +01:00
poljar (Damir Jelić)
90c63c197c Split out state messages, for now only topic messages are implemented. 2018-02-07 12:42:56 +01:00
poljar (Damir Jelić)
ce718a9259 Style fixes. 2018-02-07 12:42:33 +01:00
poljar (Damir Jelić)
ad208cbb3a Refactor of join/leave/invite API. 2018-02-07 12:41:55 +01:00
poljar (Damir Jelić)
9912415453 Refactor of backlog fetch API. 2018-02-06 14:24:52 +01:00
poljar (Damir Jelić)
4514cc43f6 Fix the hdata tags updating code for redactions. 2018-02-06 12:07:43 +01:00
poljar (Damir Jelić)
2813c42c3c Refactor of the redaction API. 2018-02-06 12:07:17 +01:00
poljar (Damir Jelić)
64df928a4e Fix room message sending API. 2018-02-06 12:06:57 +01:00
poljar (Damir Jelić)
729b48c077 Refactor of the topic API. 2018-02-05 13:21:01 +01:00
poljar (Damir Jelić)
085ade35ab Refactor of the message sending API. 2018-02-05 12:50:29 +01:00
poljar (Damir Jelić)
4a949b33a8 Fix name bar item for the server buffer.
The server buffer is a pointer to a buffer (that is a string in python)
not a list like the room buffers. Don't use 'in' to check if the buffer
belongs to the server, use 'is' instead.
2018-02-05 12:48:23 +01:00
poljar (Damir Jelić)
e02a731809 Fix global config handling. 2018-02-05 12:47:40 +01:00
poljar (Damir Jelić)
deea9d897e Full server buffer merging implementation. 2018-02-04 13:34:17 +01:00
poljar (Damir Jelić)
41c96fd332 Catch exceptions while trying to close the socket. 2018-02-03 12:51:13 +01:00
poljar (Damir Jelić)
475feaa93a Start some refactoring work on the api.
Only login and sync are so far done.
2018-02-02 15:03:52 +01:00
poljar (Damir Jelić)
b9fd3869f4 Move the socket closing function into the server class. 2018-02-02 10:37:06 +01:00
poljar (Damir Jelić)
e7f229e4a2 Mark some server methods as private. 2018-02-02 10:36:54 +01:00
poljar (Damir Jelić)
f9df032667 Move the connection functions to the server class. 2018-02-02 10:29:59 +01:00
poljar (Damir Jelić)
c63551d37e Make the send functions methods of the server class. 2018-02-02 10:29:16 +01:00
poljar (Damir Jelić)
007b2b5cad Only try to close the socket if it exists. 2018-02-02 09:51:04 +01:00
poljar (Damir Jelić)
f4c8f1ee29 Better error messages for socket errors. 2018-02-02 09:50:08 +01:00
poljar (Damir Jelić)
e9c027f131 Fix the ssl_verify config option description. 2018-02-01 19:15:55 +01:00
poljar (Damir Jelić)
b32baa65b1 Fix some style issues. 2018-02-01 18:02:58 +01:00
poljar (Damir Jelić)
a7531839d1 Fix the send callback using a undefined variable. 2018-02-01 15:02:50 +01:00
poljar (Damir Jelić)
57cc1b3e88 Rename disconnect calls in the send function. 2018-02-01 14:58:13 +01:00
poljar (Damir Jelić)
59feac395f Fix reconnection handling and refactor the server commands. 2018-02-01 13:20:52 +01:00
poljar (Damir Jelić)
576096a70e Fix server command completion. 2018-02-01 13:19:59 +01:00
poljar (Damir Jelić)
d9ba22944b Clear the receive queue if we disconnect. 2018-01-31 13:56:16 +01:00
poljar (Damir Jelić)
484d91b166 Make the message sending non blocking. 2018-01-31 13:55:55 +01:00
poljar (Damir Jelić)
d83c25e709 Make the ssl handshake non blocking. 2018-01-31 09:57:13 +01:00
poljar (Damir Jelić)
ad5472d5f2 Add missing files.
Those got forgotten while splitting functions out into different files.
2018-01-30 14:25:25 +01:00
poljar (Damir Jelić)
0fbecf6bdb Add missing str import. 2018-01-30 14:21:59 +01:00
poljar (Damir Jelić)
41c694032a Connection messages. 2018-01-30 14:16:25 +01:00
poljar (Damir Jelić)
594706e0af Don't hook the timer hook before we're connected. 2018-01-30 14:08:50 +01:00
poljar (Damir Jelić)
a4d4e56919 Add lag bar item. 2018-01-30 12:58:16 +01:00
poljar (Damir Jelić)
bb5b90691e Move connection handling to server.py. 2018-01-30 11:46:29 +01:00
poljar (Damir Jelić)
4eb7e887e8 Move server config out of the main file. 2018-01-29 18:11:45 +01:00
poljar (Damir Jelić)
44fb7a1913 More split work for the config. 2018-01-29 17:50:59 +01:00
poljar (Damir Jelić)
48f17e14d4 Split out completion callbacks. 2018-01-29 14:01:58 +01:00
poljar (Damir Jelić)
3b1c95dea8 More split work. 2018-01-29 13:24:52 +01:00
poljar (Damir Jelić)
5686d1f6c1 Move more commands out of the main file. 2018-01-29 10:37:48 +01:00
poljar (Damir Jelić)
3f2559adeb Evaluate the string for the server password.
This enables us to use weechat secured data feature.
2018-01-28 11:44:57 +01:00
poljar (Damir Jelić)
937ad993c5 Apply PEP8 fixes to the source tree. 2018-01-27 18:15:18 +01:00
poljar (Damir Jelić)
0e4c29b0c6 Fix the ssl verification turn on code. 2018-01-27 14:40:01 +01:00
poljar (Damir Jelić)
5efea04b64 Change the licence to ISC and add license headers. 2018-01-26 18:22:06 +01:00
poljar (Damir Jelić)
27c0836eb5 Move the weechat command setup and some commands. 2018-01-26 17:57:42 +01:00
poljar (Damir Jelić)
be48b73395 Move the server option update code. 2018-01-26 17:44:17 +01:00
poljar (Damir Jelić)
7328dcf7ab More splitting. 2018-01-26 17:44:17 +01:00
poljar (Damir Jelić)
6e7ed8333f Split up http handling into a separate file. 2018-01-26 17:44:11 +01:00
poljar (Damir Jelić)
85f3a9eef0 Add type annotations to some functions in color.py. 2018-01-26 13:41:24 +01:00
poljar (Damir Jelić)
d5c1538db9 Split up the utf encoding handling into a separate file. 2018-01-26 13:12:57 +01:00
poljar (Damir Jelić)
62adae5aa3 Start splitting up the script into different files. 2018-01-26 12:18:52 +01:00