ChatPanel::ChatPanel( wxWindow* parent, Channel& chan, wxImageList* imaglist ): wxPanel( parent, -1 ), m_show_nick_list( true ), m_nicklist(0), m_chat_tabs(( SLNotebook* )parent ), m_channel( &chan ), m_server( 0 ), m_user( 0 ), m_battle( 0 ), m_type( CPT_Channel ), m_popup_menu( 0 ), m_chat_log(sett().GetDefaultServer(), chan_prefix + chan.GetName()), m_icon_index( 2 ), m_imagelist( imaglist ), m_disable_append( false ), m_topic_set( false ) { GetAui().manager->AddPane( this, wxLEFT, _T("chatpanel-channel-") + chan.GetName() ); wxLogDebugFunc( _T( "wxWindow* parent, Channel& chan" ) ); CreateControls( ); LoadLastLines(); _SetChannel( &chan ); m_chatlog_text->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( ChatPanel::OnMouseDown ), 0, this ); }
void Execute(IRCServer *server, User *u, const std::vector<std::string> ¶ms) { const std::string &target = params[0]; Channel *c = server->FindChannel(target); if (c == NULL) u->WriteNumeric(403, target + " :No such channel"); else if (params.size() == 1) { u->WriteNumeric(332, c->GetName() + " :" + c->GetTopic()); u->WriteNumeric(333, c->GetName() + " " + u->GetNick() + " " + Sinkhole::stringify(c->topic_time)); } else { user_status *status = c->FindUserStatus(u); if (c->HasMode(CMODE_PROTECTEDTOPIC) && (status == NULL || !status->HasMode(CMODE_OP))) u->WriteNumeric(482, c->GetName() + " :You're not a channel operator"); else { std::string topic = params[1]; if (topic.length() > IRCServer::topiclen) topic = topic.substr(0, IRCServer::topiclen); c->SetTopic(topic); c->Send(u->GetMask(), "TOPIC " + c->GetName() + " :" + topic); } } }
void Execute(IRCServer *server, User *u, const std::vector<std::string> ¶ms) { const std::string &channel = params[0]; const std::string &targnick = params[1]; std::string reason = params.size() > 2 ? params[2] : ""; Channel *c = server->FindChannel(channel); User *target = server->FindUser(targnick); if (c == NULL) u->WriteNumeric(403, channel + " :No such channel"); else if (target == NULL) u->WriteNumeric(401, targnick + " :No such nick/channel"); else if (!target->IsOnChannel(c)) u->WriteNumeric(441, target->GetNick() + " " + c->GetName() + " :They aren't on that channel"); else { user_status *status = c->FindUserStatus(u); if (status == NULL || !status->HasMode(CMODE_OP)) u->WriteNumeric(482, c->GetName() + " :You're not a channel operator"); else { if (reason.length() > IRCServer::kicklen) reason = reason.substr(0, IRCServer::kicklen); c->Send(u->GetMask(), "KICK " + c->GetName() + " " + target->GetNick() + " :" + reason); u->Part(c); c->Part(u); } } }
void IServer::Reset() { m_users.Nullify(); while (m_users.GetNumUsers() > 0) { try { User* u = &m_users.GetUser(0); m_users.RemoveUser(u->GetNick()); delete u; } catch (std::runtime_error) { } } while (battles_iter->GetNumBattles() > 0) { battles_iter->IteratorBegin(); IBattle* b = battles_iter->GetBattle(); if (b != 0) { m_battles.RemoveBattle(b->GetBattleId()); delete b; } } while (m_channels.GetNumChannels() > 0) { Channel* c = &m_channels.GetChannel(0); m_channels.RemoveChannel(c->GetName()); delete c; } }
PVR_ERROR DVBLinkClient::GetChannels(ADDON_HANDLE handle, bool bRadio) { XBMC->Log(LOG_INFO, "Getting channels (%d channels on server)", m_channelMap.size()); for (std::map<int,Channel*>::iterator it=m_channelMap.begin(); it!=m_channelMap.end(); ++it) { Channel* channel = (*it).second; bool isRadio = (channel->GetChannelType() == Channel::CHANNEL_TYPE_RADIO); if (isRadio == bRadio) { PVR_CHANNEL xbmcChannel; memset(&xbmcChannel, 0, sizeof(PVR_CHANNEL)); xbmcChannel.bIsRadio = isRadio; xbmcChannel.iChannelNumber =channel->Number; xbmcChannel.iEncryptionSystem = 0; xbmcChannel.iUniqueId = (*it).first; PVR_STRCPY(xbmcChannel.strChannelName,channel->GetName().c_str()); CStdString stream; //PVR_STRCPY(xbmcChannel.strIconPath, "special://userdata/addon_data/pvr.dvblink/channel.png"); PVR->TransferChannelEntry(handle, &xbmcChannel); } } return PVR_ERROR_NO_ERROR; }
Channel::Channel(Channel& channel) : m_id(channel.GetID()), m_dvbLinkId(channel.GetDvbLinkID()), m_name(channel.GetName()), m_type(channel.GetChannelType()), Number(channel.Number), SubNumber(channel.SubNumber), ChildLock(channel.ChildLock), m_logo_url(channel.GetLogoUrl()) { }
void Server::Leave(Connection* connection, QString channel_name) { Channel* channel = FindChannel(channel_name); if(channel != NULL) { channel->Remove(connection); SendConfirm(connection, LEAVE_ACC, 1, channel_name); SendList(channel->GetName()); } else { qDebug("LEAVE::channel doesn't exist"); SendConfirm(connection, LEAVE_ACC, 0, channel_name); } }
Channel* Server::Join(Connection* connection, QString channel_name) { Channel* channel = FindChannel(channel_name); if(channel != NULL) { channel->Add(connection); SendConfirm(connection, JOIN_ACC, 1, channel_name); SendList(channel->GetName()); } else { qDebug("JOIN::channel doesn't exist"); SendConfirm(connection, JOIN_ACC, 0, channel_name); } return channel; }
ChatPanel::ChatPanel(wxWindow* parent, Channel& chan, wxImageList* imaglist) : wxPanel(parent, -1) , m_show_nick_list(true) , m_votePanel(0) , m_nicklist(0) , m_chat_tabs((SLNotebook*)parent) , m_channel(&chan) , m_server(0) , m_user(0) , m_battle(0) , m_type(CPT_Channel) , m_popup_menu(NULL) , m_icon_index(2) , m_imagelist(imaglist) , m_disable_append(false) , m_display_joinitem(false) , m_topic_set(false) , m_reactOnPromoteEvents(true) { Init(TowxString(chan.GetName())); SetChannel(&chan); }
void ChannelList::AddChannel(Channel& channel) { m_chans[channel.GetName()] = &channel; m_seekpos = SEEKPOS_INVALID; }