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
b104fbb8
Commit
b104fbb8
authored
5 years ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
Add Messenger -> Matrix image bridging (ref #2)
parent
0ad6391d
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
ROADMAP.md
+2
-2
2 additions, 2 deletions
ROADMAP.md
mautrix_facebook/portal.py
+9
-7
9 additions, 7 deletions
mautrix_facebook/portal.py
with
11 additions
and
9 deletions
ROADMAP.md
+
2
−
2
View file @
b104fbb8
...
...
@@ -35,8 +35,8 @@
*
[x] Files
*
[x] Voice messages
*
[ ] Videos
*
[
] Images
*
[
] Locations
*
[
x
] Images
*
[
x
] Locations
*
[ ] Formatting
*
[ ] Replies
*
[ ] Mentions
...
...
This diff is collapsed.
Click to expand it.
mautrix_facebook/portal.py
+
9
−
7
View file @
b104fbb8
...
...
@@ -297,23 +297,25 @@ class Portal:
info
=
AudioInfo
(
size
=
size
,
mimetype
=
mime
,
duration
=
attachment
.
duration
),
file_name
=
attachment
.
filename
,)
elif
isinstance
(
attachment
,
VideoAttachment
):
self
.
log
.
warn
(
"
Unsupported attachment type:
"
,
attachment
)
return
None
#elif isinstance(attachment, VideoAttachment):
#pass
elif
isinstance
(
attachment
,
FileAttachment
):
mxc
,
mime
,
size
=
await
self
.
_reupload_photo
(
attachment
.
url
,
intent
,
attachment
.
name
)
return
await
intent
.
send_file
(
self
.
mxid
,
mxc
,
info
=
FileInfo
(
size
=
size
,
mimetype
=
mime
),
file_name
=
attachment
.
name
)
elif
isinstance
(
attachment
,
ImageAttachment
):
self
.
log
.
warn
(
"
Unsupported attachment type:
"
,
attachment
)
#mxc, mime, size = await self._reupload_photo(attachment, intent)
return
None
mxc
,
mime
,
size
=
await
self
.
_reupload_photo
(
attachment
.
large_preview_url
,
intent
)
return
await
intent
.
send_image
(
self
.
mxid
,
mxc
,
file_name
=
f
"
image.
{
attachment
.
original_extension
}
"
,
info
=
ImageInfo
(
size
=
size
,
mimetype
=
mime
,
width
=
attachment
.
large_preview_width
,
height
=
attachment
.
large_preview_height
))
elif
isinstance
(
attachment
,
LocationAttachment
):
content
=
await
self
.
_convert_facebook_location
(
intent
,
attachment
)
return
await
intent
.
send_message
(
self
.
mxid
,
content
)
else
:
self
.
log
.
warn
(
"
Unsupported attachment type:
"
,
attachment
)
self
.
log
.
warn
(
f
"
Unsupported attachment type:
{
attachment
}
"
)
return
None
async
def
_convert_facebook_location
(
self
,
intent
:
IntentAPI
,
location
:
LocationAttachment
...
...
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