Mercurial > pidgin.yaz
comparison libpurple/protocols/mxit/protocol.c @ 32364:323876c34a96
Don't use strlen() when all you're trying to do is check if the string
is empty
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 22 Aug 2011 02:07:41 +0000 |
parents | 93cb9f408df4 |
children | 5d81b452dcc4 |
comparison
equal
deleted
inserted
replaced
32363:3322201b446f | 32364:323876c34a96 |
---|---|
1646 g_strlcpy( contact->alias, rec->fields[1]->data, sizeof( contact->alias ) ); | 1646 g_strlcpy( contact->alias, rec->fields[1]->data, sizeof( contact->alias ) ); |
1647 contact->type = atoi( rec->fields[2]->data ); | 1647 contact->type = atoi( rec->fields[2]->data ); |
1648 | 1648 |
1649 if ( rec->fcount >= 5 ) { | 1649 if ( rec->fcount >= 5 ) { |
1650 /* there is a personal invite message attached */ | 1650 /* there is a personal invite message attached */ |
1651 if ( ( rec->fields[4]->data ) && ( strlen( rec->fields[4]->data ) > 0 ) ) | 1651 if ( ( rec->fields[4]->data ) && ( *rec->fields[4]->data ) ) |
1652 contact->msg = strdup( rec->fields[4]->data ); | 1652 contact->msg = strdup( rec->fields[4]->data ); |
1653 } | 1653 } |
1654 | 1654 |
1655 /* handle the subscription */ | 1655 /* handle the subscription */ |
1656 if ( contact-> type == MXIT_TYPE_MULTIMX ) { /* subscription to a MultiMX room */ | 1656 if ( contact-> type == MXIT_TYPE_MULTIMX ) { /* subscription to a MultiMX room */ |
1888 struct contact* contact = NULL; | 1888 struct contact* contact = NULL; |
1889 | 1889 |
1890 contact = get_mxit_invite_contact( session, mxitId ); | 1890 contact = get_mxit_invite_contact( session, mxitId ); |
1891 if ( contact ) { | 1891 if ( contact ) { |
1892 /* this is an invite, so update its profile info */ | 1892 /* this is an invite, so update its profile info */ |
1893 if ( ( statusMsg ) && ( strlen( statusMsg ) > 0 ) ) { | 1893 if ( ( statusMsg ) && ( *statusMsg ) ) { |
1894 /* update the status message */ | 1894 /* update the status message */ |
1895 if ( contact->statusMsg ) | 1895 if ( contact->statusMsg ) |
1896 g_free( contact->statusMsg ); | 1896 g_free( contact->statusMsg ); |
1897 contact->statusMsg = strdup( statusMsg ); | 1897 contact->statusMsg = strdup( statusMsg ); |
1898 } | 1898 } |
1899 else | 1899 else |
1900 contact->statusMsg = NULL; | 1900 contact->statusMsg = NULL; |
1901 if ( contact->profile ) | 1901 if ( contact->profile ) |
1902 g_free( contact->profile ); | 1902 g_free( contact->profile ); |
1903 contact->profile = profile; | 1903 contact->profile = profile; |
1904 if ( ( avatarId ) && ( strlen( avatarId ) > 0 ) ) { | 1904 if ( ( avatarId ) && ( *avatarId ) ) { |
1905 /* avatar must be requested for this invite before we can display it */ | 1905 /* avatar must be requested for this invite before we can display it */ |
1906 mxit_get_avatar( session, mxitId, avatarId ); | 1906 mxit_get_avatar( session, mxitId, avatarId ); |
1907 if ( contact->avatarId ) | 1907 if ( contact->avatarId ) |
1908 g_free( contact->avatarId ); | 1908 g_free( contact->avatarId ); |
1909 contact->avatarId = strdup( avatarId ); | 1909 contact->avatarId = strdup( avatarId ); |
1917 else { | 1917 else { |
1918 /* this is a contact */ | 1918 /* this is a contact */ |
1919 if ( avatarId ) | 1919 if ( avatarId ) |
1920 mxit_update_buddy_avatar( session, mxitId, avatarId ); | 1920 mxit_update_buddy_avatar( session, mxitId, avatarId ); |
1921 | 1921 |
1922 if ( ( statusMsg ) && ( strlen( statusMsg ) > 0 ) ) { | 1922 if ( ( statusMsg ) && ( *statusMsg ) ) { |
1923 /* update the status message */ | 1923 /* update the status message */ |
1924 PurpleBuddy* buddy = NULL; | 1924 PurpleBuddy* buddy = NULL; |
1925 | 1925 |
1926 buddy = purple_find_buddy( session->acc, mxitId ); | 1926 buddy = purple_find_buddy( session->acc, mxitId ); |
1927 if ( buddy ) { | 1927 if ( buddy ) { |