Changeset 71c4bb6


Ignore:
Timestamp:
2010-12-13T02:22:20Z (13 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
451f121
Parents:
77aa416
Message:

Adding /ctcp call|hangup support

Location:
skype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skype/README

    r77aa416 r71c4bb6  
    307307  communication is encrypted.
    308308
    309 - Managing outgoing calls (with call duration at the end, including
    310   SkypeOut calls if you use a phone number instead of a nick):
    311 
    312   * `account skype set call nick`
    313   * `account skype set -del skype/call`
     309- Managing outgoing calls (with call duration at the end):
     310
     311  * `/ctcp nick call`
     312  * `/ctcp nick hangup`
     313
     314- Managing outgoing SkypeOut or conference calls:
     315
     316  * `account skype set call +18005551234`
     317  * `account skype set call nick1 nick2`
     318  * `account skype set -del call`
    314319
    315320- Managing incoming calls via questions, just like when you add / remove
  • skype/skype.c

    r77aa416 r71c4bb6  
    11181118}
    11191119
     1120static void skype_call(struct im_connection *ic, char *value) {
     1121        char *nick = g_strdup(value);
     1122        char *ptr = strchr(nick, '@');
     1123
     1124        if (ptr)
     1125                *ptr = '\0';
     1126        skype_printf(ic, "CALL %s", nick);
     1127        g_free(nick);
     1128}
     1129
     1130static void skype_hangup(struct im_connection *ic)
     1131{
     1132        struct skype_data *sd = ic->proto_data;
     1133
     1134        if (sd->call_id) {
     1135                skype_printf(ic, "SET CALL %s STATUS FINISHED",
     1136                                sd->call_id);
     1137                g_free(sd->call_id);
     1138                sd->call_id = 0;
     1139        } else
     1140                imcb_error(ic, "There are no active calls currently.");
     1141}
     1142
    11201143static char *skype_set_call(set_t *set, char *value)
    11211144{
    11221145        account_t *acc = set->data;
    11231146        struct im_connection *ic = acc->ic;
    1124         struct skype_data *sd = ic->proto_data;
    1125         char *nick, *ptr;
     1147        char *nick;
    11261148
    11271149        if (value) {
     
    11311153                /* We are starting a call */
    11321154                if (u)
    1133                         nick = g_strdup(u->handle);
     1155                        nick = u->handle;
    11341156                else
    11351157#endif
    1136                         nick = g_strdup(value);
    1137                 ptr = strchr(nick, '@');
    1138                 if (ptr)
    1139                         *ptr = '\0';
    1140 
    1141                 skype_printf(ic, "CALL %s", nick);
    1142                 g_free(nick);
    1143         } else {
    1144                 /* We are ending a call */
    1145                 if (sd->call_id) {
    1146                         skype_printf(ic, "SET CALL %s STATUS FINISHED",
    1147                                 sd->call_id);
    1148                         g_free(sd->call_id);
    1149                         sd->call_id = NULL;
    1150                 } else
    1151                         imcb_error(ic, "There are no active calls currently.");
    1152         }
     1158                        nick = value;
     1159                skype_call(ic, nick);
     1160        } else
     1161                skype_hangup(ic);
    11531162        return value;
    11541163}
     
    13141323}
    13151324
     1325#if BITLBEE_VERSION_CODE >= BITLBEE_VER(3, 0, 1)
     1326GList *skype_buddy_action_list( bee_user_t *bu )
     1327{
     1328        static GList *ret = NULL;
     1329
     1330        if (ret == NULL)
     1331        {
     1332                static const struct buddy_action ba[3] = {
     1333                        {"CALL", "Initiate a call" },
     1334                        {"HANGUP", "Hang up a call" },
     1335                };
     1336
     1337                ret = g_list_prepend(ret, (void*) ba + 0);
     1338        }
     1339
     1340        return ret;
     1341}
     1342
     1343void *skype_buddy_action( struct bee_user *bu, const char *action, char * const args[], void *data )
     1344{
     1345        if (!g_strcasecmp(action, "CALL")) {
     1346                skype_call(bu->ic, bu->handle);
     1347        } else if (!g_strcasecmp(action, "HANGUP")) {
     1348                skype_hangup(bu->ic);
     1349        }
     1350
     1351        return NULL;
     1352}
     1353#endif
     1354
    13161355void init_plugin(void)
    13171356{
     
    13351374        ret->handle_cmp = g_strcasecmp;
    13361375        ret->chat_topic = skype_chat_topic;
     1376#if BITLBEE_VERSION_CODE >= BITLBEE_VER(3, 0, 1)
     1377        ret->buddy_action_list = skype_buddy_action_list;
     1378        ret->buddy_action = skype_buddy_action;
     1379#endif
    13371380        register_protocol(ret);
    13381381}
Note: See TracChangeset for help on using the changeset viewer.