/
bitchan_client.py
173 lines (117 loc) · 5.44 KB
/
bitchan_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import logging
from Pyro5.api import Proxy
import config
logger = logging.getLogger('bitchan.client')
class DaemonCom:
def __init__(self, pyro_uri=config.PYRO_URI):
self.pyro_timeout = 45
self.uri = pyro_uri
def proxy(self):
try:
proxy = Proxy(self.uri)
proxy._pyroTimeout = self.pyro_timeout
proxy._pyroSerializer = "msgpack"
return proxy
except Exception as e:
logger.error("Pyro5 proxy error: {}".format(e))
def bitmessage_restarting(self):
return self.proxy().bitmessage_restarting()
def bm_sync_complete(self):
return self.proxy().bm_sync_complete()
def bm_change_connection_settings(self):
return self.proxy().bm_change_connection_settings()
def bulk_join(self, list_address, join_bulk_list):
return self.proxy().bulk_join(list_address, join_bulk_list)
def clear_bm_inventory(self):
return self.proxy().clear_bm_inventory()
def combine_bm_knownnodes(self, knownnodes_list):
return self.proxy().combine_bm_knownnodes(knownnodes_list)
def delete_and_vacuum(self):
return self.proxy().delete_and_vacuum()
def enable_onion_services_only(self, enable=False):
return self.proxy().enable_onion_services_only(enable=enable)
def generate_post_numbers(self, all_boards=False):
return self.proxy().generate_post_numbers(all_boards=all_boards)
def get_address_book(self):
return self.proxy().get_address_book()
def get_address_labels(self):
return self.proxy().get_address_labels()
def get_all_chans(self):
return self.proxy().get_all_chans()
def get_api_status(self, return_stored=True):
return self.proxy().get_api_status(return_stored=return_stored)
def get_bm_sync_complete(self):
return self.proxy().get_bm_sync_complete()
def get_board_by_chan(self, chan_address=None):
return self.proxy().get_board_by_chan(chan_address=chan_address)
def get_chans_board_info(self):
return self.proxy().get_chans_board_info()
def get_chans_list_info(self):
return self.proxy().get_chans_list_info()
def get_from_list(self, chan_address, only_owner_admin=False, all_addresses=False):
return self.proxy().get_from_list(
chan_address, only_owner_admin=only_owner_admin, all_addresses=all_addresses)
def get_identities(self):
return self.proxy().get_identities()
def get_last_post_ts(self):
return self.proxy().get_last_post_ts()
def get_start_download(self):
return self.proxy().get_start_download()
def get_subscriptions(self):
return self.proxy().get_subscriptions()
def get_timer_clear_inventory(self):
return self.proxy().get_timer_clear_inventory()
def get_utc(self):
return self.proxy().get_utc()
def get_view_counter(self):
return self.proxy().get_view_counter()
def join_chan(self, passphrase, clear_inventory=False):
return self.proxy().join_chan(passphrase, clear_inventory=clear_inventory)
def leave_chan(self, chan_address):
return self.proxy().leave_chan(chan_address)
def refresh_address_book(self):
return self.proxy().refresh_address_book()
def refresh_identities(self):
return self.proxy().refresh_identities()
def refresh_settings(self):
return self.proxy().refresh_settings()
def regenerate_bitmessage_onion_address(self):
return self.proxy().regenerate_bitmessage_onion_address()
def remove_start_download(self, message_id):
return self.proxy().remove_start_download(message_id)
def restart_bitmessage(self):
return self.proxy().restart_bitmessage()
def shutdown_daemon(self):
return self.proxy().shutdown_daemon()
def set_board_by_chan(self, chan_address, board):
return self.proxy().set_board_by_chan(chan_address, board)
def set_last_post_ts(self, ts):
return self.proxy().set_last_post_ts(ts)
def set_start_download(self, message_id):
return self.proxy().set_start_download(message_id)
def set_view_counter(self, key, endpoint, value=None, increment=None):
return self.proxy().set_view_counter(key, endpoint, value=value, increment=increment)
def update_unread_mail_count(self, ident_address):
return self.proxy().update_unread_mail_count(ident_address)
def signal_clear_inventory(self):
return self.proxy().signal_clear_inventory()
def signal_generate_post_numbers(self):
return self.proxy().signal_generate_post_numbers()
def tor_enable_custom_address(self):
return self.proxy().tor_enable_custom_address()
def tor_disable_custom_address(self):
return self.proxy().tor_disable_custom_address()
def tor_enable_random_address(self):
return self.proxy().tor_enable_random_address()
def tor_disable_random_address(self):
return self.proxy().tor_disable_random_address()
def tor_get_new_random_address(self):
return self.proxy().tor_get_new_random_address()
def tor_restart(self):
return self.proxy().tor_restart()
def trash_message(self, message_id):
return self.proxy().trash_message(message_id)
def update_timer_clear_inventory(self, seconds):
return self.proxy().update_timer_clear_inventory(seconds)
def update_timer_send_lists(self, seconds):
return self.proxy().update_timer_send_lists(seconds)