OSDN Git Service

VP27マージ
authoreru <eru01@users.sourceforge.jp>
Sat, 5 Jan 2008 16:17:15 +0000 (16:17 +0000)
committereru <eru01@users.sourceforge.jp>
Sat, 5 Jan 2008 16:17:15 +0000 (16:17 +0000)
46 files changed:
PeerCast.root/PeerCast/core/common/channel.cpp
PeerCast.root/PeerCast/core/common/channel.h
PeerCast.root/PeerCast/core/common/cstream.h
PeerCast.root/PeerCast/core/common/gnutella.cpp
PeerCast.root/PeerCast/core/common/html.cpp
PeerCast.root/PeerCast/core/common/pcp.cpp
PeerCast.root/PeerCast/core/common/pcp.h
PeerCast.root/PeerCast/core/common/peercast.cpp
PeerCast.root/PeerCast/core/common/rtsp.cpp
PeerCast.root/PeerCast/core/common/servent.cpp
PeerCast.root/PeerCast/core/common/servhs.cpp
PeerCast.root/PeerCast/core/common/servmgr.cpp
PeerCast.root/PeerCast/core/common/servmgr.h
PeerCast.root/PeerCast/core/common/socket.h
PeerCast.root/PeerCast/core/common/sys.cpp
PeerCast.root/PeerCast/core/common/sys.h
PeerCast.root/PeerCast/core/common/version2.h
PeerCast.root/PeerCast/core/common/xml.cpp
PeerCast.root/PeerCast/core/win32/wsocket.cpp
PeerCast.root/PeerCast/core/win32/wsocket.h
PeerCast.root/PeerCast/core/win32/wsys.cpp
PeerCast.root/PeerCast/core/win32/wsys.h
PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp
c:/Git/PeerCast.root/PeerCast/core/common/channel.cpp
c:/Git/PeerCast.root/PeerCast/core/common/channel.h
c:/Git/PeerCast.root/PeerCast/core/common/cstream.h
c:/Git/PeerCast.root/PeerCast/core/common/gnutella.cpp
c:/Git/PeerCast.root/PeerCast/core/common/html.cpp
c:/Git/PeerCast.root/PeerCast/core/common/pcp.cpp
c:/Git/PeerCast.root/PeerCast/core/common/pcp.h
c:/Git/PeerCast.root/PeerCast/core/common/peercast.cpp
c:/Git/PeerCast.root/PeerCast/core/common/rtsp.cpp
c:/Git/PeerCast.root/PeerCast/core/common/servent.cpp
c:/Git/PeerCast.root/PeerCast/core/common/servhs.cpp
c:/Git/PeerCast.root/PeerCast/core/common/servmgr.cpp
c:/Git/PeerCast.root/PeerCast/core/common/servmgr.h
c:/Git/PeerCast.root/PeerCast/core/common/socket.h
c:/Git/PeerCast.root/PeerCast/core/common/sys.cpp
c:/Git/PeerCast.root/PeerCast/core/common/sys.h
c:/Git/PeerCast.root/PeerCast/core/common/version2.h
c:/Git/PeerCast.root/PeerCast/core/common/xml.cpp
c:/Git/PeerCast.root/PeerCast/core/win32/wsocket.cpp
c:/Git/PeerCast.root/PeerCast/core/win32/wsocket.h
c:/Git/PeerCast.root/PeerCast/core/win32/wsys.cpp
c:/Git/PeerCast.root/PeerCast/core/win32/wsys.h
c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp

index 36aec01..9c3740e 100644 (file)
@@ -81,7 +81,7 @@ char *Channel::statusMsgs[]=
 // for PCRaw start.
 bool isIndexTxt(ChanInfo *info)
 {
-       int len;
+       size_t len;
 
        if(     info &&
                info->contentType == ChanInfo::T_RAW &&
@@ -235,6 +235,9 @@ void Channel::reset()
        mount.clear();
        bump = false;
        stayConnected = false;
+       stealth = false; //JP-MOD
+       overrideMaxRelaysPerChannel = -1; //JP-MOD
+       bClap = false; //JP-MOD
 
        icyMetaInterval = 0;
        streamPos = 0;
@@ -345,8 +348,12 @@ int Channel::totalListeners()
        return tot;
 }
 
-
-
+// -----------------------------------
+int Channel::totalClaps()      //JP-MOD
+{
+       ChanHitList *chl = chanMgr->findHitListByID(info.id);
+       return chl ? chl->numClaps() : 0;
+}
 
 // -----------------------------------
 void   Channel::startGet()
@@ -1173,8 +1180,8 @@ void Channel::broadcastTrackerUpdate(GnuID &svID, bool force)
                if (!chl)
                        throw StreamException("Broadcast channel has no hitlist");
 
-               int numListeners = totalListeners();
-               int numRelays = totalRelays();
+               int numListeners = stealth ? -1 : totalListeners(); //JP-MOD \83\8a\83X\83i\81[\90\94\89B\95Á\8b@\94\
+               int numRelays = stealth ? -1 : totalRelays(); //JP-MOD \83\8a\83\8c\81[\90\94\89B\95Á\8b@\94\
 
                unsigned int oldp = rawData.getOldestPos();
                unsigned int newp = rawData.getLatestPos();
@@ -1182,27 +1189,31 @@ void Channel::broadcastTrackerUpdate(GnuID &svID, bool force)
                hit.initLocal(numListeners,numRelays,info.numSkips,info.getUptime(),isPlaying(), false, 0, this, oldp,newp);
                hit.tracker = true;
 
-#ifndef VERSION_EX
-               atom.writeParent(PCP_BCST,8);
-#else
-               atom.writeParent(PCP_BCST,10);
-#endif
-                       atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_ROOT);
-                       atom.writeChar(PCP_BCST_HOPS,0);
-                       atom.writeChar(PCP_BCST_TTL,11);
-                       atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
-                       atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
-                       atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
+               if (version_ex == 0)
+               {
+                       atom.writeParent(PCP_BCST,8);
+               } else
+               {
+                       atom.writeParent(PCP_BCST,10);
+               }
+               atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_ROOT);
+               atom.writeChar(PCP_BCST_HOPS,0);
+               atom.writeChar(PCP_BCST_TTL,11);
+               atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
+               atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
+               atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
+
+               if (version_ex)
+               {
                        atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
                        atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
-                       atom.writeParent(PCP_CHAN,4);
-                               atom.writeBytes(PCP_CHAN_ID,info.id.id,16);
-                               atom.writeBytes(PCP_CHAN_BCID,chanMgr->broadcastID.id,16);
-                               info.writeInfoAtoms(atom);
-                               info.writeTrackAtoms(atom);
-                       hit.writeAtoms(atom,info.id);
+               }
+               atom.writeParent(PCP_CHAN,4);
+               atom.writeBytes(PCP_CHAN_ID,info.id.id,16);
+               atom.writeBytes(PCP_CHAN_BCID,chanMgr->broadcastID.id,16);
+               info.writeInfoAtoms(atom);
+               info.writeTrackAtoms(atom);
+               hit.writeAtoms(atom,info.id);
 
 
                pack.len = mem.pos;
@@ -1251,26 +1262,29 @@ void Channel::updateInfo(ChanInfo &newInfo)
 
                                AtomStream atom(mem);
 
-#ifndef VERSION_EX
-                               atom.writeParent(PCP_BCST,8);
-#else
-                               atom.writeParent(PCP_BCST,10);
-#endif
-                                       atom.writeChar(PCP_BCST_HOPS,0);
-                                       atom.writeChar(PCP_BCST_TTL,7);
-                                       atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_RELAYS);
-                                       atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
-                                       atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
-                                       atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
+                               if (version_ex == 0)
+                               {
+                                       atom.writeParent(PCP_BCST,8);
+                               } else
+                               {
+                                       atom.writeParent(PCP_BCST,10);
+                               }
+                               atom.writeChar(PCP_BCST_HOPS,0);
+                               atom.writeChar(PCP_BCST_TTL,7);
+                               atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_RELAYS);
+                               atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
+                               atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
+                               atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
+                               if (version_ex)
+                               {
                                        atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
                                        atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
-                                       atom.writeBytes(PCP_BCST_CHANID,info.id.id,16);
-                                       atom.writeParent(PCP_CHAN,3);
-                                               atom.writeBytes(PCP_CHAN_ID,info.id.id,16);
-                                               info.writeInfoAtoms(atom);
-                                               info.writeTrackAtoms(atom);
+                               }
+                               atom.writeBytes(PCP_BCST_CHANID,info.id.id,16);
+                               atom.writeParent(PCP_CHAN,3);
+                               atom.writeBytes(PCP_CHAN_ID,info.id.id,16);
+                               info.writeInfoAtoms(atom);
+                               info.writeTrackAtoms(atom);
 
                                pack.len = mem.pos;
                                pack.type = ChanPacket::T_PCP;
@@ -1424,6 +1438,11 @@ bool ChannelStream::getStatus(Channel *ch,ChanPacket &pack)
 //     LOG_DEBUG("isPlaying-------------------------------------- %d %d", ch->isPlaying(), isPlaying);
 
        hit.initLocal(newLocalListeners,newLocalRelays,ch->info.numSkips,ch->info.getUptime(),ch->isPlaying(), ch->isFull(), ch->info.bitrate, ch, oldp, newp);
+       { //JP-MOD
+               if(!(ch->info.ppFlags & ServMgr::bcstClap))
+                       ch->bClap = false;
+               hit.initLocal_pp(ch->stealth, ch->bClap ? 1 : 0);
+       }
        hit.tracker = ch->isBroadcasting();
 
        if      (       (((ctime-lastUpdate)>chanMgr->hostUpdateInterval) && chanMgr->hostUpdateInterval)
@@ -1434,13 +1453,19 @@ bool ChannelStream::getStatus(Channel *ch,ChanPacket &pack)
                ||      (ch->chDisp.relay != hit.relay)
                ||      (ch->chDisp.relayfull != hit.relayfull)
                ||      (ch->chDisp.chfull != hit.chfull)
-               ||      (ch->chDisp.ratefull != hit.ratefull)   
+               ||      (ch->chDisp.ratefull != hit.ratefull)
+               ||      (ch->bClap && ((ctime-lastClapped) > 60)) //JP-MOD      
        ){
                numListeners = newLocalListeners;
                numRelays = newLocalRelays;
                isPlaying = ch->isPlaying();
                fwState = servMgr->getFirewall();
                lastUpdate = ctime;
+
+               if(ch->bClap){ //JP-MOD
+                       lastClapped = ctime;
+                       ch->bClap = false;
+               }
        
                ch->chDisp = hit;
 
@@ -1456,23 +1481,26 @@ bool ChannelStream::getStatus(Channel *ch,ChanPacket &pack)
                GnuID noID;
                noID.clear();
 
-#ifndef VERSION_EX
+               if (version_ex == 0)
+               {
                        atom.writeParent(PCP_BCST,8);
-#else
+               } else
+               {
                        atom.writeParent(PCP_BCST,10);
-#endif
-                       atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_TRACKERS);
-                       atom.writeChar(PCP_BCST_HOPS,0);
-                       atom.writeChar(PCP_BCST_TTL,11);
-                       atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
-                       atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
-                       atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
+               }
+               atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_TRACKERS);
+               atom.writeChar(PCP_BCST_HOPS,0);
+               atom.writeChar(PCP_BCST_TTL,11);
+               atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
+               atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
+               atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
+               if (version_ex)
+               {
                        atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
                        atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
-                       atom.writeBytes(PCP_BCST_CHANID,ch->info.id.id,16);
-                       hit.writeAtoms(atom,noID);
+               }
+               atom.writeBytes(PCP_BCST_CHANID,ch->info.id.id,16);
+               hit.writeAtoms(atom,noID);
 
                pack.len = pmem.pos;
                pack.type = ChanPacket::T_PCP;
@@ -2363,7 +2391,11 @@ bool ChanMgr::writeVariable(Stream &out, const String &var, int index)
        else if (var == "numChannels")
                sprintf(buf,"%d",numChannels());
        else if (var == "djMessage")
-               strcpy(buf,broadcastMsg.cstr());
+       {
+               String utf8 = broadcastMsg;
+               utf8.convertTo(String::T_UNICODESAFE);
+               strcpy(buf,utf8.cstr());
+       }
        else if (var == "icyMetaInterval")
                sprintf(buf,"%d",icyMetaInterval);
        else if (var == "maxRelaysPerChannel")
@@ -2424,6 +2456,9 @@ bool Channel::writeVariable(Stream &out, const String &var, int index)
                utf8 = info.comment;
                utf8.convertTo(String::T_UNICODESAFE);
                strcpy(buf,utf8.cstr());
+       }else if (var == "bcstClap") //JP-MOD
+       {
+               strcpy(buf,info.ppFlags & ServMgr::bcstClap ? "1":"0");
        }else if (var == "uptime")
        {
                String uptime;
@@ -2456,7 +2491,8 @@ bool Channel::writeVariable(Stream &out, const String &var, int index)
                sprintf(buf,"%d",totalRelays());
        else if (var == "totalListeners")
                sprintf(buf,"%d",totalListeners());
-
+       else if (var == "totalClaps") //JP-MOD
+               sprintf(buf,"%d",totalClaps());
        else if (var == "status")
                sprintf(buf,"%s",getStatusStr());
        else if (var == "keep")
@@ -3125,6 +3161,7 @@ void ChanHit::init()
 
        numListeners = 0;
        numRelays = 0;
+       clap_pp = 0; //JP-MOD
 
        dead = tracker = firewalled = stable = yp = false;
        recv = cin = direct = relay = true;
@@ -3220,14 +3257,16 @@ void ChanHit::initLocal(int numl,int numr,int,int uptm,bool connected,bool isFul
 
        version = PCP_CLIENT_VERSION;
        version_vp = PCP_CLIENT_VERSION_VP;
-#ifdef VERSION_EX
-       strncpy(version_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX,2);
-       version_ex_number = PCP_CLIENT_VERSION_EX_NUMBER;
-#else
-       version_ex_prefix[0] = ' ';
-       version_ex_prefix[1] = ' ';
-       version_ex_number = 0;
-#endif
+       if (version_ex)
+       {
+               strncpy(version_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX,2);
+               version_ex_number = PCP_CLIENT_VERSION_EX_NUMBER;
+       } else
+       {
+               version_ex_prefix[0] = ' ';
+               version_ex_prefix[1] = ' ';
+               version_ex_number = 0;
+       }
 
        status = ch->status;
 
@@ -3246,6 +3285,13 @@ void ChanHit::initLocal(int numl,int numr,int,int uptm,bool connected,bool isFul
 }
 
 // -----------------------------------
+void ChanHit::initLocal_pp(bool isStealth, int numClaps) //JP-MOD
+{
+       numListeners = numListeners && !isStealth ? 1 : 0;
+       clap_pp = numClaps;
+}
+
+// -----------------------------------
 void ChanHit::writeAtoms(AtomStream &atom,GnuID &chanID)
 {
        bool addChan=chanID.isSet();
@@ -3259,32 +3305,35 @@ void ChanHit::writeAtoms(AtomStream &atom,GnuID &chanID)
        if (tracker) fl1 |= PCP_HOST_FLAGS1_TRACKER;
        if (firewalled) fl1 |= PCP_HOST_FLAGS1_PUSH;
 
-       atom.writeParent(PCP_HOST,13  + (addChan?1:0) + (uphostdata?3:0) + (version_ex_number?2:0));
-
-               if (addChan)
-                       atom.writeBytes(PCP_HOST_CHANID,chanID.id,16);
-               atom.writeBytes(PCP_HOST_ID,sessionID.id,16);
-               atom.writeInt(PCP_HOST_IP,rhost[0].ip);
-               atom.writeShort(PCP_HOST_PORT,rhost[0].port);
-               atom.writeInt(PCP_HOST_IP,rhost[1].ip);
-               atom.writeShort(PCP_HOST_PORT,rhost[1].port);
-               atom.writeInt(PCP_HOST_NUML,numListeners);
-               atom.writeInt(PCP_HOST_NUMR,numRelays);
-               atom.writeInt(PCP_HOST_UPTIME,upTime);
-               atom.writeInt(PCP_HOST_VERSION,version);
-               atom.writeInt(PCP_HOST_VERSION_VP,version_vp);
-               if (version_ex_number){
-                       atom.writeBytes(PCP_HOST_VERSION_EX_PREFIX,version_ex_prefix,2);
-                       atom.writeShort(PCP_HOST_VERSION_EX_NUMBER,version_ex_number);
-               }
-               atom.writeChar(PCP_HOST_FLAGS1,fl1);
-               atom.writeInt(PCP_HOST_OLDPOS,oldestPos);
-               atom.writeInt(PCP_HOST_NEWPOS,newestPos);
-               if (uphostdata){
-                       atom.writeInt(PCP_HOST_UPHOST_IP,uphost.ip);
-                       atom.writeInt(PCP_HOST_UPHOST_PORT,uphost.port);
-                       atom.writeInt(PCP_HOST_UPHOST_HOPS,uphostHops);
-               }
+       atom.writeParent(PCP_HOST,13  + (addChan?1:0) + (uphostdata?3:0) + (version_ex_number?2:0) + (clap_pp?1:0/*JP-MOD*/));
+
+       if (addChan)
+               atom.writeBytes(PCP_HOST_CHANID,chanID.id,16);
+       atom.writeBytes(PCP_HOST_ID,sessionID.id,16);
+       atom.writeInt(PCP_HOST_IP,rhost[0].ip);
+       atom.writeShort(PCP_HOST_PORT,rhost[0].port);
+       atom.writeInt(PCP_HOST_IP,rhost[1].ip);
+       atom.writeShort(PCP_HOST_PORT,rhost[1].port);
+       atom.writeInt(PCP_HOST_NUML,numListeners);
+       atom.writeInt(PCP_HOST_NUMR,numRelays);
+       atom.writeInt(PCP_HOST_UPTIME,upTime);
+       atom.writeInt(PCP_HOST_VERSION,version);
+       atom.writeInt(PCP_HOST_VERSION_VP,version_vp);
+       if (version_ex_number){
+               atom.writeBytes(PCP_HOST_VERSION_EX_PREFIX,version_ex_prefix,2);
+               atom.writeShort(PCP_HOST_VERSION_EX_NUMBER,version_ex_number);
+       }
+       atom.writeChar(PCP_HOST_FLAGS1,fl1);
+       atom.writeInt(PCP_HOST_OLDPOS,oldestPos);
+       atom.writeInt(PCP_HOST_NEWPOS,newestPos);
+       if (uphostdata){
+               atom.writeInt(PCP_HOST_UPHOST_IP,uphost.ip);
+               atom.writeInt(PCP_HOST_UPHOST_PORT,uphost.port);
+               atom.writeInt(PCP_HOST_UPHOST_HOPS,uphostHops);
+       }
+       if (clap_pp){   //JP-MOD
+               atom.writeInt(PCP_HOST_CLAP_PP,clap_pp);
+       }
 }
 // -----------------------------------
 bool   ChanHit::writeVariable(Stream &out, const String &var)
@@ -3319,7 +3368,7 @@ bool      ChanHit::writeVariable(Stream &out, const String &var)
                        strcat(buf,buf2);
 
                        char h_name[128];
-                       if (ClientSocket::getHostname(h_name,rhost[0].ip))
+                       if (ClientSocket::getHostname(h_name,sizeof(h_name),rhost[0].ip)) // BOF\91Î\8dô\82Á\82Û\82¢
                        {
                                strcat(buf,"[");
                                strcat(buf,h_name);
@@ -3657,7 +3706,23 @@ int      ChanHitList::numListeners()
        while (ch)
        {
                if (ch->host.ip && !ch->dead && ch->numHops)
-                       cnt += ch->numListeners;
+                       cnt += (unsigned int)ch->numListeners > 3 ? 3 : ch->numListeners;
+               ch=ch->next;
+       }
+
+       return cnt;
+}
+
+// -----------------------------------
+int ChanHitList::numClaps()    //JP-MOD
+{
+       int cnt=0;
+       ChanHit *ch = hit;
+       while (ch)
+       {
+               if (ch->host.ip && !ch->dead && ch->numHops && (ch->clap_pp & 1)){
+                       cnt++;
+               }
                ch=ch->next;
        }
 
@@ -4077,6 +4142,12 @@ bool ChanInfo::update(ChanInfo &info)
                changed = true;
        }
 
+       if(ppFlags != info.ppFlags) //JP-MOD
+       {
+               ppFlags = info.ppFlags;
+               changed = true;
+       }
+
        if (!desc.isSame(info.desc)) //JP-EX
        {
                desc = info.desc;
@@ -4140,6 +4211,7 @@ void ChanInfo::init()
        numSkips = 0;
        bcID.clear();
        createdTime = 0;
+       ppFlags = 0; //JP-MOD
 }
 // -----------------------------------
 void ChanInfo::readTrackXML(XML::Node *n)
@@ -4221,6 +4293,9 @@ void ChanInfo::readInfoAtoms(AtomStream &atom,int numc)
                        char type[16];
                        atom.readString(type,sizeof(type),d);
                        contentType = ChanInfo::getTypeFromStr(type);
+               }else if (id == PCP_CHAN_INFO_PPFLAGS) //JP-MOD
+               {
+                       ppFlags = (unsigned int)atom.readInt();
                }else
                        atom.skip(c,d);
        }       
@@ -4229,14 +4304,16 @@ void ChanInfo::readInfoAtoms(AtomStream &atom,int numc)
 // -----------------------------------
 void ChanInfo::writeInfoAtoms(AtomStream &atom)
 {
-       atom.writeParent(PCP_CHAN_INFO,7);
+       atom.writeParent(PCP_CHAN_INFO,7 + (ppFlags ? 1:0/*JP-MOD*/));
                atom.writeString(PCP_CHAN_INFO_NAME,name.cstr());
                atom.writeInt(PCP_CHAN_INFO_BITRATE,bitrate);
                atom.writeString(PCP_CHAN_INFO_GENRE,genre.cstr());
                atom.writeString(PCP_CHAN_INFO_URL,url.cstr());
                atom.writeString(PCP_CHAN_INFO_DESC,desc.cstr());
                atom.writeString(PCP_CHAN_INFO_COMMENT,comment.cstr());
-               atom.writeString(PCP_CHAN_INFO_TYPE,getTypeStr(contentType));           
+               atom.writeString(PCP_CHAN_INFO_TYPE,getTypeStr(contentType));
+               if(ppFlags)
+                       atom.writeInt(PCP_CHAN_INFO_PPFLAGS,ppFlags); //JP-MOD
 
 }
 // -----------------------------------
@@ -4395,6 +4472,13 @@ void ChanInfo::updateFromXML(XML::Node *n)
        if (br)
                bitrate = br;
 
+       { //JP-MOD
+               ppFlags = ServMgr::bcstNone;
+
+               if (n->findAttrInt("bcstClap"))
+                       ppFlags |= ServMgr::bcstClap;
+       }
+
        readXMLString(typeStr,n,"type");
        if (!typeStr.isEmpty())
                contentType = getTypeFromStr(typeStr.cstr());
@@ -4455,7 +4539,7 @@ void PlayList::readASX(Stream &in)
                                        char *hr = rf->findAttr("href");
                                        if (hr)
                                        {
-                                               addURL(hr,"");
+                                               addURL(hr,"","");
                                                //LOG("asx url %s",hr);
                                        }
 
@@ -4475,7 +4559,7 @@ void PlayList::readSCPLS(Stream &in)
                {
                        char *p = strstr(tmp,"=");
                        if (p)
-                               addURL(p+1,"");
+                               addURL(p+1,"","");
                }
        }
 }
@@ -4486,7 +4570,7 @@ void PlayList::readPLS(Stream &in)
        while (in.readLine(tmp,sizeof(tmp)))
        {
                if (tmp[0] != '#')
-                       addURL(tmp,"");
+                       addURL(tmp,"","");
        }
 }
 // -----------------------------------
@@ -4518,12 +4602,63 @@ void PlayList::writeRAM(Stream &out)
 }
 
 // -----------------------------------
+#define isHTMLSPECIAL(a) ((a == '&') || (a == '\"') || (a == '\'') || (a == '<') || (a == '>'))
+static void SJIStoSJISSAFE(char *string, size_t size)
+{
+       size_t pos;
+       for(pos = 0;
+               (string[pos] != '\0') && (pos < size);
+               ++pos)
+       {
+               if(isHTMLSPECIAL(string[pos]))
+                       string[pos] = ' ';
+       }
+}
+
+// -----------------------------------
+static void WriteASXInfo(Stream &out, String &title, String &contacturl, String::TYPE tEncoding = String::T_UNICODESAFE) //JP-MOD
+{
+       if(!title.isEmpty())
+       {
+               String titleEncode;
+               titleEncode = title;
+               titleEncode.convertTo(tEncoding);
+               if(tEncoding == String::T_SJIS)
+                       SJIStoSJISSAFE(titleEncode.cstr(), String::MAX_LEN);
+               out.writeLineF("<TITLE>%s</TITLE>", titleEncode.cstr());
+       }
+
+       if(!contacturl.isEmpty())
+       {
+               String contacturlEncode;
+               contacturlEncode = contacturl;
+               contacturlEncode.convertTo(tEncoding);
+               if(tEncoding == String::T_SJIS)
+                       SJIStoSJISSAFE(contacturlEncode.cstr(), String::MAX_LEN);
+               out.writeLineF("<MOREINFO HREF = \"%s\" />", contacturlEncode.cstr());
+       }
+}
+
+// -----------------------------------
 void PlayList::writeASX(Stream &out)
 {
        out.writeLine("<ASX Version=\"3.0\">");
+
+       String::TYPE tEncoding = String::T_SJIS;
+       if(servMgr->asxDetailedMode == 2)
+       {
+               out.writeLine("<PARAM NAME = \"Encoding\" VALUE = \"utf-8\" />"); //JP-MOD Memo: UTF-8 cannot be used in some recording software.
+               tEncoding = String::T_UNICODESAFE;
+       }
+
+       if(servMgr->asxDetailedMode)
+               WriteASXInfo(out, titles[0], contacturls[0], tEncoding); //JP-MOD
+
        for(int i=0; i<numURLs; i++)
        {
                out.writeLine("<ENTRY>");
+               if(servMgr->asxDetailedMode)
+                       WriteASXInfo(out, titles[i], contacturls[i], tEncoding); //JP-MOD
                out.writeLineF("<REF href = \"%s\" />",urls[i].cstr());
                out.writeLine("</ENTRY>");
        }
@@ -4542,7 +4677,7 @@ void PlayList::addChannel(const char *path, ChanInfo &info)
        char *nid = info.id.isSet()?idStr:info.name.cstr();
 
        sprintf(url.cstr(),"%s/stream/%s%s",path,nid,ChanInfo::getTypeExt(info.contentType));
-       addURL(url.cstr(),info.name);
+       addURL(url.cstr(),info.name,info.url);
 }
 
 // -----------------------------------
index d6f0c47..d6f5563 100644 (file)
@@ -168,6 +168,7 @@ public:
        TrackInfo       track;
        ::String        desc,genre,url,comment;
 
+       unsigned int ppFlags; //JP-MOD
 };
 
 
@@ -177,6 +178,7 @@ class ChanHit
 public:
        void    init();
        void    initLocal(int numl,int numr,int nums,int uptm,bool,bool,unsigned int,Channel*,unsigned int,unsigned int);
+       void    initLocal_pp(bool isStealth, int numClaps); //JP-MOD
        XML::Node *createXML();
 
        void    writeAtoms(AtomStream &,GnuID &);
@@ -187,6 +189,7 @@ public:
        Host                            host;
        Host                            rhost[2];
        unsigned int            numListeners,numRelays,numHops;
+       int                                     clap_pp;        //JP-MOD
        unsigned int            time,upTime,lastContact;
        unsigned int            hitID;
        GnuID                           sessionID,chanID;
@@ -225,6 +228,7 @@ public:
        void    clearHits(bool);
        int             numHits();
        int             numListeners();
+       int             numClaps();     //JP-MOD
        int             numRelays();
        int             numFirewalled();
        int             numTrackers();
@@ -474,6 +478,7 @@ public:
        int             localListeners();
        int             localRelays();
 
+       int             totalClaps();   //JP-MOD
        int             totalListeners();
        int             totalRelays();
 
@@ -496,10 +501,13 @@ public:
        ::String  sourceURL;
 
        bool    bump,stayConnected;
+       bool    stealth; //JP-MOD
        int             icyMetaInterval;
        unsigned int streamPos;
        unsigned int skipCount; //JP-EX
        bool    readDelay;
+       int             overrideMaxRelaysPerChannel; //JP-MOD
+       bool    bClap; //JP-MOD
 
        TYPE    type;
        ChannelSource *sourceData;
@@ -663,20 +671,23 @@ public:
                type = t;
                urls = new ::String[max];
                titles = new ::String[max];
+               contacturls = new ::String[max]; //JP-MOD
        }
 
        ~PlayList()
        {
                delete [] urls;
                delete [] titles;
+               delete [] contacturls; //JP-MOD
        }
 
-       void    addURL(const char *url, const char *tit)
+       void    addURL(const char *url, const char *tit, const char *contacturl/*JP-MOD*/)
        {
                if (numURLs < maxURLs)
                {
                        urls[numURLs].set(url);
                        titles[numURLs].set(tit);
+                       contacturls[numURLs].set(contacturl); //JP-MOD
                        numURLs++;
                }
        }
@@ -719,6 +730,7 @@ public:
        TYPE    type;
        int             numURLs,maxURLs;
        ::String        *urls,*titles;
+       ::String        *contacturls; //JP-MOD
 };
 
 // ----------------------------------
index 795cd6b..d59ad1d 100644 (file)
@@ -217,6 +217,7 @@ public:
        ,fwState(0)
        ,lastUpdate(0)
        ,lastCheckTime(0)
+       ,lastClapped(0) //JP-MOD
        ,parent(NULL)
        {}
        virtual ~ChannelStream() {}
@@ -240,6 +241,7 @@ public:
        int     fwState;
        unsigned int lastUpdate;
        unsigned int lastCheckTime;
+       unsigned int lastClapped; //JP-MOD
 
        Channel *parent;
 };
index bff67fd..9ee8d4b 100644 (file)
@@ -239,7 +239,7 @@ void GnuPacket::initFind(const char *str, XML *xml, int maxTTL)
 
        if (str)
        {
-               int slen = strlen(str);
+               size_t slen = strlen(str);
                mem.write((void *)str,slen+1);  // string
        }else
                mem.writeChar(0);               // null string
index ff659ac..5233edd 100644 (file)
@@ -181,10 +181,12 @@ void HTML::writeVariable(Stream &s,const String &varName, int loop)
 int HTML::getIntVariable(const String &varName,int loop)
 {
        String val;
+       LOG_DEBUG("AAA %d %d %d %d", val[0], val[1], val[2], val[3]);
        MemoryStream mem(val.cstr(),String::MAX_LEN);
 
        writeVariable(mem,varName,loop);
 
+       LOG_DEBUG("AAA %d %d %d %d", val[0], val[1], val[2], val[3]);
        return atoi(val.cstr());
 }
 // --------------------------------------
@@ -195,6 +197,10 @@ bool HTML::getBoolVariable(const String &varName,int loop)
 
        writeVariable(mem,varName,loop);
 
+       String tmp;
+       tmp = varName;
+       LOG_DEBUG("*** %s : %c", tmp.cstr(), val[0]);
+
        // integer
        if ((val[0] >= '0') && (val[0] <= '9'))
                return atoi(val.cstr()) != 0;   
@@ -220,9 +226,11 @@ void       HTML::readIf(Stream &in,Stream *outp,int loop)
                {
                        if (getBoolVariable(var,loop)==varCond)
                        {
+                               LOG_DEBUG("==varCond, loop = %d", loop);
                                if (readTemplate(in,outp,loop))
                                        readTemplate(in,NULL,loop);
                        }else{
+                               LOG_DEBUG("!=varCond, loop = %d", loop);
                                if (readTemplate(in,NULL,loop))
                                        readTemplate(in,outp,loop);
                        }
@@ -250,6 +258,8 @@ void        HTML::readLoop(Stream &in,Stream *outp,int loop)
                {
                        int cnt = getIntVariable(var,loop);
 
+                       LOG_DEBUG("loop_cnt : %s = %d", var.cstr(), cnt);
+
                        if (cnt)
                        {
                                int spos = in.getPosition();
index 08e8485..11289f6 100644 (file)
@@ -112,6 +112,7 @@ unsigned int PCPStream::flushUb(Stream &in, unsigned int size)
 int PCPStream::readPacket(Stream &in,Channel *)
 {
        BroadcastState bcs;
+       bcs.ttl = 1;
        return readPacket(in,bcs);
 }
 // ------------------------------------------
@@ -375,7 +376,7 @@ void PCPStream::readPktAtoms(Channel *ch,AtomStream &atom,int numc,BroadcastStat
 
                if (servMgr->autoBumpSkipCount) //JP-EX
                {
-                       if (ch->skipCount > servMgr->autoBumpSkipCount)
+                       if ((ch->skipCount > servMgr->autoBumpSkipCount) && !(servMgr->disableAutoBumpIfDirect && ch->sourceHost.tracker)) //JP-MOD
                        {
                                LOG_DEBUG("Auto bump");
                                ch->bump = true;
@@ -505,7 +506,18 @@ void PCPStream::readHostAtoms(AtomStream &atom, int numc, BroadcastState &bcs, C
                        hit.uphost.port = atom.readInt();
                else if (id == PCP_HOST_UPHOST_HOPS)
                        hit.uphostHops = atom.readInt();
-               else
+               else if (id == PCP_HOST_CLAP_PP){ //JP-MOD
+                       hit.clap_pp = atom.readInt();
+                       if (hit.clap_pp & 1){
+                               Channel *c = chanMgr->findChannelByID(chanID);
+                               if(c && c->isBroadcasting()){
+                                       String sjis;
+                                       sjis = c->info.name;
+                                       sjis.convertTo(String::T_SJIS);
+                                       peercastApp->notifyMessage(ServMgr::NT_APPLAUSE, sjis);
+                               }
+                       }
+               }else
                {
                        LOG_DEBUG("PCP skip: %s,%d,%d",id.getString().str(),c,d);
                        atom.skip(c,d);
@@ -519,7 +531,7 @@ void PCPStream::readHostAtoms(AtomStream &atom, int numc, BroadcastState &bcs, C
 
        hit.servent_id = bcs.servent_id;
 
-       if (flg){
+       if (flg && (bcs.ttl != 0)){
 //             LOG_DEBUG("readHostAtoms HITLISTLOCK ON-------------");
                chanMgr->hitlistlock.on();
                if (hit.recv)
@@ -651,7 +663,7 @@ void PCPStream::readChanAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
 int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
 {
        ChanPacket pack;
-       int ttl=0;              
+       //int ttl=0;            
        int ver=0;
        int ver_vp=0;
        GnuID fromID,destID;
@@ -676,9 +688,8 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
                
                if (id == PCP_BCST_TTL)
                {
-                       ttl = atom.readChar()-1;
-                       patom.writeChar(id,ttl);
-
+                       bcs.ttl = atom.readChar()-1;
+                       patom.writeChar(id,bcs.ttl);
                }else if (id == PCP_BCST_HOPS)
                {
                        bcs.numHops = atom.readChar()+1;
@@ -757,9 +768,15 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
                                pmem.pos = oldPos;
                                r = readAtom(patom,bcs);
                        } else {
-                               LOG_DEBUG("### Invalid bcst: hops=%d, ver=%d(VP%04d), ttl=%d",
-                                       bcs.numHops,ver,ver_vp,ttl);
-                               ttl = 0;
+                               char tmp[80], tmp2[80], tmp3[80];
+                               hit.uphost.toStr(tmp);
+                               hit.host.toStr(tmp2);
+                               sv->getHost().toStr(tmp3);
+                               LOG_DEBUG("### Invalid bcst: hops=%d, l/r = %d/%d, ver=%d(VP%04d), ttl=%d",
+                                       bcs.numHops,hit.numListeners, hit.numRelays, ver,ver_vp,bcs.ttl);
+                               LOG_DEBUG("### %s <- %s <- sv(%s)",
+                                       tmp2, tmp, tmp3);
+                               bcs.ttl = 0;
                        }
                } else {
                        // copy and process atoms
@@ -785,11 +802,11 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
 
        if (ver_ex_number){
                LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d(%c%c%04d), from=%s, dest=%s ttl=%d",
-                       bcs.group,bcs.numHops,ver,ver_ex_prefix[0],ver_ex_prefix[1],ver_ex_number,fromStr,destStr,ttl);
+                       bcs.group,bcs.numHops,ver,ver_ex_prefix[0],ver_ex_prefix[1],ver_ex_number,fromStr,destStr,bcs.ttl);
        } else if (ver_vp){
-               LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d(VP%04d), from=%s, dest=%s ttl=%d",bcs.group,bcs.numHops,ver,ver_vp,fromStr,destStr,ttl);
+               LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d(VP%04d), from=%s, dest=%s ttl=%d",bcs.group,bcs.numHops,ver,ver_vp,fromStr,destStr,bcs.ttl);
        } else {
-               LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d, from=%s, dest=%s ttl=%d",bcs.group,bcs.numHops,ver,fromStr,destStr,ttl);
+               LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d, from=%s, dest=%s ttl=%d",bcs.group,bcs.numHops,ver,fromStr,destStr,bcs.ttl);
        }
 
        if (fromID.isSet())
@@ -799,39 +816,39 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
                        return PCP_ERROR_BCST+PCP_ERROR_LOOPBACK;
                }
 
-       // broadcast back out if ttl > 0 
-       if ((ttl>0) && (!bcs.forMe))
-       {
-               pack.len = pmem.pos;
-               pack.type = ChanPacket::T_PCP;
-
-               if (bcs.group & (/*PCP_BCST_GROUP_ROOT|*/PCP_BCST_GROUP_TRACKERS|PCP_BCST_GROUP_RELAYS))
+               // broadcast back out if ttl > 0 
+               if ((bcs.ttl>0) && (!bcs.forMe))
                {
-                       pack.priority = 11 - bcs.numHops;
-                       chanMgr->broadcastPacketUp(pack,bcs.chanID,remoteID,destID);
-               }
+                       pack.len = pmem.pos;
+                       pack.type = ChanPacket::T_PCP;
 
-               if (bcs.group & (/*PCP_BCST_GROUP_ROOT|*/PCP_BCST_GROUP_TRACKERS|PCP_BCST_GROUP_RELAYS))
-               {
-                       servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_COUT);
-               }
+                       if (bcs.group & (/*PCP_BCST_GROUP_ROOT|*/PCP_BCST_GROUP_TRACKERS|PCP_BCST_GROUP_RELAYS))
+                       {
+                               pack.priority = 11 - bcs.numHops;
+                               chanMgr->broadcastPacketUp(pack,bcs.chanID,remoteID,destID);
+                       }
 
-               if (bcs.group & (PCP_BCST_GROUP_RELAYS|PCP_BCST_GROUP_TRACKERS))
-               {
-                       servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_CIN);
-               }
+                       if (bcs.group & (/*PCP_BCST_GROUP_ROOT|*/PCP_BCST_GROUP_TRACKERS|PCP_BCST_GROUP_RELAYS))
+                       {
+                               servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_COUT);
+                       }
 
-               if (bcs.group & (PCP_BCST_GROUP_RELAYS))
-               {
-                       servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_RELAY);
-               }
+                       if (bcs.group & (PCP_BCST_GROUP_RELAYS|PCP_BCST_GROUP_TRACKERS))
+                       {
+                               servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_CIN);
+                       }
 
+                       if (bcs.group & (PCP_BCST_GROUP_RELAYS))
+                       {
+                               servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_RELAY);
+                       }
 
-//             LOG_DEBUG("ttl=%d",ttl);
 
-       } else {
-//             LOG_DEBUG("ttl=%d",ttl);
-       }
+                       //              LOG_DEBUG("ttl=%d",ttl);
+
+               } else {
+                       //              LOG_DEBUG("ttl=%d",ttl);
+               }
        return r;
 }
 
index 770205b..da23723 100644 (file)
@@ -85,6 +85,7 @@ static const ID4 PCP_HOST_VERSION     = "ver";
 static const ID4 PCP_HOST_VERSION_VP   = "vevp";
 static const ID4 PCP_HOST_VERSION_EX_PREFIX = "vexp";
 static const ID4 PCP_HOST_VERSION_EX_NUMBER = "vexn";
+static const ID4 PCP_HOST_CLAP_PP              = "clap"; //JP-MOD
 static const ID4 PCP_HOST_FLAGS1       = "flg1";
 static const ID4 PCP_HOST_OLDPOS       = "oldp";
 static const ID4 PCP_HOST_NEWPOS       = "newp";
@@ -114,6 +115,7 @@ static const ID4 PCP_CHAN_INFO_NAME         = "name";
 static const ID4 PCP_CHAN_INFO_URL             = "url";
 static const ID4 PCP_CHAN_INFO_DESC            = "desc";
 static const ID4 PCP_CHAN_INFO_COMMENT = "cmnt";
+static const ID4 PCP_CHAN_INFO_PPFLAGS = "pflg"; //JP-MOD
 
 static const ID4 PCP_CHAN_TRACK                        = "trck";
 static const ID4 PCP_CHAN_TRACK_TITLE  = "titl";
@@ -191,6 +193,7 @@ public:
        ,streamPos(0)
        ,group(0)
        ,servent_id(0)
+       ,ttl(0)
        {
                chanID.clear();
                bcID.clear();
@@ -213,6 +216,7 @@ public:
        unsigned int streamPos;
        int group;
        int servent_id;
+       int ttl;
 };
 
 // ----------------------------------------------
index 9560fa8..320dd90 100644 (file)
@@ -8,7 +8,7 @@
 #define new DEBUG_NEW
 #endif
 
-
+#include "version2.h"
 
 // ---------------------------------
 // globals
@@ -20,6 +20,7 @@ ServMgr *servMgr;
 PeercastInstance *peercastInst=NULL;
 PeercastApplication *peercastApp=NULL;
 
+int version_ex = 0;
 
 // ---------------------------------
 void APICALL PeercastInstance::init()
index 4101852..bbb4a5a 100644 (file)
@@ -24,3 +24,5 @@
 #define DEBUG_NEW new(__FILE__, __LINE__)
 #define new DEBUG_NEW
 #endif
+
+static const int dummy = 0;
index bd4c171..d8cdddd 100644 (file)
@@ -3147,7 +3147,7 @@ bool      Servent::writeVariable(Stream &s, const String &var)
                        }
                        strcat(buf,h_ip);
                        char h_name[128];
-                       if (ClientSocket::getHostname(h_name,h.ip))
+                       if (ClientSocket::getHostname(h_name,sizeof(h_name),h.ip)) //JP-MOD(BOF\91Î\8dô)
                        {
                                strcat(buf,"[");
                                strcat(buf,h_name);
index be97958..ac30b47 100644 (file)
@@ -38,8 +38,8 @@ static void termArgs(char *str)
 {
        if (str)
        {
-               int slen = strlen(str);
-               for(int i=0; i<slen; i++)
+               size_t slen = strlen(str);
+               for(size_t i=0; i<slen; i++)
                        if (str[i]=='&') str[i] = 0;
        }
 }
@@ -162,8 +162,8 @@ void Servent::handshakeHTTP(HTTP &http, bool isHTTP)
 
                        if (pwdArg && songArg)
                        {
-                               int i;
-                               int slen = strlen(fn);
+                               size_t i;
+                               size_t slen = strlen(fn);
                                for(i=0; i<slen; i++)
                                        if (fn[i]=='&') fn[i] = 0;
 
@@ -930,10 +930,14 @@ void Servent::handshakeCMD(char *cmd)
                                int newPort=servMgr->serverHost.port;
                                int enableGetName = 0;
                                int allowConnectPCST = 0;
+                               int disableAutoBumpIfDirect = 0; //JP-MOD
+                               int asxDetailedMode = 0; //JP-MOD
 
                                char *cp = cmd;
                                while (cp=nextCGIarg(cp,curr,arg))
                                {
+                                       LOG_DEBUG("ARG: %s = %s", curr, arg);
+
                                        // server
                                        if (strcmp(curr,"serveractive")==0)
                                                servMgr->autoServe = getCGIargBOOL(arg);
@@ -1010,6 +1014,7 @@ void Servent::handshakeCMD(char *cmd)
                                                                {
                                                                        servMgr->numFilters++;
                                                                        servMgr->filters[servMgr->numFilters].init();   // clear new entry
+                                                                       LOG_DEBUG("numFilters = %d", servMgr->numFilters);
                                                                }
 
                                                        }else if (strncmp(fs,"bn",2)==0)
@@ -1110,6 +1115,10 @@ void Servent::handshakeCMD(char *cmd)
 
                                        else if (strcmp(curr, "maxRelaysIndexTxt") ==0)         // for PCRaw (relay)
                                                servMgr->maxRelaysIndexTxt = getCGIargINT(arg);
+                                       else if (strcmp(curr, "disableAutoBumpIfDirect") ==0) //JP-MOD
+                                               disableAutoBumpIfDirect = atoi(arg) ? 1 : 0;
+                                       else if (strcmp(curr, "asxDetailedMode") ==0) //JP-MOD
+                                               asxDetailedMode = getCGIargINT(arg);
                                }
 
 
@@ -1119,6 +1128,8 @@ void Servent::handshakeCMD(char *cmd)
                                servMgr->allowServer2 = allowServer2;
                                servMgr->enableGetName = enableGetName;
                                servMgr->allowConnectPCST = allowConnectPCST;
+                               servMgr->disableAutoBumpIfDirect = disableAutoBumpIfDirect; //JP-MOD
+                               servMgr->asxDetailedMode = asxDetailedMode; //JP-MOD
                                if (!(servMgr->allowServer1 & ALLOW_HTML) && !(servMgr->allowServer2 & ALLOW_HTML))
                                        servMgr->allowServer1 |= ALLOW_HTML;
 
@@ -1199,6 +1210,9 @@ void Servent::handshakeCMD(char *cmd)
                                        }else if (strcmp(curr,"type")==0)
                                        {
                                                info.contentType = ChanInfo::getTypeFromStr(arg);
+                                       }else if (strcmp(curr,"bcstClap")==0) //JP-MOD
+                                       {
+                                               info.ppFlags |= ServMgr::bcstClap;
                                        }
 
                                }
@@ -1514,6 +1528,7 @@ void Servent::handshakeCMD(char *cmd)
                                                Channel *c = chanMgr->findChannelByName(chname.cstr());
                                                if (c && (c->isActive()) && (c->status == Channel::S_BROADCASTING)){
                                                        ChanInfo newInfo = c->info;
+                                                       newInfo.ppFlags = ServMgr::bcstNone; //JP-MOD
                                                        while (cmd=nextCGIarg(cmd,curr,arg))
                                                        {
                                                                String chmeta;
@@ -1527,6 +1542,8 @@ void Servent::handshakeCMD(char *cmd)
                                                                        newInfo.genre = chmeta.cstr();
                                                                else if (strcmp(curr,"comment")==0)
                                                                        newInfo.comment = chmeta.cstr();
+                                                               else if (strcmp(curr,"bcstClap")==0) //JP-MOD
+                                                                       newInfo.ppFlags |= ServMgr::bcstClap;
                                                                else if (strcmp(curr,"t_contact")==0)
                                                                        newInfo.track.contact = chmeta.cstr();
                                                                else if (strcmp(curr,"t_title")==0)
index 3829168..9470076 100644 (file)
@@ -144,6 +144,26 @@ ServMgr::ServMgr()
        chanLog="";
 
        maxRelaysIndexTxt = 1;  // for PCRaw (relay)
+
+       { //JP-MOD
+#ifdef WIN32
+               guiSimpleChannelList = false;
+               guiSimpleConnectionList = false;
+               guiTopMost = false;
+
+               guiChanListDisplays = 10;
+               guiConnListDisplays = 10;
+
+               guiTitleModify = false;
+               guiTitleModifyNormal = "PeerCast \8eó\90M:%rx.kbits.1%kbps \91\97\90M:%tx.kbits.1%kbps";
+               guiTitleModifyMinimized = "R:%rx.kbytes%KB/s T:%tx.kbytes%KB/s";
+
+               guiAntennaNotifyIcon = false;
+#endif
+
+               disableAutoBumpIfDirect = 1;
+               asxDetailedMode = 1;
+       }
 }
 // -----------------------------------
 BCID *ServMgr::findValidBCID(int index)
@@ -243,6 +263,7 @@ void ServMgr::setFilterDefaults()
 
        numFilters++;
 
+       LOG_DEBUG("numFilters = %d", numFilters);
 }
 
 // -----------------------------------
@@ -1034,6 +1055,17 @@ void ServMgr::saveSettings(const char *fn)
 
                iniFile.writeIntValue("maxRelaysIndexTxt", servMgr->maxRelaysIndexTxt); // for PCRaw (relay)
 
+               { //JP-MOD
+                       iniFile.writeIntValue("disableAutoBumpIfDirect",servMgr->disableAutoBumpIfDirect);
+                       iniFile.writeIntValue("asxDetailedMode",servMgr->asxDetailedMode);
+
+                       iniFile.writeSection("PP");
+#ifdef WIN32
+                       iniFile.writeBoolValue("ppClapSound", servMgr->ppClapSound);
+                       iniFile.writeStrValue("ppClapSoundPath", servMgr->ppClapSoundPath.cstr());
+#endif
+               }
+
                //JP-EX
                iniFile.writeSection("Windows");
                iniFile.writeBoolValue("getModulePath",servMgr->getModulePath);
@@ -1057,6 +1089,21 @@ void ServMgr::saveSettings(const char *fn)
                        iniFile.writeIntValue("guiRight", winPlace.rcNormalPosition.right);
                }
 
+               { //JP-MOD
+                       iniFile.writeBoolValue("guiSimpleChannelList", servMgr->guiSimpleChannelList);
+                       iniFile.writeBoolValue("guiSimpleConnectionList", servMgr->guiSimpleConnectionList);
+                       iniFile.writeBoolValue("guiTopMost", servMgr->guiTopMost);
+
+                       iniFile.writeIntValue("guiChanListDisplays", servMgr->guiChanListDisplays);
+                       iniFile.writeIntValue("guiConnListDisplays", servMgr->guiConnListDisplays);
+
+                       iniFile.writeBoolValue("guiTitleModify", servMgr->guiTitleModify);
+                       iniFile.writeStrValue("guiTitleModifyNormal", servMgr->guiTitleModifyNormal.cstr());
+                       iniFile.writeStrValue("guiTitleModifyMinimized", servMgr->guiTitleModifyMinimized.cstr());
+
+                       iniFile.writeBoolValue("guiAntennaNotifyIcon", servMgr->guiAntennaNotifyIcon);
+               }
+
                iniFile.writeBoolValue("topmostGui", servMgr->topmostGui);
                iniFile.writeBoolValue("startWithGui", servMgr->startWithGui);
 #endif
@@ -1073,6 +1120,7 @@ void ServMgr::saveSettings(const char *fn)
                        iniFile.writeBoolValue("PeerCast",notifyMask&NT_PEERCAST);
                        iniFile.writeBoolValue("Broadcasters",notifyMask&NT_BROADCASTERS);
                        iniFile.writeBoolValue("TrackInfo",notifyMask&NT_TRACKINFO);
+                       iniFile.writeBoolValue("Applause",notifyMask&NT_APPLAUSE); //JP-MOD
                iniFile.writeLine("[End]");
 
 
@@ -1391,6 +1439,19 @@ void ServMgr::loadSettings(const char *fn)
                        else if (iniFile.isName("maxRelaysIndexTxt"))                   // for PCRaw (relay)
                                servMgr->maxRelaysIndexTxt = iniFile.getIntValue();
 
+                       //JP-MOD
+                       else if (iniFile.isName("disableAutoBumpIfDirect"))
+                               servMgr->disableAutoBumpIfDirect = iniFile.getIntValue();
+                       else if (iniFile.isName("asxDetailedMode"))
+                               servMgr->asxDetailedMode = iniFile.getIntValue();
+
+#ifdef WIN32
+                       else if (iniFile.isName("ppClapSound"))
+                               servMgr->ppClapSound = iniFile.getBoolValue();
+                       else if (iniFile.isName("ppClapSoundPath"))
+                               servMgr->ppClapSoundPath.set(iniFile.getStrValue(),String::T_ASCII);
+#endif
+
                        //JP-Windows
                        else if (iniFile.isName("getModulePath"))
                                servMgr->getModulePath = iniFile.getBoolValue();
@@ -1436,7 +1497,24 @@ void ServMgr::loadSettings(const char *fn)
                                if (servMgr->saveGuiPos){
                                        guiFlg = true;
                                }
-                       }
+                       }else if (iniFile.isName("guiSimpleChannelList")) //JP-MOD
+                               servMgr->guiSimpleChannelList = iniFile.getBoolValue();
+                       else if (iniFile.isName("guiSimpleConnectionList")) //JP-MOD
+                               servMgr->guiSimpleConnectionList = iniFile.getBoolValue();
+                       else if (iniFile.isName("guiTopMost")) //JP-MOD
+                               servMgr->guiTopMost = iniFile.getBoolValue();
+                       else if (iniFile.isName("guiChanListDisplays")) //JP-MOD
+                               servMgr->guiChanListDisplays = iniFile.getIntValue();
+                       else if (iniFile.isName("guiConnListDisplays")) //JP-MOD
+                               servMgr->guiConnListDisplays = iniFile.getIntValue();
+                       else if (iniFile.isName("guiTitleModify")) //JP-MOD
+                               servMgr->guiTitleModify = iniFile.getBoolValue();
+                       else if (iniFile.isName("guiTitleModifyNormal")) //JP-MOD
+                               servMgr->guiTitleModifyNormal.set(iniFile.getStrValue(),String::T_ASCII);
+                       else if (iniFile.isName("guiTitleModifyMinimized")) //JP-MOD
+                               servMgr->guiTitleModifyMinimized.set(iniFile.getStrValue(),String::T_ASCII);
+                       else if (iniFile.isName("guiAntennaNotifyIcon")) //JP-MOD
+                               servMgr->guiAntennaNotifyIcon = iniFile.getBoolValue();
 
                        else if (iniFile.isName("topmostGui"))
                        {
@@ -1470,6 +1548,7 @@ void ServMgr::loadSettings(const char *fn)
 
                                if (numFilters < (MAX_FILTERS-1))
                                        numFilters++;
+                               LOG_DEBUG("*** numFilters = %d", numFilters);
                        }
                        else if (iniFile.isName("[Notify]"))
                        {
@@ -1484,6 +1563,8 @@ void ServMgr::loadSettings(const char *fn)
                                                notifyMask |= iniFile.getBoolValue()?NT_BROADCASTERS:0;
                                        else if (iniFile.isName("TrackInfo"))
                                                notifyMask |= iniFile.getBoolValue()?NT_TRACKINFO:0;
+                                       else if (iniFile.isName("Applause")) //JP-MOD
+                                               notifyMask |= iniFile.getBoolValue()?NT_APPLAUSE:0;
                                }
 
                        }
@@ -1583,6 +1664,7 @@ void ServMgr::loadSettings(const char *fn)
        if (!numFilters)
                setFilterDefaults();
 
+       LOG_DEBUG("numFilters = %d", numFilters);
 }
 
 // --------------------------------------------------
@@ -1825,11 +1907,13 @@ bool ServMgr::start()
 #else
        priv = "";
 #endif
-#ifdef VERSION_EX
-       LOG_DEBUG("Peercast %s, %s %s",PCX_VERSTRING_EX,peercastApp->getClientTypeOS(),priv);
-#else
-       LOG_DEBUG("Peercast %s, %s %s",PCX_VERSTRING,peercastApp->getClientTypeOS(),priv);
-#endif
+       if (version_ex)
+       {
+               LOG_DEBUG("Peercast %s, %s %s",PCX_VERSTRING_EX,peercastApp->getClientTypeOS(),priv);
+       } else
+       {
+               LOG_DEBUG("Peercast %s, %s %s",PCX_VERSTRING,peercastApp->getClientTypeOS(),priv);
+       }
 
        sessionID.toStr(idStr);
        LOG_DEBUG("SessionID: %s",idStr);
@@ -1954,10 +2038,11 @@ int ServMgr::broadcastPushRequest(ChanHit &hit, Host &to, GnuID &chanID, Servent
                atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
                atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
                atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
-               atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
-               atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
+               if (version_ex)
+               {
+                       atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
+                       atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
+               }
                atom.writeParent(PCP_PUSH,3);
                        atom.writeInt(PCP_PUSH_IP,to.ip);
                        atom.writeShort(PCP_PUSH_PORT,to.port);
@@ -1996,22 +2081,25 @@ void ServMgr::broadcastRootSettings(bool getUpdate)
                ChanPacket pack;
                MemoryStream mem(pack.data,sizeof(pack.data));
                AtomStream atom(mem);
-#ifndef VERSION_EX
+               if (version_ex == 0)
+               {
                        atom.writeParent(PCP_BCST,7);
-#else
+               } else
+               {
                        atom.writeParent(PCP_BCST,9);
-#endif
-                       atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_TRACKERS);
-                       atom.writeChar(PCP_BCST_HOPS,0);
-                       atom.writeChar(PCP_BCST_TTL,7);
-                       atom.writeBytes(PCP_BCST_FROM,sessionID.id,16);
-                       atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
-                       atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
+               }
+               atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_TRACKERS);
+               atom.writeChar(PCP_BCST_HOPS,0);
+               atom.writeChar(PCP_BCST_TTL,7);
+               atom.writeBytes(PCP_BCST_FROM,sessionID.id,16);
+               atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
+               atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
+               if (version_ex)
+               {
                        atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
                        atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
-                       writeRootAtoms(atom,getUpdate);
+               }
+               writeRootAtoms(atom,getUpdate);
 
                mem.len = mem.pos;
                mem.rewind();
@@ -2318,11 +2406,13 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
        String str;
 
        if (var == "version")
-#ifdef VERSION_EX
-               strcpy(buf,PCX_VERSTRING_EX);
-#else
-               strcpy(buf,PCX_VERSTRING);
-#endif
+               if (version_ex)
+               {
+                       strcpy(buf,PCX_VERSTRING_EX);
+               } else
+               {
+                       strcpy(buf,PCX_VERSTRING);
+               }
        else if (var == "uptime")
        {
                str.setFromStopwatch(getUptime());
@@ -2352,8 +2442,10 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
                sprintf(buf,"%d",getFirewall()==FW_UNKNOWN?0:1);
        else if (var == "rootMsg")
                strcpy(buf,rootMsg);
-       else if (var == "isRoot")
+       else if (var == "isRoot"){
+               LOG_DEBUG("isRoot = %d", isRoot);
                sprintf(buf,"%d",isRoot?1:0);
+       }
        else if (var == "isPrivate")
                sprintf(buf,"%d",(PCP_BROADCAST_FLAGS&1)?1:0);
        else if (var == "forceYP")
@@ -2370,8 +2462,10 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
                sprintf(buf,"%d",maxControl);
        else if (var == "maxServIn")
                sprintf(buf,"%d",maxServIn);
-       else if (var == "numFilters")
+       else if (var == "numFilters") {
+               LOG_DEBUG("*-* numFilters = %d", numFilters);
                sprintf(buf,"%d",numFilters+1);
+       }
        else if (var == "maxPGNUIn")
                sprintf(buf,"%d",maxGnuIncoming);
        else if (var == "minPGNUIn")
@@ -2424,6 +2518,19 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
        else if (var == "enableGetName")
                strcpy(buf, (enableGetName == 1)? "1":"0");
 
+       //JP-MOD
+       else if (var == "disableAutoBumpIfDirect")
+               strcpy(buf, (disableAutoBumpIfDirect == 1) ? "1":"0");
+       else if (var.startsWith("asxDetailedMode"))
+       {
+               if (var == "asxDetailedMode.0")
+                       strcpy(buf, (asxDetailedMode == 0) ? "1":"0");
+               else if (var == "asxDetailedMode.1")
+                       strcpy(buf, (asxDetailedMode == 1) ? "1":"0");
+               else if (var == "asxDetailedMode.2")
+                       strcpy(buf, (asxDetailedMode == 2) ? "1":"0");
+       }
+
        // VP-EX
        else if (var == "ypAddress2")
                strcpy(buf,rootHost2.cstr());
index e424a9d..32012f8 100644 (file)
@@ -122,7 +122,8 @@ public:
                NT_UPGRADE                      = 0x0001,
                NT_PEERCAST                     = 0x0002,
                NT_BROADCASTERS         = 0x0004,
-               NT_TRACKINFO            = 0x0008
+               NT_TRACKINFO            = 0x0008,
+               NT_APPLAUSE                     = 0x0010 //JP-MOD
        };
 
        enum FW_STATE
@@ -421,6 +422,32 @@ public:
 
        int maxRelaysIndexTxt;  // for PCRaw (relay)
 
+#ifdef WIN32 //JP-MOD
+       bool    guiSimpleChannelList;
+       bool    guiSimpleConnectionList;
+       bool    guiTopMost;
+
+       int             guiChanListDisplays;
+       int             guiConnListDisplays;
+       bool    guiTitleModify;
+       String  guiTitleModifyNormal;
+       String  guiTitleModifyMinimized;
+
+       bool    guiAntennaNotifyIcon;
+
+       bool    ppClapSound;
+       String  ppClapSoundPath;
+#endif
+
+       int             disableAutoBumpIfDirect;
+       int             asxDetailedMode;
+
+       enum PPBCSTFLAG //JP-MOD
+       {
+               bcstNone                = 0x00000000,
+               bcstClap                = 0x00000001
+       };
+
 private:
        FW_STATE        firewalled;
 };
index 0e47e07..32f35d9 100644 (file)
@@ -161,7 +161,7 @@ public:
 
 
     static unsigned int    getIP(char *);
-       static bool                     getHostname(char *,unsigned int);
+       static bool                     getHostname(char *,size_t,unsigned int); //JP-MOD
 
     virtual bool eof()
     {
index 1e0704b..47ddf91 100644 (file)
@@ -749,11 +749,11 @@ void LogBuffer::write(const char *str, TYPE t)
 {
        lock.on();
 
-       unsigned int len = strlen(str);
+       size_t len = strlen(str);
        int cnt=0;
        while (len)
        {
-               unsigned int rlen = len;
+               size_t rlen = len;
                if (rlen > (lineLen-1))
                        rlen = lineLen-1;
 
index 0819ee1..958c348 100644 (file)
@@ -96,7 +96,7 @@ public:
        // set from null terminated string, remove first/last chars
        void setUnquote(const char *p, TYPE t=T_ASCII) 
        {
-               int slen = strlen(p);
+               size_t slen = strlen(p);
                if (slen > 2)
                {
                        if (slen >= MAX_LEN) slen = MAX_LEN;
@@ -109,6 +109,7 @@ public:
 
        void clear() 
        {
+               memset(data, 0, MAX_LEN);
                data[0]=0;
                type = T_UNKNOWN;
        }
@@ -243,6 +244,9 @@ public:
 
 typedef __int64 int64_t;
 
+#ifndef _UINTPTR_T_DEFINED
+typedef unsigned int uintptr_t;
+#endif
 
 // ------------------------------------
 class WEvent
@@ -292,7 +296,7 @@ public:
 
 // ------------------------------------
 typedef int (WINAPI *THREAD_FUNC)(ThreadInfo *);
-typedef unsigned int THREAD_HANDLE;
+typedef uintptr_t THREAD_HANDLE;
 #define THREAD_PROC int WINAPI
 #define vsnprintf _vsnprintf
 
index d9aff45..92d4a3f 100644 (file)
@@ -29,22 +29,24 @@ static bool PCP_FORCE_YP                            = false;
 #endif
 // ------------------------------------------------
 static const int PCP_CLIENT_VERSION            = 1218;
-static const int PCP_CLIENT_VERSION_VP = 26;
+static const int PCP_CLIENT_VERSION_VP = 27;
 static const int PCP_ROOT_VERSION              = 1218;
 
 static const int PCP_CLIENT_MINVERSION = 1200;
 
 static const char *PCX_AGENT           = "PeerCast/0.1218";    
 static const char *PCX_AGENTJP                 = "PeerCast/0.1218-J";
-static const char *PCX_AGENTVP         = "PeerCast/0.1218(VP0026)";
-static const char *PCX_VERSTRING       = "v0.1218(VP0026)";
+static const char *PCX_AGENTVP         = "PeerCast/0.1218(VP0027)";
+static const char *PCX_VERSTRING       = "v0.1218(VP0027)";
+
+extern int version_ex; // PP\94Å\8ag\92£\8b@\94\\97L\8cø\89»\83t\83\89\83O(\82½\82Ô\82ñ)
 
 #if 1 /* for VP extend version */
-#define VERSION_EX 1
+//#define VERSION_EX 1
 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
 static const int  PCP_CLIENT_VERSION_EX_NUMBER = 27;
-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027)";
-static const char *PCX_VERSTRING_EX = "v0.1218(IM0027)";
+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027-2)";
+static const char *PCX_VERSTRING_EX = "v0.1218(IM0027-2)";
 #endif
 
 // ------------------------------------------------
index 19c1035..9bfa3e2 100644 (file)
@@ -243,7 +243,7 @@ int XML::Node::findAttrID(const char *name)
 // ----------------------------------
 char *XML::Node::findAttr(const char *name)
 {
-       int nlen = strlen(name);
+       size_t nlen = strlen(name);
        for(int i=1; i<numAttr; i++)
     {
        char *an = getAttrName(i);
index 3df0d3f..4c4d105 100644 (file)
@@ -27,7 +27,7 @@
 #include <windows.h>
 #include <stdio.h>
 #include "wsocket.h"
-#include "stats.h"
+#include "..\common\stats.h"
 #ifdef _DEBUG
 #include "chkMemoryLeak.h"
 #define DEBUG_NEW new(__FILE__, __LINE__)
@@ -51,8 +51,11 @@ void WSAClientSocket::init()
 
 }
 // --------------------------------------------------
-bool ClientSocket::getHostname(char *str,unsigned int ip)
+bool ClientSocket::getHostname(char *str,size_t size,unsigned int ip) //JP-MOD
 {
+       if(size == 0)
+               return false;
+
        HOSTENT *he;
 
        ip = htonl(ip);
@@ -61,7 +64,9 @@ bool ClientSocket::getHostname(char *str,unsigned int ip)
 
        if (he)
        {
-               strcpy(str,he->h_name);
+               LOG_DEBUG("getHostname: %d.%d.%d.%d -> %s", ((BYTE*)&ip)[0], ((BYTE*)&ip)[1], ((BYTE*)&ip)[2], ((BYTE*)&ip)[3], he->h_name);
+               strncpy(str,he->h_name,size-1);
+               str[size-1] = '\0';
                return true;
        }else
                return false;
@@ -603,7 +608,7 @@ ClientSocket *WSAClientSocket::accept()
        int fromSize = sizeof(sockaddr_in);
        sockaddr_in from;
 
-       int conSock = ::accept(sockNum,(sockaddr *)&from,&fromSize);
+       SOCKET conSock = ::accept(sockNum,(sockaddr *)&from,&fromSize);
 
 
        if (conSock ==  INVALID_SOCKET)
index fdf4055..8bc621f 100644 (file)
@@ -22,7 +22,7 @@
 #define _WSOCKET_H
 
 #include <windows.h>
-#include "socket.h"
+#include "..\common\socket.h"
 //#include "winsock2.h"
 
 
@@ -71,7 +71,7 @@ public:
        void    checkBuffering(bool, bool);
 
        unsigned int writeCnt;
-       unsigned int sockNum;
+       SOCKET sockNum;
        struct sockaddr_in remoteAddr;
 
        enum {RBSIZE = 8192};
index 9ed1fcf..65165e9 100644 (file)
 #include <process.h>
 #include <windows.h>
 #include <time.h>
-#include "win32/wsys.h"
-#include "win32/wsocket.h"
-#include "stats.h"
-#include "peercast.h"
+#include "wsys.h"
+#include "wsocket.h"
+#include "..\common\stats.h"
+#include "..\common\peercast.h"
 #include <sys/timeb.h>
 #include <time.h>
 #include "shellapi.h"
@@ -62,7 +62,7 @@ unsigned int WSys::getTime()
 {
        time_t ltime;
        time( &ltime );
-       return ltime;
+       return (unsigned)ltime;
 }
 
 // ---------------------------------
index 95f479a..483b38e 100644 (file)
@@ -24,8 +24,8 @@
 #define _WSYS_H
 // ------------------------------------
 #include <windows.h>
-#include "socket.h"
-#include "sys.h"
+#include "..\common\socket.h"
+#include "..\common\sys.h"
 
 // ------------------------------------
 class WSys : public Sys
index 1157016..13f67e0 100644 (file)
@@ -197,6 +197,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
 
        hInst = hInstance;
 
+       version_ex = 0; // PP\94Å\8ag\92£\8b@\94\\82ð\96³\8cø\82É
+
        iniFileName.set(".\\peercast.ini");
 
        WIN32_FIND_DATA fd; //JP-EX
@@ -1290,11 +1292,14 @@ LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
                case WM_INITDIALOG:
                        //SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENT);
 //                     SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTJP);
-#ifdef VERSION_EX
-                       SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTEX);
-#else
-                       SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTVP);
-#endif
+                       if (version_ex)
+                       {
+                               SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTEX);
+                       } else
+                       {
+                               SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTVP);
+                       }
+
                        return TRUE;
 
                case WM_COMMAND:
index 36aec01..9c3740e 100644 (file)
@@ -81,7 +81,7 @@ char *Channel::statusMsgs[]=
 // for PCRaw start.
 bool isIndexTxt(ChanInfo *info)
 {
-       int len;
+       size_t len;
 
        if(     info &&
                info->contentType == ChanInfo::T_RAW &&
@@ -235,6 +235,9 @@ void Channel::reset()
        mount.clear();
        bump = false;
        stayConnected = false;
+       stealth = false; //JP-MOD
+       overrideMaxRelaysPerChannel = -1; //JP-MOD
+       bClap = false; //JP-MOD
 
        icyMetaInterval = 0;
        streamPos = 0;
@@ -345,8 +348,12 @@ int Channel::totalListeners()
        return tot;
 }
 
-
-
+// -----------------------------------
+int Channel::totalClaps()      //JP-MOD
+{
+       ChanHitList *chl = chanMgr->findHitListByID(info.id);
+       return chl ? chl->numClaps() : 0;
+}
 
 // -----------------------------------
 void   Channel::startGet()
@@ -1173,8 +1180,8 @@ void Channel::broadcastTrackerUpdate(GnuID &svID, bool force)
                if (!chl)
                        throw StreamException("Broadcast channel has no hitlist");
 
-               int numListeners = totalListeners();
-               int numRelays = totalRelays();
+               int numListeners = stealth ? -1 : totalListeners(); //JP-MOD \83\8a\83X\83i\81[\90\94\89B\95Á\8b@\94\
+               int numRelays = stealth ? -1 : totalRelays(); //JP-MOD \83\8a\83\8c\81[\90\94\89B\95Á\8b@\94\
 
                unsigned int oldp = rawData.getOldestPos();
                unsigned int newp = rawData.getLatestPos();
@@ -1182,27 +1189,31 @@ void Channel::broadcastTrackerUpdate(GnuID &svID, bool force)
                hit.initLocal(numListeners,numRelays,info.numSkips,info.getUptime(),isPlaying(), false, 0, this, oldp,newp);
                hit.tracker = true;
 
-#ifndef VERSION_EX
-               atom.writeParent(PCP_BCST,8);
-#else
-               atom.writeParent(PCP_BCST,10);
-#endif
-                       atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_ROOT);
-                       atom.writeChar(PCP_BCST_HOPS,0);
-                       atom.writeChar(PCP_BCST_TTL,11);
-                       atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
-                       atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
-                       atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
+               if (version_ex == 0)
+               {
+                       atom.writeParent(PCP_BCST,8);
+               } else
+               {
+                       atom.writeParent(PCP_BCST,10);
+               }
+               atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_ROOT);
+               atom.writeChar(PCP_BCST_HOPS,0);
+               atom.writeChar(PCP_BCST_TTL,11);
+               atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
+               atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
+               atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
+
+               if (version_ex)
+               {
                        atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
                        atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
-                       atom.writeParent(PCP_CHAN,4);
-                               atom.writeBytes(PCP_CHAN_ID,info.id.id,16);
-                               atom.writeBytes(PCP_CHAN_BCID,chanMgr->broadcastID.id,16);
-                               info.writeInfoAtoms(atom);
-                               info.writeTrackAtoms(atom);
-                       hit.writeAtoms(atom,info.id);
+               }
+               atom.writeParent(PCP_CHAN,4);
+               atom.writeBytes(PCP_CHAN_ID,info.id.id,16);
+               atom.writeBytes(PCP_CHAN_BCID,chanMgr->broadcastID.id,16);
+               info.writeInfoAtoms(atom);
+               info.writeTrackAtoms(atom);
+               hit.writeAtoms(atom,info.id);
 
 
                pack.len = mem.pos;
@@ -1251,26 +1262,29 @@ void Channel::updateInfo(ChanInfo &newInfo)
 
                                AtomStream atom(mem);
 
-#ifndef VERSION_EX
-                               atom.writeParent(PCP_BCST,8);
-#else
-                               atom.writeParent(PCP_BCST,10);
-#endif
-                                       atom.writeChar(PCP_BCST_HOPS,0);
-                                       atom.writeChar(PCP_BCST_TTL,7);
-                                       atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_RELAYS);
-                                       atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
-                                       atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
-                                       atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
+                               if (version_ex == 0)
+                               {
+                                       atom.writeParent(PCP_BCST,8);
+                               } else
+                               {
+                                       atom.writeParent(PCP_BCST,10);
+                               }
+                               atom.writeChar(PCP_BCST_HOPS,0);
+                               atom.writeChar(PCP_BCST_TTL,7);
+                               atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_RELAYS);
+                               atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
+                               atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
+                               atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
+                               if (version_ex)
+                               {
                                        atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
                                        atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
-                                       atom.writeBytes(PCP_BCST_CHANID,info.id.id,16);
-                                       atom.writeParent(PCP_CHAN,3);
-                                               atom.writeBytes(PCP_CHAN_ID,info.id.id,16);
-                                               info.writeInfoAtoms(atom);
-                                               info.writeTrackAtoms(atom);
+                               }
+                               atom.writeBytes(PCP_BCST_CHANID,info.id.id,16);
+                               atom.writeParent(PCP_CHAN,3);
+                               atom.writeBytes(PCP_CHAN_ID,info.id.id,16);
+                               info.writeInfoAtoms(atom);
+                               info.writeTrackAtoms(atom);
 
                                pack.len = mem.pos;
                                pack.type = ChanPacket::T_PCP;
@@ -1424,6 +1438,11 @@ bool ChannelStream::getStatus(Channel *ch,ChanPacket &pack)
 //     LOG_DEBUG("isPlaying-------------------------------------- %d %d", ch->isPlaying(), isPlaying);
 
        hit.initLocal(newLocalListeners,newLocalRelays,ch->info.numSkips,ch->info.getUptime(),ch->isPlaying(), ch->isFull(), ch->info.bitrate, ch, oldp, newp);
+       { //JP-MOD
+               if(!(ch->info.ppFlags & ServMgr::bcstClap))
+                       ch->bClap = false;
+               hit.initLocal_pp(ch->stealth, ch->bClap ? 1 : 0);
+       }
        hit.tracker = ch->isBroadcasting();
 
        if      (       (((ctime-lastUpdate)>chanMgr->hostUpdateInterval) && chanMgr->hostUpdateInterval)
@@ -1434,13 +1453,19 @@ bool ChannelStream::getStatus(Channel *ch,ChanPacket &pack)
                ||      (ch->chDisp.relay != hit.relay)
                ||      (ch->chDisp.relayfull != hit.relayfull)
                ||      (ch->chDisp.chfull != hit.chfull)
-               ||      (ch->chDisp.ratefull != hit.ratefull)   
+               ||      (ch->chDisp.ratefull != hit.ratefull)
+               ||      (ch->bClap && ((ctime-lastClapped) > 60)) //JP-MOD      
        ){
                numListeners = newLocalListeners;
                numRelays = newLocalRelays;
                isPlaying = ch->isPlaying();
                fwState = servMgr->getFirewall();
                lastUpdate = ctime;
+
+               if(ch->bClap){ //JP-MOD
+                       lastClapped = ctime;
+                       ch->bClap = false;
+               }
        
                ch->chDisp = hit;
 
@@ -1456,23 +1481,26 @@ bool ChannelStream::getStatus(Channel *ch,ChanPacket &pack)
                GnuID noID;
                noID.clear();
 
-#ifndef VERSION_EX
+               if (version_ex == 0)
+               {
                        atom.writeParent(PCP_BCST,8);
-#else
+               } else
+               {
                        atom.writeParent(PCP_BCST,10);
-#endif
-                       atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_TRACKERS);
-                       atom.writeChar(PCP_BCST_HOPS,0);
-                       atom.writeChar(PCP_BCST_TTL,11);
-                       atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
-                       atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
-                       atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
+               }
+               atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_TRACKERS);
+               atom.writeChar(PCP_BCST_HOPS,0);
+               atom.writeChar(PCP_BCST_TTL,11);
+               atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
+               atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
+               atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
+               if (version_ex)
+               {
                        atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
                        atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
-                       atom.writeBytes(PCP_BCST_CHANID,ch->info.id.id,16);
-                       hit.writeAtoms(atom,noID);
+               }
+               atom.writeBytes(PCP_BCST_CHANID,ch->info.id.id,16);
+               hit.writeAtoms(atom,noID);
 
                pack.len = pmem.pos;
                pack.type = ChanPacket::T_PCP;
@@ -2363,7 +2391,11 @@ bool ChanMgr::writeVariable(Stream &out, const String &var, int index)
        else if (var == "numChannels")
                sprintf(buf,"%d",numChannels());
        else if (var == "djMessage")
-               strcpy(buf,broadcastMsg.cstr());
+       {
+               String utf8 = broadcastMsg;
+               utf8.convertTo(String::T_UNICODESAFE);
+               strcpy(buf,utf8.cstr());
+       }
        else if (var == "icyMetaInterval")
                sprintf(buf,"%d",icyMetaInterval);
        else if (var == "maxRelaysPerChannel")
@@ -2424,6 +2456,9 @@ bool Channel::writeVariable(Stream &out, const String &var, int index)
                utf8 = info.comment;
                utf8.convertTo(String::T_UNICODESAFE);
                strcpy(buf,utf8.cstr());
+       }else if (var == "bcstClap") //JP-MOD
+       {
+               strcpy(buf,info.ppFlags & ServMgr::bcstClap ? "1":"0");
        }else if (var == "uptime")
        {
                String uptime;
@@ -2456,7 +2491,8 @@ bool Channel::writeVariable(Stream &out, const String &var, int index)
                sprintf(buf,"%d",totalRelays());
        else if (var == "totalListeners")
                sprintf(buf,"%d",totalListeners());
-
+       else if (var == "totalClaps") //JP-MOD
+               sprintf(buf,"%d",totalClaps());
        else if (var == "status")
                sprintf(buf,"%s",getStatusStr());
        else if (var == "keep")
@@ -3125,6 +3161,7 @@ void ChanHit::init()
 
        numListeners = 0;
        numRelays = 0;
+       clap_pp = 0; //JP-MOD
 
        dead = tracker = firewalled = stable = yp = false;
        recv = cin = direct = relay = true;
@@ -3220,14 +3257,16 @@ void ChanHit::initLocal(int numl,int numr,int,int uptm,bool connected,bool isFul
 
        version = PCP_CLIENT_VERSION;
        version_vp = PCP_CLIENT_VERSION_VP;
-#ifdef VERSION_EX
-       strncpy(version_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX,2);
-       version_ex_number = PCP_CLIENT_VERSION_EX_NUMBER;
-#else
-       version_ex_prefix[0] = ' ';
-       version_ex_prefix[1] = ' ';
-       version_ex_number = 0;
-#endif
+       if (version_ex)
+       {
+               strncpy(version_ex_prefix, PCP_CLIENT_VERSION_EX_PREFIX,2);
+               version_ex_number = PCP_CLIENT_VERSION_EX_NUMBER;
+       } else
+       {
+               version_ex_prefix[0] = ' ';
+               version_ex_prefix[1] = ' ';
+               version_ex_number = 0;
+       }
 
        status = ch->status;
 
@@ -3246,6 +3285,13 @@ void ChanHit::initLocal(int numl,int numr,int,int uptm,bool connected,bool isFul
 }
 
 // -----------------------------------
+void ChanHit::initLocal_pp(bool isStealth, int numClaps) //JP-MOD
+{
+       numListeners = numListeners && !isStealth ? 1 : 0;
+       clap_pp = numClaps;
+}
+
+// -----------------------------------
 void ChanHit::writeAtoms(AtomStream &atom,GnuID &chanID)
 {
        bool addChan=chanID.isSet();
@@ -3259,32 +3305,35 @@ void ChanHit::writeAtoms(AtomStream &atom,GnuID &chanID)
        if (tracker) fl1 |= PCP_HOST_FLAGS1_TRACKER;
        if (firewalled) fl1 |= PCP_HOST_FLAGS1_PUSH;
 
-       atom.writeParent(PCP_HOST,13  + (addChan?1:0) + (uphostdata?3:0) + (version_ex_number?2:0));
-
-               if (addChan)
-                       atom.writeBytes(PCP_HOST_CHANID,chanID.id,16);
-               atom.writeBytes(PCP_HOST_ID,sessionID.id,16);
-               atom.writeInt(PCP_HOST_IP,rhost[0].ip);
-               atom.writeShort(PCP_HOST_PORT,rhost[0].port);
-               atom.writeInt(PCP_HOST_IP,rhost[1].ip);
-               atom.writeShort(PCP_HOST_PORT,rhost[1].port);
-               atom.writeInt(PCP_HOST_NUML,numListeners);
-               atom.writeInt(PCP_HOST_NUMR,numRelays);
-               atom.writeInt(PCP_HOST_UPTIME,upTime);
-               atom.writeInt(PCP_HOST_VERSION,version);
-               atom.writeInt(PCP_HOST_VERSION_VP,version_vp);
-               if (version_ex_number){
-                       atom.writeBytes(PCP_HOST_VERSION_EX_PREFIX,version_ex_prefix,2);
-                       atom.writeShort(PCP_HOST_VERSION_EX_NUMBER,version_ex_number);
-               }
-               atom.writeChar(PCP_HOST_FLAGS1,fl1);
-               atom.writeInt(PCP_HOST_OLDPOS,oldestPos);
-               atom.writeInt(PCP_HOST_NEWPOS,newestPos);
-               if (uphostdata){
-                       atom.writeInt(PCP_HOST_UPHOST_IP,uphost.ip);
-                       atom.writeInt(PCP_HOST_UPHOST_PORT,uphost.port);
-                       atom.writeInt(PCP_HOST_UPHOST_HOPS,uphostHops);
-               }
+       atom.writeParent(PCP_HOST,13  + (addChan?1:0) + (uphostdata?3:0) + (version_ex_number?2:0) + (clap_pp?1:0/*JP-MOD*/));
+
+       if (addChan)
+               atom.writeBytes(PCP_HOST_CHANID,chanID.id,16);
+       atom.writeBytes(PCP_HOST_ID,sessionID.id,16);
+       atom.writeInt(PCP_HOST_IP,rhost[0].ip);
+       atom.writeShort(PCP_HOST_PORT,rhost[0].port);
+       atom.writeInt(PCP_HOST_IP,rhost[1].ip);
+       atom.writeShort(PCP_HOST_PORT,rhost[1].port);
+       atom.writeInt(PCP_HOST_NUML,numListeners);
+       atom.writeInt(PCP_HOST_NUMR,numRelays);
+       atom.writeInt(PCP_HOST_UPTIME,upTime);
+       atom.writeInt(PCP_HOST_VERSION,version);
+       atom.writeInt(PCP_HOST_VERSION_VP,version_vp);
+       if (version_ex_number){
+               atom.writeBytes(PCP_HOST_VERSION_EX_PREFIX,version_ex_prefix,2);
+               atom.writeShort(PCP_HOST_VERSION_EX_NUMBER,version_ex_number);
+       }
+       atom.writeChar(PCP_HOST_FLAGS1,fl1);
+       atom.writeInt(PCP_HOST_OLDPOS,oldestPos);
+       atom.writeInt(PCP_HOST_NEWPOS,newestPos);
+       if (uphostdata){
+               atom.writeInt(PCP_HOST_UPHOST_IP,uphost.ip);
+               atom.writeInt(PCP_HOST_UPHOST_PORT,uphost.port);
+               atom.writeInt(PCP_HOST_UPHOST_HOPS,uphostHops);
+       }
+       if (clap_pp){   //JP-MOD
+               atom.writeInt(PCP_HOST_CLAP_PP,clap_pp);
+       }
 }
 // -----------------------------------
 bool   ChanHit::writeVariable(Stream &out, const String &var)
@@ -3319,7 +3368,7 @@ bool      ChanHit::writeVariable(Stream &out, const String &var)
                        strcat(buf,buf2);
 
                        char h_name[128];
-                       if (ClientSocket::getHostname(h_name,rhost[0].ip))
+                       if (ClientSocket::getHostname(h_name,sizeof(h_name),rhost[0].ip)) // BOF\91Î\8dô\82Á\82Û\82¢
                        {
                                strcat(buf,"[");
                                strcat(buf,h_name);
@@ -3657,7 +3706,23 @@ int      ChanHitList::numListeners()
        while (ch)
        {
                if (ch->host.ip && !ch->dead && ch->numHops)
-                       cnt += ch->numListeners;
+                       cnt += (unsigned int)ch->numListeners > 3 ? 3 : ch->numListeners;
+               ch=ch->next;
+       }
+
+       return cnt;
+}
+
+// -----------------------------------
+int ChanHitList::numClaps()    //JP-MOD
+{
+       int cnt=0;
+       ChanHit *ch = hit;
+       while (ch)
+       {
+               if (ch->host.ip && !ch->dead && ch->numHops && (ch->clap_pp & 1)){
+                       cnt++;
+               }
                ch=ch->next;
        }
 
@@ -4077,6 +4142,12 @@ bool ChanInfo::update(ChanInfo &info)
                changed = true;
        }
 
+       if(ppFlags != info.ppFlags) //JP-MOD
+       {
+               ppFlags = info.ppFlags;
+               changed = true;
+       }
+
        if (!desc.isSame(info.desc)) //JP-EX
        {
                desc = info.desc;
@@ -4140,6 +4211,7 @@ void ChanInfo::init()
        numSkips = 0;
        bcID.clear();
        createdTime = 0;
+       ppFlags = 0; //JP-MOD
 }
 // -----------------------------------
 void ChanInfo::readTrackXML(XML::Node *n)
@@ -4221,6 +4293,9 @@ void ChanInfo::readInfoAtoms(AtomStream &atom,int numc)
                        char type[16];
                        atom.readString(type,sizeof(type),d);
                        contentType = ChanInfo::getTypeFromStr(type);
+               }else if (id == PCP_CHAN_INFO_PPFLAGS) //JP-MOD
+               {
+                       ppFlags = (unsigned int)atom.readInt();
                }else
                        atom.skip(c,d);
        }       
@@ -4229,14 +4304,16 @@ void ChanInfo::readInfoAtoms(AtomStream &atom,int numc)
 // -----------------------------------
 void ChanInfo::writeInfoAtoms(AtomStream &atom)
 {
-       atom.writeParent(PCP_CHAN_INFO,7);
+       atom.writeParent(PCP_CHAN_INFO,7 + (ppFlags ? 1:0/*JP-MOD*/));
                atom.writeString(PCP_CHAN_INFO_NAME,name.cstr());
                atom.writeInt(PCP_CHAN_INFO_BITRATE,bitrate);
                atom.writeString(PCP_CHAN_INFO_GENRE,genre.cstr());
                atom.writeString(PCP_CHAN_INFO_URL,url.cstr());
                atom.writeString(PCP_CHAN_INFO_DESC,desc.cstr());
                atom.writeString(PCP_CHAN_INFO_COMMENT,comment.cstr());
-               atom.writeString(PCP_CHAN_INFO_TYPE,getTypeStr(contentType));           
+               atom.writeString(PCP_CHAN_INFO_TYPE,getTypeStr(contentType));
+               if(ppFlags)
+                       atom.writeInt(PCP_CHAN_INFO_PPFLAGS,ppFlags); //JP-MOD
 
 }
 // -----------------------------------
@@ -4395,6 +4472,13 @@ void ChanInfo::updateFromXML(XML::Node *n)
        if (br)
                bitrate = br;
 
+       { //JP-MOD
+               ppFlags = ServMgr::bcstNone;
+
+               if (n->findAttrInt("bcstClap"))
+                       ppFlags |= ServMgr::bcstClap;
+       }
+
        readXMLString(typeStr,n,"type");
        if (!typeStr.isEmpty())
                contentType = getTypeFromStr(typeStr.cstr());
@@ -4455,7 +4539,7 @@ void PlayList::readASX(Stream &in)
                                        char *hr = rf->findAttr("href");
                                        if (hr)
                                        {
-                                               addURL(hr,"");
+                                               addURL(hr,"","");
                                                //LOG("asx url %s",hr);
                                        }
 
@@ -4475,7 +4559,7 @@ void PlayList::readSCPLS(Stream &in)
                {
                        char *p = strstr(tmp,"=");
                        if (p)
-                               addURL(p+1,"");
+                               addURL(p+1,"","");
                }
        }
 }
@@ -4486,7 +4570,7 @@ void PlayList::readPLS(Stream &in)
        while (in.readLine(tmp,sizeof(tmp)))
        {
                if (tmp[0] != '#')
-                       addURL(tmp,"");
+                       addURL(tmp,"","");
        }
 }
 // -----------------------------------
@@ -4518,12 +4602,63 @@ void PlayList::writeRAM(Stream &out)
 }
 
 // -----------------------------------
+#define isHTMLSPECIAL(a) ((a == '&') || (a == '\"') || (a == '\'') || (a == '<') || (a == '>'))
+static void SJIStoSJISSAFE(char *string, size_t size)
+{
+       size_t pos;
+       for(pos = 0;
+               (string[pos] != '\0') && (pos < size);
+               ++pos)
+       {
+               if(isHTMLSPECIAL(string[pos]))
+                       string[pos] = ' ';
+       }
+}
+
+// -----------------------------------
+static void WriteASXInfo(Stream &out, String &title, String &contacturl, String::TYPE tEncoding = String::T_UNICODESAFE) //JP-MOD
+{
+       if(!title.isEmpty())
+       {
+               String titleEncode;
+               titleEncode = title;
+               titleEncode.convertTo(tEncoding);
+               if(tEncoding == String::T_SJIS)
+                       SJIStoSJISSAFE(titleEncode.cstr(), String::MAX_LEN);
+               out.writeLineF("<TITLE>%s</TITLE>", titleEncode.cstr());
+       }
+
+       if(!contacturl.isEmpty())
+       {
+               String contacturlEncode;
+               contacturlEncode = contacturl;
+               contacturlEncode.convertTo(tEncoding);
+               if(tEncoding == String::T_SJIS)
+                       SJIStoSJISSAFE(contacturlEncode.cstr(), String::MAX_LEN);
+               out.writeLineF("<MOREINFO HREF = \"%s\" />", contacturlEncode.cstr());
+       }
+}
+
+// -----------------------------------
 void PlayList::writeASX(Stream &out)
 {
        out.writeLine("<ASX Version=\"3.0\">");
+
+       String::TYPE tEncoding = String::T_SJIS;
+       if(servMgr->asxDetailedMode == 2)
+       {
+               out.writeLine("<PARAM NAME = \"Encoding\" VALUE = \"utf-8\" />"); //JP-MOD Memo: UTF-8 cannot be used in some recording software.
+               tEncoding = String::T_UNICODESAFE;
+       }
+
+       if(servMgr->asxDetailedMode)
+               WriteASXInfo(out, titles[0], contacturls[0], tEncoding); //JP-MOD
+
        for(int i=0; i<numURLs; i++)
        {
                out.writeLine("<ENTRY>");
+               if(servMgr->asxDetailedMode)
+                       WriteASXInfo(out, titles[i], contacturls[i], tEncoding); //JP-MOD
                out.writeLineF("<REF href = \"%s\" />",urls[i].cstr());
                out.writeLine("</ENTRY>");
        }
@@ -4542,7 +4677,7 @@ void PlayList::addChannel(const char *path, ChanInfo &info)
        char *nid = info.id.isSet()?idStr:info.name.cstr();
 
        sprintf(url.cstr(),"%s/stream/%s%s",path,nid,ChanInfo::getTypeExt(info.contentType));
-       addURL(url.cstr(),info.name);
+       addURL(url.cstr(),info.name,info.url);
 }
 
 // -----------------------------------
index d6f0c47..d6f5563 100644 (file)
@@ -168,6 +168,7 @@ public:
        TrackInfo       track;
        ::String        desc,genre,url,comment;
 
+       unsigned int ppFlags; //JP-MOD
 };
 
 
@@ -177,6 +178,7 @@ class ChanHit
 public:
        void    init();
        void    initLocal(int numl,int numr,int nums,int uptm,bool,bool,unsigned int,Channel*,unsigned int,unsigned int);
+       void    initLocal_pp(bool isStealth, int numClaps); //JP-MOD
        XML::Node *createXML();
 
        void    writeAtoms(AtomStream &,GnuID &);
@@ -187,6 +189,7 @@ public:
        Host                            host;
        Host                            rhost[2];
        unsigned int            numListeners,numRelays,numHops;
+       int                                     clap_pp;        //JP-MOD
        unsigned int            time,upTime,lastContact;
        unsigned int            hitID;
        GnuID                           sessionID,chanID;
@@ -225,6 +228,7 @@ public:
        void    clearHits(bool);
        int             numHits();
        int             numListeners();
+       int             numClaps();     //JP-MOD
        int             numRelays();
        int             numFirewalled();
        int             numTrackers();
@@ -474,6 +478,7 @@ public:
        int             localListeners();
        int             localRelays();
 
+       int             totalClaps();   //JP-MOD
        int             totalListeners();
        int             totalRelays();
 
@@ -496,10 +501,13 @@ public:
        ::String  sourceURL;
 
        bool    bump,stayConnected;
+       bool    stealth; //JP-MOD
        int             icyMetaInterval;
        unsigned int streamPos;
        unsigned int skipCount; //JP-EX
        bool    readDelay;
+       int             overrideMaxRelaysPerChannel; //JP-MOD
+       bool    bClap; //JP-MOD
 
        TYPE    type;
        ChannelSource *sourceData;
@@ -663,20 +671,23 @@ public:
                type = t;
                urls = new ::String[max];
                titles = new ::String[max];
+               contacturls = new ::String[max]; //JP-MOD
        }
 
        ~PlayList()
        {
                delete [] urls;
                delete [] titles;
+               delete [] contacturls; //JP-MOD
        }
 
-       void    addURL(const char *url, const char *tit)
+       void    addURL(const char *url, const char *tit, const char *contacturl/*JP-MOD*/)
        {
                if (numURLs < maxURLs)
                {
                        urls[numURLs].set(url);
                        titles[numURLs].set(tit);
+                       contacturls[numURLs].set(contacturl); //JP-MOD
                        numURLs++;
                }
        }
@@ -719,6 +730,7 @@ public:
        TYPE    type;
        int             numURLs,maxURLs;
        ::String        *urls,*titles;
+       ::String        *contacturls; //JP-MOD
 };
 
 // ----------------------------------
index 795cd6b..d59ad1d 100644 (file)
@@ -217,6 +217,7 @@ public:
        ,fwState(0)
        ,lastUpdate(0)
        ,lastCheckTime(0)
+       ,lastClapped(0) //JP-MOD
        ,parent(NULL)
        {}
        virtual ~ChannelStream() {}
@@ -240,6 +241,7 @@ public:
        int     fwState;
        unsigned int lastUpdate;
        unsigned int lastCheckTime;
+       unsigned int lastClapped; //JP-MOD
 
        Channel *parent;
 };
index bff67fd..9ee8d4b 100644 (file)
@@ -239,7 +239,7 @@ void GnuPacket::initFind(const char *str, XML *xml, int maxTTL)
 
        if (str)
        {
-               int slen = strlen(str);
+               size_t slen = strlen(str);
                mem.write((void *)str,slen+1);  // string
        }else
                mem.writeChar(0);               // null string
index ff659ac..5233edd 100644 (file)
@@ -181,10 +181,12 @@ void HTML::writeVariable(Stream &s,const String &varName, int loop)
 int HTML::getIntVariable(const String &varName,int loop)
 {
        String val;
+       LOG_DEBUG("AAA %d %d %d %d", val[0], val[1], val[2], val[3]);
        MemoryStream mem(val.cstr(),String::MAX_LEN);
 
        writeVariable(mem,varName,loop);
 
+       LOG_DEBUG("AAA %d %d %d %d", val[0], val[1], val[2], val[3]);
        return atoi(val.cstr());
 }
 // --------------------------------------
@@ -195,6 +197,10 @@ bool HTML::getBoolVariable(const String &varName,int loop)
 
        writeVariable(mem,varName,loop);
 
+       String tmp;
+       tmp = varName;
+       LOG_DEBUG("*** %s : %c", tmp.cstr(), val[0]);
+
        // integer
        if ((val[0] >= '0') && (val[0] <= '9'))
                return atoi(val.cstr()) != 0;   
@@ -220,9 +226,11 @@ void       HTML::readIf(Stream &in,Stream *outp,int loop)
                {
                        if (getBoolVariable(var,loop)==varCond)
                        {
+                               LOG_DEBUG("==varCond, loop = %d", loop);
                                if (readTemplate(in,outp,loop))
                                        readTemplate(in,NULL,loop);
                        }else{
+                               LOG_DEBUG("!=varCond, loop = %d", loop);
                                if (readTemplate(in,NULL,loop))
                                        readTemplate(in,outp,loop);
                        }
@@ -250,6 +258,8 @@ void        HTML::readLoop(Stream &in,Stream *outp,int loop)
                {
                        int cnt = getIntVariable(var,loop);
 
+                       LOG_DEBUG("loop_cnt : %s = %d", var.cstr(), cnt);
+
                        if (cnt)
                        {
                                int spos = in.getPosition();
index 08e8485..11289f6 100644 (file)
@@ -112,6 +112,7 @@ unsigned int PCPStream::flushUb(Stream &in, unsigned int size)
 int PCPStream::readPacket(Stream &in,Channel *)
 {
        BroadcastState bcs;
+       bcs.ttl = 1;
        return readPacket(in,bcs);
 }
 // ------------------------------------------
@@ -375,7 +376,7 @@ void PCPStream::readPktAtoms(Channel *ch,AtomStream &atom,int numc,BroadcastStat
 
                if (servMgr->autoBumpSkipCount) //JP-EX
                {
-                       if (ch->skipCount > servMgr->autoBumpSkipCount)
+                       if ((ch->skipCount > servMgr->autoBumpSkipCount) && !(servMgr->disableAutoBumpIfDirect && ch->sourceHost.tracker)) //JP-MOD
                        {
                                LOG_DEBUG("Auto bump");
                                ch->bump = true;
@@ -505,7 +506,18 @@ void PCPStream::readHostAtoms(AtomStream &atom, int numc, BroadcastState &bcs, C
                        hit.uphost.port = atom.readInt();
                else if (id == PCP_HOST_UPHOST_HOPS)
                        hit.uphostHops = atom.readInt();
-               else
+               else if (id == PCP_HOST_CLAP_PP){ //JP-MOD
+                       hit.clap_pp = atom.readInt();
+                       if (hit.clap_pp & 1){
+                               Channel *c = chanMgr->findChannelByID(chanID);
+                               if(c && c->isBroadcasting()){
+                                       String sjis;
+                                       sjis = c->info.name;
+                                       sjis.convertTo(String::T_SJIS);
+                                       peercastApp->notifyMessage(ServMgr::NT_APPLAUSE, sjis);
+                               }
+                       }
+               }else
                {
                        LOG_DEBUG("PCP skip: %s,%d,%d",id.getString().str(),c,d);
                        atom.skip(c,d);
@@ -519,7 +531,7 @@ void PCPStream::readHostAtoms(AtomStream &atom, int numc, BroadcastState &bcs, C
 
        hit.servent_id = bcs.servent_id;
 
-       if (flg){
+       if (flg && (bcs.ttl != 0)){
 //             LOG_DEBUG("readHostAtoms HITLISTLOCK ON-------------");
                chanMgr->hitlistlock.on();
                if (hit.recv)
@@ -651,7 +663,7 @@ void PCPStream::readChanAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
 int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
 {
        ChanPacket pack;
-       int ttl=0;              
+       //int ttl=0;            
        int ver=0;
        int ver_vp=0;
        GnuID fromID,destID;
@@ -676,9 +688,8 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
                
                if (id == PCP_BCST_TTL)
                {
-                       ttl = atom.readChar()-1;
-                       patom.writeChar(id,ttl);
-
+                       bcs.ttl = atom.readChar()-1;
+                       patom.writeChar(id,bcs.ttl);
                }else if (id == PCP_BCST_HOPS)
                {
                        bcs.numHops = atom.readChar()+1;
@@ -757,9 +768,15 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
                                pmem.pos = oldPos;
                                r = readAtom(patom,bcs);
                        } else {
-                               LOG_DEBUG("### Invalid bcst: hops=%d, ver=%d(VP%04d), ttl=%d",
-                                       bcs.numHops,ver,ver_vp,ttl);
-                               ttl = 0;
+                               char tmp[80], tmp2[80], tmp3[80];
+                               hit.uphost.toStr(tmp);
+                               hit.host.toStr(tmp2);
+                               sv->getHost().toStr(tmp3);
+                               LOG_DEBUG("### Invalid bcst: hops=%d, l/r = %d/%d, ver=%d(VP%04d), ttl=%d",
+                                       bcs.numHops,hit.numListeners, hit.numRelays, ver,ver_vp,bcs.ttl);
+                               LOG_DEBUG("### %s <- %s <- sv(%s)",
+                                       tmp2, tmp, tmp3);
+                               bcs.ttl = 0;
                        }
                } else {
                        // copy and process atoms
@@ -785,11 +802,11 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
 
        if (ver_ex_number){
                LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d(%c%c%04d), from=%s, dest=%s ttl=%d",
-                       bcs.group,bcs.numHops,ver,ver_ex_prefix[0],ver_ex_prefix[1],ver_ex_number,fromStr,destStr,ttl);
+                       bcs.group,bcs.numHops,ver,ver_ex_prefix[0],ver_ex_prefix[1],ver_ex_number,fromStr,destStr,bcs.ttl);
        } else if (ver_vp){
-               LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d(VP%04d), from=%s, dest=%s ttl=%d",bcs.group,bcs.numHops,ver,ver_vp,fromStr,destStr,ttl);
+               LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d(VP%04d), from=%s, dest=%s ttl=%d",bcs.group,bcs.numHops,ver,ver_vp,fromStr,destStr,bcs.ttl);
        } else {
-               LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d, from=%s, dest=%s ttl=%d",bcs.group,bcs.numHops,ver,fromStr,destStr,ttl);
+               LOG_DEBUG("PCP bcst: group=%d, hops=%d, ver=%d, from=%s, dest=%s ttl=%d",bcs.group,bcs.numHops,ver,fromStr,destStr,bcs.ttl);
        }
 
        if (fromID.isSet())
@@ -799,39 +816,39 @@ int PCPStream::readBroadcastAtoms(AtomStream &atom,int numc,BroadcastState &bcs)
                        return PCP_ERROR_BCST+PCP_ERROR_LOOPBACK;
                }
 
-       // broadcast back out if ttl > 0 
-       if ((ttl>0) && (!bcs.forMe))
-       {
-               pack.len = pmem.pos;
-               pack.type = ChanPacket::T_PCP;
-
-               if (bcs.group & (/*PCP_BCST_GROUP_ROOT|*/PCP_BCST_GROUP_TRACKERS|PCP_BCST_GROUP_RELAYS))
+               // broadcast back out if ttl > 0 
+               if ((bcs.ttl>0) && (!bcs.forMe))
                {
-                       pack.priority = 11 - bcs.numHops;
-                       chanMgr->broadcastPacketUp(pack,bcs.chanID,remoteID,destID);
-               }
+                       pack.len = pmem.pos;
+                       pack.type = ChanPacket::T_PCP;
 
-               if (bcs.group & (/*PCP_BCST_GROUP_ROOT|*/PCP_BCST_GROUP_TRACKERS|PCP_BCST_GROUP_RELAYS))
-               {
-                       servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_COUT);
-               }
+                       if (bcs.group & (/*PCP_BCST_GROUP_ROOT|*/PCP_BCST_GROUP_TRACKERS|PCP_BCST_GROUP_RELAYS))
+                       {
+                               pack.priority = 11 - bcs.numHops;
+                               chanMgr->broadcastPacketUp(pack,bcs.chanID,remoteID,destID);
+                       }
 
-               if (bcs.group & (PCP_BCST_GROUP_RELAYS|PCP_BCST_GROUP_TRACKERS))
-               {
-                       servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_CIN);
-               }
+                       if (bcs.group & (/*PCP_BCST_GROUP_ROOT|*/PCP_BCST_GROUP_TRACKERS|PCP_BCST_GROUP_RELAYS))
+                       {
+                               servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_COUT);
+                       }
 
-               if (bcs.group & (PCP_BCST_GROUP_RELAYS))
-               {
-                       servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_RELAY);
-               }
+                       if (bcs.group & (PCP_BCST_GROUP_RELAYS|PCP_BCST_GROUP_TRACKERS))
+                       {
+                               servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_CIN);
+                       }
 
+                       if (bcs.group & (PCP_BCST_GROUP_RELAYS))
+                       {
+                               servMgr->broadcastPacket(pack,bcs.chanID,remoteID,destID,Servent::T_RELAY);
+                       }
 
-//             LOG_DEBUG("ttl=%d",ttl);
 
-       } else {
-//             LOG_DEBUG("ttl=%d",ttl);
-       }
+                       //              LOG_DEBUG("ttl=%d",ttl);
+
+               } else {
+                       //              LOG_DEBUG("ttl=%d",ttl);
+               }
        return r;
 }
 
index 770205b..da23723 100644 (file)
@@ -85,6 +85,7 @@ static const ID4 PCP_HOST_VERSION     = "ver";
 static const ID4 PCP_HOST_VERSION_VP   = "vevp";
 static const ID4 PCP_HOST_VERSION_EX_PREFIX = "vexp";
 static const ID4 PCP_HOST_VERSION_EX_NUMBER = "vexn";
+static const ID4 PCP_HOST_CLAP_PP              = "clap"; //JP-MOD
 static const ID4 PCP_HOST_FLAGS1       = "flg1";
 static const ID4 PCP_HOST_OLDPOS       = "oldp";
 static const ID4 PCP_HOST_NEWPOS       = "newp";
@@ -114,6 +115,7 @@ static const ID4 PCP_CHAN_INFO_NAME         = "name";
 static const ID4 PCP_CHAN_INFO_URL             = "url";
 static const ID4 PCP_CHAN_INFO_DESC            = "desc";
 static const ID4 PCP_CHAN_INFO_COMMENT = "cmnt";
+static const ID4 PCP_CHAN_INFO_PPFLAGS = "pflg"; //JP-MOD
 
 static const ID4 PCP_CHAN_TRACK                        = "trck";
 static const ID4 PCP_CHAN_TRACK_TITLE  = "titl";
@@ -191,6 +193,7 @@ public:
        ,streamPos(0)
        ,group(0)
        ,servent_id(0)
+       ,ttl(0)
        {
                chanID.clear();
                bcID.clear();
@@ -213,6 +216,7 @@ public:
        unsigned int streamPos;
        int group;
        int servent_id;
+       int ttl;
 };
 
 // ----------------------------------------------
index 9560fa8..320dd90 100644 (file)
@@ -8,7 +8,7 @@
 #define new DEBUG_NEW
 #endif
 
-
+#include "version2.h"
 
 // ---------------------------------
 // globals
@@ -20,6 +20,7 @@ ServMgr *servMgr;
 PeercastInstance *peercastInst=NULL;
 PeercastApplication *peercastApp=NULL;
 
+int version_ex = 0;
 
 // ---------------------------------
 void APICALL PeercastInstance::init()
index 4101852..bbb4a5a 100644 (file)
@@ -24,3 +24,5 @@
 #define DEBUG_NEW new(__FILE__, __LINE__)
 #define new DEBUG_NEW
 #endif
+
+static const int dummy = 0;
index bd4c171..d8cdddd 100644 (file)
@@ -3147,7 +3147,7 @@ bool      Servent::writeVariable(Stream &s, const String &var)
                        }
                        strcat(buf,h_ip);
                        char h_name[128];
-                       if (ClientSocket::getHostname(h_name,h.ip))
+                       if (ClientSocket::getHostname(h_name,sizeof(h_name),h.ip)) //JP-MOD(BOF\91Î\8dô)
                        {
                                strcat(buf,"[");
                                strcat(buf,h_name);
index be97958..ac30b47 100644 (file)
@@ -38,8 +38,8 @@ static void termArgs(char *str)
 {
        if (str)
        {
-               int slen = strlen(str);
-               for(int i=0; i<slen; i++)
+               size_t slen = strlen(str);
+               for(size_t i=0; i<slen; i++)
                        if (str[i]=='&') str[i] = 0;
        }
 }
@@ -162,8 +162,8 @@ void Servent::handshakeHTTP(HTTP &http, bool isHTTP)
 
                        if (pwdArg && songArg)
                        {
-                               int i;
-                               int slen = strlen(fn);
+                               size_t i;
+                               size_t slen = strlen(fn);
                                for(i=0; i<slen; i++)
                                        if (fn[i]=='&') fn[i] = 0;
 
@@ -930,10 +930,14 @@ void Servent::handshakeCMD(char *cmd)
                                int newPort=servMgr->serverHost.port;
                                int enableGetName = 0;
                                int allowConnectPCST = 0;
+                               int disableAutoBumpIfDirect = 0; //JP-MOD
+                               int asxDetailedMode = 0; //JP-MOD
 
                                char *cp = cmd;
                                while (cp=nextCGIarg(cp,curr,arg))
                                {
+                                       LOG_DEBUG("ARG: %s = %s", curr, arg);
+
                                        // server
                                        if (strcmp(curr,"serveractive")==0)
                                                servMgr->autoServe = getCGIargBOOL(arg);
@@ -1010,6 +1014,7 @@ void Servent::handshakeCMD(char *cmd)
                                                                {
                                                                        servMgr->numFilters++;
                                                                        servMgr->filters[servMgr->numFilters].init();   // clear new entry
+                                                                       LOG_DEBUG("numFilters = %d", servMgr->numFilters);
                                                                }
 
                                                        }else if (strncmp(fs,"bn",2)==0)
@@ -1110,6 +1115,10 @@ void Servent::handshakeCMD(char *cmd)
 
                                        else if (strcmp(curr, "maxRelaysIndexTxt") ==0)         // for PCRaw (relay)
                                                servMgr->maxRelaysIndexTxt = getCGIargINT(arg);
+                                       else if (strcmp(curr, "disableAutoBumpIfDirect") ==0) //JP-MOD
+                                               disableAutoBumpIfDirect = atoi(arg) ? 1 : 0;
+                                       else if (strcmp(curr, "asxDetailedMode") ==0) //JP-MOD
+                                               asxDetailedMode = getCGIargINT(arg);
                                }
 
 
@@ -1119,6 +1128,8 @@ void Servent::handshakeCMD(char *cmd)
                                servMgr->allowServer2 = allowServer2;
                                servMgr->enableGetName = enableGetName;
                                servMgr->allowConnectPCST = allowConnectPCST;
+                               servMgr->disableAutoBumpIfDirect = disableAutoBumpIfDirect; //JP-MOD
+                               servMgr->asxDetailedMode = asxDetailedMode; //JP-MOD
                                if (!(servMgr->allowServer1 & ALLOW_HTML) && !(servMgr->allowServer2 & ALLOW_HTML))
                                        servMgr->allowServer1 |= ALLOW_HTML;
 
@@ -1199,6 +1210,9 @@ void Servent::handshakeCMD(char *cmd)
                                        }else if (strcmp(curr,"type")==0)
                                        {
                                                info.contentType = ChanInfo::getTypeFromStr(arg);
+                                       }else if (strcmp(curr,"bcstClap")==0) //JP-MOD
+                                       {
+                                               info.ppFlags |= ServMgr::bcstClap;
                                        }
 
                                }
@@ -1514,6 +1528,7 @@ void Servent::handshakeCMD(char *cmd)
                                                Channel *c = chanMgr->findChannelByName(chname.cstr());
                                                if (c && (c->isActive()) && (c->status == Channel::S_BROADCASTING)){
                                                        ChanInfo newInfo = c->info;
+                                                       newInfo.ppFlags = ServMgr::bcstNone; //JP-MOD
                                                        while (cmd=nextCGIarg(cmd,curr,arg))
                                                        {
                                                                String chmeta;
@@ -1527,6 +1542,8 @@ void Servent::handshakeCMD(char *cmd)
                                                                        newInfo.genre = chmeta.cstr();
                                                                else if (strcmp(curr,"comment")==0)
                                                                        newInfo.comment = chmeta.cstr();
+                                                               else if (strcmp(curr,"bcstClap")==0) //JP-MOD
+                                                                       newInfo.ppFlags |= ServMgr::bcstClap;
                                                                else if (strcmp(curr,"t_contact")==0)
                                                                        newInfo.track.contact = chmeta.cstr();
                                                                else if (strcmp(curr,"t_title")==0)
index 3829168..9470076 100644 (file)
@@ -144,6 +144,26 @@ ServMgr::ServMgr()
        chanLog="";
 
        maxRelaysIndexTxt = 1;  // for PCRaw (relay)
+
+       { //JP-MOD
+#ifdef WIN32
+               guiSimpleChannelList = false;
+               guiSimpleConnectionList = false;
+               guiTopMost = false;
+
+               guiChanListDisplays = 10;
+               guiConnListDisplays = 10;
+
+               guiTitleModify = false;
+               guiTitleModifyNormal = "PeerCast \8eó\90M:%rx.kbits.1%kbps \91\97\90M:%tx.kbits.1%kbps";
+               guiTitleModifyMinimized = "R:%rx.kbytes%KB/s T:%tx.kbytes%KB/s";
+
+               guiAntennaNotifyIcon = false;
+#endif
+
+               disableAutoBumpIfDirect = 1;
+               asxDetailedMode = 1;
+       }
 }
 // -----------------------------------
 BCID *ServMgr::findValidBCID(int index)
@@ -243,6 +263,7 @@ void ServMgr::setFilterDefaults()
 
        numFilters++;
 
+       LOG_DEBUG("numFilters = %d", numFilters);
 }
 
 // -----------------------------------
@@ -1034,6 +1055,17 @@ void ServMgr::saveSettings(const char *fn)
 
                iniFile.writeIntValue("maxRelaysIndexTxt", servMgr->maxRelaysIndexTxt); // for PCRaw (relay)
 
+               { //JP-MOD
+                       iniFile.writeIntValue("disableAutoBumpIfDirect",servMgr->disableAutoBumpIfDirect);
+                       iniFile.writeIntValue("asxDetailedMode",servMgr->asxDetailedMode);
+
+                       iniFile.writeSection("PP");
+#ifdef WIN32
+                       iniFile.writeBoolValue("ppClapSound", servMgr->ppClapSound);
+                       iniFile.writeStrValue("ppClapSoundPath", servMgr->ppClapSoundPath.cstr());
+#endif
+               }
+
                //JP-EX
                iniFile.writeSection("Windows");
                iniFile.writeBoolValue("getModulePath",servMgr->getModulePath);
@@ -1057,6 +1089,21 @@ void ServMgr::saveSettings(const char *fn)
                        iniFile.writeIntValue("guiRight", winPlace.rcNormalPosition.right);
                }
 
+               { //JP-MOD
+                       iniFile.writeBoolValue("guiSimpleChannelList", servMgr->guiSimpleChannelList);
+                       iniFile.writeBoolValue("guiSimpleConnectionList", servMgr->guiSimpleConnectionList);
+                       iniFile.writeBoolValue("guiTopMost", servMgr->guiTopMost);
+
+                       iniFile.writeIntValue("guiChanListDisplays", servMgr->guiChanListDisplays);
+                       iniFile.writeIntValue("guiConnListDisplays", servMgr->guiConnListDisplays);
+
+                       iniFile.writeBoolValue("guiTitleModify", servMgr->guiTitleModify);
+                       iniFile.writeStrValue("guiTitleModifyNormal", servMgr->guiTitleModifyNormal.cstr());
+                       iniFile.writeStrValue("guiTitleModifyMinimized", servMgr->guiTitleModifyMinimized.cstr());
+
+                       iniFile.writeBoolValue("guiAntennaNotifyIcon", servMgr->guiAntennaNotifyIcon);
+               }
+
                iniFile.writeBoolValue("topmostGui", servMgr->topmostGui);
                iniFile.writeBoolValue("startWithGui", servMgr->startWithGui);
 #endif
@@ -1073,6 +1120,7 @@ void ServMgr::saveSettings(const char *fn)
                        iniFile.writeBoolValue("PeerCast",notifyMask&NT_PEERCAST);
                        iniFile.writeBoolValue("Broadcasters",notifyMask&NT_BROADCASTERS);
                        iniFile.writeBoolValue("TrackInfo",notifyMask&NT_TRACKINFO);
+                       iniFile.writeBoolValue("Applause",notifyMask&NT_APPLAUSE); //JP-MOD
                iniFile.writeLine("[End]");
 
 
@@ -1391,6 +1439,19 @@ void ServMgr::loadSettings(const char *fn)
                        else if (iniFile.isName("maxRelaysIndexTxt"))                   // for PCRaw (relay)
                                servMgr->maxRelaysIndexTxt = iniFile.getIntValue();
 
+                       //JP-MOD
+                       else if (iniFile.isName("disableAutoBumpIfDirect"))
+                               servMgr->disableAutoBumpIfDirect = iniFile.getIntValue();
+                       else if (iniFile.isName("asxDetailedMode"))
+                               servMgr->asxDetailedMode = iniFile.getIntValue();
+
+#ifdef WIN32
+                       else if (iniFile.isName("ppClapSound"))
+                               servMgr->ppClapSound = iniFile.getBoolValue();
+                       else if (iniFile.isName("ppClapSoundPath"))
+                               servMgr->ppClapSoundPath.set(iniFile.getStrValue(),String::T_ASCII);
+#endif
+
                        //JP-Windows
                        else if (iniFile.isName("getModulePath"))
                                servMgr->getModulePath = iniFile.getBoolValue();
@@ -1436,7 +1497,24 @@ void ServMgr::loadSettings(const char *fn)
                                if (servMgr->saveGuiPos){
                                        guiFlg = true;
                                }
-                       }
+                       }else if (iniFile.isName("guiSimpleChannelList")) //JP-MOD
+                               servMgr->guiSimpleChannelList = iniFile.getBoolValue();
+                       else if (iniFile.isName("guiSimpleConnectionList")) //JP-MOD
+                               servMgr->guiSimpleConnectionList = iniFile.getBoolValue();
+                       else if (iniFile.isName("guiTopMost")) //JP-MOD
+                               servMgr->guiTopMost = iniFile.getBoolValue();
+                       else if (iniFile.isName("guiChanListDisplays")) //JP-MOD
+                               servMgr->guiChanListDisplays = iniFile.getIntValue();
+                       else if (iniFile.isName("guiConnListDisplays")) //JP-MOD
+                               servMgr->guiConnListDisplays = iniFile.getIntValue();
+                       else if (iniFile.isName("guiTitleModify")) //JP-MOD
+                               servMgr->guiTitleModify = iniFile.getBoolValue();
+                       else if (iniFile.isName("guiTitleModifyNormal")) //JP-MOD
+                               servMgr->guiTitleModifyNormal.set(iniFile.getStrValue(),String::T_ASCII);
+                       else if (iniFile.isName("guiTitleModifyMinimized")) //JP-MOD
+                               servMgr->guiTitleModifyMinimized.set(iniFile.getStrValue(),String::T_ASCII);
+                       else if (iniFile.isName("guiAntennaNotifyIcon")) //JP-MOD
+                               servMgr->guiAntennaNotifyIcon = iniFile.getBoolValue();
 
                        else if (iniFile.isName("topmostGui"))
                        {
@@ -1470,6 +1548,7 @@ void ServMgr::loadSettings(const char *fn)
 
                                if (numFilters < (MAX_FILTERS-1))
                                        numFilters++;
+                               LOG_DEBUG("*** numFilters = %d", numFilters);
                        }
                        else if (iniFile.isName("[Notify]"))
                        {
@@ -1484,6 +1563,8 @@ void ServMgr::loadSettings(const char *fn)
                                                notifyMask |= iniFile.getBoolValue()?NT_BROADCASTERS:0;
                                        else if (iniFile.isName("TrackInfo"))
                                                notifyMask |= iniFile.getBoolValue()?NT_TRACKINFO:0;
+                                       else if (iniFile.isName("Applause")) //JP-MOD
+                                               notifyMask |= iniFile.getBoolValue()?NT_APPLAUSE:0;
                                }
 
                        }
@@ -1583,6 +1664,7 @@ void ServMgr::loadSettings(const char *fn)
        if (!numFilters)
                setFilterDefaults();
 
+       LOG_DEBUG("numFilters = %d", numFilters);
 }
 
 // --------------------------------------------------
@@ -1825,11 +1907,13 @@ bool ServMgr::start()
 #else
        priv = "";
 #endif
-#ifdef VERSION_EX
-       LOG_DEBUG("Peercast %s, %s %s",PCX_VERSTRING_EX,peercastApp->getClientTypeOS(),priv);
-#else
-       LOG_DEBUG("Peercast %s, %s %s",PCX_VERSTRING,peercastApp->getClientTypeOS(),priv);
-#endif
+       if (version_ex)
+       {
+               LOG_DEBUG("Peercast %s, %s %s",PCX_VERSTRING_EX,peercastApp->getClientTypeOS(),priv);
+       } else
+       {
+               LOG_DEBUG("Peercast %s, %s %s",PCX_VERSTRING,peercastApp->getClientTypeOS(),priv);
+       }
 
        sessionID.toStr(idStr);
        LOG_DEBUG("SessionID: %s",idStr);
@@ -1954,10 +2038,11 @@ int ServMgr::broadcastPushRequest(ChanHit &hit, Host &to, GnuID &chanID, Servent
                atom.writeBytes(PCP_BCST_FROM,servMgr->sessionID.id,16);
                atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
                atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
-               atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
-               atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
+               if (version_ex)
+               {
+                       atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
+                       atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
+               }
                atom.writeParent(PCP_PUSH,3);
                        atom.writeInt(PCP_PUSH_IP,to.ip);
                        atom.writeShort(PCP_PUSH_PORT,to.port);
@@ -1996,22 +2081,25 @@ void ServMgr::broadcastRootSettings(bool getUpdate)
                ChanPacket pack;
                MemoryStream mem(pack.data,sizeof(pack.data));
                AtomStream atom(mem);
-#ifndef VERSION_EX
+               if (version_ex == 0)
+               {
                        atom.writeParent(PCP_BCST,7);
-#else
+               } else
+               {
                        atom.writeParent(PCP_BCST,9);
-#endif
-                       atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_TRACKERS);
-                       atom.writeChar(PCP_BCST_HOPS,0);
-                       atom.writeChar(PCP_BCST_TTL,7);
-                       atom.writeBytes(PCP_BCST_FROM,sessionID.id,16);
-                       atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
-                       atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
-#ifdef VERSION_EX
+               }
+               atom.writeChar(PCP_BCST_GROUP,PCP_BCST_GROUP_TRACKERS);
+               atom.writeChar(PCP_BCST_HOPS,0);
+               atom.writeChar(PCP_BCST_TTL,7);
+               atom.writeBytes(PCP_BCST_FROM,sessionID.id,16);
+               atom.writeInt(PCP_BCST_VERSION,PCP_CLIENT_VERSION);
+               atom.writeInt(PCP_BCST_VERSION_VP,PCP_CLIENT_VERSION_VP);
+               if (version_ex)
+               {
                        atom.writeBytes(PCP_BCST_VERSION_EX_PREFIX,PCP_CLIENT_VERSION_EX_PREFIX,2);
                        atom.writeShort(PCP_BCST_VERSION_EX_NUMBER,PCP_CLIENT_VERSION_EX_NUMBER);
-#endif
-                       writeRootAtoms(atom,getUpdate);
+               }
+               writeRootAtoms(atom,getUpdate);
 
                mem.len = mem.pos;
                mem.rewind();
@@ -2318,11 +2406,13 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
        String str;
 
        if (var == "version")
-#ifdef VERSION_EX
-               strcpy(buf,PCX_VERSTRING_EX);
-#else
-               strcpy(buf,PCX_VERSTRING);
-#endif
+               if (version_ex)
+               {
+                       strcpy(buf,PCX_VERSTRING_EX);
+               } else
+               {
+                       strcpy(buf,PCX_VERSTRING);
+               }
        else if (var == "uptime")
        {
                str.setFromStopwatch(getUptime());
@@ -2352,8 +2442,10 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
                sprintf(buf,"%d",getFirewall()==FW_UNKNOWN?0:1);
        else if (var == "rootMsg")
                strcpy(buf,rootMsg);
-       else if (var == "isRoot")
+       else if (var == "isRoot"){
+               LOG_DEBUG("isRoot = %d", isRoot);
                sprintf(buf,"%d",isRoot?1:0);
+       }
        else if (var == "isPrivate")
                sprintf(buf,"%d",(PCP_BROADCAST_FLAGS&1)?1:0);
        else if (var == "forceYP")
@@ -2370,8 +2462,10 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
                sprintf(buf,"%d",maxControl);
        else if (var == "maxServIn")
                sprintf(buf,"%d",maxServIn);
-       else if (var == "numFilters")
+       else if (var == "numFilters") {
+               LOG_DEBUG("*-* numFilters = %d", numFilters);
                sprintf(buf,"%d",numFilters+1);
+       }
        else if (var == "maxPGNUIn")
                sprintf(buf,"%d",maxGnuIncoming);
        else if (var == "minPGNUIn")
@@ -2424,6 +2518,19 @@ bool ServMgr::writeVariable(Stream &out, const String &var)
        else if (var == "enableGetName")
                strcpy(buf, (enableGetName == 1)? "1":"0");
 
+       //JP-MOD
+       else if (var == "disableAutoBumpIfDirect")
+               strcpy(buf, (disableAutoBumpIfDirect == 1) ? "1":"0");
+       else if (var.startsWith("asxDetailedMode"))
+       {
+               if (var == "asxDetailedMode.0")
+                       strcpy(buf, (asxDetailedMode == 0) ? "1":"0");
+               else if (var == "asxDetailedMode.1")
+                       strcpy(buf, (asxDetailedMode == 1) ? "1":"0");
+               else if (var == "asxDetailedMode.2")
+                       strcpy(buf, (asxDetailedMode == 2) ? "1":"0");
+       }
+
        // VP-EX
        else if (var == "ypAddress2")
                strcpy(buf,rootHost2.cstr());
index e424a9d..32012f8 100644 (file)
@@ -122,7 +122,8 @@ public:
                NT_UPGRADE                      = 0x0001,
                NT_PEERCAST                     = 0x0002,
                NT_BROADCASTERS         = 0x0004,
-               NT_TRACKINFO            = 0x0008
+               NT_TRACKINFO            = 0x0008,
+               NT_APPLAUSE                     = 0x0010 //JP-MOD
        };
 
        enum FW_STATE
@@ -421,6 +422,32 @@ public:
 
        int maxRelaysIndexTxt;  // for PCRaw (relay)
 
+#ifdef WIN32 //JP-MOD
+       bool    guiSimpleChannelList;
+       bool    guiSimpleConnectionList;
+       bool    guiTopMost;
+
+       int             guiChanListDisplays;
+       int             guiConnListDisplays;
+       bool    guiTitleModify;
+       String  guiTitleModifyNormal;
+       String  guiTitleModifyMinimized;
+
+       bool    guiAntennaNotifyIcon;
+
+       bool    ppClapSound;
+       String  ppClapSoundPath;
+#endif
+
+       int             disableAutoBumpIfDirect;
+       int             asxDetailedMode;
+
+       enum PPBCSTFLAG //JP-MOD
+       {
+               bcstNone                = 0x00000000,
+               bcstClap                = 0x00000001
+       };
+
 private:
        FW_STATE        firewalled;
 };
index 0e47e07..32f35d9 100644 (file)
@@ -161,7 +161,7 @@ public:
 
 
     static unsigned int    getIP(char *);
-       static bool                     getHostname(char *,unsigned int);
+       static bool                     getHostname(char *,size_t,unsigned int); //JP-MOD
 
     virtual bool eof()
     {
index 1e0704b..47ddf91 100644 (file)
@@ -749,11 +749,11 @@ void LogBuffer::write(const char *str, TYPE t)
 {
        lock.on();
 
-       unsigned int len = strlen(str);
+       size_t len = strlen(str);
        int cnt=0;
        while (len)
        {
-               unsigned int rlen = len;
+               size_t rlen = len;
                if (rlen > (lineLen-1))
                        rlen = lineLen-1;
 
index 0819ee1..958c348 100644 (file)
@@ -96,7 +96,7 @@ public:
        // set from null terminated string, remove first/last chars
        void setUnquote(const char *p, TYPE t=T_ASCII) 
        {
-               int slen = strlen(p);
+               size_t slen = strlen(p);
                if (slen > 2)
                {
                        if (slen >= MAX_LEN) slen = MAX_LEN;
@@ -109,6 +109,7 @@ public:
 
        void clear() 
        {
+               memset(data, 0, MAX_LEN);
                data[0]=0;
                type = T_UNKNOWN;
        }
@@ -243,6 +244,9 @@ public:
 
 typedef __int64 int64_t;
 
+#ifndef _UINTPTR_T_DEFINED
+typedef unsigned int uintptr_t;
+#endif
 
 // ------------------------------------
 class WEvent
@@ -292,7 +296,7 @@ public:
 
 // ------------------------------------
 typedef int (WINAPI *THREAD_FUNC)(ThreadInfo *);
-typedef unsigned int THREAD_HANDLE;
+typedef uintptr_t THREAD_HANDLE;
 #define THREAD_PROC int WINAPI
 #define vsnprintf _vsnprintf
 
index d9aff45..92d4a3f 100644 (file)
@@ -29,22 +29,24 @@ static bool PCP_FORCE_YP                            = false;
 #endif
 // ------------------------------------------------
 static const int PCP_CLIENT_VERSION            = 1218;
-static const int PCP_CLIENT_VERSION_VP = 26;
+static const int PCP_CLIENT_VERSION_VP = 27;
 static const int PCP_ROOT_VERSION              = 1218;
 
 static const int PCP_CLIENT_MINVERSION = 1200;
 
 static const char *PCX_AGENT           = "PeerCast/0.1218";    
 static const char *PCX_AGENTJP                 = "PeerCast/0.1218-J";
-static const char *PCX_AGENTVP         = "PeerCast/0.1218(VP0026)";
-static const char *PCX_VERSTRING       = "v0.1218(VP0026)";
+static const char *PCX_AGENTVP         = "PeerCast/0.1218(VP0027)";
+static const char *PCX_VERSTRING       = "v0.1218(VP0027)";
+
+extern int version_ex; // PP\94Å\8ag\92£\8b@\94\\97L\8cø\89»\83t\83\89\83O(\82½\82Ô\82ñ)
 
 #if 1 /* for VP extend version */
-#define VERSION_EX 1
+//#define VERSION_EX 1
 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
 static const int  PCP_CLIENT_VERSION_EX_NUMBER = 27;
-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027)";
-static const char *PCX_VERSTRING_EX = "v0.1218(IM0027)";
+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027-2)";
+static const char *PCX_VERSTRING_EX = "v0.1218(IM0027-2)";
 #endif
 
 // ------------------------------------------------
index 19c1035..9bfa3e2 100644 (file)
@@ -243,7 +243,7 @@ int XML::Node::findAttrID(const char *name)
 // ----------------------------------
 char *XML::Node::findAttr(const char *name)
 {
-       int nlen = strlen(name);
+       size_t nlen = strlen(name);
        for(int i=1; i<numAttr; i++)
     {
        char *an = getAttrName(i);
index 3df0d3f..4c4d105 100644 (file)
@@ -27,7 +27,7 @@
 #include <windows.h>
 #include <stdio.h>
 #include "wsocket.h"
-#include "stats.h"
+#include "..\common\stats.h"
 #ifdef _DEBUG
 #include "chkMemoryLeak.h"
 #define DEBUG_NEW new(__FILE__, __LINE__)
@@ -51,8 +51,11 @@ void WSAClientSocket::init()
 
 }
 // --------------------------------------------------
-bool ClientSocket::getHostname(char *str,unsigned int ip)
+bool ClientSocket::getHostname(char *str,size_t size,unsigned int ip) //JP-MOD
 {
+       if(size == 0)
+               return false;
+
        HOSTENT *he;
 
        ip = htonl(ip);
@@ -61,7 +64,9 @@ bool ClientSocket::getHostname(char *str,unsigned int ip)
 
        if (he)
        {
-               strcpy(str,he->h_name);
+               LOG_DEBUG("getHostname: %d.%d.%d.%d -> %s", ((BYTE*)&ip)[0], ((BYTE*)&ip)[1], ((BYTE*)&ip)[2], ((BYTE*)&ip)[3], he->h_name);
+               strncpy(str,he->h_name,size-1);
+               str[size-1] = '\0';
                return true;
        }else
                return false;
@@ -603,7 +608,7 @@ ClientSocket *WSAClientSocket::accept()
        int fromSize = sizeof(sockaddr_in);
        sockaddr_in from;
 
-       int conSock = ::accept(sockNum,(sockaddr *)&from,&fromSize);
+       SOCKET conSock = ::accept(sockNum,(sockaddr *)&from,&fromSize);
 
 
        if (conSock ==  INVALID_SOCKET)
index fdf4055..8bc621f 100644 (file)
@@ -22,7 +22,7 @@
 #define _WSOCKET_H
 
 #include <windows.h>
-#include "socket.h"
+#include "..\common\socket.h"
 //#include "winsock2.h"
 
 
@@ -71,7 +71,7 @@ public:
        void    checkBuffering(bool, bool);
 
        unsigned int writeCnt;
-       unsigned int sockNum;
+       SOCKET sockNum;
        struct sockaddr_in remoteAddr;
 
        enum {RBSIZE = 8192};
index 9ed1fcf..65165e9 100644 (file)
 #include <process.h>
 #include <windows.h>
 #include <time.h>
-#include "win32/wsys.h"
-#include "win32/wsocket.h"
-#include "stats.h"
-#include "peercast.h"
+#include "wsys.h"
+#include "wsocket.h"
+#include "..\common\stats.h"
+#include "..\common\peercast.h"
 #include <sys/timeb.h>
 #include <time.h>
 #include "shellapi.h"
@@ -62,7 +62,7 @@ unsigned int WSys::getTime()
 {
        time_t ltime;
        time( &ltime );
-       return ltime;
+       return (unsigned)ltime;
 }
 
 // ---------------------------------
index 95f479a..483b38e 100644 (file)
@@ -24,8 +24,8 @@
 #define _WSYS_H
 // ------------------------------------
 #include <windows.h>
-#include "socket.h"
-#include "sys.h"
+#include "..\common\socket.h"
+#include "..\common\sys.h"
 
 // ------------------------------------
 class WSys : public Sys
index 1157016..13f67e0 100644 (file)
@@ -197,6 +197,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
 
        hInst = hInstance;
 
+       version_ex = 0; // PP\94Å\8ag\92£\8b@\94\\82ð\96³\8cø\82É
+
        iniFileName.set(".\\peercast.ini");
 
        WIN32_FIND_DATA fd; //JP-EX
@@ -1290,11 +1292,14 @@ LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
                case WM_INITDIALOG:
                        //SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENT);
 //                     SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTJP);
-#ifdef VERSION_EX
-                       SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTEX);
-#else
-                       SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTVP);
-#endif
+                       if (version_ex)
+                       {
+                               SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTEX);
+                       } else
+                       {
+                               SendDlgItemMessage(hDlg,IDC_ABOUTVER,WM_SETTEXT,0,(LONG)PCX_AGENTVP);
+                       }
+
                        return TRUE;
 
                case WM_COMMAND: