-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Launch SfB meetings by clicking on a link #205
Open
xhaakon
wants to merge
5
commits into
launchpad-next
Choose a base branch
from
conf-url-handler
base: launchpad-next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
49d788d
purple: add conference URL handler and .desktop file
6252302
purple: rename URL handler to sipe-url-handler
xhaakon 0523f16
purple: Update sipe-url-handler.desktop Name
xhaakon 60c8958
purple: install the URL handler
xhaakon 9607d70
purple: improve logging in sipe-url-handler
xhaakon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
|
||
LOG_FILE=/tmp/sipe-uri-handler.log | ||
|
||
log() { | ||
# Debug message if $LOG_FILE exists | ||
if [ -f $LOG_FILE ]; then | ||
echo "$@" >> $LOG_FILE | ||
fi | ||
} | ||
|
||
log "$0 $@" | ||
|
||
# Get meeting URL | ||
MEETURL=$(echo $1 | sed -n 's/^sfb:.*meeturl=\([^&]*\).*/\1/p' | sed 's/_/=/g;s/!/=/g' | base64 -d) | ||
if echo $MEETURL | grep origurl=; then | ||
MEETURL=$(echo ${MEETURL#*origurl=} | sed 's/_/=/g;s/!/=/g' | base64 -d) | ||
fi | ||
log "MEETURL = $MEETURL" | ||
|
||
if [ -n "$MEETURL" ]; then | ||
# Start Pidgin if it is not running | ||
if [ -z "$(pgrep pidgin)" ]; then | ||
pidgin & | ||
# Wait up to 120 seconds for pidgin to start and present a valid ACCOUNT number | ||
SECONDS=0 | ||
while [ $SECONDS -lt 120 ]; do | ||
ACCOUNT=$(purple-remote PurpleAccountsFindConnected?name=\&protocol=prpl-sipe) | ||
if [ -n "$ACCOUNT" ] && [ $ACCOUNT -ne 0 ]; then | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
fi | ||
|
||
# Get SIPE Account number | ||
ACCOUNT=$(purple-remote PurpleAccountsFindConnected?name=\&protocol=prpl-sipe) | ||
log "ACCOUNT = $ACCOUNT" | ||
if [ -z "$ACCOUNT" ] || [ $ACCOUNT -eq 0 ]; then | ||
log "No SfB Account found" | ||
exit 1 | ||
fi | ||
|
||
# Join meeting | ||
purple-remote SipeJoinConferenceWithUri?account=$ACCOUNT\&uri=$MEETURL | ||
fi | ||
|
||
# Close SfB tab in browser | ||
if hash xdotool 2>/dev/null; then | ||
WID=$(xdotool search --name "Skype for Business Web App" | head -1) | ||
if [ -n "$WID" ]; then | ||
xdotool windowactivate --sync $WID | ||
xdotool key --clearmodifiers ctrl+w | ||
fi | ||
fi | ||
|
||
# Make Pidgin chat window active (Skip "Buddy List") | ||
if hash xdotool 2>/dev/null; then | ||
for PIDGIN_PID in $(pgrep pidgin); do | ||
for WID in $(xdotool search --onlyvisible --pid $PIDGIN_PID); do | ||
if [ "$(xdotool getwindowname $WID)" != "Buddy List" ]; then | ||
xdotool windowactivate --sync $WID | ||
fi | ||
done | ||
done | ||
fi | ||
|
||
# Auto join meeting | ||
if hash xdotool 2>/dev/null; then | ||
SECONDS=0 | ||
while [ $SECONDS -lt 120 ]; do | ||
WID=$(xdotool search --name "Office Communicator" | head -1) | ||
if [ -n "$WID" ]; then | ||
xdotool windowactivate --sync $WID | ||
xdotool key --clearmodifiers Return | ||
break | ||
fi | ||
done | ||
fi | ||
|
||
# Auto join shared screen | ||
if hash xdotool 2>/dev/null; then | ||
SECONDS=0 | ||
while [ $SECONDS -lt 30 ]; do | ||
WID=$(xdotool search --name "Office Communicator" | head -1) | ||
if [ -n "$WID" ]; then | ||
xdotool windowactivate --sync $WID | ||
xdotool key --clearmodifiers Return | ||
break | ||
fi | ||
done | ||
fi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[Desktop Entry] | ||
Name=Skype for Business conference URL handler | ||
Comment=Start Skype for Bussiness meeting in Pidgin | ||
Exec=/usr/bin/sipe-url-handler %U | ||
MimeType=x-scheme-handler/sfb; | ||
NoDisplay=true | ||
Type=Application | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this fiddling with with windows. I guess it will work in your specific use case, however, I feel in its present shape it isn't fit for upstream:
IMO anyone willing to implement this properly should focus on these areas:
Service
im.pidgin.purple.PurpleService
that Pidgin exposes on session DBus should be made activatable, so that we don't have to check if Pidgin is running and possibly launch it manually (line 24) - whenever the service is accessed, DBus should launch Pidgin automatically.SipeJoinConferenceWithUri
method should have a boolean parameter (e.g.join_call
) that when True, makes Sipe connect to the conference call and screencast automatically, skipping any popup dialogs user would have to confirm.Optionally, Pidgin could expose
PurpleConversationSetFocus
method on DBus that would bring the chat window with the given conversation to front, replacingxdotool windowactivate
.