diff options
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | doc/user-guide/commands.xml | 8 | ||||
-rw-r--r-- | protocols/skype/README | 57 | ||||
-rw-r--r-- | protocols/skype/skype.c | 23 | ||||
-rw-r--r-- | protocols/skype/skyped.txt | 32 | ||||
-rw-r--r-- | protocols/skype/t/filetransfer-bitlbee.mock | 10 | ||||
-rw-r--r-- | protocols/skype/t/filetransfer-skyped.mock | 33 | ||||
-rw-r--r-- | protocols/skype/t/group-read-bitlbee.mock | 14 | ||||
-rw-r--r-- | protocols/skype/t/group-read-skyped.mock | 26 | ||||
-rwxr-xr-x | protocols/skype/test.py | 6 | ||||
-rw-r--r-- | root_commands.c | 23 |
11 files changed, 174 insertions, 60 deletions
@@ -644,7 +644,7 @@ fi case "$CC" in *gcc* ) echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings - for i in . lib protocols protocols/*/; do + for i in . lib tests protocols protocols/*/; do mkdir -p $i/.depend done esac diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index a21153ef..a13956ec 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -1783,11 +1783,15 @@ <bitlbee-command name="group"> <short-description>Contact group management</short-description> - <syntax>group list</syntax> + <syntax>group [ list | info <group> ]</syntax> <description> <para> - Only the <emphasis>group list</emphasis> command is supported at the moment, which shows a list of all groups defined so far. + The <emphasis>group list</emphasis> command shows a list of all groups defined so far. + </para> + + <para> + The <emphasis>group info</emphasis> command shows a list of all members of a the group <group>. </para> <para> diff --git a/protocols/skype/README b/protocols/skype/README index 06e608ff..2e45727f 100644 --- a/protocols/skype/README +++ b/protocols/skype/README @@ -144,62 +144,7 @@ This will install the plugin to where BitlBee expects them, which is === Configuring -- Set up `~/.skyped/skyped.conf`: Create the `~/.skyped` directory, copy - `skyped.conf` and `skyped.cnf` from - `/usr/local/etc/skyped/skyped.conf` to `~/.skyped`, adjust `username` - and `password`. The `username` should be your Skype login and the - `password` can be whatever you want, but you will have to specify that - one when adding the Skype account to BitlBee (see later). - -NOTE: Here, and later - `/usr/local/etc` can be different on your installation -if you used the `--sysconfdir` switch when running bitlbee-skype's `configure`. - -- Generate the SSL pem files: - ----- -# cd ~/.skyped -# openssl req -new -x509 -days 365 -nodes -config skyped.cnf -out skyped.cert.pem \ - -keyout skyped.key.pem ----- - -NOTE: Maybe you want to adjust the permissions in the `~/.skyped` -dir. For example make it readable by just your user. - -- Start `skyped` (the tcp server): - ----- -$ skyped ----- - -- Start your `IRC` client, connect to BitlBee and add your account: - ----- -account add skype <user> <pass> -account skype set server localhost ----- - -<user> should be your Skype account name, <pass> should be the one you declared -in `skyped.conf`. If you want to run skyped on a remote machine, replace -`localhost` with the name of the machine. - -If you are running skyped on a custom port: - ----- -account skype set port <port> ----- - -If you want to set your full name (optional): - ----- -account skype set display_name "John Smith" ----- - -If you want to see your skypeout contacts online as well (they are -offline by default): - ----- -account skype set skypeout_offline false ----- +See the manpage of `skyped`. == Setting up Skype in a VNC server (optional) diff --git a/protocols/skype/skype.c b/protocols/skype/skype.c index 8f0d9b1c..b3d29dab 100644 --- a/protocols/skype/skype.c +++ b/protocols/skype/skype.c @@ -45,6 +45,8 @@ enum { enum { SKYPE_FILETRANSFER_NEW = 1, + SKYPE_FILETRANSFER_TRANSFERRING, + SKYPE_FILETRANSFER_COMPLETED, SKYPE_FILETRANSFER_FAILED }; @@ -80,6 +82,8 @@ struct skype_data { int call_out; /* Same for file transfers. */ int filetransfer_status; + /* Path of the file being transferred. */ + char *filetransfer_path; /* Using /j #nick we want to have a groupchat with two people. Usually * not (default). */ char *groupchat_with; @@ -782,6 +786,15 @@ static void skype_parse_filetransfer(struct im_connection *ic, char *line) skype_printf(ic, "GET FILETRANSFER %s PARTNER_HANDLE\n", id); sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED; + } else if (!strcmp(info, "STATUS COMPLETED")) { + skype_printf(ic, "GET FILETRANSFER %s PARTNER_HANDLE\n", id); + sd->filetransfer_status = SKYPE_FILETRANSFER_COMPLETED; + } else if (!strcmp(info, "STATUS TRANSFERRING")) { + skype_printf(ic, "GET FILETRANSFER %s PARTNER_HANDLE\n", id); + sd->filetransfer_status = SKYPE_FILETRANSFER_TRANSFERRING; + } else if (!strncmp(info, "FILEPATH ", 9)) { + info += 9; + sd->filetransfer_path = g_strdup(info); } else if (!strncmp(info, "PARTNER_HANDLE ", 15)) { info += 15; if (!sd->filetransfer_status) @@ -795,6 +808,16 @@ static void skype_parse_filetransfer(struct im_connection *ic, char *line) imcb_log(ic, "Failed to transfer file from user %s.", info); break; + case SKYPE_FILETRANSFER_COMPLETED: + imcb_log(ic, "File transfer from user %s completed.", info); + break; + case SKYPE_FILETRANSFER_TRANSFERRING: + if (sd->filetransfer_path) { + imcb_log(ic, "File transfer from user %s started, saving to %s.", info, sd->filetransfer_path); + g_free(sd->filetransfer_path); + sd->filetransfer_path = NULL; + } + break; } sd->filetransfer_status = 0; } diff --git a/protocols/skype/skyped.txt b/protocols/skype/skyped.txt index c27cfada..0f11f093 100644 --- a/protocols/skype/skyped.txt +++ b/protocols/skype/skyped.txt @@ -19,7 +19,37 @@ is done via SSL. == CONFIGURATION -See the README for information about how to configure this daemon. +- Set up `~/.skyped/skyped.conf`: Create the `~/.skyped` directory, copy + `skyped.conf` and `skyped.cnf` from `/usr/local/etc/skyped/` to `~/.skyped`, + adjust `username` and `password`. The `username` should be your Skype login and + the `password` can be whatever you want, but you will have to specify that one + when adding the Skype account to BitlBee (see later). + +NOTE: Here, and later - `/usr/local/etc` can be different on your installation +if you used the `--sysconfdir` switch when running the `configure` of BitlBee. + +- Generate the SSL pem files: + +---- +$ cd ~/.skyped +$ openssl req -new -x509 -days 365 -nodes -config skyped.cnf -out skyped.cert.pem \ + -keyout skyped.key.pem +---- + +- Start `skyped` (the TCP server), initially without detaching and enabling debug messages: + +---- +$ skyped -d -n +---- + +- Start your `IRC` client, connect to BitlBee and add your account: + +---- +account add skype <user> <pass> +---- + +`<user>` should be your Skype account name, `<pass>` should be the one you declared +in `skyped.conf`. == OPTIONS diff --git a/protocols/skype/t/filetransfer-bitlbee.mock b/protocols/skype/t/filetransfer-bitlbee.mock new file mode 100644 index 00000000..a08e52bc --- /dev/null +++ b/protocols/skype/t/filetransfer-bitlbee.mock @@ -0,0 +1,10 @@ +>> NOTICE AUTH +<< NICK alice +<< USER alice alice localhost :Alice +>> PRIVMSG &bitlbee +<< PRIVMSG &bitlbee :account add skype alice foo +<< PRIVMSG &bitlbee :account skype on +>> :bob!bob@skype.com JOIN :&bitlbee +>> PRIVMSG &bitlbee :skype - The user bob offered a new file for you. +>> PRIVMSG &bitlbee :skype - File transfer from user bob started, saving to /home/alice/text.odt. +>> PRIVMSG &bitlbee :skype - File transfer from user bob completed. diff --git a/protocols/skype/t/filetransfer-skyped.mock b/protocols/skype/t/filetransfer-skyped.mock new file mode 100644 index 00000000..850c4c31 --- /dev/null +++ b/protocols/skype/t/filetransfer-skyped.mock @@ -0,0 +1,33 @@ +>> SEARCH GROUPS CUSTOM +<< GROUPS 48, 49 +>> SEARCH FRIENDS +<< USERS echo123, bob +>> SET USERSTATUS ONLINE +<< USERSTATUS ONLINE +>> SET USERSTATUS ONLINE +<< USERSTATUS ONLINE +>> GET USER echo123 ONLINESTATUS +<< USER echo123 ONLINESTATUS ONLINE +>> GET USER bob ONLINESTATUS +<< USER bob ONLINESTATUS ONLINE +<< FILETRANSFER 208 TYPE INCOMING +<< FILETRANSFER 208 PARTNER_HANDLE bob +<< FILETRANSFER 208 PARTNER_DISPNAME bob +<< FILETRANSFER 208 FILENAME text.odt +<< FILETRANSFER 208 STATUS NEW +<< FILETRANSFER 208 FILESIZE 83534193 +<< FILETRANSFER 208 STARTTIME 1358458276 +<< FILETRANSFER 208 FINISHTIME 0 +<< FILETRANSFER 208 BYTESPERSECOND 0 +<< FILETRANSFER 208 BYTESTRANSFERRED 0 +<< FILETRANSFER 208 FILESIZE 83534193 +>> GET FILETRANSFER 208 PARTNER_HANDLE +<< FILETRANSFER 208 PARTNER_HANDLE bob +<< FILETRANSFER 208 FILEPATH /home/alice/text.odt +<< FILETRANSFER 208 STATUS CONNECTING +<< FILETRANSFER 208 STATUS TRANSFERRING +>> GET FILETRANSFER 208 PARTNER_HANDLE +<< FILETRANSFER 208 PARTNER_HANDLE bob +<< FILETRANSFER 208 STATUS COMPLETED +>> GET FILETRANSFER 208 PARTNER_HANDLE +<< FILETRANSFER 208 PARTNER_HANDLE bob diff --git a/protocols/skype/t/group-read-bitlbee.mock b/protocols/skype/t/group-read-bitlbee.mock new file mode 100644 index 00000000..0f001400 --- /dev/null +++ b/protocols/skype/t/group-read-bitlbee.mock @@ -0,0 +1,14 @@ +>> NOTICE AUTH +<< NICK alice +<< USER alice alice localhost :Alice +>> PRIVMSG &bitlbee +<< PRIVMSG &bitlbee :account add skype alice foo +<< PRIVMSG &bitlbee :account skype set read_groups true +<< PRIVMSG &bitlbee :account skype on +>> :bob!bob@skype.com JOIN :&bitlbee +>> :cecil!cecil@skype.com JOIN :&bitlbee +>> :daniel!daniel@skype.com JOIN :&bitlbee +<< JOIN &family +>> 353 alice = &family :@alice +bob +cecil @root +<< JOIN &work +>> 353 alice = &work :@alice +daniel @root diff --git a/protocols/skype/t/group-read-skyped.mock b/protocols/skype/t/group-read-skyped.mock new file mode 100644 index 00000000..4a7a2299 --- /dev/null +++ b/protocols/skype/t/group-read-skyped.mock @@ -0,0 +1,26 @@ +>> SEARCH GROUPS CUSTOM +<< GROUPS 70, 71 +>> SEARCH FRIENDS +<< USERS echo123, bob, cecil, daniel, emily +>> SET USERSTATUS ONLINE +<< USERSTATUS ONLINE +>> SET USERSTATUS ONLINE +<< USERSTATUS ONLINE +>> GET GROUP 70 DISPLAYNAME +<< GROUP 70 DISPLAYNAME Family +>> GET GROUP 70 USERS +<< GROUP 70 USERS bob, cecil +>> GET GROUP 71 DISPLAYNAME +<< GROUP 71 DISPLAYNAME Work +>> GET GROUP 71 USERS +<< GROUP 71 USERS daniel, emily +>> GET USER echo123 ONLINESTATUS +<< USER echo123 ONLINESTATUS ONLINE +>> GET USER bob ONLINESTATUS +<< USER bob ONLINESTATUS ONLINE +>> GET USER cecil ONLINESTATUS +<< USER cecil ONLINESTATUS ONLINE +>> GET USER daniel ONLINESTATUS +<< USER daniel ONLINESTATUS ONLINE +>> GET USER emily ONLINESTATUS +<< USER emily ONLINESTATUS OFFLINE diff --git a/protocols/skype/test.py b/protocols/skype/test.py index 3c35a5c0..9f4c13ce 100755 --- a/protocols/skype/test.py +++ b/protocols/skype/test.py @@ -96,5 +96,11 @@ class Test(unittest.TestCase): def testCalledNo(self): self.mock("called-no") + def testFiletransfer(self): + self.mock("filetransfer") + + def testGroupRead(self): + self.mock("group-read") + if __name__ == '__main__': unittest.main() diff --git a/root_commands.c b/root_commands.c index d4adfa81..6188245d 100644 --- a/root_commands.c +++ b/root_commands.c @@ -1290,6 +1290,29 @@ static void cmd_group( irc_t *irc, char **cmd ) } irc_rootmsg( irc, "End of group list" ); } + else if( g_strncasecmp(cmd[1], "info", len ) == 0 ) + { + bee_group_t *bg; + int n = 0; + + MIN_ARGS(2); + bg = bee_group_by_name( irc->b, cmd[2], FALSE ); + + if( bg ) + { + if( strchr(irc->umode, 'b') ) + irc_rootmsg( irc, "Members of %s:", cmd[2] ); + for( l = irc->b->users; l; l = l->next ) + { + bee_user_t *bu = l->data; + if( bu->group == bg ) + irc_rootmsg( irc, "%d. %s", n ++, bu->nick ? : bu->handle ); + } + irc_rootmsg( irc, "End of member list" ); + } + else + irc_rootmsg( irc, "Unknown group: %s. Please use \x02group list\x02 to get a list of available groups.", cmd[2] ); + } else { irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] ); |