Changeset 2eb4b1f


Ignore:
Timestamp:
2008-02-29T00:34:31Z (16 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
239b036
Parents:
9db0234
Message:

add support for account set -del skype/call
to finish an outgoing call

Location:
skype
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • skype/README

    r9db0234 r2eb4b1f  
    238238  communication is encrypted.
    239239
    240 - Starting calls: `account set skype/call nick`
     240- Managing outgoing calls:
     241
     242  * `account set skype/call nick`
     243  * `account set -del skype/call`
    241244
    242245== What needs to be done (aka. TODO)
  • skype/skype.c

    r9db0234 r2eb4b1f  
    4343        SKYPE_CALL_MISSED,
    4444        SKYPE_CALL_UNPLACED,
     45        SKYPE_CALL_CANCELLED,
    4546        /* This means we are ringing somebody, not somebody rings us. */
    4647        SKYPE_CALL_RINGING_OUT
     
    8081         * notification about the handle is in a given status. */
    8182        skype_call_status call_status;
     83        char *call_id;
    8284        /* Same for file transfers. */
    8385        skype_filetransfer_status filetransfer_status;
     
    576578                                                sd->call_status = SKYPE_CALL_MISSED;
    577579                                        }
     580                                        else if(!strcmp(info, "STATUS CANCELLED"))
     581                                        {
     582                                                g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
     583                                                skype_write( ic, buf, strlen( buf ) );
     584                                                sd->call_status = SKYPE_CALL_CANCELLED;
     585                                        }
    578586                                        else if(!strcmp(info, "STATUS UNPLACED"))
     587                                        {
     588                                                if(sd->call_id)
     589                                                        g_free(sd->call_id);
     590                                                /* Save the ID for later usage (Cancel/Finish). */
     591                                                sd->call_id = g_strdup(id);
    579592                                                sd->call_status = SKYPE_CALL_UNPLACED;
     593                                        }
    580594                                        else if(!strncmp(info, "PARTNER_HANDLE ", 15))
    581595                                        {
     
    592606                                                                case SKYPE_CALL_RINGING_OUT:
    593607                                                                        imcb_log(ic, "You are currently ringing the user %s.", info);
     608                                                                        break;
     609                                                                case SKYPE_CALL_CANCELLED:
     610                                                                        imcb_log(ic, "You cancelled the call to the user %s.", info);
    594611                                                                        break;
    595612                                                                default:
     
    908925        account_t *acc = set->data;
    909926        struct im_connection *ic = acc->ic;
     927        struct skype_data *sd = ic->proto_data;
    910928        char *nick, *ptr, *buf;
    911         user_t *u = user_find(acc->irc, value);
    912 
    913         if(!u)
     929
     930        if(value)
    914931        {
    915                 imcb_error(ic, "%s - no such nick", value);
    916                 return(value);
     932                user_t *u = user_find(acc->irc, value);
     933                /* We are starting a call */
     934                if(!u)
     935                {
     936                        imcb_error(ic, "%s - no such nick", value);
     937                        return(value);
     938                }
     939                nick = g_strdup(u->handle);
     940                ptr = strchr(nick, '@');
     941                if(ptr)
     942                        *ptr = '\0';
     943
     944                buf = g_strdup_printf("CALL %s", nick);
     945                skype_write( ic, buf, strlen( buf ) );
     946                g_free(buf);
     947                g_free(nick);
    917948        }
    918         nick = g_strdup(u->handle);
    919         ptr = strchr(nick, '@');
    920         if(ptr)
    921                 *ptr = '\0';
    922 
    923         buf = g_strdup_printf("CALL %s", nick);
    924         skype_write( ic, buf, strlen( buf ) );
    925         g_free(buf);
    926         g_free(nick);
     949        else
     950        {
     951                /* We are ending a call */
     952                if(sd->call_id)
     953                {
     954                        buf = g_strdup_printf("SET CALL %s STATUS FINISHED", sd->call_id);
     955                        skype_write( ic, buf, strlen( buf ) );
     956                        g_free(buf);
     957                }
     958                else
     959                {
     960                        imcb_error(ic, "There are no active calls currently.");
     961                }
     962        }
    927963        return(value);
    928964}
  • skype/skyped.py

    r9db0234 r2eb4b1f  
    5656                options.buf = None
    5757        else:
    58                 input = fd.recv(1024)
     58                try:
     59                        input = fd.recv(1024)
     60                except SysCallError:
     61                        return True
    5962                for i in input.split("\n"):
    6063                        skype.send(i.strip())
Note: See TracChangeset for help on using the changeset viewer.