Exemplo n.º 1
0
//-----------------------------
void	APICALL MyPeercastApp::channelUpdate(ChanInfo *info)
{
	if (lastPlayID.isSet() && info && info->id.isSame(lastPlayID))
	{

		String tmp;
		tmp.append(info->track.artist);
		tmp.append(" ");
		tmp.append(info->track.title);


		if (!tmp.isSame(trackTitle))
		{
			if (ServMgr::NT_TRACKINFO & peercastInst->getNotifyMask())
			{
				trackTitle=tmp;
				clearChannelPopup();
				channelPopup(info->name.cstr(),trackTitle.cstr());
			}
		} else if (!info->comment.isSame(channelComment))
		{
			if (ServMgr::NT_BROADCASTERS & peercastInst->getNotifyMask())
			{
				channelComment = info->comment;
				clearChannelPopup();
				channelPopup(info->name.cstr(),channelComment.cstr());
			}
		}



	}
}
Exemplo n.º 2
0
// ------------------------------------------
void PCPStream::readPushAtoms(AtomStream &atom, int numc, BroadcastState &bcs) {
    Host host;
    GnuID chanID;

    chanID.clear();

    for (int i = 0; i < numc; i++) {
        int c, d;
        ID4 id = atom.read(c, d);

        if (id == PCP_PUSH_IP)
            host.ip = atom.readInt();
        else if (id == PCP_PUSH_PORT)
            host.port = atom.readShort();
        else if (id == PCP_PUSH_CHANID)
            atom.readBytes(chanID.id, 16);
        else {
            LOG_DEBUG("PCP skip: %s,%d,%d", id.getString().str(), c, d);
            atom.skip(c, d);
        }
    }


    if (bcs.forMe) {
        char ipstr[64];
        host.toStr(ipstr);

        Servent *s = NULL;

        if (chanID.isSet()) {
            Channel *ch = chanMgr->findChannelByID(chanID);
            if (ch) if (ch->isBroadcasting() || !ch->isFull() && !servMgr->relaysFull() && ch->info.id.isSame(chanID))
                s = servMgr->allocServent();
        } else {
            s = servMgr->allocServent();
        }

        if (s) {
            LOG_DEBUG("GIVing to %s", ipstr);
            s->initGIV(host, chanID);
        }
    }

}
Exemplo n.º 3
0
// ------------------------------------------
bool PCPStream::sendPacket(ChanPacket & pack, GnuID & destID) {
    if (destID.isSet()) if (!destID.isSame(remoteID)) if (!routeList.contains(destID))
        return false;

    return outData.writePacket(pack);
}