Changeset 33528bd


Ignore:
Timestamp:
2015-05-07T23:12:06Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
81a15da
Parents:
b71f599
git-author:
dequis <dx@…> (07-05-15 19:53:58)
git-committer:
dequis <dx@…> (07-05-15 23:12:06)
Message:

twitter: split length check function into twitter_message_len

Mostly to be able to test twitter_message_len externally against the
twitter-text conformance tests (the current version definitely fails -
it doesn't do utf8 normalization)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    rb71f599 r33528bd  
    483483}
    484484
    485 static 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");
     485int twitter_message_len(gchar *msg, int target_len)
     486{
    489487        int url_len_diff = 0;
    490488
     
    493491        }
    494492
    495         if (max == 0 || (len = g_utf8_strlen(msg, -1) + url_len_diff) <= max) {
     493        return g_utf8_strlen(msg, -1) + url_len_diff;
     494}
     495
     496static 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) {
    496503                return TRUE;
    497504        }
Note: See TracChangeset for help on using the changeset viewer.