static void SetGender(MCONTACT hContact, int gender, bool clear) { if (hContact == NULL) return; char *proto = GetContactProto(hContact); if (IsEmpty(proto)) return; if (gender <= 0) gender = db_get_b(hContact, proto, "Gender", 0); if (gender <= 0) gender = db_get_b(hContact, "UserInfo", "Gender", 0); const char *ico; if (gender == 'M') ico = "gender_male"; else if (gender == 'F') ico = "gender_female"; else ico = NULL; if (ico != NULL || clear) { ExtraIcon *extra = GetExtraIcon(hExtraGender); if (extra) extra->setIconByName((int)hExtraGender, hContact, ico); } }
MIR_APP_DLL(int) ExtraIcon_SetIconByName(HANDLE hExtraIcon, MCONTACT hContact, const char *icoName) { if (hExtraIcon == NULL || hContact == NULL) return -1; ExtraIcon *extra = GetExtraIcon(hExtraIcon); if (extra == NULL) return -1; return extra->setIconByName((INT_PTR)hExtraIcon, hContact, icoName); }
INT_PTR ExtraIcon_SetIconByName(WPARAM wParam, LPARAM lParam) { if (wParam == 0) return -1; EXTRAICON *ei = (EXTRAICON*)wParam; if (ei->cbSize < (int)sizeof(EXTRAICON) || ei->hExtraIcon == NULL || ei->hContact == NULL) return -1; ExtraIcon *extra = GetExtraIcon(ei->hExtraIcon); if (extra == NULL) return -1; return extra->setIconByName((int)ei->hExtraIcon, ei->hContact, ei->icoName); }