Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
facebook
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
mautrix
facebook
Commits
b3018cfa
Commit
b3018cfa
authored
5 years ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
Add logout command
parent
265fd90f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mautrix_facebook/commands/auth.py
+8
-0
8 additions, 0 deletions
mautrix_facebook/commands/auth.py
mautrix_facebook/user.py
+2
-0
2 additions, 0 deletions
mautrix_facebook/user.py
with
10 additions
and
0 deletions
mautrix_facebook/commands/auth.py
+
8
−
0
View file @
b3018cfa
...
...
@@ -95,6 +95,14 @@ async def enter_login_cookies(evt: CommandEvent) -> None:
evt
.
sender
.
command_status
=
None
@command_handler
(
needs_auth
=
True
,
help_section
=
SECTION_AUTH
,
help_text
=
"
Log out of Facebook
"
)
async
def
logout
(
evt
:
CommandEvent
)
->
None
:
puppet
=
pu
.
Puppet
.
get_by_fbid
(
evt
.
sender
.
uid
)
await
evt
.
sender
.
logout
()
if
puppet
.
is_real_user
:
await
puppet
.
switch_mxid
(
None
,
None
)
@command_handler
(
needs_auth
=
True
,
management_only
=
True
,
help_args
=
"
<_access token_>
"
,
help_section
=
SECTION_AUTH
,
help_text
=
"
Replace your Facebook Messenger account
'
s
"
"
Matrix puppet with your Matrix account
"
)
...
...
This diff is collapsed.
Click to expand it.
mautrix_facebook/user.py
+
2
−
0
View file @
b3018cfa
...
...
@@ -145,6 +145,7 @@ class User(Client):
# endregion
async
def
logout
(
self
)
->
bool
:
self
.
stopListening
()
ok
=
await
super
().
logout
()
self
.
_session_data
=
None
self
.
_is_logged_in
=
False
...
...
@@ -223,6 +224,7 @@ class User(Client):
:return: Whether the loop should keep running
"""
self
.
log
.
exception
(
"
Got exception while listening
"
)
await
asyncio
.
sleep
(
10
)
return
True
async
def
onMessage
(
self
,
mid
:
str
=
None
,
author_id
:
str
=
None
,
message
:
str
=
None
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment