Changeset 29ff5c2 for protocols


Ignore:
Timestamp:
2015-11-21T00:01:50Z (9 years ago)
Author:
dequis <dx@…>
Parents:
e4f08bf (diff), 8fdeaa5 (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 'master' into feat/hip-cat

Location:
protocols
Files:
63 edited

Legend:

Unmodified
Added
Removed
  • protocols/bee.h

    re4f08bf r29ff5c2  
    6262        BEE_USER_LOCAL = 256,   /* Locally-added contacts (not in real contact list) */
    6363        BEE_USER_SPECIAL = 512, /* Denotes a user as being special */
     64        BEE_USER_NOOTR = 4096,  /* Per-user version of OPT_NOOTR */
    6465} bee_user_flags_t;
    6566
     
    104105        gboolean (*user_status)(bee_t *bee, struct bee_user *bu, struct bee_user *old);
    105106        /* On every incoming message. sent_at = 0 means unknown. */
    106         gboolean (*user_msg)(bee_t *bee, bee_user_t *bu, const char *msg, time_t sent_at);
     107        gboolean (*user_msg)(bee_t *bee, bee_user_t *bu, const char *msg, guint32 flags, time_t sent_at);
    107108        /* Flags currently defined (OPT_TYPING/THINKING) in nogaim.h. */
    108109        gboolean (*user_typing)(bee_t *bee, bee_user_t *bu, guint32 flags);
     
    119120        /* System messages of any kind. */
    120121        gboolean (*chat_log)(bee_t *bee, struct groupchat *c, const char *text);
    121         gboolean (*chat_msg)(bee_t *bee, struct groupchat *c, bee_user_t *bu, const char *msg, time_t sent_at);
     122        gboolean (*chat_msg)(bee_t *bee, struct groupchat *c, bee_user_t *bu, const char *msg, guint32 flags, time_t sent_at);
    122123        gboolean (*chat_add_user)(bee_t *bee, struct groupchat *c, bee_user_t *bu);
    123         gboolean (*chat_remove_user)(bee_t *bee, struct groupchat *c, bee_user_t *bu);
     124        gboolean (*chat_remove_user)(bee_t *bee, struct groupchat *c, bee_user_t *bu, const char *reason);
    124125        gboolean (*chat_topic)(bee_t *bee, struct groupchat *c, const char *new_topic, bee_user_t *bu);
    125126        gboolean (*chat_name_hint)(bee_t *bee, struct groupchat *c, const char *name);
  • protocols/bee_chat.c

    re4f08bf r29ff5c2  
    104104}
    105105
    106 void imcb_chat_msg(struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at)
     106void imcb_chat_msg(struct groupchat *c, const char *who, char *msg, guint32 flags, time_t sent_at)
    107107{
    108108        struct im_connection *ic = c->ic;
    109109        bee_t *bee = ic->bee;
    110110        bee_user_t *bu;
    111         gboolean temp;
     111        gboolean temp = FALSE;
    112112        char *s;
    113113
    114         /* Gaim sends own messages through this too. IRC doesn't want this, so kill them */
    115         if (handle_is_self(ic, who)) {
     114        if (handle_is_self(ic, who) && !(flags & OPT_SELFMESSAGE)) {
    116115                return;
    117116        }
     
    131130
    132131        if (bee->ui->chat_msg) {
    133                 bee->ui->chat_msg(bee, c, bu, msg, sent_at);
     132                bee->ui->chat_msg(bee, c, bu, msg, flags, sent_at);
    134133        }
    135134
     
    239238
    240239        if (bee->ui->chat_remove_user && bu) {
    241                 bee->ui->chat_remove_user(bee, c, bu);
     240                bee->ui->chat_remove_user(bee, c, bu, reason);
    242241        }
    243242}
  • protocols/bee_user.c

    re4f08bf r29ff5c2  
    247247}
    248248
    249 void imcb_buddy_msg(struct im_connection *ic, const char *handle, const char *msg, uint32_t flags, time_t sent_at)
     249void imcb_buddy_msg(struct im_connection *ic, const char *handle, const char *msg, guint32 flags, time_t sent_at)
    250250{
    251251        bee_t *bee = ic->bee;
     
    265265
    266266        if (bee->ui->user_msg && bu) {
    267                 bee->ui->user_msg(bee, bu, msg, sent_at);
     267                bee->ui->user_msg(bee, bu, msg, flags, sent_at);
    268268        } else {
    269269                imcb_log(ic, "Message from unknown handle %s:\n%s", handle, msg);
     
    297297}
    298298
    299 void imcb_buddy_typing(struct im_connection *ic, const char *handle, uint32_t flags)
     299void imcb_buddy_typing(struct im_connection *ic, const char *handle, guint32 flags)
    300300{
    301301        bee_user_t *bu;
  • protocols/ft.h

    re4f08bf r29ff5c2  
    5858 *                                    | accept
    5959 *                                    V
    60  *                     /------ /-------------\                    /------------------------\
    61  *         out_of_data |       | TRANSFERING | -----------------> | TRANSFERING | CANCELED |
    62  *                     \-----> \-------------/  [canceled,]free   \------------------------/
     60 *                     /------ /-------------\                    /--------------------------\
     61 *         out_of_data |       | TRANSFERRING | -----------------> | TRANSFERRING | CANCELED |
     62 *                     \-----> \-------------/  [canceled,]free   \--------------------------/
    6363 *                                    |
    6464 *                                    | finished,free
    6565 *                                    V
    66  *                       /------------------------\
    67  *                       | TRANSFERING | FINISHED |
    68  *                       \------------------------/
     66 *                       /-------------------------\
     67 *                       | TRANSFERRING | FINISHED |
     68 *                       \-------------------------/
    6969 */
    7070typedef struct file_transfer {
     
    115115
    116116        /*
    117          * If set, called after succesful connection setup.
     117         * If set, called after successful connection setup.
    118118         */
    119119        void (*accept)(struct file_transfer *file);
  • protocols/jabber/conference.c

    re4f08bf r29ff5c2  
    2626
    2727static xt_status jabber_chat_join_failed(struct im_connection *ic, struct xt_node *node, struct xt_node *orig);
     28static xt_status jabber_chat_self_message(struct im_connection *ic, struct xt_node *node, struct xt_node *orig);
    2829
    2930struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password)
     
    127128}
    128129
     130static xt_status jabber_chat_self_message(struct im_connection *ic, struct xt_node *node, struct xt_node *orig)
     131{
     132        /* This is a self message sent by this bitlbee - just drop it */
     133        return XT_ABORT;
     134}
     135
    129136struct groupchat *jabber_chat_by_jid(struct im_connection *ic, const char *name)
    130137{
     
    171178        node = jabber_make_packet("message", "groupchat", jc->name, node);
    172179
    173         if (!jabber_write_packet(ic, node)) {
    174                 xt_free_node(node);
    175                 return 0;
    176         }
    177         xt_free_node(node);
    178 
    179         return 1;
     180        jabber_cache_add(ic, node, jabber_chat_self_message);
     181
     182        return !jabber_write_packet(ic, node);
    180183}
    181184
     
    299302                                        }
    300303                                }
    301 
    302                                 /* Some program-specific restrictions. */
    303                                 imcb_clean_handle(ic, bud->ext_jid);
    304304                        }
    305305                        bud->flags |= JBFLAG_IS_ANONYMOUS;
     
    331331        } else if (type) { /* type can only be NULL or "unavailable" in this function */
    332332                if ((bud->flags & JBFLAG_IS_CHATROOM) && bud->ext_jid) {
     333                        char *reason = NULL;
     334                        char *status = NULL;
     335                        char *status_text = NULL;
     336                       
     337                        if ((c = xt_find_node_by_attr(node->children, "x", "xmlns", XMLNS_MUC_USER))) {
     338                                struct xt_node *c2 = c->children;
     339
     340                                while ((c2 = xt_find_node(c2, "status"))) {
     341                                        char *code = xt_find_attr(c2, "code");
     342                                        if (g_strcmp0(code, "301") == 0) {
     343                                                status = "Banned";
     344                                                break;
     345                                        } else if (g_strcmp0(code, "303") == 0) {
     346                                                /* This could be handled in a cleverer way,
     347                                                 * but let's just show a literal part/join for now */
     348                                                status = "Changing nicks";
     349                                                break;
     350                                        } else if (g_strcmp0(code, "307") == 0) {
     351                                                status = "Kicked";
     352                                                break;
     353                                        }
     354                                        c2 = c2->next;
     355                                }
     356
     357                                /* Sometimes the status message is in presence/x/item/reason */
     358                                if ((c2 = xt_find_path(c, "item/reason")) && c2->text && c2->text_len) {
     359                                        status_text = c2->text;
     360                                }
     361                        }
     362
     363                        /* Sometimes the status message is right inside <presence> */
     364                        if ((c = xt_find_node(node->children, "status")) && c->text && c->text_len) {
     365                                status_text = c->text;
     366                        }
     367
     368                        if (status_text && status) {
     369                                reason = g_strdup_printf("%s: %s", status, status_text);
     370                        } else {
     371                                reason = g_strdup(status_text ? : status);
     372                        }
     373
    333374                        s = strchr(bud->ext_jid, '/');
    334375                        if (s) {
    335376                                *s = 0;
    336377                        }
    337                         imcb_chat_remove_buddy(chat, bud->ext_jid, NULL);
     378                        imcb_chat_remove_buddy(chat, bud->ext_jid, reason);
    338379                        if (bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS) {
    339                                 imcb_remove_buddy(ic, bud->ext_jid, NULL);
     380                                imcb_remove_buddy(ic, bud->ext_jid, reason);
    340381                        }
    341382                        if (s) {
    342383                                *s = '/';
    343384                        }
     385
     386                        g_free(reason);
    344387                }
    345388
     
    360403        char *final_from = NULL;
    361404        char *bare_jid = NULL;
     405        guint32 flags = 0;
    362406
    363407        from = (bud) ? bud->full_jid : xt_find_attr(node, "from");
     
    396440
    397441        if (subject && chat) {
    398                 char *subject_text = subject->text_len > 0 ? subject->text : NULL;
     442                char *subject_text = subject->text_len > 0 ? subject->text : "";
    399443                if (g_strcmp0(chat->topic, subject_text) != 0) {
    400444                        bare_jid = (bud) ? jabber_get_bare_jid(bud->ext_jid) : NULL;
     
    402446                                        jabber_get_timestamp(node));
    403447                        g_free(bare_jid);
     448                        bare_jid = NULL;
    404449                }
    405450        }
     
    422467                imcb_chat_log(chat, "From conference server: %s", body->text);
    423468                return;
    424         } else if (jc && jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me) {
    425                 /* exclude self-messages since they would get filtered out
    426                  * but not the ones in the backlog */
     469        } else if (jc && jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me &&
     470                   (jabber_cache_handle_packet(ic, node) == XT_ABORT)) {
     471                /* Self message marked by this bitlbee, don't show it */
    427472                return;
    428473        }
    429474
    430         if (bud && jc && bud != jc->me) {
     475        if (bud) {
    431476                bare_jid = jabber_get_bare_jid(bud->ext_jid ? bud->ext_jid : bud->full_jid);
    432477                final_from = bare_jid;
     478                flags = (bud == jc->me) ? OPT_SELFMESSAGE : 0;
    433479        } else {
    434480                final_from = nick;
    435481        }
    436482
    437         imcb_chat_msg(chat, final_from, body->text, 0, jabber_get_timestamp(node));
     483        imcb_chat_msg(chat, final_from, body->text, flags, jabber_get_timestamp(node));
    438484
    439485        g_free(bare_jid);
  • protocols/jabber/io.c

    re4f08bf r29ff5c2  
    147147}
    148148
    149 static gboolean jabber_read_callback(gpointer data, gint fd, b_input_condition cond)
    150 {
    151         struct im_connection *ic = data;
    152         struct jabber_data *jd = ic->proto_data;
    153         char buf[512];
    154         int st;
    155 
    156         if (jd->fd == -1) {
    157                 return FALSE;
    158         }
    159 
    160         if (jd->ssl) {
    161                 st = ssl_read(jd->ssl, buf, sizeof(buf));
    162         } else {
    163                 st = read(jd->fd, buf, sizeof(buf));
    164         }
    165 
    166         if (st > 0) {
    167                 /* Parse. */
    168                 if (xt_feed(jd->xt, buf, st) < 0) {
     149static gboolean jabber_feed_input(struct im_connection *ic, char *buf, int size)
     150{
     151        struct jabber_data *jd = ic->proto_data;
     152
     153        /* Allow not passing a size for debugging purposes.
     154         * This never happens when reading from the socket */
     155        if (size == -1) {
     156                size = strlen(buf);
     157        }
     158
     159        /* Parse. */
     160        if (xt_feed(jd->xt, buf, size) < 0) {
     161                imcb_error(ic, "XML stream error");
     162                imc_logout(ic, TRUE);
     163                return FALSE;
     164        }
     165
     166        /* Execute all handlers. */
     167        if (!xt_handle(jd->xt, NULL, 1)) {
     168                /* Don't do anything, the handlers should have
     169                   aborted the connection already. */
     170                return FALSE;
     171        }
     172
     173        if (jd->flags & JFLAG_STREAM_RESTART) {
     174                jd->flags &= ~JFLAG_STREAM_RESTART;
     175                jabber_start_stream(ic);
     176        }
     177
     178        /* Garbage collection. */
     179        xt_cleanup(jd->xt, NULL, 1);
     180
     181        /* This is a bit hackish, unfortunately. Although xmltree
     182           has nifty event handler stuff, it only calls handlers
     183           when nodes are complete. Since the server should only
     184           send an opening <stream:stream> tag, we have to check
     185           this by hand. :-( */
     186        if (!(jd->flags & JFLAG_STREAM_STARTED) && jd->xt && jd->xt->root) {
     187                if (g_strcasecmp(jd->xt->root->name, "stream:stream") == 0) {
     188                        jd->flags |= JFLAG_STREAM_STARTED;
     189
     190                        /* If there's no version attribute, assume
     191                           this is an old server that can't do SASL
     192                           authentication. */
     193                        if (!set_getbool(&ic->acc->set, "sasl") || !sasl_supported(ic)) {
     194                                /* If there's no version= tag, we suppose
     195                                   this server does NOT implement: XMPP 1.0,
     196                                   SASL and TLS. */
     197                                if (set_getbool(&ic->acc->set, "tls")) {
     198                                        imcb_error(ic, "TLS is turned on for this "
     199                                                   "account, but is not supported by this server");
     200                                        imc_logout(ic, FALSE);
     201                                        return FALSE;
     202                                } else {
     203                                        if (!jabber_init_iq_auth(ic)) {
     204                                                return FALSE;
     205                                        }
     206                                }
     207                        }
     208                } else {
    169209                        imcb_error(ic, "XML stream error");
    170210                        imc_logout(ic, TRUE);
    171211                        return FALSE;
    172212                }
    173 
    174                 /* Execute all handlers. */
    175                 if (!xt_handle(jd->xt, NULL, 1)) {
    176                         /* Don't do anything, the handlers should have
    177                            aborted the connection already. */
     213        }
     214
     215        return TRUE;
     216}
     217
     218
     219static gboolean jabber_read_callback(gpointer data, gint fd, b_input_condition cond)
     220{
     221        struct im_connection *ic = data;
     222        struct jabber_data *jd = ic->proto_data;
     223        char buf[512];
     224        int st;
     225
     226        if (jd->fd == -1) {
     227                return FALSE;
     228        }
     229
     230        if (jd->ssl) {
     231                st = ssl_read(jd->ssl, buf, sizeof(buf));
     232        } else {
     233                st = read(jd->fd, buf, sizeof(buf));
     234        }
     235
     236        if (st > 0) {
     237                if (!jabber_feed_input(ic, buf, st)) {
    178238                        return FALSE;
    179                 }
    180 
    181                 if (jd->flags & JFLAG_STREAM_RESTART) {
    182                         jd->flags &= ~JFLAG_STREAM_RESTART;
    183                         jabber_start_stream(ic);
    184                 }
    185 
    186                 /* Garbage collection. */
    187                 xt_cleanup(jd->xt, NULL, 1);
    188 
    189                 /* This is a bit hackish, unfortunately. Although xmltree
    190                    has nifty event handler stuff, it only calls handlers
    191                    when nodes are complete. Since the server should only
    192                    send an opening <stream:stream> tag, we have to check
    193                    this by hand. :-( */
    194                 if (!(jd->flags & JFLAG_STREAM_STARTED) && jd->xt && jd->xt->root) {
    195                         if (g_strcasecmp(jd->xt->root->name, "stream:stream") == 0) {
    196                                 jd->flags |= JFLAG_STREAM_STARTED;
    197 
    198                                 /* If there's no version attribute, assume
    199                                    this is an old server that can't do SASL
    200                                    authentication. */
    201                                 if (!set_getbool(&ic->acc->set, "sasl") || !sasl_supported(ic)) {
    202                                         /* If there's no version= tag, we suppose
    203                                            this server does NOT implement: XMPP 1.0,
    204                                            SASL and TLS. */
    205                                         if (set_getbool(&ic->acc->set, "tls")) {
    206                                                 imcb_error(ic, "TLS is turned on for this "
    207                                                            "account, but is not supported by this server");
    208                                                 imc_logout(ic, FALSE);
    209                                                 return FALSE;
    210                                         } else {
    211                                                 return jabber_init_iq_auth(ic);
    212                                         }
    213                                 }
    214                         } else {
    215                                 imcb_error(ic, "XML stream error");
    216                                 imc_logout(ic, TRUE);
    217                                 return FALSE;
    218                         }
    219239                }
    220240        } else if (st == 0 || (st < 0 && !ssl_sockerr_again(jd->ssl))) {
  • protocols/jabber/iq.c

    re4f08bf r29ff5c2  
    385385        struct xt_node *response;
    386386        struct jabber_data *jd = ic->proto_data;
    387 
    388         response = jabber_make_packet("iq", "result", g_strdup_printf("%s@%s", jd->username, jd->server), NULL);
     387       
     388        response = jabber_make_packet("iq", "result", jd->me, NULL);
    389389
    390390        jabber_cache_add(ic, response, NULL);
  • protocols/jabber/jabber.c

    re4f08bf r29ff5c2  
    8585                set_setstr(&acc->set, "server", "chat.hipchat.com");
    8686        } else {
    87                 s = set_add(&acc->set, "oauth", "false", set_eval_oauth, acc);
     87                set_add(&acc->set, "oauth", "false", set_eval_oauth, acc);
     88
     89                /* this reuses set_eval_oauth, which clears the password */
     90                set_add(&acc->set, "anonymous", "false", set_eval_oauth, acc);
    8891        }
    8992
     
    194197        } else {
    195198                jabber_connect(ic);
     199        }
     200}
     201
     202static void jabber_xmlconsole_enable(struct im_connection *ic)
     203{
     204        struct jabber_data *jd = ic->proto_data;
     205        const char *handle = JABBER_XMLCONSOLE_HANDLE;
     206        bee_user_t *bu;
     207       
     208        jd->flags |= JFLAG_XMLCONSOLE;
     209
     210        if (!(bu = bee_user_by_handle(ic->bee, ic, handle))) {
     211                bu = bee_user_new(ic->bee, ic, handle, 0);
     212                bu->flags |= BEE_USER_NOOTR;
    196213        }
    197214}
     
    263280
    264281        if (set_getbool(&acc->set, "xmlconsole")) {
    265                 jd->flags |= JFLAG_XMLCONSOLE;
    266                 /* Shouldn't really do this at this stage already, maybe. But
    267                    I think this shouldn't break anything. */
    268                 imcb_add_buddy(ic, JABBER_XMLCONSOLE_HANDLE, NULL);
     282                jabber_xmlconsole_enable(ic);
    269283        }
    270284
     
    331345        }
    332346        if (jd->fd >= 0) {
    333                 closesocket(jd->fd);
     347                proxy_disconnect(jd->fd);
    334348        }
    335349
     
    342356        }
    343357
    344         jabber_buddy_remove_all(ic);
     358        if (jd->buddies) {
     359                jabber_buddy_remove_all(ic);
     360        }
    345361
    346362        xt_free(jd->xt);
     
    469485static void jabber_add_buddy(struct im_connection *ic, char *who, char *group)
    470486{
    471         struct jabber_data *jd = ic->proto_data;
    472 
    473487        if (g_strcasecmp(who, JABBER_XMLCONSOLE_HANDLE) == 0) {
    474                 jd->flags |= JFLAG_XMLCONSOLE;
    475                 imcb_add_buddy(ic, JABBER_XMLCONSOLE_HANDLE, NULL);
     488                jabber_xmlconsole_enable(ic);
    476489                return;
    477490        }
     
    587600{
    588601        struct jabber_data *jd = ic->proto_data;
    589         struct jabber_buddy *bud;
     602        struct jabber_buddy *bud, *bare;
    590603
    591604        /* Enable typing notification related code from now. */
    592605        jd->flags |= JFLAG_WANT_TYPING;
    593606
    594         if ((bud = jabber_buddy_by_jid(ic, who, 0)) == NULL) {
     607        if ((bud = jabber_buddy_by_jid(ic, who, 0)) == NULL ||
     608            (bare = jabber_buddy_by_jid(ic, who, GET_BUDDY_BARE)) == NULL) {
    595609                /* Sending typing notifications to unknown buddies is
    596610                   unsupported for now. Shouldn't be a problem, I think. */
     
    598612        }
    599613
    600         if (bud->flags & JBFLAG_DOES_XEP85) {
     614
     615        if (bud->flags & JBFLAG_DOES_XEP85 || bare->flags & JBFLAG_DOES_XEP85) {
    601616                /* We're only allowed to send this stuff if we know the other
    602                    side supports it. */
     617                   side supports it. If the bare JID has the flag, all other
     618                   resources get it, too (That is the case in gtalk) */
    603619
    604620                struct xt_node *node;
  • protocols/jabber/jabber_util.c

    re4f08bf r29ff5c2  
    514514                } else if (bud->resource && (flags & GET_BUDDY_EXACT)) {
    515515                        /* We want an exact match, so in thise case there shouldn't be a /resource. */
    516                         return NULL;
     516                        if (head != bud && head->resource == NULL) {
     517                                return head;
     518                        } else {
     519                                return NULL;
     520                        }
    517521                } else if (bud->resource == NULL || bud->next == NULL) {
    518522                        /* No need for selection if there's only one option. */
  • protocols/jabber/message.c

    re4f08bf r29ff5c2  
    3737        if (!from) {
    3838                return XT_HANDLED; /* Consider this packet corrupted. */
     39        }
    3940
    40         }
    41         if (request && id) {
     41        if (request && id && g_strcmp0(type, "groupchat") != 0) {
    4242                /* Send a message receipt (XEP-0184), looking like this:
    43                  * <message
    44                  *  from='kingrichard@royalty.england.lit/throne'
    45                  *  id='bi29sg183b4v'
    46                  *  to='northumberland@shakespeare.lit/westminster'>
     43                 * <message from='...' id='...' to='...'>
    4744                 *  <received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>
    48                  * </message> */
     45                 * </message>
     46                 *
     47                 * MUC messages are excluded, since receipts aren't supposed to be sent over MUCs
     48                 * (XEP-0184 section 5.3) and replying to those may result in 'forbidden' errors.
     49                 */
    4950                struct xt_node *received, *receipt;
    5051
     
    142143                        imcb_buddy_typing(ic, from, OPT_TYPING);
    143144                }
    144                 /* No need to send a "stopped typing" signal when there's a message. */
    145                 else if (xt_find_node(node->children, "active") && (body == NULL)) {
     145                else if (xt_find_node(node->children, "active")) {
    146146                        bud->flags |= JBFLAG_DOES_XEP85;
    147                         imcb_buddy_typing(ic, from, 0);
     147
     148                        /* No need to send a "stopped typing" signal when there's a message. */
     149                        if (body == NULL) {
     150                                imcb_buddy_typing(ic, from, 0);
     151                        }
    148152                } else if (xt_find_node(node->children, "paused")) {
    149153                        bud->flags |= JBFLAG_DOES_XEP85;
  • protocols/jabber/s5bytestream.c

    re4f08bf r29ff5c2  
    8585                return jabber_bs_abort(bt, msg ": %s", strerror(errno)); }
    8686
    87 gboolean jabber_bs_abort(struct bs_transfer *bt, char *format, ...);
     87gboolean jabber_bs_abort(struct bs_transfer *bt, char *format, ...) G_GNUC_PRINTF(2, 3);
    8888void jabber_bs_canceled(file_transfer_t *ft, char *reason);
    8989void jabber_bs_free_transfer(file_transfer_t *ft);
     
    536536                 * that sends atyp=0 addrlen=0 and only 6 bytes (one less than one would expect).
    537537                 * Therefore I removed the wait for more bytes. Since we don't care about what else the proxy
    538                  * is sending, it shouldnt matter */
     538                 * is sending, it should not matter */
    539539
    540540                if (bt->tf->ft->sending) {
     
    559559 * An intelligent sender would probably specify himself as the first streamhost and
    560560 * a proxy as the second (Kopete and PSI are examples here). That way, a (potentially)
    561  * slow proxy is only used if neccessary. This of course also means, that the timeout
     561 * slow proxy is only used if necessary. This of course also means, that the timeout
    562562 * per streamhost should be kept short. If one or two firewalled adresses are specified,
    563563 * they have to timeout first before a proxy is tried.
  • protocols/jabber/sasl.c

    re4f08bf r29ff5c2  
    5454        struct xt_node *c, *reply;
    5555        char *s;
    56         int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_fb = 0;
    57         int want_oauth = FALSE, want_hipchat = FALSE;
     56        int sup_plain = 0, sup_digest = 0, sup_gtalk = 0, sup_fb = 0, sup_anonymous = 0;
     57        int want_oauth = FALSE, want_hipchat = FALSE, want_anonymous = FALSE;
    5858        GString *mechs;
    5959
     
    7474        }
    7575
     76        want_anonymous = set_getbool(&ic->acc->set, "anonymous");
    7677        want_oauth = set_getbool(&ic->acc->set, "oauth");
    7778        want_hipchat = (jd->flags & JFLAG_HIPCHAT);
     
    8485                } else if (c->text && g_strcasecmp(c->text, "DIGEST-MD5") == 0) {
    8586                        sup_digest = 1;
     87                } else if (c->text && g_strcasecmp(c->text, "ANONYMOUS") == 0) {
     88                        sup_anonymous = 1;
    8689                } else if (c->text && g_strcasecmp(c->text, "X-OAUTH2") == 0) {
    8790                        sup_gtalk = 1;
     
    142145                xt_free_node(reply);
    143146                return XT_ABORT;
    144         } else if (sup_digest) {
     147        } else if (want_anonymous && sup_anonymous) {
     148                xt_add_attr(reply, "mechanism", "ANONYMOUS");
     149
     150                /* Well, that was easy. */
     151        } else if (want_anonymous) {
     152                imcb_error(ic, "Anonymous login requested, but not supported by server");
     153                imc_logout(ic, FALSE);
     154                xt_free_node(reply);
     155                return XT_ABORT;
     156        } else if (sup_digest && !(jd->ssl && sup_plain)) {
     157                /* Only try DIGEST-MD5 if there's no SSL/TLS or if PLAIN isn't supported.
     158                 * Which in practice means "don't bother with DIGEST-MD5 most of the time".
     159                 * It's weak, pointless over TLS, and often breaks with some servers (hi openfire) */
     160
    145161                xt_add_attr(reply, "mechanism", "DIGEST-MD5");
    146162
  • protocols/jabber/si.c

    re4f08bf r29ff5c2  
    186186        jd->filetransfers = g_slist_prepend(jd->filetransfers, tf);
    187187
    188         /* query buddy's features and server's streaming proxies if neccessary */
     188        /* query buddy's features and server's streaming proxies if necessary */
    189189
    190190        if (!tf->bud->features) {
     
    283283
    284284        if (requestok) {
    285                 /* Figure out who the transfer should come frome... */
     285                /* Figure out who the transfer should come from... */
    286286
    287287                ext_jid = ini_jid;
     
    403403         * <iq from=... to=... id=...>
    404404         *      <si xmlns=si>
    405          *      [       <file xmlns=ft/>    ] <-- not neccessary
     405         *      [       <file xmlns=ft/>    ] <-- not necessary
    406406         *              <feature xmlns=feature>
    407407         *                      <x xmlns=xdata type=submit>
  • protocols/msn/ns.c

    re4f08bf r29ff5c2  
    3939static void msn_ns_send_adl(struct im_connection *ic);
    4040static void msn_ns_structured_message(struct msn_data *md, char *msg, int msglen, char **cmd);
    41 static void msn_ns_sdg(struct msn_data *md, char *who, char **parts, char *action);
     41static void msn_ns_sdg(struct msn_data *md, char *who, char **parts, char *action, gboolean selfmessage);
    4242static void msn_ns_nfy(struct msn_data *md, char *who, char **parts, char *action, gboolean is_put);
    4343
     
    475475}
    476476
     477/* returns newly allocated string */
     478static char *msn_ns_parse_header_address(struct msn_data *md, char *headers, char *header_name)
     479{
     480        char *semicolon = NULL;
     481        char *header = NULL;
     482        char *address = NULL;
     483
     484        if (!(header = get_rfc822_header(headers, header_name, 0))) {
     485                return NULL;
     486        }
     487
     488        /* either the semicolon or the end of the string */
     489        semicolon = strchr(header, ';') ? : (header + strlen(header));
     490
     491        address = g_strndup(header + 2, semicolon - header - 2);
     492
     493        g_free(header);
     494        return address;
     495}
     496
    477497static void msn_ns_structured_message(struct msn_data *md, char *msg, int msglen, char **cmd)
    478498{
    479499        char **parts = NULL;
    480         char *semicolon = NULL;
    481500        char *action = NULL;
    482         char *from = NULL;
    483501        char *who = NULL;
     502        gboolean selfmessage = FALSE;
    484503
    485504        parts = g_strsplit(msg, "\r\n\r\n", 4);
    486505
    487         if (!(from = get_rfc822_header(parts[0], "From", 0))) {
     506        if (!(who = msn_ns_parse_header_address(md, parts[0], "From"))) {
    488507                goto cleanup;
    489508        }
    490509
    491         /* either the semicolon or the end of the string */
    492         semicolon = strchr(from, ';') ? : (from + strlen(from));
    493 
    494         who = g_strndup(from + 2, semicolon - from - 2);
     510        if (strcmp(who, md->ic->acc->user) == 0) {
     511                selfmessage = TRUE;
     512                g_free(who);
     513                if (!(who = msn_ns_parse_header_address(md, parts[0], "To"))) {
     514                        goto cleanup;
     515                }
     516        }
    495517
    496518        if ((strcmp(cmd[0], "SDG") == 0) && (action = get_rfc822_header(parts[2], "Message-Type", 0))) {
    497                 msn_ns_sdg(md, who, parts, action);
     519                msn_ns_sdg(md, who, parts, action, selfmessage);
    498520
    499521        } else if ((strcmp(cmd[0], "NFY") == 0) && (action = get_rfc822_header(parts[2], "Uri", 0))) {
     
    505527        g_strfreev(parts);
    506528        g_free(action);
    507         g_free(from);
    508529        g_free(who);
    509530}
    510531
    511 static void msn_ns_sdg(struct msn_data *md, char *who, char **parts, char *action)
     532static void msn_ns_sdg(struct msn_data *md, char *who, char **parts, char *action, gboolean selfmessage)
    512533{
    513534        struct im_connection *ic = md->ic;
    514535
    515         if (strcmp(action, "Control/Typing") == 0) {
     536        if (strcmp(action, "Control/Typing") == 0 && !selfmessage) {
    516537                imcb_buddy_typing(ic, who, OPT_TYPING);
    517538        } else if (strcmp(action, "Text") == 0) {
    518                 imcb_buddy_msg(ic, who, parts[3], 0, 0);
     539                imcb_buddy_msg(ic, who, parts[3], selfmessage ? OPT_SELFMESSAGE : 0, 0);
    519540        }
    520541}
     
    595616        } else {
    596617                imcb_error(ic, "Error during Passport authentication: %s", error);
    597                 imc_logout(ic, TRUE);
     618
     619                /* don't reconnect with auth errors */
     620                if (error && g_str_has_prefix(error, "wsse:FailedAuthentication")) {
     621                        imc_logout(ic, FALSE);
     622                } else {
     623                        imc_logout(ic, TRUE);
     624                }
    598625        }
    599626}
  • protocols/msn/soap.c

    re4f08bf r29ff5c2  
    327327        struct xt_node *code = xt_find_node(node->children, "faultcode");
    328328        struct xt_node *string = xt_find_node(node->children, "faultstring");
     329        struct xt_node *reqstatus = xt_find_path(node, "psf:pp/psf:reqstatus");
    329330        struct xt_node *url;
    330331
     
    335336                   url->text_len > 0) {
    336337                sd->redirect = g_strdup(url->text);
     338        } else if (reqstatus && strcmp(reqstatus->text, "0x800488fe") == 0) {
     339                char *msg = "Location blocked. Log in to live.com, go to recent activity and click 'this was me'";
     340                sd->error = g_strdup_printf("%s (%s)", code->text, msg);
    337341        } else {
    338342                sd->error = g_strdup_printf("%s (%s)", code->text, string && string->text_len ?
     
    346350        { "wsse:BinarySecurityToken", "wst:RequestedSecurityToken", msn_soap_passport_sso_token },
    347351        { "S:Fault", "S:Envelope", msn_soap_passport_failure },
     352        { "S:Fault", "wst:RequestSecurityTokenResponse", msn_soap_passport_failure },
    348353        { NULL, NULL, NULL }
    349354};
  • protocols/nogaim.c

    re4f08bf r29ff5c2  
    735735}
    736736
     737/* Deprecated: using this function resulted in merging several handles accidentally
     738 * Also the irc layer handles this decently nowadays */
    737739void imcb_clean_handle(struct im_connection *ic, char *handle)
    738740{
    739         /* Accepts a handle and does whatever is necessary to make it
    740            BitlBee-friendly. Currently this means removing everything
    741            outside 33-127 (ASCII printable excl spaces), @ (only one
    742            is allowed) and ! and : */
    743         char out[strlen(handle) + 1];
    744         int s, d;
    745 
    746         s = d = 0;
    747         while (handle[s]) {
    748                 if (handle[s] > ' ' && handle[s] != '!' && handle[s] != ':' &&
    749                     (handle[s] & 0x80) == 0) {
    750                         if (handle[s] == '@') {
    751                                 /* See if we got an @ already? */
    752                                 out[d] = 0;
    753                                 if (strchr(out, '@')) {
    754                                         continue;
    755                                 }
    756                         }
    757 
    758                         out[d++] = handle[s];
    759                 }
    760                 s++;
    761         }
    762         out[d] = handle[s];
    763 
    764         strcpy(handle, out);
    765 }
     741}
  • protocols/nogaim.h

    re4f08bf r29ff5c2  
    7070#define OPT_PONGS       0x00010000 /* Service sends us keep-alives */
    7171#define OPT_PONGED      0x00020000 /* Received a keep-alive during last interval */
     72#define OPT_SELFMESSAGE 0x00080000 /* A message sent by self from another location */
    7273
    7374/* ok. now the fun begins. first we create a connection structure */
     
    325326G_MODULE_EXPORT void imcb_buddy_action_response(bee_user_t *bu, const char *action, char * const args[], void *data);
    326327
    327 G_MODULE_EXPORT void imcb_buddy_typing(struct im_connection *ic, const char *handle, uint32_t flags);
     328G_MODULE_EXPORT void imcb_buddy_typing(struct im_connection *ic, const char *handle, guint32 flags);
    328329G_MODULE_EXPORT struct bee_user *imcb_buddy_by_handle(struct im_connection *ic, const char *handle);
    329 G_MODULE_EXPORT void imcb_clean_handle(struct im_connection *ic, char *handle);
     330
     331G_GNUC_DEPRECATED G_MODULE_EXPORT void imcb_clean_handle(struct im_connection *ic, char *handle);
    330332
    331333/* Actions, or whatever. */
  • protocols/oscar/aim.h

    re4f08bf r29ff5c2  
    871871 * SNAC Family: Internal Messages
    872872 *
    873  * This isn't truely a SNAC family either, but using
     873 * This isn't truly a SNAC family either, but using
    874874 * these, we can integrated non-SNAC services into
    875875 * the SNAC-centered libfaim callback structure.
  • protocols/oscar/auth.c

    re4f08bf r29ff5c2  
    4141 * meaning you generally never call this.
    4242 *
    43  * But there are times when something might want it seperate. Specifically,
     43 * But there are times when something might want it separate. Specifically,
    4444 * libfaim sends this internally when doing SNAC login.
    4545 *
  • protocols/oscar/conn.c

    re4f08bf r29ff5c2  
    1515 * In OSCAR, every connection has a set of SNAC groups associated
    1616 * with it.  These are the groups that you can send over this connection
    17  * without being guarenteed a "Not supported" SNAC error.
     17 * without being guaranteed a "Not supported" SNAC error.
    1818 *
    1919 * The grand theory of things says that these associations transcend
     
    3636 *
    3737 * Here comes the good bit.  Without even letting anyone know, particularly
    38  * the module that decided to send this SNAC, and definitly not that twit
     38 * the module that decided to send this SNAC, and definitely not that twit
    3939 * in Greenland, you send out a service request.  In this request, you have
    4040 * marked the need for a connection supporting group 0x000e.  A few seconds
     
    317317
    318318        if (deadconn->fd >= 3) {
    319                 closesocket(deadconn->fd);
     319                proxy_disconnect(deadconn->fd);
    320320        }
    321321        deadconn->fd = -1;
  • protocols/oscar/im.c

    re4f08bf r29ff5c2  
    5050 * encoding for your message.  In UNICODE mode, _all_ characters must
    5151 * occupy 16bits, including ones that are not special.  (Remember that
    52  * the first 128 UNICODE symbols are equivelent to ASCII7, however they
     52 * the first 128 UNICODE symbols are equivalent to ASCII7, however they
    5353 * must be prefixed with a zero high order byte.)
    5454 *
     
    6464 * in all of libfaim, it is written with performance in mind.  As such,
    6565 * it is not as clear as it could be in respect to how this message is
    66  * supposed to be layed out. Most obviously, tlvlists should be used
     66 * supposed to be laid out. Most obviously, tlvlists should be used
    6767 * instead of writing out the bytes manually.
    6868 *
     
    476476 * examples of how to do this.
    477477 *
    478  * I would definitly recommend avoiding this feature unless you really
     478 * I would definitely recommend avoiding this feature unless you really
    479479 * know what you are doing, and/or you have something neat to do with it.
    480480 *
     
    638638                        }
    639639#if 0
    640                         /* XXX this isn't really necesary... */
     640                        /* XXX this isn't really necessary... */
    641641                        if (((args.flag1 != 0x0000) &&
    642642                             (args.flag1 != 0x0002) &&
     
    11611161         *
    11621162         * Channel 0x0001 is the message channel.  There are
    1163          * other channels for things called "rendevous"
     1163         * other channels for things called "rendezvous"
    11641164         * which represent chat and some of the other new
    11651165         * features of AIM2/3/3.5.
    11661166         *
    1167          * Channel 0x0002 is the Rendevous channel, which
     1167         * Channel 0x0002 is the Rendezvous channel, which
    11681168         * is where Chat Invitiations and various client-client
    11691169         * connection negotiations come from.
     
    11811181         * with the TLVs read below, they are two different pieces.  The
    11821182         * userinfo block contains the number of TLVs that contain user
    1183          * information, the rest are not even though there is no seperation.
     1183         * information, the rest are not even though there is no separation.
    11841184         * aim_extractuserinfo() returns the number of bytes used by the
    11851185         * userinfo tlvs, so you can start reading the rest of them right
     
    12531253/*
    12541254 *
    1255  * I definitly recommend sending this.  If you don't, you'll be stuck
     1255 * I definitely recommend sending this.  If you don't, you'll be stuck
    12561256 * with the rather unreasonable defaults.  You don't want those.  Send this.
    12571257 *
  • protocols/oscar/misc.c

    re4f08bf r29ff5c2  
    33 * aim_misc.c
    44 *
    5  * TODO: Seperate a lot of this into an aim_bos.c.
     5 * TODO: Separate a lot of this into an aim_bos.c.
    66 *
    77 * Other things...
  • protocols/oscar/msgcookie.c

    re4f08bf r29ff5c2  
    142142 * @cookiep: the address of a pointer to the cookie struct to remove
    143143 *
    144  * this function removes the cookie *cookie from teh list of cookies
     144 * this function removes the cookie *cookie from the list of cookies
    145145 * in sess, and then frees all memory associated with it. including
    146146 * its data! if you want to use the private data after calling this,
  • protocols/oscar/oscar.c

    re4f08bf r29ff5c2  
    456456                        b_event_remove(n->inpa);
    457457                }
     458                n->inpa = 0;
    458459                g_free(n->name);
    459460                g_free(n->show);
     
    481482        if (ic->inpa > 0) {
    482483                b_event_remove(ic->inpa);
     484                ic->inpa = 0;
    483485        }
    484486        if (odata->cnpa > 0) {
    485487                b_event_remove(odata->cnpa);
     488                odata->cnpa = 0;
    486489        }
    487490        if (odata->paspa > 0) {
    488491                b_event_remove(odata->paspa);
     492                odata->paspa = 0;
    489493        }
    490494        aim_session_kill(odata->sess);
     
    637641        aim_sendcookie(sess, bosconn, info->cookie);
    638642        b_event_remove(ic->inpa);
     643        ic->inpa = 0;
    639644
    640645        return 1;
     
    12611266        } break;
    12621267
    1263         case 2: {         /* rendevous */
     1268        case 2: {         /* rendezvous */
    12641269                struct aim_incomingim_ch2_args *args;
    12651270                args = va_arg(ap, struct aim_incomingim_ch2_args *);
     
    25862591        if (cc->inpa > 0) {
    25872592                b_event_remove(cc->inpa);
     2593                cc->inpa = 0;
    25882594        }
    25892595        aim_conn_kill(od->sess, &cc->conn);
  • protocols/oscar/rxhandlers.c

    re4f08bf r29ff5c2  
    381381        /*
    382382         * This doesn't have to be called here.  It could easily be done
    383          * by a seperate thread or something. It's an administrative operation,
     383         * by a separate thread or something. It's an administrative operation,
    384384         * and can take a while. Though the less you call it the less memory
    385385         * you'll have :)
  • protocols/oscar/rxqueue.c

    re4f08bf r29ff5c2  
    361361/*
    362362 * Grab a single command sequence off the socket, and enqueue
    363  * it in the incoming event queue in a seperate struct.
     363 * it in the incoming event queue in a separate struct.
    364364 */
    365365int aim_get_command(aim_session_t *sess, aim_conn_t *conn)
     
    479479
    480480/*
    481  * Purge recieve queue of all handled commands (->handled==1).  Also
     481 * Purge receive queue of all handled commands (->handled==1).  Also
    482482 * allows for selective freeing using ->nofree so that the client can
    483483 * keep the data for various purposes.
  • protocols/oscar/service.c

    re4f08bf r29ff5c2  
    157157
    158158/*
    159  * OSCAR defines several 'rate classes'.  Each class has seperate
     159 * OSCAR defines several 'rate classes'.  Each class has separate
    160160 * rate limiting properties (limit level, alert level, disconnect
    161161 * level, etc), and a set of SNAC family/type pairs associated with
     
    709709 * of memory.  (I won't put it past them to start requesting data in
    710710 * less static regions -- regions that are initialized at run time, but still
    711  * before the client recieves this request.)
    712  *
    713  * When the client recieves the request, it adds it to the current ds
     711 * before the client receives this request.)
     712 *
     713 * When the client receives the request, it adds it to the current ds
    714714 * (0x00400000) and dereferences it, copying the data into a buffer which
    715715 * it then runs directly through the MD5 hasher.  The 16 byte output of
     
    723723 *     download a FREE, fully featured, and authorized client, here
    724724 *     http://www.aol.com/aim/download2.html"
    725  * The connection is then closed, recieving disconnect code 1, URL
     725 * The connection is then closed, receiving disconnect code 1, URL
    726726 * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html.
    727727 *
    728728 * Note, however, that numerous inconsistencies can cause the above error,
    729  * not just sending back a bad hash.  Do not immediatly suspect this code
     729 * not just sending back a bad hash.  Do not immediately suspect this code
    730730 * if you get disconnected.  AOL and the open/free software community have
    731731 * played this game for a couple years now, generating the above message
    732  * on numerous ocassions.
     732 * on numerous occasions.
    733733 *
    734734 * Anyway, neener.  We win again.
  • protocols/oscar/tlv.c

    re4f08bf r29ff5c2  
    2525 * bstream references, so that at least the ->value portion of each
    2626 * element doesn't need to be malloc/memcpy'd.  This could prove to be
    27  * just as effecient as the in-place TLV parsing used in a couple places
     27 * just as efficient as the in-place TLV parsing used in a couple places
    2828 * in libfaim.
    2929 *
     
    135135/**
    136136 * aim_addtlvtochain_str - Add a string to a TLV chain
    137  * @list: Desination chain (%NULL pointer if empty)
     137 * @list: Designation chain (%NULL pointer if empty)
    138138 * @type: TLV type
    139139 * @str: String to add
  • protocols/oscar/txqueue.c

    re4f08bf r29ff5c2  
    6767 * The overall purpose here is to enqueue the passed in command struct
    6868 * into the outgoing (tx) queue.  Basically...
    69  *   1) Make a scope-irrelevent copy of the struct
     69 *   1) Make a scope-irrelevant copy of the struct
    7070 *   3) Mark as not-sent-yet
    7171 *   4) Enqueue the struct into the list
  • protocols/purple/purple.c

    re4f08bf r29ff5c2  
    113113           servers anyway! */
    114114        if (!dir_fixed) {
     115                PurpleCertificatePool *pool;
    115116                irc_t *irc = acc->bee->ui_data;
    116117                char *dir;
     
    122123                purple_blist_load();
    123124                purple_prefs_load();
     125
     126                if (proxytype == PROXY_SOCKS4A) {
     127                        /* do this here after loading prefs. yes, i know, it sucks */
     128                        purple_prefs_set_bool("/purple/proxy/socks4_remotedns", TRUE);
     129                }
     130
     131                /* re-create the certificate cache directory */
     132                pool = purple_certificate_find_pool("x509", "tls_peers");
     133                dir = purple_certificate_pool_mkpath(pool, NULL);
     134                purple_build_dir(dir, 0700);
     135
    124136                dir_fixed = TRUE;
    125137        }
     
    14041416                PurpleProxyInfo *pi = purple_global_proxy_get_info();
    14051417                switch (proxytype) {
     1418                case PROXY_SOCKS4A:
    14061419                case PROXY_SOCKS4:
    14071420                        purple_proxy_info_set_type(pi, PURPLE_PROXY_SOCKS4);
  • protocols/skype/README

    re4f08bf r29ff5c2  
    203203
    204204  * `account skype set skypeconsole_receive true` will make the
    205     `skypeconsole` account dump all the recieved raw traffic for you
     205    `skypeconsole` account dump all the received raw traffic for you
    206206
    207207- If you want to automatically join bookmarked groupchats right after
  • protocols/skype/skype.c

    re4f08bf r29ff5c2  
    2121
    2222#define _XOPEN_SOURCE
    23 #define _BSD_SOURCE
    2423#include <poll.h>
    2524#include <stdio.h>
     
    188187
    189188        va_start(args, fmt);
    190         vsnprintf(str, IRC_LINE_SIZE, fmt, args);
     189        g_vsnprintf(str, IRC_LINE_SIZE, fmt, args);
    191190        va_end(args);
    192191
     
    322321        }
    323322        return NULL;
     323}
     324
     325static struct groupchat *skype_chat_get_or_create(struct im_connection *ic, char *id)
     326{
     327        struct skype_data *sd = ic->proto_data;
     328        struct groupchat *gc = bee_chat_by_title(ic->bee, ic, id);
     329
     330        if (!gc) {
     331                gc = imcb_chat_new(ic, id);
     332                imcb_chat_name_hint(gc, id);
     333                imcb_chat_add_buddy(gc, sd->username);
     334
     335                skype_printf(ic, "GET CHAT %s ADDER\n", id);
     336                skype_printf(ic, "GET CHAT %s TOPIC\n", id);
     337                skype_printf(ic, "GET CHAT %s ACTIVEMEMBERS\n", id);
     338        }
     339
     340        return gc;
    324341}
    325342
     
    688705                info += 9;
    689706                if (sd->handle && sd->body && sd->type) {
    690                         struct groupchat *gc = bee_chat_by_title(ic->bee, ic, info);
     707                        struct groupchat *gc = skype_chat_get_or_create(ic, info);
    691708                        int i;
    692709                        for (i = 0; i < g_list_length(sd->body); i++) {
     
    10261043        }
    10271044        if (!strcmp(info, "STATUS MULTI_SUBSCRIBED")) {
    1028                 gc = bee_chat_by_title(ic->bee, ic, id);
    1029                 if (!gc) {
    1030                         gc = imcb_chat_new(ic, id);
    1031                         imcb_chat_name_hint(gc, id);
    1032                 }
    1033                 skype_printf(ic, "GET CHAT %s ADDER\n", id);
    1034                 skype_printf(ic, "GET CHAT %s TOPIC\n", id);
     1045                skype_chat_get_or_create(ic, id);
    10351046        } else if (!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) {
    1036                 gc = imcb_chat_new(ic, id);
    1037                 imcb_chat_name_hint(gc, id);
     1047                gc = skype_chat_get_or_create(ic, id);
    10381048                /* According to the docs this
    10391049                 * is necessary. However it
     
    10461056                           sd->groupchat_with);
    10471057                imcb_chat_add_buddy(gc, buf);
    1048                 imcb_chat_add_buddy(gc, sd->username);
    10491058                g_free(sd->groupchat_with);
    10501059                sd->groupchat_with = NULL;
    1051                 skype_printf(ic, "GET CHAT %s ADDER\n", id);
    1052                 skype_printf(ic, "GET CHAT %s TOPIC\n", id);
    10531060        } else if (!strcmp(info, "STATUS UNSUBSCRIBED")) {
    10541061                gc = bee_chat_by_title(ic->bee, ic, id);
     
    12571264                }
    12581265                g_strfreev(lines);
    1259         } else if (st == 0 || (st < 0 && !sockerr_again())) {
     1266        } else if (st == 0 || (st < 0 && !ssl_sockerr_again(sd->ssl))) {
    12601267                ssl_disconnect(sd->ssl);
    12611268                sd->fd = -1;
  • protocols/skype/t/add-yes-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/added-no-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/added-yes-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/away-set-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/call-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :alice
  • protocols/skype/t/call-failed-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :alice
  • protocols/skype/t/called-no-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/called-yes-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/ctcp-help-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/filetransfer-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/group-add-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/group-read-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/groupchat-invite-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
     
    77>> :bob!bob@skype.com JOIN :&bitlbee
    88<< PRIVMSG &bitlbee :chat with bob
    9 >> 353 alice = ##alice/$bob;a7ab206ec780 :@alice bob @root
    10 << INVITE cecil ##alice/$bob;a7ab206ec780
    11 >> cecil@skype.com JOIN :##alice/$bob;a7ab206ec780
     9>> 353 alice = ##alice/$bob;a7ab206ec78 :@alice @root
     10<< INVITE cecil ##alice/$bob;a7ab206ec78
     11>> cecil@skype.com JOIN :##alice/$bob;a7ab206ec78
  • protocols/skype/t/groupchat-invite-skyped.mock

    re4f08bf r29ff5c2  
    2626>> GET CHAT #alice/$bob;a7ab206ec78060f1 TOPIC
    2727<< CHAT #alice/$bob;a7ab206ec78060f1 TOPIC
     28>> GET CHAT #alice/$bob;a7ab206ec78060f1 ACTIVEMEMBERS
     29<< CHAT #alice/$bob;a7ab206ec78060f1 ACTIVEMEMBERS
    2830<< CHATMESSAGE 206 STATUS SENDING
    2931<< CHAT #alice/$bob;a7ab206ec78060f1 STATUS DIALOG
  • protocols/skype/t/groupchat-invited-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
     
    55<< PRIVMSG &bitlbee :account add skype alice foo
    66<< PRIVMSG &bitlbee :account skype on
    7 >> JOIN :##cecil/$bob;4d8cc9965791
    8 >> 353 alice = ##cecil/$bob;4d8cc9965791 :@alice bob cecil @root
     7>> JOIN :##cecil/$bob;4d8cc996579
     8>> 353 alice = ##cecil/$bob;4d8cc996579 :@alice @root
  • protocols/skype/t/groupchat-leave-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
     
    66<< PRIVMSG &bitlbee :account skype set skypeconsole_receive true
    77<< PRIVMSG &bitlbee :account skype on
    8 >> JOIN :##cecil/$bob;4d8cc9965791
    9 >> 353 alice = ##cecil/$bob;4d8cc9965791 :@alice bob cecil @root
    10 << PART ##cecil/$bob;4d8cc9965791
     8>> JOIN :##cecil/$bob;4d8cc996579
     9>> 353 alice = ##cecil/$bob;4d8cc996579 :@alice @root
     10<< PART ##cecil/$bob;4d8cc996579
    1111>> PRIVMSG &bitlbee :alice: CHAT #cecil/$bob;4d8cc9965791c6b9 STATUS UNSUBSCRIBED
  • protocols/skype/t/groupchat-leave-skyped.mock

    re4f08bf r29ff5c2  
    3636>> GET CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    3737<< CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    38 >> GET CHAT #cecil/$bob;4d8cc9965791c6b9 ADDER
    39 << CHAT #cecil/$bob;4d8cc9965791c6b9 ADDER bob
    40 >> GET CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    41 << CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    42 >> GET CHAT #cecil/$bob;4d8cc9965791c6b9 ADDER
    43 << CHAT #cecil/$bob;4d8cc9965791c6b9 ADDER bob
    44 >> GET CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    45 << CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
     38>> GET CHAT #cecil/$bob;4d8cc9965791c6b9 ACTIVEMEMBERS
     39<< CHAT #cecil/$bob;4d8cc9965791c6b9 ACTIVEMEMBERS
    4640>> GET CHATMESSAGE 188 FROM_HANDLE
    4741<< CHATMESSAGE 188 FROM_HANDLE bob
  • protocols/skype/t/groupchat-msg-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
     
    66<< PRIVMSG &bitlbee :account skype set skypeconsole_receive true
    77<< PRIVMSG &bitlbee :account skype on
    8 >> JOIN :##cecil/$bob;4d8cc9965791
    9 >> 353 alice = ##cecil/$bob;4d8cc9965791 :@alice bob cecil @root
    10 << PRIVMSG ##cecil/$bob;4d8cc9965791 :hello
     8>> JOIN :##cecil/$bob;4d8cc996579
     9>> 353 alice = ##cecil/$bob;4d8cc996579 :@alice @root
     10<< PRIVMSG ##cecil/$bob;4d8cc996579 :hello
    1111>> PRIVMSG &bitlbee :alice: CHAT #cecil/$bob;4d8cc9965791c6b9 ACTIVITY_TIMESTAMP
  • protocols/skype/t/groupchat-msg-skyped.mock

    re4f08bf r29ff5c2  
    3636>> GET CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    3737<< CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    38 >> GET CHAT #cecil/$bob;4d8cc9965791c6b9 ADDER
    39 << CHAT #cecil/$bob;4d8cc9965791c6b9 ADDER bob
    40 >> GET CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    41 << CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    42 >> GET CHAT #cecil/$bob;4d8cc9965791c6b9 ADDER
    43 << CHAT #cecil/$bob;4d8cc9965791c6b9 ADDER bob
    44 >> GET CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
    45 << CHAT #cecil/$bob;4d8cc9965791c6b9 TOPIC
     38>> GET CHAT #cecil/$bob;4d8cc9965791c6b9 ACTIVEMEMBERS
     39<< CHAT #cecil/$bob;4d8cc9965791c6b9 ACTIVEMEMBERS bob cecil alice
    4640>> GET CHATMESSAGE 188 FROM_HANDLE
    4741<< CHATMESSAGE 188 FROM_HANDLE bob
  • protocols/skype/t/groupchat-topic-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
     
    55<< PRIVMSG &bitlbee :account add skype alice foo
    66<< PRIVMSG &bitlbee :account skype on
    7 >> JOIN :##cecil/$bob;4d8cc9965791
    8 >> 353 alice = ##cecil/$bob;4d8cc9965791 :@alice bob cecil @root
    9 << TOPIC ##cecil/$bob;4d8cc9965791 :topic
    10 >> TOPIC ##cecil/$bob;4d8cc9965791 :topic
     7>> JOIN :##cecil/$bob;4d8cc996579
     8>> 353 alice = ##cecil/$bob;4d8cc996579 :@alice @root
     9<< TOPIC ##cecil/$bob;4d8cc996579 :topic
     10>> TOPIC ##cecil/$bob;4d8cc996579 :topic
  • protocols/skype/t/info-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/login-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/msg-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/skype/t/set-mood-text-bitlbee.mock

    re4f08bf r29ff5c2  
    1 >> NOTICE AUTH
     1>> NOTICE *
    22<< NICK alice
    33<< USER alice alice localhost :Alice
  • protocols/twitter/twitter.c

    re4f08bf r29ff5c2  
    678678        ic->flags &= ~OPT_LOGGED_IN;
    679679
    680         // Remove the main_loop function from the function queue.
    681         b_event_remove(td->main_loop_id);
    682 
    683         if (td->timeline_gc) {
    684                 imcb_chat_free(td->timeline_gc);
    685         }
    686 
    687680        if (td) {
     681                // Remove the main_loop function from the function queue.
     682                b_event_remove(td->main_loop_id);
     683
     684                if (td->timeline_gc) {
     685                        imcb_chat_free(td->timeline_gc);
     686                }
     687
    688688                if (td->filter_update_id > 0) {
    689689                        b_event_remove(td->filter_update_id);
     
    10121012                        twitter_log(ic, "Tweet `%s' does not exist", cmd[1]);
    10131013                } else {
    1014                         /* More common link is twitter.com/$UID/status/$ID (and that's
    1015                          * what this will 302 to) but can't generate that since for RTs,
    1016                          * bu here points at the retweeter while id contains the id of
    1017                          * the original message. */
    1018                         twitter_log(ic, "https://twitter.com/statuses/%lld", id);
     1014                        twitter_status_show_url(ic, id);
    10191015                }
    10201016                goto eof;
  • protocols/twitter/twitter_http.c

    re4f08bf r29ff5c2  
    2424/***************************************************************************\
    2525*                                                                           *
    26 *  Some funtions within this file have been copied from other files within  *
     26*  Some functions within this file have been copied from other files within  *
    2727*  BitlBee.                                                                 *
    2828*                                                                           *
     
    5353        char *tmp;
    5454        GString *request = g_string_new("");
    55         void *ret;
     55        void *ret = NULL;
    5656        char *url_arguments;
    5757        url_t *base_url = NULL;
     
    7272                base_url = g_new0(url_t, 1);
    7373                if (!url_set(base_url, url_string)) {
    74                         g_free(base_url);
    75                         return NULL;
     74                        goto error;
    7675                }
    7776        }
     
    132131        }
    133132
     133error:
    134134        g_free(url_arguments);
    135135        g_string_free(request, TRUE);
  • protocols/twitter/twitter_lib.c

    re4f08bf r29ff5c2  
    312312        td = ic->proto_data;
    313313
     314        // Parse the data.
     315        if (!(parsed = twitter_parse_response(ic, req))) {
     316                return;
     317        }
     318
    314319        txl = g_new0(struct twitter_xml_list, 1);
    315320        txl->list = td->follow_ids;
    316 
    317         // Parse the data.
    318         if (!(parsed = twitter_parse_response(ic, req))) {
    319                 return;
    320         }
    321321
    322322        twitter_xt_get_friends_id_list(parsed, txl);
     
    388388        }
    389389
     390        // Get the user list from the parsed xml feed.
     391        if (!(parsed = twitter_parse_response(ic, req))) {
     392                return;
     393        }
     394
    390395        txl = g_new0(struct twitter_xml_list, 1);
    391396        txl->list = NULL;
    392397
    393         // Get the user list from the parsed xml feed.
    394         if (!(parsed = twitter_parse_response(ic, req))) {
    395                 return;
    396         }
    397398        twitter_xt_get_users(parsed, txl);
    398399        json_value_free(parsed);
     
    13851386        td = ic->proto_data;
    13861387
    1387         txl = g_new0(struct twitter_xml_list, 1);
    1388         txl->list = NULL;
    1389 
    13901388        // The root <statuses> node should hold the list of statuses <status>
    13911389        if (!(parsed = twitter_parse_response(ic, req))) {
    13921390                goto end;
    13931391        }
     1392
     1393        txl = g_new0(struct twitter_xml_list, 1);
     1394        txl->list = NULL;
     1395
    13941396        twitter_xt_get_status_list(ic, parsed, txl);
    13951397        json_value_free(parsed);
     
    14241426        td = ic->proto_data;
    14251427
    1426         txl = g_new0(struct twitter_xml_list, 1);
    1427         txl->list = NULL;
    1428 
    14291428        // The root <statuses> node should hold the list of statuses <status>
    14301429        if (!(parsed = twitter_parse_response(ic, req))) {
    14311430                goto end;
    14321431        }
     1432
     1433        txl = g_new0(struct twitter_xml_list, 1);
     1434        txl->list = NULL;
     1435
    14331436        twitter_xt_get_status_list(ic, parsed, txl);
    14341437        json_value_free(parsed);
     
    15731576        g_free(args[1]);
    15741577}
     1578
     1579static void twitter_http_status_show_url(struct http_request *req)
     1580{
     1581        struct im_connection *ic = req->data;
     1582        json_value *parsed, *id;
     1583        const char *name;
     1584
     1585        // Check if the connection is still active.
     1586        if (!g_slist_find(twitter_connections, ic)) {
     1587                return;
     1588        }
     1589
     1590        if (!(parsed = twitter_parse_response(ic, req))) {
     1591                return;
     1592        }
     1593
     1594        /* for the parson branch:
     1595        name = json_object_dotget_string(json_object(parsed), "user.screen_name");
     1596        id = json_object_get_integer(json_object(parsed), "id");
     1597        */
     1598
     1599        name = json_o_str(json_o_get(parsed, "user"), "screen_name");
     1600        id = json_o_get(parsed, "id");
     1601
     1602        if (name && id && id->type == json_integer) {
     1603                twitter_log(ic, "https://twitter.com/%s/status/%" G_GUINT64_FORMAT, name, id->u.integer);
     1604        } else {
     1605                twitter_log(ic, "Error: could not fetch tweet url.");
     1606        }
     1607
     1608        json_value_free(parsed);
     1609}
     1610
     1611void twitter_status_show_url(struct im_connection *ic, guint64 id)
     1612{
     1613        char *url = g_strdup_printf("%s%" G_GUINT64_FORMAT "%s", TWITTER_STATUS_SHOW_URL, id, ".json");
     1614        twitter_http(ic, url, twitter_http_status_show_url, ic, 0, NULL, 0);
     1615        g_free(url);
     1616}
  • protocols/twitter/twitter_lib.h

    re4f08bf r29ff5c2  
    9696void twitter_report_spam(struct im_connection *ic, char *screen_name);
    9797void twitter_favourite_tweet(struct im_connection *ic, guint64 id);
     98void twitter_status_show_url(struct im_connection *ic, guint64 id);
    9899
    99100#endif //_TWITTER_LIB_H
  • protocols/yahoo/libyahoo2.c

    re4f08bf r29ff5c2  
    1212 * GNU GPL.
    1313 *
    14  * This code is derivitive of Gaim <http://gaim.sourceforge.net>
     14 * This code is derivative of Gaim <http://gaim.sourceforge.net>
    1515 * copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
    1616 *             1998-1999, Adam Fritzler <afritz@marko.net>
     
    14021402
    14031403        /*
    1404          * Status updates may be spread accross multiple packets and not
     1404         * Status updates may be spread across multiple packets and not
    14051405         * even on buddy boundaries, so keeping some state is important.
    14061406         * So, continue where we left off, and only add a user entry to
  • protocols/yahoo/yahoo.c

    re4f08bf r29ff5c2  
    440440{
    441441        struct byahoo_connect_callback_data *d = data;
    442 
    443         if (!byahoo_get_ic_by_id(d->id)) {
     442        struct im_connection *ic;
     443
     444        if (!(ic = byahoo_get_ic_by_id(d->id))) {
     445                g_free(d);
     446                return;
     447        }
     448
     449        if (source == -1) {
     450                d->callback(NULL, 0, d->data);
     451                imcb_error(ic, "Could not connect to server");
     452                imc_logout(ic, TRUE);
    444453                g_free(d);
    445454                return;
  • protocols/yahoo/yahoo2_callbacks.h

    re4f08bf r29ff5c2  
    685685 * Name: ext_yahoo_connect_async
    686686 *      Connect to a host:port asynchronously. This function should return
    687  *      immediately returing a tag used to identify the connection handler,
     687 *      immediately returning a tag used to identify the connection handler,
    688688 *      or a pre-connect error (eg: host name lookup failure).
    689689 *      Once the connect completes (successfully or unsuccessfully), callback
Note: See TracChangeset for help on using the changeset viewer.