This patch adds functions in order to use Sip-Communicator from a CLI.
This is done via CommandHandlers in the argdelegation bundle.
Commands can be sent either directly when launching SC or by starting
SC again. Everything after either the switch -e or the switch --command
in the argument vector will be passed along to the commandhandlers.
When SC starts it begins to listen for connections in case another instance
of SC were to be started.
If another instance of SC is started it will connect to the already running
and send all arguments (except the "simple" ones like --version and --help
still is handeled by LaunchArgHandler). When all arguments are sent it will
for responses until the connection is closed. When it closes the newly
instance will halt.
The "old" way of handling arguments is to just parse the arguments from the
That code is still there and handles all "simple" commands like --version.
If the switch
-e or --command is present then our commandhandlers are invoked. This design
should ease the implementation of new commandhandlers as you only have to
write a simple class that implements the CommandHandler interface and
register it as
a service in the bundlecontext.
Here is an copy from the help command which lists all avalible commands.
receive-message-from-provider-id: Receive messages from a particular
provider identified by its ID
send-message-via-provider-id: send message via the provider
coresponding to provider id to contact
call: Makes a call to the number via the
correct provider, hopefully
bundle-remove: Uninstall a bundle
exit: Tries to shutdown SIP-Communicator
and kills it if it takes to long.
list-contacts: Lists all online contacts
hide-contact-list: Hides the contact-list
receive-message-from-contact: Receive messages from a particular
bundle-stop: Stop a bundle
call-via-provider-id: Call using a per provider unique ID.
call-via-protocol-from-user: Calls via the specified user using a
send-message: send a message to a contact
bundle-list: List all bundles
answer-call: Answer a call.
hide-chat: Close a chat window.
set-status-for-provider-id: Set the status for a provider
matching the provided ID
quit: Tries to shutdown SIP-Communicator
and kills it if it takes to long.
list-providers: Lists all avalible providers
receive-message: Recieve messages.
send-message-via-protocol-from-user: send message via protocol and a
certain user to contact
get-supported-status-set: Lists the supported statuses for a
list-calls: Lists all active calls
open-chat: Open a chat window.
end-call: Hang up a call.
help: prints help about commands
set-status: Set the global status
call-via-protocol: Makes the call via the specified
send-message-via-protocol: send a message via protocol to
show-contact-list: Displayes the contact list
bundle-start: Start a bundle
receive-message-from-protocol: Receive messages from a particular
list-open-chats: Lists all open chats
toggle-contact-list: Toggle the visability of the
set-status-for-protocol-and-user: Set the status for a provider
matching both user and protcol
bundle-install: Install a new bundle
set-status-for-protocol: Set the status for a particular
and here is the command i run to get the above output:
$ ant run -Dargs="-e help"
This patch does also contain the code in the patch i sent earlier with the
modified shutdown command (subject: [PATCH] New shutdown bundle).
If/when it gets committed to trunk I will send a new patch.
Any comments are appreciated
Have a nice day!
Geek Communicator.txt (280 KB)