INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM, LPARAM res) { if (!m_bJabberOnline || !hContact) return 0; TCHAR *jid, text[1024]; ptrT tszJid(getTStringA(hContact, "jid")); if (tszJid == NULL) { ptrT roomid(getTStringA(hContact, "ChatRoomID")); if (roomid == NULL) return 0; JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, roomid); if (item == NULL) return 0; mir_sntprintf(text, _T("%s/%s"), item->jid, item->nick); jid = text; } else jid = tszJid; CMString szValue; if (EnterString(szValue, TranslateT("Status Message"), ESF_MULTILINE)) SendPresenceTo(res, jid, NULL, szValue); return 0; }
void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { debugLogA("CVkProto::OnReceiveStatusMsg %d", reply->resultCode); if (reply->resultCode != 200) return; OnReceiveStatus(reply, pReq); ptrT ptszOldStatusMsg(db_get_tsa(NULL, m_szModuleName, "OldStatusMsg")); CMString tszOldStatusMsg(ptszOldStatusMsg); ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_MULTILINE; pForm.caption = TranslateT("Enter new status message"); pForm.ptszInitVal = ptszOldStatusMsg; pForm.szModuleName = m_szModuleName; pForm.szDataPrefix = "statusmsgform_"; if (!EnterString(&pForm)) return; CMString tszNewStatusMsg(ptrT(pForm.ptszResult)); if (tszOldStatusMsg == tszNewStatusMsg) return; RetrieveStatusMsg(tszNewStatusMsg); setTString("OldStatusMsg", ptszOldStatusMsg); }
LPTSTR CVkProto::ChangeChatTopic(CVkChatInfo *cc) { ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_MULTILINE; pForm.caption = TranslateT("Enter new chat title"); pForm.ptszInitVal = cc->m_tszTopic; pForm.szModuleName = m_szModuleName; pForm.szDataPrefix = "gctopic_"; return (!EnterString(&pForm)) ? NULL : pForm.ptszResult; }
CMString CSkypeProto::ChangeTopicForm() { CMString caption(FORMAT, _T("[%s] %s"), _A2T(m_szModuleName), TranslateT("Enter new chatroom topic")); ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_MULTILINE; pForm.caption = caption; pForm.ptszInitVal = NULL; pForm.szModuleName = m_szModuleName; return (!EnterString(&pForm)) ? CMString() : CMString(ptrT(pForm.ptszResult)); }
INT_PTR __cdecl WhatsAppProto::OnCreateGroup(WPARAM wParam, LPARAM lParam) { ENTER_STRING es = { 0 }; es.cbSize = sizeof(es); es.type = ESF_MULTILINE; es.caption = _T("Enter a subject for new group"); es.szModuleName = m_szModuleName; if (EnterString(&es)) { if (isOnline()) { std::string groupName(T2Utf(es.ptszResult)); m_pConnection->sendCreateGroupChat(groupName); } mir_free(es.ptszResult); } return FALSE; }
void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo) { CMString title(FORMAT, TranslateT("Set new subject for %s"), pInfo->tszNick); ptrT tszOldValue(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK)); ENTER_STRING es = { 0 }; es.cbSize = sizeof(es); es.type = ESF_RICHEDIT; es.szModuleName = m_szModuleName; es.ptszInitVal = tszOldValue; es.caption = title; es.szDataPrefix = "setSubject_"; if (EnterString(&es)) { T2Utf gjid(pInfo->tszJid); T2Utf gsubject(es.ptszResult); m_pConnection->sendSetNewSubject(std::string(gjid), std::string(gsubject)); mir_free(es.ptszResult); } }
int main(int argc, char** argv) { int i = 0; SHACopr copr; SHAUser user; FileEntry fe = {"COPR",0}; uchar *authSecret; int authlen; char test[2] = {'y',0}; long balance; copr.portnum = 0; user.portnum = 0; puts("\nStarting SHA initrov Application\n"); // check for required port name if (argc != 2) { printf("1-Wire Net name required on command line!\n" " (example: \"COM1\" (Win32 DS2480),\"/dev/cua0\" " "(Linux DS2480),\"{1,5}\" (Win32 TMEX)\n"); exit(1); } if((user.portnum = copr.portnum = owAcquireEx(argv[1])) < 0) { printf("Failed to acquire port.\n"); exit(2); } #ifdef COPRVM if(!GetCoprVM(&copr, &fe)) exit(1); #else puts("\nPlease place coprocessor token on the 1-Wire bus.\n"); while(!FindCoprSHA(&copr, &fe)) { if(owHasErrors()) msDelay(10); } printf("Found device: "); PrintSerialNum(copr.devAN); puts("\n"); #endif authlen = GetSecret("System Authentication Secret", &authSecret); EnterString("Reformat the secret for DS1961S compatibility", test, 1, 1); if(test[0] == 'y') { ReformatSecretFor1961S(authSecret, authlen); PrintHex(authSecret, authlen); printf("\n"); copr.ds1961Scompatible = 0x55; } puts("\nPlease place user token on the 1-Wire bus.\n"); do { while(!FindNewSHA(user.portnum, user.devAN, (i==0))) { if(owHasErrors()) { OWERROR_DUMP(stdout); msDelay(10); } } i++; } while(user.devAN[7]==copr.devAN[7]); // just check the crc of the two devices balance = 100; EnterNum("\nInitial Balance in Cents?\n", 5, &balance, 0, 0xFFFFF); printf("Installing Service Data on device: "); PrintSerialNum(user.devAN); puts("\n"); if(InstallServiceData(&copr, &user, authSecret, authlen, (int)balance)) { puts("User token successfully set up"); } else { puts("User token setup failed"); OWERROR_DUMP(stdout); } // and we're done owRelease(copr.portnum); // program is about to exit, but we may as well free these // up anyways... free(authSecret); return 0; }