Changeset 28ee32b for logging.c


Ignore:
Timestamp:
Dec 24, 2007, 2:53:11 AM (16 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
762512d
Parents:
5bc0f68
Message:
UTF-8 - first pass

unicode changes:
* remove downstr() from text.c, replace on site with calls to g_utf8_strdown.
  In place downcasing is not a good idea, so the downstr() contract is unfulfillable.

* make owl_text_truncate_cols() and owl_fmtext_truncate_cols() understand character width.
  This may need more work. Some code duplication - see if we can refactor.

* stristr() rewritten to yse g_utf_casefold() instead of downstr(), and restructured to have a single return.

* only_whitespace() rewritten for unicode.

glib changes:
* rewrite owl_sprintf() in terms of g_strdup_vprintf()

WARNING: THIS IS NOT SAFE YET. Network data is not yet sanitized. Non
UTF-8 inputs may do horrible things to you. This phase is just
working on rendering.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • logging.c

    rd0961fe r28ee32b  
    155155    to = owl_sprintf("jabber:%s", owl_message_get_recipient(m));
    156156  } else if (owl_message_is_type_aim(m)) {
     157    char *temp2;
    157158    temp = owl_aim_normalize_screenname(owl_message_get_recipient(m));
    158     downstr(temp);
    159     to = owl_sprintf("aim:%s", temp);
     159    temp2 = g_utf8_strdown(temp,-1);
     160    to = owl_sprintf("aim:%s", temp2);
     161    owl_free(temp2);
    160162    owl_free(temp);
    161163  } else {
     
    267269  } else if (owl_message_is_type_aim(m)) {
    268270    /* we do not yet handle chat rooms */
    269     char *normalto;
    270     normalto=owl_aim_normalize_screenname(owl_message_get_sender(m));
    271     downstr(normalto);
     271    char *normalto, *temp;
     272    temp = owl_aim_normalize_screenname(owl_message_get_sender(m));
     273    normalto = g_utf8_strdown(temp, -1);
    272274    from=frombuff=owl_sprintf("aim:%s", normalto);
    273275    owl_free(normalto);
     276    owl_free(temp);
    274277  } else if (owl_message_is_type_loopback(m)) {
    275278    from=frombuff=owl_strdup("loopback");
     
    290293
    291294  ch=frombuff[0];
    292   if (!isalnum(ch)) from="weird";
     295  if (!g_ascii_isalnum(ch)) from="weird";
    293296
    294297  for (i=0; i<len; i++) {
     
    299302
    300303  if (!personal) {
    301     if (strcmp(from, "weird")) downstr(from);
     304    if (strcmp(from, "weird")) {
     305      char* temp = g_utf8_strdown(frombuff, -1);
     306      if (temp) {
     307        owl_free(frombuff);
     308        from = frombuff = temp;
     309      }
     310    }
    302311  }
    303312
Note: See TracChangeset for help on using the changeset viewer.