[sip-comm-dev] [PATCH] GsoC 09: Geek Communicator


#1

Hello,

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
instance
and send all arguments (except the "simple" ones like --version and --help
which
still is handeled by LaunchArgHandler). When all arguments are sent it will
wait
for responses until the connection is closed. When it closes the newly
started
instance will halt.

The "old" way of handling arguments is to just parse the arguments from the
command line.
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
contact
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
particular protocol
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
particular provider
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
protocol
send-message-via-protocol: send a message via protocol to
contact
show-contact-list: Displayes the contact list
bundle-start: Start a bundle
receive-message-from-protocol: Receive messages from a particular
protocol
list-open-chats: Lists all open chats
toggle-contact-list: Toggle the visability of the
contact-list
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
protocol

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 :slight_smile:

Have a nice day!
Linus

Geek Communicator.txt (280 KB)


#2

Hi again,
Well, the idea was that i would update this patch when my old code
were committed to trunk. I have some problems doing that now because eclipse
is not nice to me.

When the trunk version contained the same package as I had locally but with
a difference in case I tried to correct it, resulting in an infinite loop
where eclipse constantly created new folders in shutdowntimeout recursivly.
So atm the shutdowntimeout folder's path is to long for windows to handle, I
cant remove it from the file system. And for each subdir a folder has it
would seem eclipse add a new line in its package explorer, meaning I have
more packages than ram atm :confused:

I will try to correct this but I'm not even sure its possible, so the new
patch might take some time :frowning:

Linus

···

2009/8/14 Linus <linus.wallgren@gmail.com>

Hello,

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
instance
and send all arguments (except the "simple" ones like --version and --help
which
still is handeled by LaunchArgHandler). When all arguments are sent it will
wait
for responses until the connection is closed. When it closes the newly
started
instance will halt.

The "old" way of handling arguments is to just parse the arguments from the
command line.
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
contact
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
particular protocol
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
particular provider
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
protocol
send-message-via-protocol: send a message via protocol to
contact
show-contact-list: Displayes the contact list
bundle-start: Start a bundle
receive-message-from-protocol: Receive messages from a particular
protocol
list-open-chats: Lists all open chats
toggle-contact-list: Toggle the visability of the
contact-list
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
protocol

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 :slight_smile:

Have a nice day!
Linus


#3

Okay, now I kinda have resolved the issue, i moved the dir instead of
deleted it (thx Emil :P)
So here is the new patch reflecting the changes in trunk

Have a nice day! :slight_smile:

Geek Communicator.txt (255 KB)

···

2009/8/14 Linus <linus.wallgren@gmail.com>

Hi again,
Well, the idea was that i would update this patch when my old code
were committed to trunk. I have some problems doing that now because eclipse
is not nice to me.

When the trunk version contained the same package as I had locally but with
a difference in case I tried to correct it, resulting in an infinite loop
where eclipse constantly created new folders in shutdowntimeout recursivly.
So atm the shutdowntimeout folder's path is to long for windows to handle, I
cant remove it from the file system. And for each subdir a folder has it
would seem eclipse add a new line in its package explorer, meaning I have
more packages than ram atm :confused:

I will try to correct this but I'm not even sure its possible, so the new
patch might take some time :frowning:

Linus

2009/8/14 Linus <linus.wallgren@gmail.com>

Hello,

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 instance
and send all arguments (except the "simple" ones like --version and --help
which
still is handeled by LaunchArgHandler). When all arguments are sent it
will wait
for responses until the connection is closed. When it closes the newly
started
instance will halt.

The "old" way of handling arguments is to just parse the arguments from
the command line.
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
contact
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 particular protocol
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
particular provider
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
protocol
send-message-via-protocol: send a message via protocol to
contact
show-contact-list: Displayes the contact list
bundle-start: Start a bundle
receive-message-from-protocol: Receive messages from a particular
protocol
list-open-chats: Lists all open chats
toggle-contact-list: Toggle the visability of the
contact-list
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
protocol

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 :slight_smile:

Have a nice day!
Linus