void jConference::s_conferenceInvite(const JID &room, const JID &from, const QString &reason_sent, const QString &password) { QString reason = reason_sent; if (reason.isEmpty()) reason = "no reason"; if (QMessageBox(QMessageBox::Question, tr("Invite to groupchat"), tr("User %1 invite you\nto conference %2\nwith reason \"%3\"\nAccept invitation?").arg(utils::fromStd(from.bare())).arg(utils::fromStd(room.full())).arg(reason), QMessageBox::Yes | QMessageBox::No).exec() == QMessageBox::Yes) joinGroupchat(utils::fromStd(room.full()), "", password, true); }
void jConference::joinGroupchat() { joinGroupchat("", "", "", true); }
void jConference::handleMUCError (MUCRoom *room_entity, StanzaError error) { /* PresenceJidHandlerList::const_iterator itj = m_client_base->m_presenceJidHandlers.begin(); for( ; itj != m_client_base->m_presenceJidHandlers.end(); ++itj ) { qDebug() << utils::fromStd((*itj).jid->bare()); if( (*itj).jid->bare() == pres.from().bare() && (*itj).ph ) { (*itj).ph->handlePresence( pres ); match = true; } }*/ QString conference_name = utils::fromStd(room_entity->name()+"@"+room_entity->service()); Room *room = m_rooms.value(conference_name); if(!room) return; // JID jid(room->name()+"@"+room->service()); // m_client_base->removePresenceHandler( jid, this);//(PresenceHandler *)room ); //m_client_base->removePresenceHandler( (PresenceHandler *)room ); /*if ( m_room_list.contains(conference_name)) { MUCRoom *tmp_room = m_room_list.value(conference_name); qDebug() << "tmp_room" << tmp_room; m_room_list.remove(m_room_list.key(tmp_room)); tmp_room->leave(); delete tmp_room; delete static_cast<QHash<QString,jBuddy::ResourceInfo> *>(m_contacts_list[conference_name]); m_contacts_list.remove(conference_name); }*/ bool nnr = false; QString error_tr; switch(error) { case StanzaErrorNotAuthorized: error_tr=tr("Not authorized: Password required."); break; case StanzaErrorForbidden: error_tr=tr("Forbidden: Access denied, user is banned."); break; case StanzaErrorItemNotFound: error_tr=tr("Item not found: The room does not exist."); break; case StanzaErrorNotAllowed: error_tr=tr("Not allowed: Room creation is restricted."); break; case StanzaErrorNotAcceptable : error_tr=tr("Not acceptable: Room nicks are locked down."); break; case StanzaErrorRegistrationRequired: error_tr=tr("Registration required: User is not on the member list."); break; case StanzaErrorConflict: error_tr=tr("Conflict: Desired room nickname is in use or registered by another user."); break; case StanzaErrorServiceUnavailable: error_tr=tr("Service unavailable: Maximum number of users has been reached."); break; default: nnr = true; error_tr=tr("Unknown error: No description."); break; } if ( nnr ) { emit addSystemMessageToConference( "Jabber", conference_name, m_jabber_account->getAccountName(), error_tr,QDateTime(), false); } else { QMessageBox::warning(0, tr("Join groupchat on")+" "+m_jabber_account->getAccountName(), error_tr); joinGroupchat(conference_name, "", room->password, true); leaveConference(conference_name); } }
void jAccount::createStatusMenu() { m_conference_menu = new QMenu(); m_conference_menu->setTitle(tr("Conferences")); m_join_groupchat = new QAction(tr("Join groupchat"), this); connect(m_join_groupchat, SIGNAL(triggered()), m_conference_management_object, SLOT(joinGroupchat())); m_conference_menu->addAction(m_join_groupchat); m_additional_menu = new QMenu(); m_additional_menu->setTitle(tr("Additional")); m_join_group_chat = new QAction(tr("Join groupchat"), this); m_join_group_chat->setVisible(false); m_change_resource = new QAction(tr("Change resource"), this); m_open_xml_console = new QAction(tr("Open XML console"), this); m_add_contact = new QAction(tr("Add new contact"), this); m_transport_browser = new QAction(tr("Transports"), this); m_other_browser = new QAction(tr("Other Services"), this); QAction *bookmark_action = new QAction(jPluginSystem::instance().getIcon("bookmarkstorage"),tr("Bookmarks"),this); bookmark_action->setVisible(false); // m_jabber_protocol->setBookmarkAction(m_bookmark_action); // m_bookmark_action->setEnabled(false); QAction *mood_action = new QAction(jPluginSystem::instance().getIcon("mood"),tr("Set mood"),this); mood_action->setEnabled(false); QAction *activity_action = new QAction(jPluginSystem::instance().getIcon("activity"),tr("Set activity"),this); activity_action->setEnabled(false); m_jabber_protocol->setActions(bookmark_action, mood_action, activity_action); m_join_group_chat->setIcon(QIcon(":/icons/chat")); m_additional_menu->addAction(m_join_group_chat); // m_change_resource->setIcon(QIcon(":/icons/chat")); connect(m_transport_browser, SIGNAL(triggered()), this, SLOT(showTransportsBrowser())); m_additional_menu->addAction(m_transport_browser); connect(m_other_browser, SIGNAL(triggered()), this, SLOT(showOtherServicesBrowser())); m_additional_menu->addAction(m_other_browser); m_additional_menu->addSeparator(); connect(m_change_resource, SIGNAL(triggered()), this, SLOT(showChangeResourceDialog())); m_additional_menu->addAction(m_change_resource); connect(m_open_xml_console, SIGNAL(triggered()), m_jabber_slotsignal, SLOT(createXmlConsole())); m_additional_menu->addAction(m_open_xml_console); //m_add_contact->setIcon(QIcon(":/icons/servdisco")); connect(m_add_contact, SIGNAL(triggered()), this, SLOT(showAddDialog())); m_additional_menu->addAction(m_add_contact); onlineAction = new QAction(m_jabber_plugin_system.getStatusIcon("online", "jabber"), tr("Online"), this); connect(onlineAction, SIGNAL(triggered()), this, SLOT(setStatus())); statusMenuActions.insert("online", onlineAction); offlineAction = new QAction(m_jabber_plugin_system.getStatusIcon("offline", "jabber"), tr("Offline"), this); connect(offlineAction, SIGNAL(triggered()), this, SLOT(setStatus())); statusMenuActions.insert("offline", offlineAction); ffcAction = new QAction(m_jabber_plugin_system.getStatusIcon("ffc", "jabber"), tr("Free for chat"), this); connect(ffcAction, SIGNAL(triggered()), this, SLOT(setStatus())); statusMenuActions.insert("ffc", ffcAction); awayAction = new QAction(m_jabber_plugin_system.getStatusIcon("away", "jabber"), tr("Away"), this); connect(awayAction, SIGNAL(triggered()), this, SLOT(setStatus())); statusMenuActions.insert("away", awayAction); xaAction = new QAction(m_jabber_plugin_system.getStatusIcon("na", "jabber"), tr("NA"), this); connect(xaAction, SIGNAL(triggered()), this, SLOT(setStatus())); statusMenuActions.insert("na", xaAction); dndAction = new QAction(m_jabber_plugin_system.getStatusIcon("dnd", "jabber"), tr("DND"), this); connect(dndAction, SIGNAL(triggered()), this, SLOT(setStatus())); statusMenuActions.insert("dnd", dndAction); QHashIterator<QString, QAction *> iterator(statusMenuActions); while (iterator.hasNext()) { iterator.next(); iterator.value()->setCheckable(true); } m_status_menu = new QMenu(); m_status_menu->setTitle(m_account_name); m_status_menu->setIcon(m_jabber_plugin_system.getStatusIcon("offline", "jabber")); m_status_menu->addAction(onlineAction); m_status_menu->addAction(ffcAction); m_status_menu->addAction(awayAction); m_status_menu->addAction(xaAction); m_status_menu->addAction(dndAction); m_status_menu->addSeparator(); m_status_menu->addAction(mood_action); m_status_menu->addAction(activity_action); m_status_menu->addAction(bookmark_action); m_status_menu->addMenu(m_additional_menu); m_status_menu->addMenu(m_conference_menu); m_status_menu->addSeparator(); m_status_menu->addAction(offlineAction); offlineAction->setChecked(true); }