void __cdecl CYahooProto::get_status_thread(HANDLE hContact) { int l; DBVARIANT dbv; char *gm = NULL, *sm = NULL, *fm; Sleep( 150 ); /* Check Yahoo Games Message */ if (!getString(hContact, "YGMsg", &dbv)) { gm = strdup(dbv.pszVal); db_free(&dbv); } if (! db_get_s(hContact, "CList", "StatusMsg", &dbv)) { if (lstrlenA(dbv.pszVal) >= 1) sm = strdup(dbv.pszVal); db_free(&dbv); } else { int status = getWord(hContact, "YStatus", (WORD)YAHOO_STATUS_OFFLINE); sm = yahoo_status_code( yahoo_status(status)); if (sm) sm = strdup(sm); /* we need this to go global FREE later */ } l = 0; if (gm) l += lstrlenA(gm) + 3; l += lstrlenA(sm) + 1; fm = (char *) malloc(l); fm[0] ='\0'; if (gm && lstrlenA(gm) > 0) { /* BAH YAHOO SUCKS! WHAT A PAIN! find first carriage return add status message then add the rest */ char *c = strchr(gm, '\r'); if (c != NULL) { lstrcpynA(fm,gm, c - gm + 1); fm[c - gm + 1] = '\0'; } else lstrcpyA(fm, gm); if (sm) { lstrcatA(fm, ": "); lstrcatA(fm, sm); } if (c != NULL) lstrcatA(fm, c); } else if (sm) { lstrcatA(fm, sm); } FREE(sm); ProtoBroadcastAck( hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, (LPARAM)( TCHAR* )_A2T(fm)); }
void BuddyListWidget::ChangeStatus(int status) { c_YInstance *yinstance = c_YInstance::GetInstance(); if(status >= YAHOO_STATUS_AVAILABLE && status < YAHOO_STATUS_STEPPEDOUT) { c_SetStatus *set_status = new c_SetStatus(yinstance->GetSocket(),"",yahoo_status(status),yinstance->GetId()); yinstance->AddAction(set_status); StatusCB->setEditable(false); } else if(status >= 13) //custom { if(StatusCB->isEditable()) { c_SetStatus *set_status = new c_SetStatus(yinstance->GetSocket(),this->StatusCB->currentText().toLatin1().data(),YAHOO_STATUS_CUSTOM,yinstance->GetId()); yinstance->AddAction(set_status); StatusCB->setEditable(false); } else { StatusCB->setEditable(true); } } else if(status == 10) //invisible { c_SetStatus *set_status = new c_SetStatus(yinstance->GetSocket(),"",YAHOO_STATUS_INVISIBLE,yinstance->GetId()); yinstance->AddAction(set_status); StatusCB->setEditable(false); } };