status_t TBarView::SendDragMessage(const char* signature, entry_ref* ref) { status_t err = B_ERROR; if (fDragMessage) { if (fRefsRcvdOnly) { // current message sent to apps is only B_REFS_RECEIVED fDragMessage->what = B_REFS_RECEIVED; } BRoster roster; if (signature && strlen(signature) > 0 && roster.IsRunning(signature)) { BMessenger mess(signature); // drag message is still owned by DB, copy is sent // can toss it after send err = mess.SendMessage(fDragMessage); } else if (ref) { FSLaunchItem((const entry_ref*)ref, (const BMessage*)fDragMessage, true, true); } else if (signature && strlen(signature) > 0) { roster.Launch(signature, fDragMessage); } } return err; }
void MIDIProcessor::handleIncomingMidiMessage(juce::MidiInput * /*device*/, const juce::MidiMessage& message) { RSJ::Message mess(RSJ::ParseMidi(message)); switch (mess.MessageType) { case RSJ::kCCFlag: if (nrpn_filter_.ProcessMidi(mess.Channel, mess.Number, mess.Value)) { //true if nrpn piece if (nrpn_filter_.IsReady(mess.Channel)) { //send when finished for (const auto listener : listeners_) listener->handleMIDI(RSJ::Message{RSJ::kCCFlag, mess.Channel, nrpn_filter_.GetControl(mess.Channel), nrpn_filter_.GetValue(mess.Channel)}); nrpn_filter_.Clear(mess.Channel); } } else {//regular message for (const auto listener : listeners_) listener->handleMIDI(mess); } break; case RSJ::kNoteOnFlag: case RSJ::kPWFlag: for (const auto listener : listeners_) { listener->handleMIDI(mess); } break; } }
void IdentityRedirectInserter::StartInsert(const long localidentityid, const std::string &redirect) { std::string idstring(""); StringFunctions::Convert(localidentityid,idstring); SQLite3DB::Statement st=m_db->Prepare("SELECT PrivateKey FROM tblLocalIdentity WHERE LocalIdentityID=?"); st.Bind(0, localidentityid); st.Step(); if(st.RowReturned()) { std::string privatekey(""); std::string messagebase(""); Option option(m_db); option.Get("MessageBase",messagebase); st.ResultText(0, privatekey); FCPv2::Message mess("ClientPut"); mess["URI"]="USK"+privatekey.substr(3)+messagebase+"|IdentityRedirect/0/"; mess["Identifier"]="IdentityRedirectInserter|"+idstring+"|"+mess["URI"]; mess["UploadFrom"]="redirect"; mess["TargetURI"]=redirect; m_fcp->Send(mess); m_log->debug("IdentityRedirectInserter::StartInsert inserting redirect for "+idstring+" to "+redirect); } }
void MessageQueue::addMessage(const char* m, Color c) { Message mess(m, c); messages.insert(messages.end(), mess); if(messages.size() > size) messages.erase(messages.begin()); }
void CommandHandler::SendCreateRoom(std::string *arg) { Message mess((uint32_t)CREATE_ROOM, (uint32_t)(arg->size()), (void *)(arg->c_str()), arg); _writebuff.add_data(mess); _state["Pending"] = true; }
void client::thread_func(unsigned n) { session sess(address_, port_); std::size_t message_sizes[] = { 0, 1, 3, 7, 234, 6432, 23221, 3311, 34, 4521, 333 }; for (auto s : message_sizes) { std::vector<uint8_t> mess(s, 'x'); try { const std::size_t cnt = 1024 * 10; for (std::size_t i = 0; i < cnt; ++i) sess.echo(mess); ostream_ << "#" << n << ": " << cnt << " echos (size " << mess.size() << " bytes) received" << std::endl; } catch (std::exception& e) { ostream_ << "#" << n << ": " << "Exception: " << e.what() << std::endl; } } }
void CommandHandler::SendGetRooms(std::string *arg) { Message mess((uint32_t)GET_ROOMS, (uint32_t)(arg->size()), (void *)(arg->c_str()), arg); _writebuff.add_data(mess); _state["Pending"] = true; }
// fonctions that send data void CommandHandler::SendLogin(std::string *arg) { Message mess((uint32_t)LOGIN, (uint32_t)(arg->size()), (void *)(arg->c_str()), arg); _writebuff.add_data(mess); _state["Pending"] = true; }
/// Fit the data simultaneously. void MultiDatasetFit::fitSimultaneous() { try { m_uiForm.btnFit->setEnabled(false); auto fun = createFunction(); auto fit = Mantid::API::AlgorithmManager::Instance().create("Fit"); fit->initialize(); fit->setProperty("Function", fun); fit->setPropertyValue("InputWorkspace", getWorkspaceName(0).toStdString()); fit->setProperty("WorkspaceIndex", getWorkspaceIndex(0)); auto range = getFittingRange(0); fit->setProperty("StartX", range.first); fit->setProperty("EndX", range.second); int n = getNumberOfSpectra(); for (int ispec = 1; ispec < n; ++ispec) { std::string suffix = boost::lexical_cast<std::string>(ispec); fit->setPropertyValue("InputWorkspace_" + suffix, getWorkspaceName(ispec).toStdString()); fit->setProperty("WorkspaceIndex_" + suffix, getWorkspaceIndex(ispec)); auto range = getFittingRange(ispec); fit->setProperty("StartX_" + suffix, range.first); fit->setProperty("EndX_" + suffix, range.second); } m_fitOptionsBrowser->copyPropertiesToAlgorithm(*fit); m_outputWorkspaceName = m_fitOptionsBrowser->getProperty("Output"); if (m_outputWorkspaceName.isEmpty()) { m_outputWorkspaceName = "out"; fit->setPropertyValue("Output", m_outputWorkspaceName.toStdString()); m_fitOptionsBrowser->setProperty("Output", "out"); } if (n == 1) { m_outputWorkspaceName += "_Workspace"; } else { m_outputWorkspaceName += "_Workspaces"; } removeOldOutput(); m_fitRunner.reset(new API::AlgorithmRunner()); connect(m_fitRunner.get(), SIGNAL(algorithmComplete(bool)), this, SLOT(finishFit(bool)), Qt::QueuedConnection); m_fitRunner->startAlgorithm(fit); } catch (std::exception &e) { QString mess(e.what()); const int maxSize = 500; if (mess.size() > maxSize) { mess = mess.mid(0, maxSize); mess += "..."; } QMessageBox::critical(this, "MantidPlot - Error", QString("Fit failed:\n\n %1").arg(mess)); m_uiForm.btnFit->setEnabled(true); } }
void main() { int a=3; float b,c=3.8; clrscr(); b=mess(a,c); printf("prodct =%f",b); getch(); }
void CommandHandler::SendLeaveRoom(std::string *arg) { std::string *str = new std::string(_room->get_name()); Message mess((uint32_t)LEAVE_ROOM, (uint32_t)(str->size()), (void *)(str->c_str()), str); delete arg; _writebuff.add_data(mess); _state["Pending"] = true; }
//Funcion a donde van a parar las funciones que terminan. void Cleaner(void) { char Men[10]; Cli(); Destroy(CurrentPID); k_clear_screen(); mess("==>"); Sti(); while(1); }
void gtprintf(char *fmt, ...) { va_list argp; char s[1000]; va_start(argp, fmt); vsprintf(s, fmt, argp); va_end(argp); mess(s); }
static void recRecompile() { // Look up the block... // (Mask the IOP address accordingly to account for the many various segments and // mirrors). u32 masked_pc = iopRegs.pc & IopMemory::AddressMask; if( masked_pc < 0x800000 ) masked_pc &= Ps2MemSize::IopRam-1; xBlocksMap::Blockmap_iterator blowme( g_PersState.xBlockMap.Map.find( masked_pc ) ); memzero_obj( g_BlockState ); //g_BlockState.pc = iopRegs.pc; if( blowme == g_PersState.xBlockMap.Map.end() ) { //Console::WriteLn( "IOP First-pass block at PC: 0x%08x (total blocks=%d)", params masked_pc, g_PersState.xBlockMap.Blocks.GetLength() ); recIR_FirstPassInterpreter(); jASSUME( iopRegs.evtCycleCountdown <= iopRegs.evtCycleDuration ); if( iopRegs.evtCycleCountdown <= 0 ) iopRegs.ExecutePendingEvents(); //if( !IsIopRamPage( masked_pc ) ) // disable block checking for non-ram (rom, rom1, etc) // m_blockspace.ramlen = 0; g_PersState.xBlockMap.Map[masked_pc] = g_PersState.xBlockMap.Blocks.GetLength(); g_PersState.xBlockMap.Blocks.New().Assign( m_blockspace ); } else { recBlockItem& mess( g_PersState.xBlockMap.Blocks[blowme->second] ); if( !mess.InstOptInfo.IsDisposed() ) { //Console::WriteLn( "IOP Second-pass block at PC: 0x%08x (total blocks=%d)", params masked_pc, g_PersState.xBlockMap.Blocks.GetLength() ); m_tempIR.GenerateIR( mess ); mess.InstOptInfo.Dispose(); m_x86blockstate.AssignBlock( m_tempIR ); m_x86blockstate.RegisterMapper(); g_BlockState.xBlockPtr = m_xBlock_CurPtr; m_x86blockstate.EmitSomeExecutableGoodness(); m_xBlock_CurPtr = xGetPtr(); uptr temp = m_tbl_TranslatePC[masked_pc>>XlatePC_PageBitShift]; uptr* dispatch_ptr = (uptr*)(temp + (masked_pc & XlatePC_PageMask)); *dispatch_ptr = (uptr)g_BlockState.xBlockPtr; } }
/// Fit the data sets sequentially if there are no global parameters. void MultiDatasetFit::fitSequential() { try { /// disable button to avoid multiple fit click m_uiForm.btnFit->setEnabled(false); std::ostringstream input; int n = getNumberOfSpectra(); for (int ispec = 0; ispec < n; ++ispec) { input << getWorkspaceName(ispec).toStdString() << ",i" << getWorkspaceIndex(ispec) << ";"; } auto fun = m_functionBrowser->getFunction(); auto fit = Mantid::API::AlgorithmManager::Instance().create("PlotPeakByLogValue"); fit->initialize(); fit->setPropertyValue("Function", fun->asString()); fit->setPropertyValue("Input", input.str()); auto range = getFittingRange(0); fit->setProperty("StartX", range.first); fit->setProperty("EndX", range.second); m_fitOptionsBrowser->copyPropertiesToAlgorithm(*fit); m_outputWorkspaceName = m_fitOptionsBrowser->getProperty("OutputWorkspace") + "_Workspaces"; removeOldOutput(); m_fitRunner.reset(new API::AlgorithmRunner()); connect(m_fitRunner.get(), SIGNAL(algorithmComplete(bool)), this, SLOT(finishFit(bool)), Qt::QueuedConnection); m_fitRunner->startAlgorithm(fit); } catch (std::exception &e) { QString mess(e.what()); const int maxSize = 500; if (mess.size() > maxSize) { mess = mess.mid(0, maxSize); mess += "..."; } QMessageBox::critical( this, "MantidPlot - Error", QString("PlotPeakByLogValue failed:\n\n %1").arg(mess)); m_uiForm.btnFit->setEnabled(true); } }
void MainWindow::readyRead() { QString messages = sock.readAll(); QStringList msgList = messages.split("\n"); for(size_t i = 0; i < msgList.size(); ++i) { IrcMessage mess(msgList[i]); if(!mess.getCommand().isEmpty()) { manager->recieve(msgList[i]); } } }
void VarManager::search() { QMessageBox mess(QMessageBox::Information, tr("Recherche"), tr("Recherche des variables en cours, cela peut prendre une minute...")); mess.setWindowModality(Qt::ApplicationModal); mess.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint | Qt::MSWindowsFixedSizeDialogHint); mess.setStandardButtons(QMessageBox::NoButton); mess.show(); allVars = fieldArchive->searchAllVars(_fieldNames); int b = bank->value(); for(int adress=0 ; adress<256 ; ++adress) { colorizeItem(liste2->topLevelItem(adress), FF7Var(b, adress)); } }
void ClickableLabel::keyPressEvent(QKeyEvent* event) { #pragma region if (event->key() == Qt::Key_D) { QMessageBox mess(QMessageBox::Question, QStringLiteral("删除提示"), QStringLiteral("确认删除所选组件?"), NULL); QPushButton* okButton = mess.addButton(QStringLiteral("确定"), QMessageBox::AcceptRole); QPushButton* cancelButton = mess.addButton(QStringLiteral("取消"), QMessageBox::RejectRole); mess.exec(); if (reinterpret_cast<QPushButton*>(mess.clickedButton()) == okButton) { } } #pragma endregion }
void yousee(char *fmt, ...) { va_list argp; char s[1000]; char s2[1020]; sprintf(s2, "You see "); va_start(argp, fmt); vsprintf(s, fmt, argp); va_end(argp); strcat(s2, s); mess(s2); }
//----< test stub >-------------------------------------------- void main() { Channel ch("Channel", Peer(8081, "127.0.0.1", 8080)); MockMessenger mess(ch); Message m; std::cout<<"\n Reading from run.bat.."; // test binary message here m.fromFile("../run.bat"); std::cout<<"\n Message length: "<< m.length() <<"\n Block size: "<< m.blockSize() <<"\n Block number: "<< m.size() <<"\n Message name: "<< m.fileName(); mess(m); // use messenger to process message // test string message here Message m2; std::cout<<"\n Testing string message.."; m2.fromString("Test string message"); std::cout<<"\n Message length: "<< m.length() <<"\n Block size: "<< m.blockSize() <<"\n Block number: "<< m.size() <<"\n Message name: "<< m.fileName(); mess(m2); std::cout<<"\n\n"; }
void FreenetMessageInserter::StartTopicInsert(const int localidentityid, const std::string &channel, const std::string &topic) { SQLite3DB::Statement st; std::string idstr(""); std::string data(""); std::string datalengthstr(""); DateTime now; FCPv2::Message mess("ClientPut"); LoadLocalIdentityPrivateKey(localidentityid); if(m_identitykeys[localidentityid]!="") { std::string indexstr("0"); FreenetMessage fm; fm["type"]="settopic"; fm["channel"]=channel; fm["sentdate"]=now.Format("%Y-%m-%d %H:%M:%S"); fm.Body()=topic; data=fm.GetMessageText(); StringFunctions::Convert(localidentityid,idstr); StringFunctions::Convert(data.size(),datalengthstr); StringFunctions::Convert(GetNextMessageIndex(localidentityid,now),indexstr); st=m_db->Prepare("INSERT INTO tblInsertedMessageIndex(LocalIdentityID,Date,MessageIndex) VALUES(?,?,?);"); st.Bind(0,localidentityid); st.Bind(1,now.Format("%Y-%m-%d")); st.Bind(2,indexstr); st.Step(); mess["URI"]="SSK@"+m_identitykeys[localidentityid].substr(4)+m_messagebase+"|"+now.Format("%Y-%m-%d")+"|Message-"+indexstr; mess["Identifier"]=m_fcpuniqueidentifier+"|"+idstr+"|"+now.Format("%Y-%m-%d")+"|"+indexstr+"|"+mess["URI"]; mess["RealTimeFlag"]="true"; mess["UploadFrom"]="direct"; mess["PriorityClass"]=m_insertpriority; mess["ExtraInsertsSingleBlock"]="0"; mess["DataLength"]=datalengthstr; mess["Metadata.ContentType"]=""; m_fcp->Send(mess); m_fcp->Send(std::vector<char>(data.begin(),data.end())); m_log->Debug("FreenetMessageInserter::StartInsert started insert of channel topic "+mess["Identifier"]); } }
void t_tanksMid::run() { t_message mess(t_message::string,new std::string("Hello world peeps")); sharedData.guiQueue.push(mess); sleep(2); t_message mess2(t_message::string,new std::string("Hello world again peeps")); sharedData.guiQueue.push(mess2); bool status = true; while (status) { t_message aMess = sharedData.midQueue.pop(); status = processMessage(aMess); } }
/** Performs a transformation of the form: Q^A x I^B x Ln(Q^C x I^D x E) v Q^F x * I^G x Ln(Q^H x I^I x J). * Uses the 'GeneralFunctionConstants' property where A-J are the 10 (ordered) * input constants. * @param ws The workspace to be transformed * @throw std::range_error if an attempt is made to take log of a negative * number */ void IQTransform::general(API::MatrixWorkspace_sptr ws) { MantidVec &X = ws->dataX(0); MantidVec &Y = ws->dataY(0); MantidVec &E = ws->dataE(0); const std::vector<double> C = getProperty("GeneralFunctionConstants"); // Check for the correct number of elements if (C.size() != 10) { std::string mess( "The General transformation requires 10 values to be provided."); g_log.error(mess); throw std::invalid_argument(mess); } for (size_t i = 0; i < Y.size(); ++i) { double tmpX = std::pow(X[i], C[7]) * std::pow(Y[i], C[8]) * C[9]; if (tmpX <= 0.0) throw std::range_error( "Attempt to take log of a zero or negative number."); tmpX = std::pow(X[i], C[5]) * std::pow(Y[i], C[6]) * std::log(tmpX); const double tmpY = std::pow(X[i], C[2]) * std::pow(Y[i], C[3]) * C[4]; if (tmpY <= 0.0) throw std::range_error( "Attempt to take log of a zero or negative number."); const double newY = std::pow(X[i], C[0]) * std::pow(Y[i], C[1]) * std::log(tmpY); E[i] *= std::pow(X[i], C[0]) * (C[1] * std::pow(Y[i], C[1] - 1) * std::log(tmpY) + ((std::pow(Y[i], C[1]) * std::pow(X[i], C[2]) * C[4] * C[3] * std::pow(Y[i], C[3] - 1)) / tmpY)); X[i] = tmpX; Y[i] = newY; } std::stringstream ylabel; ylabel << "Q^" << C[0] << " x I^" << C[1] << " x Ln( Q^" << C[2] << " x I^" << C[3] << " x " << C[4] << ")"; ws->setYUnitLabel(ylabel.str()); std::stringstream xlabel; xlabel << "Q^" << C[5] << " x I^" << C[6] << " x Ln( Q^" << C[7] << " x I^" << C[8] << " x " << C[9] << ")"; m_label->setLabel(xlabel.str()); }
bool CRemoteControl::Connect() { m_socket = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); if (m_socket == INVALID_SOCKET) { return false; //Couldn't create the socket } // Get the local host information hostent* localHost = gethostbyname(""); char* localIP = inet_ntoa (*(struct in_addr *)*localHost->h_addr_list); SOCKADDR_IN target; memset(&target, 0, sizeof(SOCKADDR_IN)); target.sin_family = AF_INET; target.sin_addr.s_addr = inet_addr(localIP); target.sin_port = htons (IRSS_PORT); if (connect(m_socket, (SOCKADDR *)&target, sizeof(target)) == SOCKET_ERROR) { Close(); return false; //Couldn't connect, irss not available } u_long iMode = 1; //non-blocking if (ioctlsocket(m_socket, FIONBIO, &iMode) == SOCKET_ERROR) { CLog::Log(LOGERROR, "IRServerSuite: failed to set socket to non-blocking."); Close(); return false; } //register CIrssMessage mess(IRSSMT_RegisterClient, IRSSMF_Request); if (!SendPacket(mess)) { CLog::Log(LOGERROR, "IRServerSuite: failed to send RegisterClient packet."); return false; } m_isConnecting = true; return true; }
// call template's downloadlink JavaScript function void fancydm::sendLink(Socket &peersock, String &linkurl, String &prettyurl) { String mess("<script language='javascript'>\n<!--\ndownloadlink(\""+linkurl+"\",\""+prettyurl + "\"," + (toobig_notdownloaded ? "2" : (toobig_unscanned ? "1" : "0")) + ");\n//-->\n</script>\n"); peersock.writeString(mess.toCharArray()); // send text-only version for non-JS-enabled browsers // 1220 "Scan complete.</p><p>Click here to download: " // 1221 "Download complete; file not scanned.</p><p>Click here to download: " // 1222 "File too large to cache.</p><p>Click here to re-download, bypassing virus scanning: " mess = "<noscript><p>"; mess += o.language_list.getTranslation(toobig_notdownloaded ? 1222 : (toobig_unscanned ? 1221 : 1220)); mess += "<a href=\"" + linkurl + "\">" + prettyurl + "</a></p></noscript>"; peersock.writeString(mess.toCharArray()); peersock.writeString("<!-- force flush -->\r\n"); peersock.writeString("</body></html>\n"); if (toobig_notdownloaded) { // add URL to clean cache (for all groups) addToClean(prettyurl, o.filter_groups + 1); } }
bool yesno(char *fmt, ...) { va_list argp; char s[1000]; char c; va_start(argp, fmt); vsprintf(s, fmt, argp); va_end(argp); strcat(s, " (y/n)?"); mess(s); update_screen(); c = gtgetch(); if(c == 'y' || c == 'Y') return true; if(c == 'n' || c == 'N') return false; return false; }
void MainElement::mousePressEvent(QGraphicsSceneMouseEvent *event) { if(isSelectRelayMode && event->button() == Qt::LeftButton) { if(dynamic_cast<RelayRelay*>(this)!=NULL) { if(CreateDialog("Привязать контакт реле к реле?")) { relayContactSelected->setAssociatedRelay(dynamic_cast<RelayRelay*>(this)); relayContactSelected->setNameElement(this->getNameElement()); relayContactSelected->setIsLinked(true); } } else { QErrorMessage mess(this->scene()->views().last()->cornerWidget()); mess.showMessage("Выбранный элемент не является реле, будет выполнен сброс команды."); mess.exec(); } relayContactSelected->setIsProcessLinked(false); relayContactSelected=NULL; isSelectRelayMode=false; dynamic_cast<Scene*>(this->scene())->update(); } QGraphicsItem::mousePressEvent(event); }
bool CRemoteControl::Connect() { char namebuf[NI_MAXHOST], portbuf[NI_MAXSERV]; struct addrinfo hints = {}; struct addrinfo *result, *addr; char service[33]; int res; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; sprintf(service, "%d", IRSS_PORT); res = getaddrinfo("localhost", service, &hints, &result); if(res) { if(m_iAttempt == 0) CLog::Log(LOGDEBUG, "CRemoteControl::Connect - getaddrinfo failed: %s", gai_strerror(res)); return false; } for(addr = result; addr; addr = addr->ai_next) { if(getnameinfo(addr->ai_addr, addr->ai_addrlen, namebuf, sizeof(namebuf), portbuf, sizeof(portbuf),NI_NUMERICHOST)) { strcpy(namebuf, "[unknown]"); strcpy(portbuf, "[unknown]"); } if(m_iAttempt == 0) CLog::Log(LOGDEBUG, "CRemoteControl::Connect - connecting to: %s:%s ...", namebuf, portbuf); m_socket = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); if(m_socket == INVALID_SOCKET) continue; if(connect(m_socket, addr->ai_addr, addr->ai_addrlen) != SOCKET_ERROR) break; closesocket(m_socket); m_socket = INVALID_SOCKET; } freeaddrinfo(result); if(m_socket == INVALID_SOCKET) { if(m_iAttempt == 0) CLog::Log(LOGDEBUG, "CRemoteControl::Connect - failed to connect"); Close(); return false; } u_long iMode = 1; //non-blocking if (ioctlsocket(m_socket, FIONBIO, &iMode) == SOCKET_ERROR) { if(m_iAttempt == 0) CLog::Log(LOGERROR, "IRServerSuite: failed to set socket to non-blocking."); Close(); return false; } //register CIrssMessage mess(IRSSMT_RegisterClient, IRSSMF_Request); if (!SendPacket(mess)) { if(m_iAttempt == 0) CLog::Log(LOGERROR, "IRServerSuite: failed to send RegisterClient packet."); return false; } m_isConnecting = true; return true; }
void MSNP::buddyChangedStatus(MSN::NotificationServerConnection* conn, MSN::Passport buddy, std::string friendlyname, MSN::BuddyStatus status, unsigned int clientID, std::string msnobject) { printf("chngstat\n"); BMessage msg(IM_MESSAGE); msg.AddInt32("im_what", IM_STATUS_SET); msg.AddString("protocol", kProtocolSignature); msg.AddString("id", buddy.c_str()); switch(status) { case MSN::STATUS_AVAILABLE : msg.AddInt32("status", CAYA_ONLINE); break; case MSN::STATUS_AWAY : msg.AddInt32("status", CAYA_AWAY); break; case MSN::STATUS_IDLE : msg.AddInt32("status", CAYA_AWAY); break; case MSN::STATUS_BUSY : msg.AddInt32("status", CAYA_DO_NOT_DISTURB); break; case MSN::STATUS_BERIGHTBACK : msg.AddInt32("status", CAYA_AWAY); break; case MSN::STATUS_ONTHEPHONE : msg.AddInt32("status", CAYA_DO_NOT_DISTURB); break; case MSN::STATUS_OUTTOLUNCH : msg.AddInt32("status", CAYA_AWAY); break; default : msg.AddInt32("status", CAYA_OFFLINE); break; } fServerMsgr->SendMessage(&msg); // updating the user informations BMessage mess(IM_MESSAGE); mess.AddInt32("im_what", IM_CONTACT_INFO); //mess.AddString("protocol", kProtocolSignature); msg.AddString("id", buddy.c_str()); msg.AddString("name", friendlyname.c_str()); fServerMsgr->SendMessage(&msg); if(!CheckAvatar(msnobject, buddy)) { for (uint32 i = 0; i < fAvatarQueue.CountItems(); i++) { if (fAvatarQueue.ItemAt(i)->first == buddy) { delete fAvatarQueue.ItemAt(i); fAvatarQueue.RemoveItemAt(i); } } for (uint32 i = 0; i < fAvatarDone.CountItems(); i++) { if (fAvatarDone.ItemAt(i)->first == buddy) delete fAvatarDone.ItemAt(i); fAvatarDone.RemoveItemAt(i); } fAvatarQueue.AddItem(new pair<string, string>(buddy, msnobject)); bigtime_t time; int32 count; fAvatarRunner->GetInfo(&time, &count); if (count == 0) fAvatarRunner->SetCount(-1); } else { for (uint32 i = 0; i < fAvatarDone.CountItems(); i++) { if (fAvatarDone.ItemAt(i)->first == buddy) fAvatarDone.ItemAt(i)->second = msnobject; return; } fAvatarDone.AddItem(new pair<string, string>(buddy, msnobject)); } }
void run() { Messenger mess(ch); // use default messenger here ch.listen<Messenger>(mess); }