Changes in / [b8c336b:356e2dd]


Ignore:
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.h

    rb8c336b r356e2dd  
    9393#undef g_source_remove
    9494#define g_source_remove         __PLEASE_USE_B_EVENT_REMOVE__
     95#undef g_source_remove_by_user_data
     96#define g_source_remove_by_user_data    __PLEASE_USE_B_SOURCE_REMOVE_BY_USER_DATA__
    9597#undef g_main_run
    9698#define g_main_run              __PLEASE_USE_B_MAIN_RUN__
  • configure

    rb8c336b r356e2dd  
    5656GLIB_MIN_VERSION=2.16
    5757
     58echo BitlBee configure
     59
    5860# Cygwin and Darwin don't support PIC/PIE
    5961case "$arch" in
     
    6365                pie=0;;
    6466esac
    65 
    66 get_version() {
    67         REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
    68 
    69         if [ -n "$BITLBEE_VERSION" ]; then
    70                 # environment variable already set to something to spoof it
    71                 # don't replace it with the git stuff
    72                 return
    73         fi
    74 
    75         BITLBEE_VERSION=$REAL_BITLBEE_VERSION
    76 
    77         if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then
    78                 timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
    79                 branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)
    80 
    81                 search="(.+)-([0-9]+)-(g[0-9a-f]+)"
    82                 replace="\1+$timestamp+$branch+\2-\3-git"
    83 
    84                 BITLBEE_VERSION=$(cd $srcdir; git describe --long --tags | sed -r "s/$search/$replace/")
    85 
    86                 unset timestamp branch search replace
    87         fi
    88 }
    89 
    90 if [ "$1" = "--dump-version" ]; then
    91         srcdir=$(cd $(dirname $0);pwd)
    92         get_version
    93         echo $BITLBEE_VERSION
    94         exit
    95 fi
    96 
    97 echo BitlBee configure
    9867
    9968while [ -n "$1" ]; do
     
    703672fi
    704673
    705 get_version
    706 
    707 if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then
     674REAL_BITLBEE_VERSION=`grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/'`
     675echo
     676if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
     677        nick=`bzr nick`
     678        if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
     679                nick="-$nick"
     680        else
     681                nick=""
     682        fi
     683        rev=`bzr revno`
     684        echo 'Using bzr revision #'$rev' as version number'
     685        BITLBEE_VERSION=$REAL_BITLBEE_VERSION-bzr$nick-$rev
     686fi
     687
     688if [ -z "$BITLBEE_VERSION" -a -d .git ] && type git > /dev/null 2> /dev/null; then
     689        rev=`git describe --long --tags`-`git rev-parse --abbrev-ref HEAD`
     690        echo 'Using '$rev' as git version number'
     691        BITLBEE_VERSION=$rev-git
     692fi
     693
     694if [ -n "$BITLBEE_VERSION" ]; then
    708695        echo 'Spoofing version number: '$BITLBEE_VERSION
    709696        echo '#undef BITLBEE_VERSION' >> config.h
    710697        echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
    711698        echo
     699else
     700        # for pkg-config
     701        BITLBEE_VERSION=$REAL_BITLBEE_VERSION
    712702fi
    713703
  • debian/control

    rb8c336b r356e2dd  
    2222Architecture: any
    2323Depends: ${misc:Depends}, ${shlibs:Depends}, debianutils (>= 1.16), bitlbee-common (= ${source:Version})
    24 Provides: bitlbee
    2524Conflicts: bitlbee
    2625Replaces: bitlbee
  • doc/user-guide/commands.xml

    rb8c336b r356e2dd  
    121121                        <description>
    122122                                <para>
    123                                         This command deletes an account from your account list. You should signoff the account before deleting it.
     123                                        This commands deletes an account from your account list. You should signoff the account before deleting it.
    124124                                </para>
    125125
     
    853853                                <varlistentry><term>favourite &lt;screenname|#id&gt;</term><listitem><para>Favo<emphasis>u</emphasis>rite the given user's most recent tweet, or the given tweet ID.</para></listitem></varlistentry>
    854854                                <varlistentry><term>post &lt;message&gt;</term><listitem><para>Post a tweet</para></listitem></varlistentry>
    855                                 <varlistentry><term>url &lt;screenname|#id&gt;</term><listitem><para>Show URL for a tweet to open it in a browser (and see context)</para></listitem></varlistentry>
    856855                        </variablelist>
    857856
  • irc_im.c

    rb8c336b r356e2dd  
    5050
    5151        memset(nick, 0, MAX_NICK_LENGTH + 1);
    52         strncpy(nick, nick_get(bu), MAX_NICK_LENGTH);
     52        strcpy(nick, nick_get(bu));
    5353
    5454        bu->ui_data = iu = irc_user_new(irc, nick);
     
    752752                        g_free(channel);
    753753                        channel = s;
    754                 } else {
    755                         g_free(s);
    756754                }
    757755        }
  • irc_send.c

    rb8c336b r356e2dd  
    175175
    176176        if (iu == irc->user) {
     177                irc_write(irc, ":%s MODE %s +%s", irc->root->host, ic->name, ic->mode);
     178                irc_send_names(ic);
    177179                if (ic->topic && *ic->topic) {
    178180                        irc_send_topic(ic, FALSE);
    179181                }
    180                 irc_send_names(ic);
    181182        }
    182183}
  • lib/events_glib.c

    rb8c336b r356e2dd  
    8282        }
    8383
    84         event_debug("gaim_io_invoke( %d, %d, %p )\n", g_io_channel_unix_get_fd(source), condition, data);
     84        event_debug("gaim_io_invoke( %d, %d, 0x%x )\n", g_io_channel_unix_get_fd(source), condition, data);
    8585
    8686        st = closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
     
    101101static void gaim_io_destroy(gpointer data)
    102102{
    103         event_debug("gaim_io_destroy( 0%p )\n", data);
     103        event_debug("gaim_io_destroy( 0x%x )\n", data);
    104104        g_free(data);
    105105}
     
    127127                                 gaim_io_invoke, closure, gaim_io_destroy);
    128128
    129         event_debug("b_input_add( %d, %d, %p, %p ) = %d (%p)\n", source, condition, function, data, st, closure);
     129        event_debug("b_input_add( %d, %d, 0x%x, 0x%x ) = %d (%p)\n", source, condition, function, data, st, closure);
    130130
    131131        g_io_channel_unref(channel);
     
    140140        gint st = g_timeout_add(timeout, (GSourceFunc) func, data);
    141141
    142         event_debug("b_timeout_add( %d, %p, %p ) = %d\n", timeout, func, data, st);
     142        event_debug("b_timeout_add( %d, %d, %d ) = %d\n", timeout, func, data, st);
    143143
    144144        return st;
  • lib/oauth.c

    rb8c336b r356e2dd  
    9696{
    9797        int key_len = strlen(key);
    98         GSList *l, *n;
     98        GSList *l;
    9999
    100100        if (!params) {
     
    102102        }
    103103
    104         for (l = *params; l; l = n) {
    105                 n = l->next;
     104        for (l = *params; l; l = l->next) {
    106105                char *data = l->data;
    107106
  • lib/oauth2.c

    rb8c336b r356e2dd  
    140140        struct oauth2_access_token_data *cb_data = req->data;
    141141        char *atoken = NULL, *rtoken = NULL, *error = NULL;
    142         char *content_type = NULL;
     142        char *content_type;
    143143
    144         if (req->status_code <= 0 && !req->reply_body) {
    145                 cb_data->func(cb_data->data, NULL, NULL, req->status_string);
    146                 g_free(cb_data);
    147                 return;
    148         }
    149 
    150         if (getenv("BITLBEE_DEBUG")) {
     144        if (getenv("BITLBEE_DEBUG") && req->reply_body) {
    151145                printf("%s\n", req->reply_body);
    152146        }
  • protocols/jabber/hipchat.c

    rb8c336b r356e2dd  
    4747        jd->flags &= ~JFLAG_STREAM_RESTART;
    4848
    49         if (!jabber_get_roster(ic) ||
    50             !jabber_iq_disco_server(ic) ||
    51             !jabber_get_hipchat_profile(ic) ||
    52             !jabber_iq_disco_muc(ic, muc_host)) {
     49        if (!jabber_get_roster(ic)) {
     50                return XT_ABORT;
     51        }
     52        if (!jabber_iq_disco_server(ic)) {
     53                return XT_ABORT;
     54        }
     55        if (!jabber_get_hipchat_profile(ic)) {
     56                return XT_ABORT;
     57        }
     58        if (!jabber_iq_disco_muc(ic, muc_host)) {
    5359                return XT_ABORT;
    5460        }
     
    7884{
    7985        struct xt_node *query, *name_node;
     86
     87        //char *name;
    8088
    8189        if (!(query = xt_find_node(node->children, "query"))) {
  • protocols/jabber/iq.c

    rb8c336b r356e2dd  
    373373static xt_status jabber_parse_roster(struct im_connection *ic, struct xt_node *node, struct xt_node *orig)
    374374{
    375         struct jabber_data *jd = ic->proto_data;
    376375        struct xt_node *query, *c;
    377376        int initial = (orig != NULL);
     
    389388                char *sub = xt_find_attr(c, "subscription");
    390389                char *mention_name = xt_find_attr(c, "mention_name");
     390                char *nick = mention_name ? : name;
    391391
    392392                if (jid && sub) {
     
    399399                                }
    400400
    401                                 /* This could also be used to set the full name as nick for fb/gtalk,
    402                                  * but i'm keeping the old (ugly?) default behavior just to be safe */
    403                                 if (mention_name && (jd->flags & JFLAG_HIPCHAT)) {
    404                                         imcb_buddy_nick_hint(ic, jid, mention_name);
     401                                if (nick) {
     402                                        imcb_buddy_nick_hint(ic, jid, nick);
    405403                                }
    406404                        } else if (strcmp(sub, "remove") == 0) {
  • protocols/jabber/jabber.c

    rb8c336b r356e2dd  
    428428        }
    429429
    430         jabber_get_vcard(ic, who);
     430        jabber_get_vcard(ic, bud ? bud->full_jid : who);
    431431}
    432432
  • protocols/msn/gw.c

    rb8c336b r356e2dd  
    8787        gw->polling = FALSE;
    8888
    89         if (req->status_code != 200 || !req->reply_body) {
    90                 gw->callback(gw->md, -1, B_EV_IO_READ);
    91                 return;
    92         }
    93 
    9489        if (getenv("BITLBEE_DEBUG")) {
    9590                fprintf(stderr, "\n\x1b[90mHTTP:%s\n", req->reply_body);
    9691                fprintf(stderr, "\n\x1b[97m\n");
     92        }
     93
     94        if (req->status_code != 200) {
     95                gw->callback(gw->md, -1, B_EV_IO_READ);
     96                return;
    9797        }
    9898
     
    113113        if (req->body_size) {
    114114                g_byte_array_append(gw->in, (const guint8 *) req->reply_body, req->body_size);
    115 
    116                 if (!gw->callback(gw->md, -1, B_EV_IO_READ)) {
    117                         return;
    118                 }
     115                gw->callback(gw->md, -1, B_EV_IO_READ);
    119116        }
    120117
  • protocols/msn/ns.c

    rb8c336b r356e2dd  
    181181                imcb_error(ic, "Error while reading from server");
    182182                imc_logout(ic, TRUE);
    183                 g_free(bytes);
    184183                return FALSE;
    185184        }
     
    189188        g_free(bytes);
    190189
    191         return msn_handler(md);
     190        /* Ignore ret == 0, it's already disconnected then. */
     191        msn_handler(md);
     192
     193        return TRUE;
     194       
    192195}
    193196
  • protocols/oscar/ssi.c

    rb8c336b r356e2dd  
    6666                                newitem->gid += 0x0001;
    6767                                for (cur = *list, i = 0; ((cur) && (!i)); cur = cur->next) {
    68                                         if ((cur->bid == newitem->bid) && (cur->gid == newitem->gid)) {
     68                                        if ((cur->gid == newitem->gid) && (cur->gid == newitem->gid)) {
    6969                                                i = 1;
    7070                                        }
  • protocols/twitter/twitter.c

    rb8c336b r356e2dd  
    483483}
    484484
    485 int twitter_message_len(gchar *msg, int target_len)
    486 {
     485static gboolean twitter_length_check(struct im_connection *ic, gchar * msg)
     486{
     487        int max = set_getint(&ic->acc->set, "message_length"), len;
     488        int target_len = set_getint(&ic->acc->set, "target_url_length");
    487489        int url_len_diff = 0;
    488490
     
    491493        }
    492494
    493         return g_utf8_strlen(msg, -1) + url_len_diff;
    494 }
    495 
    496 static gboolean twitter_length_check(struct im_connection *ic, gchar * msg)
    497 {
    498         int max = set_getint(&ic->acc->set, "message_length");
    499         int target_len = set_getint(&ic->acc->set, "target_url_length");
    500         int len = twitter_message_len(msg, target_len);
    501 
    502         if (max == 0 || len <= max) {
     495        if (max == 0 || (len = g_utf8_strlen(msg, -1) + url_len_diff) <= max) {
    503496                return TRUE;
    504497        }
     
    874867}
    875868
    876 bee_user_t twitter_log_local_user;
    877 
    878869/** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID
    879870 *  into a twitter tweet ID.
     
    906897                        bu = td->log[id].bu;
    907898                        id = td->log[id].id;
     899                        /* Beware of dangling pointers! */
     900                        if (!g_slist_find(ic->bee->users, bu)) {
     901                                bu = NULL;
     902                        }
    908903                } else if (twitter_parse_id(arg, 10, &id)) {
    909904                        /* Allow normal tweet IDs as well; not a very useful
     
    916911        }
    917912        if (bu_) {
    918                 if (bu == &twitter_log_local_user) {
    919                         /* HACK alert. There's no bee_user object for the local
    920                          * user so just fake one for the few cmds that need it. */
    921                         twitter_log_local_user.handle = td->user;
    922                 } else {
    923                         /* Beware of dangling pointers! */
    924                         if (!g_slist_find(ic->bee->users, bu)) {
    925                                 bu = NULL;
    926                         }
    927                 }
    928913                *bu_ = bu;
    929914        }
     
    10181003                in_reply_to = id;
    10191004                allow_post = TRUE;
    1020         } else if (g_strcasecmp(cmd[0], "url") == 0) {
    1021                 id = twitter_message_id_from_command_arg(ic, cmd[1], &bu);
    1022                 if (!id) {
    1023                         twitter_log(ic, "Tweet `%s' does not exist", cmd[1]);
    1024                 } else {
    1025                         /* More common link is twitter.com/$UID/status/$ID (and that's
    1026                          * what this will 302 to) but can't generate that since for RTs,
    1027                          * bu here points at the retweeter while id contains the id of
    1028                          * the original message. */
    1029                         twitter_log(ic, "https://twitter.com/statuses/%lld", id);
    1030                 }
    1031                 goto eof;
    1032 
    10331005        } else if (g_strcasecmp(cmd[0], "post") == 0) {
    10341006                message += 5;
  • protocols/twitter/twitter.h

    rb8c336b r356e2dd  
    101101struct twitter_log_data {
    102102        guint64 id;
    103         /* DANGER: bu can be a dead pointer. Check it first.
    104          * twitter_message_id_from_command_arg() will do this. */
    105         struct bee_user *bu;
     103        struct bee_user *bu; /* DANGER: can be a dead pointer. Check it first. */
    106104};
    107105
     
    112110 */
    113111extern GSList *twitter_connections;
    114 
    115 /**
    116  * Evil hack: Fake bee_user which will always point at the local user.
    117  * Sometimes used as a return value by twitter_message_id_from_command_arg.
    118  * NOT thread safe but don't you dare to even think of ever making BitlBee
    119  * threaded. :-)
    120  */
    121 extern bee_user_t twitter_log_local_user;
    122112
    123113void twitter_login_finish(struct im_connection *ic);
  • protocols/twitter/twitter_lib.c

    rb8c336b r356e2dd  
    460460#endif
    461461
    462 static void expand_entities(char **text, const json_value *node);
     462static char* expand_entities(char* text, const json_value *entities);
    463463
    464464/**
     
    473473{
    474474        struct twitter_xml_status *txs;
    475         const json_value *rt = NULL;
     475        const json_value *rt = NULL, *entities = NULL;
    476476
    477477        if (node->type != json_object) {
     
    501501                } else if (strcmp("in_reply_to_status_id", k) == 0 && v->type == json_integer) {
    502502                        txs->reply_to = v->u.integer;
     503                } else if (strcmp("entities", k) == 0 && v->type == json_object) {
     504                        entities = v;
    503505                }
    504506        }
     
    514516                        txs_free(rtxs);
    515517                }
    516         } else {
    517                 expand_entities(&txs->text, node);
     518        } else if (entities) {
     519                txs->text = expand_entities(txs->text, entities);
    518520        }
    519521
     
    532534{
    533535        struct twitter_xml_status *txs;
     536        const json_value *entities = NULL;
    534537
    535538        if (node->type != json_object) {
     
    558561        }
    559562
    560         expand_entities(&txs->text, node);
     563        if (entities) {
     564                txs->text = expand_entities(txs->text, entities);
     565        }
    561566
    562567        if (txs->text && txs->user && txs->id) {
     
    568573}
    569574
    570 static void expand_entities(char **text, const json_value *node)
    571 {
    572         json_value *entities, *quoted;
    573         char *quote_url = NULL, *quote_text = NULL;
    574 
    575         if (!((entities = json_o_get(node, "entities")) && entities->type == json_object))
    576                 return;
    577         if ((quoted = json_o_get(node, "quoted_status")) && quoted->type == json_object) {
    578                 /* New "retweets with comments" feature. Note that this info
    579                  * seems to be included in the streaming API only! Grab the
    580                  * full message and try to insert it when we run into the
    581                  * Tweet entity. */
    582                 struct twitter_xml_status *txs = twitter_xt_get_status(quoted);
    583                 quote_text = g_strdup_printf("@%s: %s", txs->user->screen_name, txs->text);
    584                 quote_url = g_strdup_printf("%s/status/%" G_GUINT64_FORMAT, txs->user->screen_name, txs->id);
    585                 txs_free(txs);
    586         } else {
    587                 quoted = NULL;
    588         }
    589 
     575static char* expand_entities(char* text, const json_value *entities)
     576{
    590577        JSON_O_FOREACH(entities, k, v) {
    591578                int i;
     
    599586
    600587                for (i = 0; i < v->u.array.length; i++) {
    601                         const char *format = "%s%s <%s>%s";
    602 
    603588                        if (v->u.array.values[i]->type != json_object) {
    604589                                continue;
     
    607592                        const char *kort = json_o_str(v->u.array.values[i], "url");
    608593                        const char *disp = json_o_str(v->u.array.values[i], "display_url");
    609                         const char *full = json_o_str(v->u.array.values[i], "expanded_url");
    610594                        char *pos, *new;
    611595
    612                         if (!kort || !disp || !(pos = strstr(*text, kort))) {
     596                        if (!kort || !disp || !(pos = strstr(text, kort))) {
    613597                                continue;
    614598                        }
    615                         if (quote_url && strstr(full, quote_url)) {
    616                                 format = "%s<%s> [%s]%s";
    617                                 disp = quote_text;
    618                         }
    619599
    620600                        *pos = '\0';
    621                         new = g_strdup_printf(format, *text, kort,
     601                        new = g_strdup_printf("%s%s <%s>%s", text, kort,
    622602                                              disp, pos + strlen(kort));
    623603
    624                         g_free(*text);
    625                         *text = new;
    626                 }
    627         }
    628         g_free(quote_text);
    629         g_free(quote_url);
     604                        g_free(text);
     605                        text = new;
     606                }
     607        }
     608
     609        return text;
    630610}
    631611
     
    701681        if (g_strcasecmp(txs->user->screen_name, td->user) == 0) {
    702682                td->log[td->log_id].id = txs->rt_id;
    703                 /* More useful than NULL. */
    704                 td->log[td->log_id].bu = &twitter_log_local_user;
    705683        }
    706684
  • protocols/yahoo/yahoo2.h

    rb8c336b r356e2dd  
    3333#undef malloc
    3434#define malloc(x)             g_malloc(x)
     35#undef calloc
     36#define calloc(x, y)          g_calloc(x, y)
    3537#undef realloc
    3638#define realloc(x, y)         g_realloc(x, y)
  • unix.c

    rb8c336b r356e2dd  
    212212                       argv[0], argv[0], argv[0], argv[0], argv[0]);
    213213        } else if (strcmp(argv[2], "enc") == 0) {
    214                 char *encoded;
    215 
    216                 pass_len = arc_encode(argv[4], strlen(argv[4]), &pass_cr, argv[3], 12);
    217 
    218                 encoded = base64_encode(pass_cr, pass_len);
    219                 printf("%s\n", encoded);
    220                 g_free(encoded);
    221                 g_free(pass_cr);
     214                pass_len = arc_encode(argv[4], strlen(argv[4]), (unsigned char **) &pass_cr, argv[3], 12);
     215                printf("%s\n", base64_encode(pass_cr, pass_len));
    222216        } else if (strcmp(argv[2], "dec") == 0) {
    223                 pass_len = base64_decode(argv[4], &pass_cr);
     217                pass_len = base64_decode(argv[4], (unsigned char **) &pass_cr);
    224218                arc_decode(pass_cr, pass_len, (char **) &pass_cl, argv[3]);
    225219                printf("%s\n", pass_cl);
    226 
    227                 g_free(pass_cr);
    228                 g_free(pass_cl);
    229220        } else if (strcmp(argv[2], "hash") == 0) {
    230221                md5_byte_t pass_md5[21];
    231222                md5_state_t md5_state;
    232                 char *encoded;
    233223
    234224                random_bytes(pass_md5 + 16, 5);
     
    238228                md5_finish(&md5_state, pass_md5);
    239229
    240                 encoded = base64_encode(pass_md5, 21);
    241                 printf("%s\n", encoded);
    242                 g_free(encoded);
     230                printf("%s\n", base64_encode(pass_md5, 21));
    243231        } else if (strcmp(argv[2], "unhash") == 0) {
    244232                printf("Hash %s submitted to a massive Beowulf cluster of\n"
Note: See TracChangeset for help on using the changeset viewer.