aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--skype/README5
-rw-r--r--skype/skype.c36
2 files changed, 38 insertions, 3 deletions
diff --git a/skype/README b/skype/README
index 5515ccc7..00346539 100644
--- a/skype/README
+++ b/skype/README
@@ -242,9 +242,10 @@ your VNC server regularly. (How ugly.)
* `account set skype/call nick`
* `account set -del skype/call`
-== What needs to be done (aka. TODO)
+- Managing incoming calls via questions, just like when you add / remove
+ contacts.
-- Add support for accepting/rejecting calls via settings.
+== What needs to be done (aka. TODO)
- Notice if foo invites bar. Currently you can see only that bar joined.
diff --git a/skype/skype.c b/skype/skype.c
index 4a808fc1..9134fbb0 100644
--- a/skype/skype.c
+++ b/skype/skype.c
@@ -119,6 +119,7 @@ struct skype_away_state
struct skype_buddy_ask_data
{
struct im_connection *ic;
+ /* This is also used for call IDs for simplicity */
char *handle;
};
@@ -194,6 +195,33 @@ void skype_buddy_ask( struct im_connection *ic, char *handle, char *message)
g_free( buf );
}
+static void skype_call_ask_yes( gpointer w, struct skype_buddy_ask_data *bla )
+{
+ char *buf = g_strdup_printf("SET CALL %s STATUS INPROGRESS", bla->handle);
+ skype_write( bla->ic, buf, strlen( buf ) );
+ g_free(buf);
+ g_free(bla->handle);
+ g_free(bla);
+}
+
+static void skype_call_ask_no( gpointer w, struct skype_buddy_ask_data *bla )
+{
+ char *buf = g_strdup_printf("SET CALL %s STATUS FINISHED", bla->handle);
+ skype_write( bla->ic, buf, strlen( buf ) );
+ g_free(buf);
+ g_free(bla->handle);
+ g_free(bla);
+}
+
+void skype_call_ask( struct im_connection *ic, char *call_id, char *message)
+{
+ struct skype_buddy_ask_data *bla = g_new0( struct skype_buddy_ask_data, 1 );
+
+ bla->ic = ic;
+ bla->handle = g_strdup(call_id);
+
+ imcb_ask( ic, message, bla, skype_call_ask_yes, skype_call_ask_no );
+}
struct groupchat *skype_chat_by_name( struct im_connection *ic, char *name )
{
struct groupchat *ret;
@@ -566,6 +594,9 @@ static gboolean skype_read_callback( gpointer data, gint fd, b_input_condition c
info++;
if(!strcmp(info, "STATUS RINGING"))
{
+ if(sd->call_id)
+ g_free(sd->call_id);
+ sd->call_id = g_strdup(id);
g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
skype_write( ic, buf, strlen( buf ) );
sd->call_status = SKYPE_CALL_RINGING;
@@ -618,7 +649,10 @@ static gboolean skype_read_callback( gpointer data, gint fd, b_input_condition c
if(sd->call_out)
imcb_log(ic, "You are currently ringing the user %s.", info);
else
- imcb_log(ic, "The user %s is currently ringing you.", info);
+ {
+ g_snprintf(buf, 1024, "The user %s is currently ringing you.", info);
+ skype_call_ask(ic, sd->call_id, buf);
+ }
break;
case SKYPE_CALL_MISSED:
imcb_log(ic, "You have missed a call from user %s.", info);