comparison src/util.c @ 13613:723fd573111c

[gaim-migrate @ 15999] Refactor the codeflow of gaim_normalize() slightly so that it's easier to read. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 10 Apr 2006 20:55:03 +0000
parents ffb12e85473f
children 6bf81c38b458
comparison
equal deleted inserted replaced
13612:dd03aa8a28ad 13613:723fd573111c
2610 * String Functions 2610 * String Functions
2611 **************************************************************************/ 2611 **************************************************************************/
2612 const char * 2612 const char *
2613 gaim_normalize(const GaimAccount *account, const char *str) 2613 gaim_normalize(const GaimAccount *account, const char *str)
2614 { 2614 {
2615 GaimPlugin *prpl = NULL;
2616 GaimPluginProtocolInfo *prpl_info = NULL;
2617 const char *ret = NULL; 2615 const char *ret = NULL;
2618 2616
2619 if(account) 2617 if (account == NULL)
2620 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); 2618 {
2621 2619 GaimPlugin *prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
2622 if(prpl) 2620
2623 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); 2621 if (prpl != NULL)
2624 2622 {
2625 if(prpl_info && prpl_info->normalize) 2623 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
2626 ret = prpl_info->normalize(account, str); 2624
2627 2625 if(prpl_info && prpl_info->normalize)
2628 if(!ret) 2626 ret = prpl_info->normalize(account, str);
2627 }
2628 }
2629
2630 if (ret != NULL)
2629 { 2631 {
2630 static char buf[BUF_LEN]; 2632 static char buf[BUF_LEN];
2631 char *tmp; 2633 char *tmp;
2632 2634
2633 tmp = g_utf8_normalize(str, -1, G_NORMALIZE_DEFAULT); 2635 tmp = g_utf8_normalize(str, -1, G_NORMALIZE_DEFAULT);