void AIMContact::userInfoUpdated( const QString& contact, const UserDetails& details ) { if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) ) return; kDebug(OSCAR_ICQ_DEBUG) << contact; //if they don't have an SSI alias, make sure we use the capitalization from the //server so their contact id looks all pretty. QString nickname = property( Kopete::Global::Properties::self()->nickName() ).value().toString(); if ( nickname.isEmpty() || Oscar::normalize( nickname ) == Oscar::normalize( contact ) ) setNickName( contact ); kDebug( OSCAR_ICQ_DEBUG ) << "extendedStatus is " << details.extendedStatus(); Oscar::Presence presence = mProtocol->statusManager()->presenceOf( details.extendedStatus(), details.userClass() ); setPresenceTarget( presence ); m_mobile = ( presence.flags() & Oscar::Presence::Wireless ); setAwayMessage( details.personalMessage() ); if ( presence.type() != Oscar::Presence::Online && m_details.awaySinceTime() < details.awaySinceTime() ) //prevent cyclic away message requests { mAccount->engine()->requestAIMAwayMessage( contactId() ); } OscarContact::userInfoUpdated( contact, details ); }
WPContact::WPContact(Kopete::Account *account, const QString &newHostName, const QString &nickName, Kopete::MetaContact *metaContact) : Kopete::Contact(account, newHostName, metaContact) { // kdDebug(14170) << "WPContact::WPContact(<account>, " << newHostName << ", " << nickName << ", <parent>)" << endl; kdDebug(14170) << "WPContact::WPContact: " << this << endl; QString theNickName = nickName; if (theNickName.isEmpty()) { // Construct nickname from hostname with first letter to upper. GF theNickName = newHostName.lower(); theNickName = theNickName.replace(0, 1, theNickName[0].upper()); } setNickName(theNickName); myWasConnected = false; m_manager = 0; m_infoDialog = 0; // Initialise and start the periodical checking for contact's status setOnlineStatus(static_cast<WPProtocol *>(protocol())->WPOffline); connect(&checkStatus, SIGNAL(timeout()), this, SLOT(slotCheckStatus())); checkStatus.start(1000, false); }
void IRCLobby::changeNickName(const std::string &nick) { std::stringstream notice; notice << "Changing nickname to: " << nick; addChatMessage("Notice",notice.str()); setNickName(nick); sendNickName(); }
void CWizardIrcConnection::setConnection( const ConnectionInfo& connection ) { if ( !connection.nick.isEmpty() ) { setNickName( connection.nick ); } else { setNickName( quazaaSettings.Profile.IrcNickname ); } if ( !connection.real.isEmpty() ) { setRealName( connection.real ); } else { setRealName( quazaaSettings.Profile.IrcUserName ); } if ( !connection.host.isEmpty() ) { setHostName( connection.host ); } else { setHostName( "irc.paradoxirc.net" ); } if ( connection.port ) { setPort( connection.port ); } else { setPort( 6667 ); } setSecure( connection.secure ); setUserName( connection.user ); setPassword( connection.pass ); setConnectionName( connection.name ); }
LRESULT CALLBACK ConnectDialogHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_CONN_BUTTON: int lenIp = GetWindowTextLength(GetDlgItem(hwnd, IDC_EDIT_IP_NAME)); if(lenIp > 0) { int lenNick = GetWindowTextLength(GetDlgItem(hwnd, IDC_EDIT_NICK_NAME)); if(lenNick > 0) { char *ipData, *nickData; ipData = new char[lenIp + 1]; nickData = new char[lenNick + 1]; GetDlgItemText(hwnd, IDC_EDIT_IP_NAME, ipData, lenIp + 1); GetDlgItemText(hwnd, IDC_EDIT_NICK_NAME, nickData, lenNick + 1); if((serverSocket = TalkConnectToServer(ipData, mainDialogHandle)) != NULL) { connectionState = TRYING_TO_CONNECT; TalkSendMessage(serverSocket, nickData, lenNick + 1); setNickName(nickData); } else ShowError("Unable to connect to remote host!", mainDialogHandle); delete[] nickData; delete[] ipData; } else ShowError("Type in a nick name first!", mainDialogHandle); } else ShowError("Type in an ip adress first!", mainDialogHandle); break; } break; default: return FALSE; } return TRUE; }
void Session::initFrom(const ConnectionInfo& connection) { setName(connection.name); setSecure(connection.secure); setPassword(connection.pass); setHost(connection.host); setPort(connection.port); setNickName(connection.nick); QString appName = QApplication::applicationName(); setUserName(connection.user.isEmpty() ? appName : connection.user); setRealName(connection.real.isEmpty() ? appName : connection.real); setChannels(connection.channels); m_quit = connection.quit; }
int QXmppMucRoom::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 32) qt_static_metacall(this, _c, _id, _a); _id -= 32; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QXmppMucRoom::Actions*>(_v) = allowedActions(); break; case 1: *reinterpret_cast< bool*>(_v) = isJoined(); break; case 2: *reinterpret_cast< QString*>(_v) = jid(); break; case 3: *reinterpret_cast< QString*>(_v) = name(); break; case 4: *reinterpret_cast< QString*>(_v) = nickName(); break; case 5: *reinterpret_cast< QStringList*>(_v) = participants(); break; case 6: *reinterpret_cast< QString*>(_v) = password(); break; case 7: *reinterpret_cast< QString*>(_v) = subject(); break; } _id -= 8; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 4: setNickName(*reinterpret_cast< QString*>(_v)); break; case 6: setPassword(*reinterpret_cast< QString*>(_v)); break; case 7: setSubject(*reinterpret_cast< QString*>(_v)); break; } _id -= 8; } else if (_c == QMetaObject::ResetProperty) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 8; } #endif // QT_NO_PROPERTIES return _id; }
IRCLobby::IRCLobby(const std::string& server, const std::string& nick, const std::string& newchannelname ) : game_servers(0), irc_server_socket(0), channel_name(newchannelname), nickname(nick), running_thread(0) { serveraddress=server; game_servers=new GameServerList(); game_servers_mutex=SDL_CreateMutex(); change_name=0; expected_ping=0; setNickName(nick); }
/** * JabberGroupMemberContact constructor */ JabberGroupMemberContact::JabberGroupMemberContact (const XMPP::RosterItem &rosterItem, JabberAccount *account, Kopete::MetaContact * mc) : JabberBaseContact ( rosterItem, account, mc) { mc->setDisplayName ( rosterItem.jid().resource() ); setNickName ( rosterItem.jid().resource() ); setFileCapable ( true ); mManager = 0; mRequestOfflineEvent = false; mRequestDisplayedEvent = false; mRequestDeliveredEvent = false; mRequestComposingEvent = false; mRequestReceiptDelivery = false; }
void JabberPersonalInfoService::updatePersonalInfo(const QString &id, Buddy buddy) { Q_UNUSED(id); if (!VCardService) { emit personalInfoUpdated(false); return; } CurrentBuddy = buddy; auto vcard = QXmppVCardIq{}; vcard.setFullName(CurrentBuddy.firstName()); vcard.setNickName(CurrentBuddy.nickName()); vcard.setMiddleName(CurrentBuddy.familyName()); QDate birthday; birthday.setDate(CurrentBuddy.birthYear(), 1, 1); vcard.setBirthday(birthday); auto addr = QXmppVCardAddress{}; addr.setLocality(CurrentBuddy.city()); vcard.setAddresses({addr}); auto email = QXmppVCardEmail{}; email.setAddress(CurrentBuddy.email()); vcard.setEmails({email}); vcard.setUrl(CurrentBuddy.website()); auto vCardUploader = VCardService->createVCardUploader(); if (!vCardUploader) { emit personalInfoUpdated(false); return; } vCardUploader->uploadVCard(vcard); emit personalInfoUpdated(true); }
void AIMContact::userInfoUpdated( const QString& contact, const UserDetails& details ) { if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) ) return; kDebug(OSCAR_ICQ_DEBUG) << contact; setNickName( contact ); kDebug( OSCAR_ICQ_DEBUG ) << "extendedStatus is " << details.extendedStatus(); Oscar::Presence presence = mProtocol->statusManager()->presenceOf( details.extendedStatus(), details.userClass() ); setPresenceTarget( presence ); m_mobile = ( presence.flags() & Oscar::Presence::Wireless ); setAwayMessage( details.personalMessage() ); if ( presence.type() != Oscar::Presence::Online && m_details.awaySinceTime() < details.awaySinceTime() ) //prevent cyclic away message requests { mAccount->engine()->requestAIMAwayMessage( contactId() ); } OscarContact::userInfoUpdated( contact, details ); }
void AIMContact::userInfoUpdated( const QString& contact, const UserDetails& details ) { if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) ) return; kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << contact << endl; //if they don't have an SSI alias, make sure we use the capitalization from the //server so their contact id looks all pretty. QString nickname = property( Kopete::Global::Properties::self()->nickName() ).value().toString(); if ( nickname.isEmpty() || Oscar::normalize( nickname ) == Oscar::normalize( contact ) ) setNickName( contact ); ( details.userClass() & CLASS_WIRELESS ) ? m_mobile = true : m_mobile = false; if ( ( details.userClass() & CLASS_AWAY ) == STATUS_ONLINE ) { if ( m_mobile ) { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " is mobile-online." << endl; setOnlineStatus( mProtocol->statusWirelessOnline ); } else { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " is online." << endl; setOnlineStatus( mProtocol->statusOnline ); //we're online } removeProperty( mProtocol->awayMessage ); m_haveAwayMessage = false; } else if ( ( details.userClass() & CLASS_AWAY ) ) // STATUS_AWAY { if ( m_mobile ) { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " is mobile-away." << endl; setOnlineStatus( mProtocol->statusWirelessOnline ); } else { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " is away." << endl; setOnlineStatus( mProtocol->statusAway ); //we're away } if ( !m_haveAwayMessage ) //prevent cyclic away message requests { mAccount->engine()->requestAIMAwayMessage( contactId() ); m_haveAwayMessage = true; } } else { kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " class " << details.userClass() << " is unhandled... defaulting to away." << endl; setOnlineStatus( mProtocol->statusAway ); //we're away if ( !m_haveAwayMessage ) //prevent cyclic away message requests { mAccount->engine()->requestAIMAwayMessage( contactId() ); m_haveAwayMessage = true; } } if ( details.buddyIconHash().size() > 0 && details.buddyIconHash() != m_details.buddyIconHash() ) { if ( !mAccount->engine()->hasIconConnection() ) mAccount->engine()->requestServerRedirect( 0x0010 ); int time = ( KApplication::random() % 10 ) * 1000; kdDebug(OSCAR_ICQ_DEBUG) << k_funcinfo << "updating buddy icon in " << time/1000 << " seconds" << endl; QTimer::singleShot( time, this, SLOT( requestBuddyIcon() ) ); } OscarContact::userInfoUpdated( contact, details ); }
void SessionClient::availableMessages() { Message* message; while( ( message = receiveMessage() ) != NULL ) { server_->checkSessionStateChange( this, message->type() ); switch( message->type() ) { case Message::MSG_HELLO: { // Send the client its initial nickname sendMessage( new NicknameMessage( nickName_ ) ); break; } case Message::MSG_NICKNAME: { NicknameMessage* nickNameMessage = dynamic_cast<NicknameMessage*>( message ); if( ! server_->clientChangedNickName( this, nickNameMessage ) ) { // The nickname could not be changed, report the problem to the client sendMessage( new StatusMessage( Errors::Status_NickNameAlreadyRegistered ) ); } else { // Change the nickname setNickName( nickNameMessage->nickName() ); sendMessage( new NicknameMessage( nickName_ ) ); } break; } case Message::MSG_STATUS: { StatusMessage* statusMessage = dynamic_cast<StatusMessage*>( message ); Common::debug( "The client reports status code %d", statusMessage->statusCode() ); Errors::StatusCode code = statusMessage->statusCode(); switch( code ) { case Errors::Status_Ok: Common::debug( "Session \"%s\" sent status OK", nickName_ ); break; case Errors::Status_AcceptFileTransfer: case Errors::Status_RejectFileTransfer: if( ! server_->isFileTransferModeActive() ) { sendMessage( new StatusMessage( Errors::Status_FileTransferCanceled ) ); break; } // Save the status fileTransferStatus_ = code; server_->clientSentFileTransferResponse( this, code == Errors::Status_AcceptFileTransfer ); break; default: Common::debug( "Session \"%s\" sent status %d", nickName_, code ); break; } break; } case Message::MSG_CHAT: { ChatMessage* chatMessage = dynamic_cast<ChatMessage*>( message ); if( ! server_->clientSentChatMessage( this, chatMessage ) ) { sendMessage( new StatusMessage( Errors::Status_ChattingAlone ) ); } break; } case Message::MSG_FILE_REQUEST: { // Deny new file transfers if one is already active if( server_->isFileTransferModeActive() ) { sendMessage( new StatusMessage( Errors::Status_FileTransferCanceled ) ); break; } FileTransferMessage* fileMessage = dynamic_cast<FileTransferMessage*>( message ); if( ! server_->clientSentFileTransferRequest( this, fileMessage ) ) { sendMessage( new StatusMessage( Errors::Status_ChattingAlone ) ); break; } fileTransferStatus_ = Errors::Status_AcceptFileTransfer; break; } case Message::MSG_FILE_DATA: { FileDataMessage* dataMessage = dynamic_cast<FileDataMessage*>( message ); server_->clientSentFileData( this, dataMessage ); // Reset the file transfer status for the next file if( dataMessage->isLastBlock() ) { fileTransferStatus_ = Errors::Status_FileTransferCanceled; } break; } default: break; } delete message; } }