bool CCAnimationFrame::initWithSpriteFrame(CCSpriteFrame* spriteFrame, float delayUnits, CCDictionary* userInfo) { setSpriteFrame(spriteFrame); setDelayUnits(delayUnits); setUserInfo(userInfo); return true; }
bool AnimationFrame::initWithSpriteFrame(SpriteFrame* spriteFrame, float delayUnits, const ValueMap& userInfo) { setSpriteFrame(spriteFrame); setDelayUnits(delayUnits); setUserInfo(userInfo); return true; }
void ProfileActivity::OnResponseReady(void * userDataPtr, int identifier) { if (loading) { loading = false; setUserInfo(*(UserInfo*)userDataPtr); delete (UserInfo*)userDataPtr; } else if (saving) { Exit(); } }
EUser::EUser(long _id) { db = EDBconnection::getInstance(); QString query = QString("SELECT " \ "id, login, password, lastname, name, address, phone, email, type, reg_date " \ "FROM users WHERE id='%1'").arg(_id); QList<QStringList> List = db->get(query); if (List.isEmpty()/* || List[0].isEmpty()*/) { qDebug("EUser constructor error: List is empty"); } else { setUserInfo(List); } }
SkypeWindow::SkypeWindow(wxWindow* parent, SkypeFunctions *sf, std::string un, wxTextCtrl *lb, wxWindowID id,const wxPoint& pos,const wxSize& size) { //(*Initialize(SkypeWindow) Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxMAXIMIZE_BOX, _T("wxID_ANY")); SetClientSize(wxSize(400,315)); chat_log = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxPoint(8,112), wxSize(384,160), wxTE_MULTILINE|wxTE_READONLY, wxDefaultValidator, _T("ID_TEXTCTRL1")); chat_send = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxPoint(8,280), wxSize(344,27), wxTE_PROCESS_ENTER|wxTE_MULTILINE, wxDefaultValidator, _T("ID_TEXTCTRL2")); button_chat = new wxButton(this, ID_BUTTON1, _("<-"), wxPoint(360,280), wxSize(32,27), 0, wxDefaultValidator, _T("ID_BUTTON1")); Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(8,8), wxSize(384,96), wxTAB_TRAVERSAL, _T("ID_PANEL1")); img_avatar = new wxStaticBitmap(Panel1, ID_STATICBITMAP1, wxBitmap(wxImage(_T("./img/avatar_prueba.jpg")).Rescale(wxSize(89,89).GetWidth(),wxSize(89,89).GetHeight())), wxPoint(0,0), wxSize(89,89), 0, _T("ID_STATICBITMAP1")); panel_call = new wxPanel(Panel1, ID_PANEL3, wxPoint(104,0), wxSize(48,40), wxTAB_TRAVERSAL, _T("ID_PANEL3")); img_call = new wxBitmapButton(panel_call, ID_BITMAPBUTTON1, wxBitmap(wxImage(_T("./img/call_on.gif"))), wxPoint(0,0), wxSize(40,40), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTON1")); img_call->SetDefault(); Panel2 = new wxPanel(Panel1, ID_PANEL4, wxPoint(152,0), wxSize(48,40), wxTAB_TRAVERSAL, _T("ID_PANEL4")); img_sound = new wxBitmapButton(Panel2, ID_BITMAPBUTTON3, wxBitmap(wxImage(_T("./img/mute_on.png"))), wxPoint(0,0), wxSize(40,40), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTON3")); img_sound->SetDefault(); panel_mute = new wxPanel(Panel1, ID_PANEL2, wxPoint(200,0), wxSize(48,40), wxTAB_TRAVERSAL, _T("ID_PANEL2")); img_micro = new wxBitmapButton(panel_mute, ID_BITMAPBUTTON2, wxBitmap(wxImage(_T("./img/micro_on.png"))), wxPoint(0,0), wxSize(40,40), wxBU_AUTODRAW, wxDefaultValidator, _T("ID_BITMAPBUTTON2")); img_micro->SetDefault(); label_name = new wxStaticText(Panel1, ID_STATICTEXT1, _("Name"), wxPoint(104,48), wxDefaultSize, 0, _T("ID_STATICTEXT1")); label_location = new wxStaticText(Panel1, ID_STATICTEXT2, _("City, Country"), wxPoint(104,72), wxDefaultSize, 0, _T("ID_STATICTEXT2")); timer_messageEvents.SetOwner(this, ID_TIMER1); timer_messageEvents.Start(100, false); Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&SkypeWindow::Onchat_sendTextEnter); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SkypeWindow::Onbutton_chatClick); Connect(ID_BITMAPBUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SkypeWindow::callButton); Connect(ID_BITMAPBUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SkypeWindow::soundButton); Connect(ID_BITMAPBUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SkypeWindow::muteButton); Connect(ID_TIMER1,wxEVT_TIMER,(wxObjectEventFunction)&SkypeWindow::Ontimer_messageEventsTrigger); //*) SF = sf; userName = un; log_box = lb; chat_log->AppendText(wxString("Now you can chat with ", wxConvUTF8)); chat_log->AppendText(wxString(userName.c_str(), wxConvUTF8)); chat_log->AppendText(wxString(" ...\n", wxConvUTF8)); setUserInfo(); }
// handle Owner's avatar hash changes void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) { if (nDataLen < 0x14 || !m_bAvatarsEnabled) return; switch (bFlags) { case 1: // our avatar is on the server setSettingBlob(NULL, "AvatarHash", pData, 0x14); /// TODO: properly handle multiple avatar items (more formats) setUserInfo(); { // here we need to find a file, check its hash, if invalid get avatar from server TCHAR *file = GetOwnAvatarFileName(); if (!file) { // we have no avatar file, download from server debugLogA("We have no avatar, requesting from server."); TCHAR szFile[MAX_PATH * 2 + 4]; GetAvatarFileName(0, NULL, szFile, MAX_PATH * 2); GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, szFile); } else { // we know avatar filename BYTE *hash = calcMD5HashOfFile(file); if (!hash) { // hash could not be calculated - probably missing file, get avatar from server debugLogA("We have no avatar, requesting from server."); TCHAR szFile[MAX_PATH * 2 + 4]; GetAvatarFileName(0, NULL, szFile, MAX_PATH * 2); GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, szFile); } // check if we had set any avatar if yes set our, if not download from server else if (memcmp(hash, pData + 4, 0x10)) { // we have different avatar, sync that if (m_bSsiEnabled && getByte("ForceOurAvatar", 1)) { // we want our avatar, update hash DWORD dwPaFormat = ::ProtoGetAvatarFileFormat(file); BYTE pHash[0x14]; debugLogA("Our avatar is different, setting our new hash."); pHash[0] = 0; pHash[1] = dwPaFormat == PA_FORMAT_XML ? AVATAR_HASH_FLASH : AVATAR_HASH_STATIC; pHash[2] = 1; // state of the hash pHash[3] = 0x10; // len of the hash memcpy((pHash + 4), hash, 0x10); updateServAvatarHash(pHash, 0x14); } else { // get avatar from server debugLogA("We have different avatar, requesting new from server."); TCHAR tszFile[MAX_PATH * 2 + 4]; GetAvatarFileName(0, NULL, tszFile, MAX_PATH * 2); GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, tszFile); } } SAFE_FREE((void**)&hash); SAFE_FREE(&file); } } break; case 0x41: // request to upload avatar data case 0x81: // request to re-upload avatar data if (m_bSsiEnabled) { // we could not change serv-list if it is disabled... TCHAR *file = GetOwnAvatarFileName(); if (!file) { // we have no file to upload, remove hash from server debugLogA("We do not have avatar, removing hash."); SetMyAvatar(0, 0); break; } DWORD dwPaFormat = ::ProtoGetAvatarFileFormat(file); BYTE *hash = calcMD5HashOfFile(file); if (!hash) { // the hash could not be calculated, remove from server debugLogA("We could not obtain hash, removing hash."); SetMyAvatar(0, 0); } else if (!memcmp(hash, pData + 4, 0x10)) { // we have the right file HANDLE hFile = NULL, hMap = NULL; BYTE *ppMap = NULL; long cbFileSize = 0; debugLogA("Uploading our avatar data."); if ((hFile = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE) if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL) if ((ppMap = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL) cbFileSize = GetFileSize(hFile, NULL); if (cbFileSize != 0) SetAvatarData(NULL, (WORD)(dwPaFormat == PA_FORMAT_XML ? AVATAR_HASH_FLASH : AVATAR_HASH_STATIC), ppMap, cbFileSize); if (ppMap != NULL) UnmapViewOfFile(ppMap); if (hMap != NULL) CloseHandle(hMap); if (hFile != NULL) CloseHandle(hFile); SAFE_FREE((void**)&hash); } else { BYTE pHash[0x14]; debugLogA("Our file is different, set our new hash."); pHash[0] = 0; pHash[1] = dwPaFormat == PA_FORMAT_XML ? AVATAR_HASH_FLASH : AVATAR_HASH_STATIC; pHash[2] = 1; // state of the hash pHash[3] = 0x10; // len of the hash memcpy((pHash + 4), hash, 0x10); updateServAvatarHash(pHash, 0x14); SAFE_FREE((void**)&hash); } SAFE_FREE(&file); } break; default: debugLogA("Received UNKNOWN Avatar Status."); } }
int main( int argc, char *argv[] ) { int verbose = 0; int useProxy = 0; int i, j; char usernameLivedoor[80]; char passwordLivedoor[80]; char usernameFC2N[80]; char passwordFC2N[80]; char editorPath[MAX_PATH]; int ret = 0; char *p; FILE *fp; usernameLivedoor[0] = NUL; passwordLivedoor[0] = NUL; usernameFC2N[0] = NUL; passwordFC2N[0] = NUL; editorPath[0] = NUL; for ( i = 1; i < argc; i++ ) { if ( argv[i][0] != '-' ) break; for ( j = 1; argv[i][j]; j++ ) { switch ( argv[i][j] ) { case 'v': verbose = !verbose; break; case 'p': useProxy = !useProxy; break; case 'e': if ( argv[i][j + 1] ) strcpy( editorPath, &(argv[i][j + 1]) ); else if ( i + 1 < argc ) strcpy( editorPath, argv[++i] ); else continue; j = strlen( argv[i] ) - 1; break; } } } fp = fopen( "setting.inf", "r" ); if ( fp ) { char buf[BUFSIZ], *q; int cnt = 0; while ( ( p = fgets( buf, BUFSIZ - 1, fp ) ) != NULL ) { while ( (*p == ' ') || (*p == '\t') ) p++; if ( (*p == '#') || (*p == '\n') || (*p == '\r') ) continue; q = p + strlen( p ); while ( --q > p ) { if ( (*q == '\n') || (*q == '\r') || (*q == ' ') || (*q == '\t') ) *q = NUL; else break; } if ( !(*p) || (p == q) ) continue; switch ( cnt ) { case 0: strcpy( usernameLivedoor, p ); break; case 1: strcpy( passwordLivedoor, p ); break; case 2: strcpy( usernameFC2N, p ); break; case 3: strcpy( passwordFC2N, p ); break; } if ( ++cnt >= 4 ) break; } fclose( fp ); } /* livedoor Blog */ if ( usernameLivedoor[0] == NUL ) { do { fputs( "[livedoor Blog] Username: "******"[livedoor Blog] Password: "******"[FC2NETWORK] Username: "******"[FC2NETWORK] Password: ", stderr ); p = fgets( passwordFC2N, 79, stdin ); if ( !p ) { clearerr( stdin ); passwordFC2N[0] = '\0'; } while ( passwordFC2N[strlen(passwordFC2N) - 1] == '\n' ) { passwordFC2N[strlen(passwordFC2N) - 1] = '\0'; if ( passwordFC2N[0] == '\0' ) break; } } while ( passwordFC2N[0] == '\0' ); } setUserInfo( usernameLivedoor, passwordLivedoor ); setVerbose( verbose, stderr ); setUseProxy( useProxy ); ret = interDiary( usernameLivedoor, usernameFC2N, passwordFC2N, editorPath ); return ( ret ); }
/* 連日記 */ int interDiary( const char *usernameLivedoor, const char *usernameFC2N, const char *passwordFC2N, const char *editorPath ) { char postID[MAX_POSTIDLENGTH + 1]; char title[80]; char livedoorContent[20480]; char fc2networkContent[20480]; int ret; ret = writeDiary( title, livedoorContent, fc2networkContent, editorPath ); if ( ret ) { /* livedoor Blog に 記事 を投稿する */ CATLISTINFEX catEx; char blogID[80]; char *content, *subject; int bRet; char summary[2048]; blogID[0] = NUL; setTargetURL( ATOMURL_LIVEDOOR_200507 ); setBlogID( blogID ); catEx.numberOfCategories = 1; strcpy( catEx.categoryName[0], sjis2utf( "連日記" ) ); strcpy( summary, sjis2utf( "FC2NETWORK と連携した日記を書く企画です。" ) ); subject = (char *)malloc( strlen( title ) + BUFSIZ + 1 ); content = (char *)malloc( strlen(livedoorContent) * 3 + BUFSIZ + 1 ); strcpy( subject, sjis2utf( title ) ); if ( !strncmp( livedoorContent, "<p>", 3 ) ) strcpy( content, sjis2utf( livedoorContent ) ); else sprintf( content, "<p>%s</p>\n", sjis2utf( livedoorContent ) ); strcat( content, sjis2utf( "<p style=\"text-align: right;\">(つづく)</p>\n" "<hr />\n" "<p>* 続きは FC2NETWORK の私の日記をご覧ください</p>\n" ) ); bRet = postEntryOnAtomAPI( NULL, NULL, blogID, subject, /* 題名 */ summary, /* 概要 */ content, /* 本文 */ &catEx, /* カテゴリ */ TRUE, /* 投稿状態 */ postID /* 投稿後の記事ID */ ); free( subject ); free( content ); } if ( ret ) { /* FC2NETWORK に 日記 を投稿する */ char cookie[BUFSIZ * 4]; char livedoorURL[MAX_URLLENGTH]; char trackbackURL[512]; char *content, *subject; char body[20480]; setUserInfo( usernameFC2N, passwordFC2N ); setBlogKind( BLOGKIND_FC2NETWORK ); memset( cookie, 0x00, BUFSIZ * 4 ); if ( loginFC2NETWORK( NULL, NULL, cookie ) ) { sprintf( trackbackURL, "http://blog.livedoor.jp/%s/tb.cgi/%s", usernameLivedoor, postID ); sprintf( livedoorURL, "http://blog.livedoor.jp/%s/archives/%s.html", usernameLivedoor, postID ); sprintf( body, "* livedoor Blog で日記の前半、FC2NETWORK で日記の後半" "を書いています\n (この日記は livedoor Blog で書いた記" "事とセットになって1つの日記、つまり「連日記」を構成し" "ています。)\n\n" "livedoor Blog で書いた日記\n" "『[:strong-s:]%s[:strong-e:]』\n[:i-s:](%s)[:i-e:]\n" "の続きです。\n\n[:strong-s:](つづき)[:strong-e:]\n%s\n", title, livedoorURL, fc2networkContent ); subject = (char *)malloc( strlen( title ) + BUFSIZ + 1 ); content = (char *)malloc( strlen( body ) * 3 + BUFSIZ + 1 ); strcpy( subject, sjis2euc( title ) ); strcpy( content, sjis2euc( body ) ); postFC2NETWORK( NULL, NULL, cookie, subject, content, trackbackURL ); free( subject ); free( content ); } } return ( ret ); }
int main(void) { system("mode con lines=25 cols=80"); //콘솔 창 크기 초기화 UserInfo *userInfo = NULL; FILE *readFile = NULL; FILE *writeFile = NULL; int input = 1, menu = 1, choice; int *ptr = &menu; char *menu_num[MENU_NUM]; puts("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t = 시작하는 중 = \n\n\n\n\n\n\n\n\n\n\n"); userInfo = setUserInfo(userInfo, readFile); //구조체 배열에 파일 데이터 저장 if (userInfo == (UserInfo*)-1) return 0; //오류 났을 경우 바로 종료 startSound(); //로딩 완료 효과음 printMainSub(menu, menu_num); //메인 메뉴 구성 while(1) { printMain(menu, menu_num); //메인 화면 출력 input = getch(); //입력 if (input == ARROW_BUFFER) //방향키는 입력 시 아스키확장 값이 먼저 들어온 후 값이 들어옴 input = getch(); //그래서 이 경우 버퍼를 한번 비우도록 하였음 switch (input) { case UP_ARROW_KEY: //상 방향키 if (menu > 1) menu--; moveSound(); break; case DOWN_ARROW_KEY: //하 방향키 if (menu < 6) menu++; moveSound(); break; case ENTER_KEY: //enter키 inSound(); switch (menu) { case 1: //출력 printList(userInfo); break; case 2: //등록 addUser(userInfo); break; case 3: //삭제 searchMain(userInfo, _DELETE, "삭제", "Delete"); break; case 4: //수정 searchMain(userInfo, MODIFY, "수정", "Modify"); break; case 5: //검색 searchMain(userInfo, SEARCH, "검색", "Search"); break; case 6: //저장 saveInfo(userInfo, writeFile); break; } //switch(menu) out break; case ESC_KEY: //esc키 inSound(); choice = closeProgram(); if (choice == SAVE) choice = saveInfo(userInfo, writeFile); if (choice == SAVE || choice == EXIT){ printClose(); free(userInfo); closeSound(); printClose_sub(); return 0; } else break; default: warningMessage(input - '0', 6, ptr); break; } //switch(input) out } free(userInfo); return 0; }
rcComm_t* _rcConnect( const char *rodsHost, int rodsPort, const char *proxyUserName, const char *proxyRodsZone, const char *clientUserName, const char *clientRodsZone, rErrMsg_t *errMsg, int connectCnt, int reconnFlag ) { rcComm_t *conn; int status; char *tmpStr; conn = ( rcComm_t* )malloc( sizeof( rcComm_t ) ); memset( conn, 0, sizeof( rcComm_t ) ); conn->thread_ctx = ( thread_context* ) malloc( sizeof( thread_context ) ); memset( conn->thread_ctx, 0, sizeof( thread_context ) ); if ( errMsg != NULL ) { memset( errMsg, 0, sizeof( rErrMsg_t ) ); } if ( ( tmpStr = getenv( IRODS_PROT ) ) != NULL ) { conn->irodsProt = ( irodsProt_t )atoi( tmpStr ); } else { conn->irodsProt = NATIVE_PROT; } status = setUserInfo( proxyUserName, proxyRodsZone, clientUserName, clientRodsZone, &conn->clientUser, &conn->proxyUser ); if ( status < 0 ) { if ( errMsg != NULL ) { errMsg->status = status; snprintf( errMsg->msg, ERR_MSG_LEN - 1, "_rcConnect: setUserInfo failed\n" ); } if ( conn->thread_ctx != NULL ) { delete conn->thread_ctx->reconnThr; delete conn->thread_ctx->lock; delete conn->thread_ctx->cond; free( conn->thread_ctx ); } free( conn ); return NULL; } status = setRhostInfo( conn, rodsHost, rodsPort ); if ( status < 0 ) { if ( errMsg != NULL ) { rodsLogError( LOG_ERROR, status, "_rcConnect: setRhostInfo error, irodsHost is probably not set correctly" ); errMsg->status = status; snprintf( errMsg->msg, ERR_MSG_LEN - 1, "_rcConnect: setRhostInfo failed\n" ); } if ( conn->thread_ctx != NULL ) { delete conn->thread_ctx->reconnThr; delete conn->thread_ctx->lock; delete conn->thread_ctx->cond; free( conn->thread_ctx ); } free( conn ); return NULL; } status = connectToRhost( conn, connectCnt, reconnFlag ); if ( status < 0 ) { if ( getIrodsErrno( status ) == SYS_SOCK_READ_TIMEDOUT ) { /* timed out. try again */ rodsLog( LOG_ERROR, "_rcConnect: connectToRhost timedout retrying" ); status = connectToRhost( conn, connectCnt, reconnFlag ); } } if ( status < 0 ) { rodsLogError( LOG_ERROR, status, "_rcConnect: connectToRhost error, server on %s:%d is probably down", conn->host, conn->portNum ); if ( errMsg != NULL ) { errMsg->status = status; snprintf( errMsg->msg, ERR_MSG_LEN - 1, "_rcConnect: connectToRhost failed\n" ); } if ( conn->thread_ctx != NULL ) { delete conn->thread_ctx->reconnThr; delete conn->thread_ctx->lock; delete conn->thread_ctx->cond; free( conn->thread_ctx ); } free( conn ); return NULL; } #ifndef windows_platform if ( reconnFlag == RECONN_TIMEOUT && conn->svrVersion != NULL && conn->svrVersion->reconnPort > 0 ) { if ( isLoopbackAddress( conn->svrVersion->reconnAddr ) || strcmp( conn->svrVersion->reconnAddr , "0.0.0.0" ) == 0 || strcmp( conn->svrVersion->reconnAddr , "localhost" ) ) { /* localhost. just use conn->host */ rstrcpy( conn->svrVersion->reconnAddr, conn->host, NAME_LEN ); } conn->exit_flg = false; try { conn->thread_ctx->lock = new boost::mutex; conn->thread_ctx->cond = new boost::condition_variable; conn->thread_ctx->reconnThr = new boost::thread( cliReconnManager, conn ); } catch ( const boost::thread_resource_error& ) { rodsLog( LOG_ERROR, "failure initializing the boost thread context in _rcConnect" ); return NULL; } } #endif return conn; }
void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) { setUserInfo(); /* SNAC 3,4: Tell server who's on our list (deprecated) */ /* SNAC 3,15: Try to add unauthorised contacts to temporary list */ sendEntireListServ(ICQ_BUDDY_FAMILY, ICQ_USER_ADDTOTEMPLIST, BUL_ALLCONTACTS); if (m_iDesiredStatus == ID_STATUS_INVISIBLE) { /* Tell server who's on our visible list (deprecated) */ if (!m_bSsiEnabled) sendEntireListServ(ICQ_BOS_FAMILY, ICQ_CLI_ADDVISIBLE, BUL_VISIBLE); else updateServVisibilityCode(3); } if (m_iDesiredStatus != ID_STATUS_INVISIBLE) { /* Tell server who's on our invisible list (deprecated) */ if (!m_bSsiEnabled) sendEntireListServ(ICQ_BOS_FAMILY, ICQ_CLI_ADDINVISIBLE, BUL_INVISIBLE); else updateServVisibilityCode(4); } // SNAC 1,1E: Set status icq_packet packet; { DWORD dwDirectCookie = rand() ^ (rand() << 16); // Get status WORD wStatus = MirandaStatusToIcq(m_iDesiredStatus); // Get status note & mood char *szStatusNote = PrepareStatusNote(m_iDesiredStatus); BYTE bXStatus = getContactXStatus(NULL); char szMoodData[32]; // prepare mood id if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus - 1] != -1) mir_snprintf(szMoodData, "icqmood%d", moodXStatus[bXStatus - 1]); else szMoodData[0] = '\0'; //! Tricky code, this ensures that the status note will be saved to the directory SetStatusNote(szStatusNote, m_bGatewayMode ? 5000 : 2500, TRUE); size_t wStatusNoteLen = mir_strlen(szStatusNote); size_t wStatusMoodLen = mir_strlen(szMoodData); size_t wSessionDataLen = (wStatusNoteLen ? wStatusNoteLen + 4 : 0) + 4 + wStatusMoodLen + 4; serverPacketInit(&packet, 71 + (wSessionDataLen ? wSessionDataLen + 4 : 0)); packFNACHeader(&packet, ICQ_SERVICE_FAMILY, ICQ_CLIENT_SET_STATUS); packDWord(&packet, 0x00060004); // TLV 6: Status mode and security flags packWord(&packet, GetMyStatusFlags()); // Status flags packWord(&packet, wStatus); // Status packTLVWord(&packet, 0x0008, 0x0A06); // TLV 8: Independent Status Messages packDWord(&packet, 0x000c0025); // TLV C: Direct connection info packDWord(&packet, getDword("RealIP", 0)); packDWord(&packet, nPort); packByte(&packet, DC_TYPE); // TCP/FLAG firewall settings packWord(&packet, ICQ_VERSION); packDWord(&packet, dwDirectCookie); // DC Cookie packDWord(&packet, WEBFRONTPORT); // Web front port packDWord(&packet, CLIENTFEATURES); // Client features packDWord(&packet, 0x7fffffff); // Abused timestamp packDWord(&packet, ICQ_PLUG_VERSION); // Abused timestamp if (ServiceExists("SecureIM/IsContactSecured")) packDWord(&packet, 0x5AFEC0DE); // SecureIM Abuse else packDWord(&packet, 0x00000000); // Timestamp packWord(&packet, 0x0000); // Unknown packTLVWord(&packet, 0x001F, 0x0000); if (wSessionDataLen) { // Pack session data packWord(&packet, 0x1D); // TLV 1D packWord(&packet, WORD(wSessionDataLen)); // TLV length packWord(&packet, 0x02); // Item Type if (wStatusNoteLen) { packWord(&packet, 0x400 | WORD(wStatusNoteLen + 4)); // Flags + Item Length packWord(&packet, WORD(wStatusNoteLen)); // Text Length packBuffer(&packet, (LPBYTE)szStatusNote, wStatusNoteLen); packWord(&packet, 0); // Encoding not specified (utf-8 is default) } else packWord(&packet, 0); // Flags + Item Length packWord(&packet, 0x0E); // Item Type packWord(&packet, WORD(wStatusMoodLen)); // Flags + Item Length if (wStatusMoodLen) packBuffer(&packet, (LPBYTE)szMoodData, wStatusMoodLen); // Mood // Save current status note & mood db_set_utf(NULL, m_szModuleName, DBSETTING_STATUS_NOTE, szStatusNote); setString(DBSETTING_STATUS_MOOD, szMoodData); } // Release memory SAFE_FREE(&szStatusNote); sendServPacket(&packet); } /* SNAC 1,11 */ serverPacketInit(&packet, 14); packFNACHeader(&packet, ICQ_SERVICE_FAMILY, ICQ_CLIENT_SET_IDLE); packDWord(&packet, 0x00000000); sendServPacket(&packet); m_bIdleAllow = 0; // Change status SetCurrentStatus(m_iDesiredStatus); // Finish Login sequence serverPacketInit(&packet, 98); packFNACHeader(&packet, ICQ_SERVICE_FAMILY, ICQ_CLIENT_READY); packDWord(&packet, 0x00220001); // imitate ICQ 6 behaviour packDWord(&packet, 0x0110164f); packDWord(&packet, 0x00010004); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x00130004); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x00020001); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x00030001); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x00150001); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x00040001); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x00060001); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x00090001); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x000A0001); packDWord(&packet, 0x0110164f); packDWord(&packet, 0x000B0001); packDWord(&packet, 0x0110164f); sendServPacket(&packet); debugLogA(" *** Yeehah, login sequence complete"); // login sequence is complete enter logged-in mode info->bLoggedIn = true; m_bConnectionLost = false; // enable auto info-update routine icq_EnableUserLookup(true); if (!info->isMigrating) { // Get Offline Messages Reqeust cookie_offline_messages *ack = (cookie_offline_messages*)SAFE_MALLOC(sizeof(cookie_offline_messages)); if (ack) { DWORD dwCookie = AllocateCookie(CKT_OFFLINEMESSAGE, ICQ_MSG_CLI_REQ_OFFLINE, 0, ack); serverPacketInit(&packet, 10); packFNACHeader(&packet, ICQ_MSG_FAMILY, ICQ_MSG_CLI_REQ_OFFLINE, 0, dwCookie); sendServPacket(&packet); } else icq_LogMessage(LOG_WARNING, LPGEN("Failed to request offline messages. They may be received next time you log in.")); // Update our information from the server sendOwnerInfoRequest(); // Request info updates on all contacts icq_RescanInfoUpdate(); // Start sending Keep-Alive packets StartKeepAlive(info); if (m_bAvatarsEnabled) { // Send SNAC 1,4 - request avatar family 0x10 connection icq_requestnewfamily(ICQ_AVATAR_FAMILY, &CIcqProto::StartAvatarThread); m_avatarsConnectionPending = TRUE; debugLogA("Requesting Avatar family entry point."); } // Set last xstatus updateServerCustomStatus(TRUE); } info->isMigrating = false; if (m_bAimEnabled) { char **szAwayMsg = NULL; mir_cslock l(m_modeMsgsMutex); szAwayMsg = MirandaStatusToAwayMsg(m_iStatus); if (szAwayMsg) icq_sendSetAimAwayMsgServ(*szAwayMsg); } }