Changeset 89db90e for protocols


Ignore:
Timestamp:
2015-03-12T09:10:16Z (10 years ago)
Author:
dequis <dx@…>
Children:
fc650a8
Parents:
0e4c3dd (diff), 3bb333c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'develop' into feat/hip-cat

Location:
protocols
Files:
1 added
17 edited

Legend:

Unmodified
Added
Removed
  • protocols/bee.h

    r0e4c3dd r89db90e  
    154154G_MODULE_EXPORT void imcb_buddy_times(struct im_connection *ic, const char *handle, time_t login, time_t idle);
    155155/* Call when a handle says something. 'flags' and 'sent_at may be just 0. */
    156 G_MODULE_EXPORT void imcb_buddy_msg(struct im_connection *ic, const char *handle, char *msg, guint32 flags,
     156G_MODULE_EXPORT void imcb_buddy_msg(struct im_connection *ic, const char *handle, const char *msg, guint32 flags,
    157157                                    time_t sent_at);
    158158
  • protocols/bee_user.c

    r0e4c3dd r89db90e  
    6868        }
    6969
     70        bee->users = g_slist_remove(bee->users, bu);
     71
    7072        g_free(bu->handle);
    7173        g_free(bu->fullname);
     
    7476        g_free(bu->status_msg);
    7577        g_free(bu);
    76 
    77         bee->users = g_slist_remove(bee->users, bu);
    7878
    7979        return 1;
     
    247247}
    248248
    249 void imcb_buddy_msg(struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at)
     249void imcb_buddy_msg(struct im_connection *ic, const char *handle, const char *msg, uint32_t flags, time_t sent_at)
    250250{
    251251        bee_t *bee = ic->bee;
  • protocols/jabber/s5bytestream.c

    r0e4c3dd r89db90e  
    2323
    2424#include "jabber.h"
    25 #include "sha1.h"
    2625#include "lib/ftutil.h"
    2726#include <poll.h>
     
    4241
    4342        /* SHA1( SID + Initiator JID + Target JID) */
    44         char *pseudoadr;
     43        char *pseudoaddr;
    4544
    4645        gint connect_timeout;
     
    130129        }
    131130
    132         g_free(bt->pseudoadr);
     131        g_free(bt->pseudoaddr);
    133132
    134133        while (bt->streamhosts) {
     
    254253}
    255254
     255void jabber_bs_remove_events(struct bs_transfer *bt)
     256{
     257        struct jabber_transfer *tf = bt->tf;
     258
     259        if (tf->watch_out) {
     260                b_event_remove(tf->watch_out);
     261                tf->watch_out = 0;
     262        }
     263
     264        if (tf->watch_in) {
     265                b_event_remove(tf->watch_in);
     266                tf->watch_in = 0;
     267        }
     268
     269        if (tf->fd != -1) {
     270                closesocket(tf->fd);
     271                tf->fd = -1;
     272        }
     273
     274        if (bt->connect_timeout) {
     275                b_event_remove(bt->connect_timeout);
     276                bt->connect_timeout = 0;
     277        }
     278}
     279
    256280/* Bad luck */
    257281void jabber_bs_canceled(file_transfer_t *ft, char *reason)
     
    260284
    261285        imcb_log(tf->ic, "File transfer aborted: %s", reason);
     286}
     287
     288static struct jabber_transfer *get_ft_by_sid(GSList *tflist, char *sid) {
     289        GSList *l;
     290        for (l = tflist; l; l = g_slist_next(l)) {
     291                struct jabber_transfer *tft = l->data;
     292                if ((strcmp(tft->sid, sid) == 0)) {
     293                        return tft;
     294                }
     295        }
     296        return NULL;
     297}
     298
     299/* SHA1( SID + Initiator JID + Target JID ) is given to the streamhost which it will match against the initiator's value
     300 * Returns a newly allocated string */
     301static char *generate_pseudoaddr(char *sid, char *ini_jid, char *tgt_jid) {
     302        char *contents = g_strconcat(sid, ini_jid, tgt_jid, NULL);
     303        char *hash_hex = g_compute_checksum_for_string(G_CHECKSUM_SHA1, contents, -1);
     304        g_free(contents);
     305        return hash_hex;
     306}
     307
     308static jabber_streamhost_t *jabber_streamhost_new(char *jid, char *host, int port)
     309{
     310        jabber_streamhost_t *sh = g_new0(jabber_streamhost_t, 1);
     311        sh->jid = g_strdup(jid);
     312        sh->host = g_strdup(host);
     313        if (port) {
     314                g_snprintf(sh->port, sizeof(sh->port), "%u", port);
     315        }
     316        return sh;
    262317}
    263318
     
    270325        struct jabber_data *jd = ic->proto_data;
    271326        struct jabber_transfer *tf = NULL;
    272         GSList *tflist;
    273327        struct bs_transfer *bt;
    274328        GSList *shlist = NULL;
    275329        struct xt_node *shnode;
    276 
    277         sha1_state_t sha;
    278         char hash_hex[41];
    279         unsigned char hash[20];
    280         int i;
    281330
    282331        if (!(iq_id   = xt_find_attr(node, "id")) ||
     
    303352                    (port_s = xt_find_attr(shnode, "port")) &&
    304353                    (sscanf(port_s, "%d", &port) == 1)) {
    305                         jabber_streamhost_t *sh = g_new0(jabber_streamhost_t, 1);
    306                         sh->jid = g_strdup(jid);
    307                         sh->host = g_strdup(host);
    308                         sprintf(sh->port, "%u", port);
    309                         shlist = g_slist_append(shlist, sh);
     354                        shlist = g_slist_append(shlist, jabber_streamhost_new(jid, host, port));
    310355                }
    311356                shnode = shnode->next;
     
    317362        }
    318363
    319         /* Let's see if we can find out what this bytestream should be for... */
    320 
    321         for (tflist = jd->filetransfers; tflist; tflist = g_slist_next(tflist)) {
    322                 struct jabber_transfer *tft = tflist->data;
    323                 if ((strcmp(tft->sid, sid) == 0) &&
    324                     (strcmp(tft->ini_jid, ini_jid) == 0) &&
    325                     (strcmp(tft->tgt_jid, tgt_jid) == 0)) {
    326                         tf = tft;
    327                         break;
    328                 }
    329         }
    330 
    331         if (!tf) {
     364        if (!(tf = get_ft_by_sid(jd->filetransfers, sid))) {
    332365                imcb_log(ic, "WARNING: Received bytestream request from %s that doesn't match an SI request", ini_jid);
    333366                return XT_HANDLED;
     
    339372
    340373        tf->ft->canceled = jabber_bs_canceled;
    341 
    342         /* SHA1( SID + Initiator JID + Target JID ) is given to the streamhost which it will match against the initiator's value */
    343         sha1_init(&sha);
    344         sha1_append(&sha, (unsigned char *) sid, strlen(sid));
    345         sha1_append(&sha, (unsigned char *) ini_jid, strlen(ini_jid));
    346         sha1_append(&sha, (unsigned char *) tgt_jid, strlen(tgt_jid));
    347         sha1_finish(&sha, hash);
    348 
    349         for (i = 0; i < 20; i++) {
    350                 sprintf(hash_hex + i * 2, "%02x", hash[i]);
    351         }
    352374
    353375        bt = g_new0(struct bs_transfer, 1);
     
    356378        bt->sh = shlist->data;
    357379        bt->phase = BS_PHASE_CONNECT;
    358         bt->pseudoadr = g_strdup(hash_hex);
     380        bt->pseudoaddr = generate_pseudoaddr(sid, ini_jid, tgt_jid);
    359381        tf->streamhandle = bt;
    360382        tf->ft->free = jabber_bs_free_transfer;
     
    451473                        .rsv = 0,
    452474                        .atyp = 0x03,
    453                         .addrlen = strlen(bt->pseudoadr),
     475                        .addrlen = strlen(bt->pseudoaddr),
    454476                        .port = 0
    455477                };
     
    468490
    469491                /* copy hash into connect message */
    470                 memcpy(socks5_connect.address, bt->pseudoadr, socks5_connect.addrlen);
     492                memcpy(socks5_connect.address, bt->pseudoaddr, socks5_connect.addrlen);
    471493
    472494                ASSERTSOCKOP(send(fd, &socks5_connect, sizeof(struct socks5_message), 0), "Sending SOCKS5 Connect");
     
    558580        if (shlist && shlist->next) {
    559581                bt->sh = shlist->next->data;
     582                jabber_bs_remove_events(bt);
    560583                return jabber_bs_recv_handshake(bt, -1, 0);
    561584        }
     
    731754        struct jabber_data *jd = ic->proto_data;
    732755        struct bs_transfer *bt;
    733         GSList *tflist;
    734756        struct xt_node *c;
    735757        char *sid, *jid;
     
    750772        /* Let's see if we can find out what this bytestream should be for... */
    751773
    752         for (tflist = jd->filetransfers; tflist; tflist = g_slist_next(tflist)) {
    753                 struct jabber_transfer *tft = tflist->data;
    754                 if ((strcmp(tft->sid, sid) == 0)) {
    755                         tf = tft;
    756                         break;
    757                 }
    758         }
    759 
    760         if (!tf) {
     774        if (!(tf = get_ft_by_sid(jd->filetransfers, sid))) {
    761775                imcb_log(ic, "WARNING: Received SOCKS5 bytestream reply to unknown request");
    762776                return XT_HANDLED;
     
    776790                /* using a proxy, abort listen */
    777791
    778                 if (tf->watch_in) {
    779                         b_event_remove(tf->watch_in);
    780                         tf->watch_in = 0;
    781                 }
    782 
    783                 if (tf->fd != -1) {
    784                         closesocket(tf->fd);
    785                         tf->fd = -1;
    786                 }
    787 
    788                 if (bt->connect_timeout) {
    789                         b_event_remove(bt->connect_timeout);
    790                         bt->connect_timeout = 0;
    791                 }
     792                jabber_bs_remove_events(bt);
    792793
    793794                GSList *shlist;
     
    838839{
    839840        char *sid;
    840         GSList *tflist;
    841841        struct jabber_transfer *tf = NULL;
    842842        struct xt_node *query;
     
    846846        sid = xt_find_attr(query, "sid");
    847847
    848         for (tflist = jd->filetransfers; tflist; tflist = g_slist_next(tflist)) {
    849                 struct jabber_transfer *tft = tflist->data;
    850                 if ((strcmp(tft->sid, sid) == 0)) {
    851                         tf = tft;
    852                         break;
    853                 }
    854         }
    855 
    856         if (!tf) {
     848        if (!(tf = get_ft_by_sid(jd->filetransfers, sid))) {
    857849                imcb_log(ic, "WARNING: Received SOCKS5 bytestream activation for unknown stream");
    858850                return XT_HANDLED;
     
    883875        *port++ = '\0';
    884876
    885         sh = g_new0(jabber_streamhost_t, 1);
    886         sh->jid = g_strdup(jid);
    887         sh->host = g_strdup(host);
    888         g_snprintf(sh->port, sizeof(sh->port), "%s", port);
     877        sh = jabber_streamhost_new(jid, host, 0);
     878        strncpy(sh->port, port, sizeof(sh->port));
    889879
    890880        return sh;
     
    910900                if (strcmp(proxy, "<local>") == 0) {
    911901                        if ((tf->fd = ft_listen(&tf->saddr, host, port, jd->fd, FALSE, &errmsg)) != -1) {
    912                                 sh = g_new0(jabber_streamhost_t, 1);
    913                                 sh->jid = g_strdup(tf->ini_jid);
    914                                 sh->host = g_strdup(host);
    915                                 g_snprintf(sh->port, sizeof(sh->port), "%s", port);
     902                                sh = jabber_streamhost_new(tf->ini_jid, host, 0);
     903                                strncpy(sh->port, port, sizeof(sh->port));
    916904                                bt->streamhosts = g_slist_append(bt->streamhosts, sh);
    917905
     
    948936{
    949937        struct bs_transfer *bt;
    950         sha1_state_t sha;
    951         char hash_hex[41];
    952         unsigned char hash[20];
    953         int i, ret;
    954 
    955         /* SHA1( SID + Initiator JID + Target JID ) is given to the streamhost which it will match against the initiator's value */
    956         sha1_init(&sha);
    957         sha1_append(&sha, (unsigned char *) tf->sid, strlen(tf->sid));
    958         sha1_append(&sha, (unsigned char *) tf->ini_jid, strlen(tf->ini_jid));
    959         sha1_append(&sha, (unsigned char *) tf->tgt_jid, strlen(tf->tgt_jid));
    960         sha1_finish(&sha, hash);
    961 
    962         for (i = 0; i < 20; i++) {
    963                 sprintf(hash_hex + i * 2, "%02x", hash[i]);
    964         }
    965938
    966939        bt = g_new0(struct bs_transfer, 1);
    967940        bt->tf = tf;
    968941        bt->phase = BS_PHASE_CONNECT;
    969         bt->pseudoadr = g_strdup(hash_hex);
     942        bt->pseudoaddr = generate_pseudoaddr(tf->sid, tf->ini_jid, tf->tgt_jid);
    970943        tf->streamhandle = bt;
    971944        tf->ft->free = jabber_bs_free_transfer;
     
    974947        jabber_si_set_proxies(bt);
    975948
    976         ret = jabber_bs_send_request(tf, bt->streamhosts);
    977 
    978         return ret;
     949        return jabber_bs_send_request(tf, bt->streamhosts);
    979950}
    980951
     
    11391110                                               socks5_connect.atyp);
    11401111                }
    1141                 if (!(memcmp(socks5_connect.address, bt->pseudoadr, 40) == 0)) {
     1112                if (!(memcmp(socks5_connect.address, bt->pseudoaddr, 40) == 0)) {
    11421113                        return jabber_bs_abort(bt, "SOCKS5 Connect message contained wrong digest");
    11431114                }
  • protocols/jabber/sasl.c

    r0e4c3dd r89db90e  
    4242        "https://www.facebook.com/dialog/oauth",
    4343        "https://graph.facebook.com/oauth/access_token",
    44         "http://www.bitlbee.org/main.php/Facebook/oauth2.html",
     44        "https://www.bitlbee.org/main.php/Facebook/oauth2.html",
    4545        "offline_access,xmpp_login",
    4646        "126828914005625",
  • protocols/msn/msn.c

    r0e4c3dd r89db90e  
    4141        s->flags |= SET_NOSAVE | ACC_SET_ONLINE_ONLY;
    4242
    43         s = set_add(&acc->set, "server", MSN_NS_HOST, set_eval_account, acc);
     43        s = set_add(&acc->set, "server", NULL, set_eval_account, acc);
    4444        s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
    4545
     
    5858        struct im_connection *ic = imcb_new(acc);
    5959        struct msn_data *md = g_new0(struct msn_data, 1);
     60        char *server = set_getstr(&ic->acc->set, "server");
    6061
    6162        ic->proto_data = md;
    6263        ic->flags |= OPT_PONGS | OPT_PONGED;
     64
     65        if (!server) {
     66                imcb_error(ic, "The msn protocol is disabled in this version because most servers disabled MSNP18 over port 1863.");
     67                imcb_error(ic, "If you find a working server, you can change the 'server' setting of this account. Good luck!");
     68                imcb_error(ic, "See also: http://ismsndeadyet.com/"); // shameless plug
     69                imc_logout(ic, FALSE);
     70                return;
     71        }
    6372
    6473        if (strchr(acc->user, '@') == NULL) {
     
    7685
    7786        imcb_log(ic, "Connecting");
    78         msn_ns_connect(ic, md->ns,
    79                        set_getstr(&ic->acc->set, "server"),
     87        msn_ns_connect(ic, md->ns, server,
    8088                       set_getint(&ic->acc->set, "port"));
    8189}
     
    112120                while (md->groups) {
    113121                        struct msn_group *mg = md->groups->data;
     122                        md->groups = g_slist_remove(md->groups, mg);
    114123                        g_free(mg->id);
    115124                        g_free(mg->name);
    116125                        g_free(mg);
    117                         md->groups = g_slist_remove(md->groups, mg);
    118126                }
    119127
     
    127135                while (md->grpq) {
    128136                        struct msn_groupadd *ga = md->grpq->data;
     137                        md->grpq = g_slist_remove(md->grpq, ga);
    129138                        g_free(ga->group);
    130139                        g_free(ga->who);
    131140                        g_free(ga);
    132                         md->grpq = g_slist_remove(md->grpq, ga);
    133141                }
    134142
  • protocols/msn/ns.c

    r0e4c3dd r89db90e  
    944944                struct msn_message *m = (*msgq)->data;
    945945
     946                *msgq = g_slist_remove(*msgq, m);
    946947                g_free(m->who);
    947948                g_free(m->text);
    948949                g_free(m);
    949 
    950                 *msgq = g_slist_remove(*msgq, m);
    951         }
    952 }
     950        }
     951}
  • protocols/msn/sb.c

    r0e4c3dd r89db90e  
    519519                                        }
    520520                                }
     521                                sb->msgq = g_slist_remove(sb->msgq, m);
    521522                                g_free(m->text);
    522523                                g_free(m->who);
    523524                                g_free(m);
    524 
    525                                 sb->msgq = g_slist_remove(sb->msgq, m);
    526525                        }
    527526
  • protocols/msn/soap.h

    r0e4c3dd r89db90e  
    167167
    168168#define SOAP_MEMLIST_PAYLOAD \
    169         "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\"><serviceFilter xmlns=\"http://www.msn.com/webservices/AddressBook\"><Types xmlns=\"http://www.msn.com/webservices/AddressBook\"><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Messenger</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Invitation</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">SocialNetwork</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Space</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Profile</ServiceType></Types></serviceFilter>" \
     169        "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\"><serviceFilter><Types><ServiceType>Messenger</ServiceType><ServiceType>IMAvailability</ServiceType></Types></serviceFilter><expandMembership>true</expandMembership>" \
    170170        "</FindMembership>"
    171171
  • protocols/nogaim.h

    r0e4c3dd r89db90e  
    180180        void (* set_away)       (struct im_connection *, char *state, char *message);
    181181        /* Implementing this function is optional. */
    182         void (* get_away)       (struct im_connection *, char *who);
    183         /* Implementing this function is optional. */
    184182        int (* send_typing)    (struct im_connection *, char *who, int flags);
    185183
     
    195193        void (* rem_permit)     (struct im_connection *, char *who);
    196194        void (* rem_deny)       (struct im_connection *, char *who);
    197         /* Doesn't actually have UI hooks. Not used at all, can be removed. */
    198         void (* set_permit_deny)(struct im_connection *);
    199195
    200196        /* Request profile info. Free-formatted stuff, the IM module gives back
    201197           this info via imcb_log(). Implementing these are optional. */
    202198        void (* get_info)       (struct im_connection *, char *who);
    203         /* set_my_name is *DEPRECATED*, not used by the UI anymore. Use the
    204            display_name setting instead. */
    205         void (* set_my_name)    (struct im_connection *, char *name);
    206         void (* set_name)       (struct im_connection *, char *who, char *name);
    207199
    208200        /* Group chat stuff. */
  • protocols/oscar/oscar.c

    r0e4c3dd r89db90e  
    19141914}
    19151915
    1916 static void oscar_get_away(struct im_connection *g, char *who)
    1917 {
    1918         struct oscar_data *odata = (struct oscar_data *) g->proto_data;
    1919 
    1920         if (odata->icq) {
    1921                 /** FIXME(wilmer): Hmm, lost the ability to get away msgs here, do we care to get that back?
    1922                 struct buddy *budlight = imcb_find_buddy(g, who);
    1923                 if (budlight)
    1924                         if ((budlight->uc & 0xff80) >> 7)
    1925                                 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
    1926                                         aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xff80) >> 7);
    1927                 */
    1928         } else {
    1929                 aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_AWAYMESSAGE);
    1930         }
    1931 }
    1932 
    19331916static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
    19341917{
     
    27122695        ret->get_info = oscar_get_info;
    27132696        ret->set_away = oscar_set_away;
    2714         ret->get_away = oscar_get_away;
    27152697        ret->add_buddy = oscar_add_buddy;
    27162698        ret->remove_buddy = oscar_remove_buddy;
  • protocols/purple/ft-direct.c

    r0e4c3dd r89db90e  
    2828
    2929#include "bitlbee.h"
     30#include "bpurple.h"
    3031
    3132#include <stdarg.h>
     
    207208void purple_transfer_request(struct im_connection *ic, file_transfer_t *ft, char *handle)
    208209{
    209         PurpleAccount *pa = ic->proto_data;
     210        struct purple_data *pd = ic->proto_data;
    210211        struct prpl_xfer_data *px;
    211212
     
    213214           multi-threaded anyway. */
    214215        next_ft = ft;
    215         serv_send_file(purple_account_get_connection(pa), handle, ft->file_name);
     216        serv_send_file(purple_account_get_connection(pd->account), handle,
     217                       ft->file_name);
    216218
    217219        ft->write = prpl_xfer_write;
  • protocols/purple/ft.c

    r0e4c3dd r89db90e  
    2828
    2929#include "bitlbee.h"
     30#include "bpurple.h"
    3031
    3132#include <stdarg.h>
     
    285286{
    286287        struct prpl_xfer_data *px = ft->data;
    287         PurpleAccount *pa = px->ic->proto_data;
     288        struct purple_data *pd = px->ic->proto_data;
    288289
    289290        /* xfer_new() will pick up this variable. It's a hack but we're not
    290291           multi-threaded anyway. */
    291292        next_ft = ft;
    292         serv_send_file(purple_account_get_connection(pa), px->handle, px->fn);
     293        serv_send_file(purple_account_get_connection(pd->account),
     294                   px->handle, px->fn);
    293295}
    294296
  • protocols/purple/purple.c

    r0e4c3dd r89db90e  
    2323
    2424#include "bitlbee.h"
     25#include "bpurple.h"
    2526#include "help.h"
    2627
     
    4243{
    4344        GSList *i;
     45        struct purple_data *pd;
    4446
    4547        for (i = purple_connections; i; i = i->next) {
    46                 if (((struct im_connection *) i->data)->proto_data == pa) {
     48                pd = ((struct im_connection *) i->data)->proto_data;
     49                if (pd->account == pa) {
    4750                        return i->data;
    4851                }
     
    290293{
    291294        struct im_connection *ic = imcb_new(acc);
    292         PurpleAccount *pa;
     295        struct purple_data *pd;
    293296
    294297        if ((local_bee != NULL && local_bee != acc->bee) ||
     
    306309        purple_connections = g_slist_prepend(purple_connections, ic);
    307310
    308         ic->proto_data = pa = purple_account_new(acc->user, (char *) acc->prpl->data);
    309         purple_account_set_password(pa, acc->pass);
    310         purple_sync_settings(acc, pa);
    311 
    312         purple_account_set_enabled(pa, "BitlBee", TRUE);
     311        ic->proto_data = pd = g_new0(struct purple_data, 1);
     312        pd->account = purple_account_new(acc->user, (char *) acc->prpl->data);
     313        purple_account_set_password(pd->account, acc->pass);
     314        purple_sync_settings(acc, pd->account);
     315
     316        purple_account_set_enabled(pd->account, "BitlBee", TRUE);
    313317}
    314318
    315319static void purple_logout(struct im_connection *ic)
    316320{
    317         PurpleAccount *pa = ic->proto_data;
    318 
    319         purple_account_set_enabled(pa, "BitlBee", FALSE);
     321        struct purple_data *pd = ic->proto_data;
     322
     323        purple_account_set_enabled(pd->account, "BitlBee", FALSE);
    320324        purple_connections = g_slist_remove(purple_connections, ic);
    321         purple_accounts_remove(pa);
     325        purple_accounts_remove(pd->account);
     326        g_free(pd);
    322327}
    323328
     
    325330{
    326331        PurpleConversation *conv;
     332        struct purple_data *pd = ic->proto_data;
    327333
    328334        if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
    329                                                           who, ic->proto_data)) == NULL) {
     335                                                          who, pd->account)) == NULL) {
    330336                conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,
    331                                                ic->proto_data, who);
     337                                               pd->account, who);
    332338        }
    333339
     
    339345static GList *purple_away_states(struct im_connection *ic)
    340346{
    341         PurpleAccount *pa = ic->proto_data;
     347        struct purple_data *pd = ic->proto_data;
    342348        GList *st, *ret = NULL;
    343349
    344         for (st = purple_account_get_status_types(pa); st; st = st->next) {
     350        for (st = purple_account_get_status_types(pd->account); st; st = st->next) {
    345351                PurpleStatusPrimitive prim = purple_status_type_get_primitive(st->data);
    346352                if (prim != PURPLE_STATUS_AVAILABLE && prim != PURPLE_STATUS_OFFLINE) {
     
    354360static void purple_set_away(struct im_connection *ic, char *state_txt, char *message)
    355361{
    356         PurpleAccount *pa = ic->proto_data;
    357         GList *status_types = purple_account_get_status_types(pa), *st;
     362        struct purple_data *pd = ic->proto_data;
     363        GList *status_types = purple_account_get_status_types(pd->account), *st;
    358364        PurpleStatusType *pst = NULL;
    359365        GList *args = NULL;
     
    378384        }
    379385
    380         purple_account_set_status_list(pa, st ? purple_status_type_get_id(pst) : "away",
     386        purple_account_set_status_list(pd->account,
     387                                       st ? purple_status_type_get_id(pst) : "away",
    381388                                       TRUE, args);
    382389
     
    447454        PurpleBuddy *pb;
    448455        PurpleGroup *pg = NULL;
     456        struct purple_data *pd = ic->proto_data;
    449457
    450458        if (group && !(pg = purple_find_group(group))) {
     
    453461        }
    454462
    455         pb = purple_buddy_new((PurpleAccount *) ic->proto_data, who, NULL);
     463        pb = purple_buddy_new(pd->account, who, NULL);
    456464        purple_blist_add_buddy(pb, NULL, pg, NULL);
    457         purple_account_add_buddy((PurpleAccount *) ic->proto_data, pb);
    458 
    459         purple_gg_buddylist_export(((PurpleAccount *) ic->proto_data)->gc);
     465        purple_account_add_buddy(pd->account, pb);
     466
     467        purple_gg_buddylist_export(pd->account->gc);
    460468}
    461469
     
    463471{
    464472        PurpleBuddy *pb;
    465 
    466         pb = purple_find_buddy((PurpleAccount *) ic->proto_data, who);
     473        struct purple_data *pd = ic->proto_data;
     474
     475        pb = purple_find_buddy(pd->account, who);
    467476        if (pb != NULL) {
    468477                PurpleGroup *group;
    469478
    470479                group = purple_buddy_get_group(pb);
    471                 purple_account_remove_buddy((PurpleAccount *) ic->proto_data, pb, group);
     480                purple_account_remove_buddy(pd->account, pb, group);
    472481
    473482                purple_blist_remove_buddy(pb);
    474483        }
    475484
    476         purple_gg_buddylist_export(((PurpleAccount *) ic->proto_data)->gc);
     485        purple_gg_buddylist_export(pd->account->gc);
    477486}
    478487
    479488static void purple_add_permit(struct im_connection *ic, char *who)
    480489{
    481         PurpleAccount *pa = ic->proto_data;
    482 
    483         purple_privacy_permit_add(pa, who, FALSE);
     490        struct purple_data *pd = ic->proto_data;
     491
     492        purple_privacy_permit_add(pd->account, who, FALSE);
    484493}
    485494
    486495static void purple_add_deny(struct im_connection *ic, char *who)
    487496{
    488         PurpleAccount *pa = ic->proto_data;
    489 
    490         purple_privacy_deny_add(pa, who, FALSE);
     497        struct purple_data *pd = ic->proto_data;
     498
     499        purple_privacy_deny_add(pd->account, who, FALSE);
    491500}
    492501
    493502static void purple_rem_permit(struct im_connection *ic, char *who)
    494503{
    495         PurpleAccount *pa = ic->proto_data;
    496 
    497         purple_privacy_permit_remove(pa, who, FALSE);
     504        struct purple_data *pd = ic->proto_data;
     505
     506        purple_privacy_permit_remove(pd->account, who, FALSE);
    498507}
    499508
    500509static void purple_rem_deny(struct im_connection *ic, char *who)
    501510{
    502         PurpleAccount *pa = ic->proto_data;
    503 
    504         purple_privacy_deny_remove(pa, who, FALSE);
     511        struct purple_data *pd = ic->proto_data;
     512
     513        purple_privacy_deny_remove(pd->account, who, FALSE);
    505514}
    506515
    507516static void purple_get_info(struct im_connection *ic, char *who)
    508517{
    509         serv_get_info(purple_account_get_connection(ic->proto_data), who);
     518        struct purple_data *pd = ic->proto_data;
     519
     520        serv_get_info(purple_account_get_connection(pd->account), who);
    510521}
    511522
     
    517528{
    518529        PurpleTypingState state = PURPLE_NOT_TYPING;
    519         PurpleAccount *pa = ic->proto_data;
     530        struct purple_data *pd = ic->proto_data;
    520531
    521532        if (flags & OPT_TYPING) {
     
    525536        }
    526537
    527         serv_send_typing(purple_account_get_connection(pa), who, state);
     538        serv_send_typing(purple_account_get_connection(pd->account), who, state);
    528539
    529540        return 1;
     
    559570        /* There went my nice afternoon. :-( */
    560571
    561         PurpleAccount *pa = ic->proto_data;
    562         PurplePlugin *prpl = purple_plugins_find_with_id(pa->protocol_id);
     572        struct purple_data *pd = ic->proto_data;
     573        PurplePlugin *prpl = purple_plugins_find_with_id(pd->account->protocol_id);
    563574        PurplePluginProtocolInfo *pi = prpl->info->extra_info;
    564         PurpleBuddy *pb = purple_find_buddy((PurpleAccount *) ic->proto_data, who);
     575        PurpleBuddy *pb = purple_find_buddy(pd->account, who);
    565576        PurpleMenuAction *mi;
    566577        GList *menu;
     
    597608        PurpleConversation *pc = gc->data;
    598609        PurpleConvChat *pcc = PURPLE_CONV_CHAT(pc);
    599 
    600         serv_chat_invite(purple_account_get_connection(gc->ic->proto_data),
     610        struct purple_data *pd = gc->ic->proto_data;
     611
     612        serv_chat_invite(purple_account_get_connection(pd->account),
    601613                         purple_conv_chat_get_id(pcc),
    602614                         message && *message ? message : "Please join my chat",
     
    623635                                   set_t **sets)
    624636{
    625         PurpleAccount *pa = ic->proto_data;
    626         PurplePlugin *prpl = purple_plugins_find_with_id(pa->protocol_id);
     637        struct purple_data *pd = ic->proto_data;
     638        PurplePlugin *prpl = purple_plugins_find_with_id(pd->account->protocol_id);
    627639        PurplePluginProtocolInfo *pi = prpl->info->extra_info;
    628640        GHashTable *chat_hash;
     
    631643
    632644        if (!pi->chat_info || !pi->chat_info_defaults ||
    633             !(info = pi->chat_info(purple_account_get_connection(pa)))) {
     645            !(info = pi->chat_info(purple_account_get_connection(pd->account)))) {
    634646                imcb_error(ic, "Joining chatrooms not supported by this protocol");
    635647                return NULL;
    636648        }
    637649
    638         if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, room, pa))) {
     650        if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
     651                                                          room, pd->account))) {
    639652                purple_conversation_destroy(conv);
    640653        }
    641654
    642         chat_hash = pi->chat_info_defaults(purple_account_get_connection(pa), room);
     655        chat_hash = pi->chat_info_defaults(
     656                purple_account_get_connection(pd->account), room
     657        );
    643658
    644659        for (l = info; l; l = l->next) {
     
    654669        }
    655670
    656         serv_join_chat(purple_account_get_connection(pa), chat_hash);
     671        serv_join_chat(purple_account_get_connection(pd->account), chat_hash);
    657672
    658673        return NULL;
     
    10331048}
    10341049
     1050/* So it turns out some requests have no account context at all, because
     1051 * libpurple hates us. This means that query_del_by_conn() won't remove those
     1052 * on logout, and will segfault if the user replies. That's why this exists.
     1053 */
     1054static void prplcb_close_request(PurpleRequestType type, void *data)
     1055{
     1056        if (type == PURPLE_REQUEST_ACTION) {
     1057                struct prplcb_request_action_data *pqad = data;
     1058                query_del(local_bee->ui_data, pqad->bee_data);
     1059        }
     1060        /* Add the request input handler here when that becomes a thing */
     1061}
     1062
    10351063/*
    10361064static void prplcb_request_test()
     
    10471075        NULL,
    10481076        NULL,
    1049         NULL,
     1077        prplcb_close_request,
    10501078        NULL,
    10511079};
  • protocols/skype/Makefile

    r0e4c3dd r89db90e  
    66DATE := $(shell date +%Y-%m-%d)
    77INSTALL = install
    8 ASCIIDOC = yes
    98
    10 ifeq ($(ASCIIDOC),yes)
     9
     10ifdef ASCIIDOC
    1111MANPAGES = skyped.1
    1212else
     
    2929
    3030install-doc: doc
    31 ifeq ($(ASCIIDOC),yes)
     31ifdef ASCIIDOC
    3232        $(INSTALL) -d $(DESTDIR)$(MANDIR)/man1
    3333        $(INSTALL) -m644 $(MANPAGES) $(DESTDIR)$(MANDIR)/man1
  • protocols/twitter/twitter.c

    r0e4c3dd r89db90e  
    852852}
    853853
     854/* Parses a decimal or hex tweet ID, returns TRUE on success */
     855static gboolean twitter_parse_id(char *string, int base, guint64 *id)
     856{
     857        guint64 parsed;
     858        char *endptr;
     859
     860        errno = 0;
     861        parsed = g_ascii_strtoull(string, &endptr, base);
     862        if (errno || endptr == string || *endptr != '\0') {
     863                return FALSE;
     864        }
     865        *id = parsed;
     866        return TRUE;
     867}
     868
    854869/** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID
    855870 *  into a twitter tweet ID.
     
    879894                        arg++;
    880895                }
    881                 if (sscanf(arg, "%" G_GINT64_MODIFIER "x", &id) == 1 &&
    882                     id < TWITTER_LOG_LENGTH) {
     896                if (twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) {
    883897                        bu = td->log[id].bu;
    884898                        id = td->log[id].id;
     
    887901                                bu = NULL;
    888902                        }
    889                 } else if (sscanf(arg, "%" G_GINT64_MODIFIER "d", &id) == 1) {
     903                } else if (twitter_parse_id(arg, 10, &id)) {
    890904                        /* Allow normal tweet IDs as well; not a very useful
    891905                           feature but it's always been there. Just ignore
  • protocols/twitter/twitter_lib.c

    r0e4c3dd r89db90e  
    862862
    863863                imcb_error(ic, "Stream closed (%s)", req->status_string);
     864                if (req->status_code == 401) {
     865                        imcb_error(ic, "Check your system clock.");
     866                }
    864867                imc_logout(ic, TRUE);
    865868                return;
  • protocols/yahoo/yahoo.c

    r0e4c3dd r89db90e  
    733733                inp = l->data;
    734734                if (inp->h == tag) {
     735                        byahoo_inputs = g_slist_remove(byahoo_inputs, inp);
    735736                        g_free(inp->d);
    736737                        g_free(inp);
    737                         byahoo_inputs = g_slist_remove(byahoo_inputs, inp);
    738738                        break;
    739739                }
Note: See TracChangeset for help on using the changeset viewer.