OSDN Git Service

名前登録機能追加
authorunknown <qwerty2501@users.sourceforge.jp>
Fri, 10 Feb 2012 06:48:46 +0000 (15:48 +0900)
committerunknown <qwerty2501@users.sourceforge.jp>
Fri, 10 Feb 2012 06:48:46 +0000 (15:48 +0900)
nlite.suo
nlite/nlite_chatData.cpp
nlite/nlite_chatData.h
nlite/nlite_commentview.cpp
nlite/nlite_common.cpp
nlite/nlite_common.h
nlite/nlite_property.h
nlite_stub/nlite_stub.cpp

index 7f388d8..aadf79e 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index 6516e9c..fcee389 100644 (file)
@@ -1,6 +1,6 @@
 #include "stdafx.h"
 #include "nlite_include.h"
-
+using namespace std::tr1;
 namespace nlite{
 
 
@@ -44,6 +44,13 @@ VOID ListenerData::SetBkColor(COLORREF bkColor_in){
        return;
 }
 
+VOID ListenerData::SetUserName(LPCTSTR name){
+
+       this->name = name;
+       this->writePropertyFlag = TRUE;
+
+}
+
 
 CChatData::ViewData::ViewData():
                        sellLineColor(INIT_COLOR),
@@ -77,7 +84,18 @@ VOID CChatData::SetChat(NicoLiveChat &chat_in,ListenerData &listener){
 
        
        this->listenerData = &listenerList.Register(listener,FALSE);
-
+       tstring target(chat_in.chatBuf);
+       
+       match_results<tstring::iterator> results;
+       if(regex_match(target.begin(),target.end(),results,nliteregex::NAMESERTCHREGEX) == TRUE){
+               
+               const tstring &name = results.str(results.size() - 1).c_str();
+               
+               if(nliteProperty.gp.numberNameFlag == TRUE || _tcstol(name.c_str(),NULL,10) == 0){
+                       this->listenerData->SetUserName(name.c_str());
+               }
+               
+       }
        
        this->vpos = _ttol(chat_in.vpos);
        this->thread = _ttol(chat_in.thread);
index 3e1cc7e..fae41f6 100644 (file)
@@ -20,6 +20,7 @@ namespace nlite{
        ///\83\8a\83X\83i\81[\83f\81[\83^
        ///
        struct ListenerData{
+       private:
 
        public:
                CNLiteString user_id;                                   //\83\86\81[\83U\81[ID
@@ -46,6 +47,10 @@ namespace nlite{
                ///
                VOID SetBkColor(COLORREF bkColor_in);
                
+               ///
+               ///\83\86\81[\83U\96¼\90Ý\92è
+               ///
+               VOID SetUserName(LPCTSTR name);
        };
 
        //
index c57892c..8e08708 100644 (file)
@@ -22,7 +22,7 @@ namespace nlite{
                BOOL rslt = FALSE;
                try{
                        
-                       tstring viewString(regex_replace(tstring(chat.chatBuf),nliteregex::TAGSTRING,nliteregex::NUTHINGSTRING));
+                       tstring viewString(regex_replace(tstring(chat.chatBuf),nliteregex::TAGSTRING,nliteregex::text::NUTHINGSTRING));
                        rslt = __super::SetWindowText(viewString.c_str());
 
                        CHARFORMAT2 defaultFormat;
index 055ca1f..f780541 100644 (file)
@@ -12,13 +12,15 @@ namespace nliteregex{
                const  CString VIDEOID_TEXT = TEXT("(sm|nm)([0-9])+");
                const  CString LIVEID_TEXT = TEXT("(lv)([0-9])+");
                const  CString LINK_TEXT = TEXT("(") + URL_TEXT + TEXT(")|(") + VIDEOID_TEXT + TEXT(")|(") + LIVEID_TEXT + TEXT(")");
+               const  CString SEARTCH_AT_MARK(TEXT("(.*)(@|\81\97)([^@^\81\97]+)"));
+               const  tstring NUTHINGSTRING(TEXT(""));
        }
        const  tregex URL(text::URL_TEXT);
        const  tregex TAGSTRING(text::TAG_TEXT);
        const  tregex VIDEOID(text::VIDEOID_TEXT);
        const  tregex LIVEID(text::LIVEID_TEXT);
        const  tregex LILNKREGEX(text::LINK_TEXT);
-       const  tstring NUTHINGSTRING(TEXT(""));
+       const tregex NAMESERTCHREGEX(text::SEARTCH_AT_MARK);
 }
 Property nliteProperty;        
 CListenerList nlite::listenerList;
index 8089571..d3e8bef 100644 (file)
@@ -35,13 +35,15 @@ namespace nlite{
                        extern const  CString VIDEOID_TEXT;
                        extern const  CString LIVEID_TEXT;
                        extern const  CString LINK_TEXT;
+                       extern const  CString SEARTCH_AT_MARK;
+                       extern const  tstring NUTHINGSTRING;
                }
                extern const  tregex URL;
                extern const  tregex TAGSTRING;
                extern const  tregex VIDEOID;
                extern const  tregex LIVEID;
                extern const  tregex LILNKREGEX;
-               extern const  tstring NUTHINGSTRING;
+               extern const  tregex NAMESERTCHREGEX;
        }
 
 }
\ No newline at end of file
index a41ad3e..72eeb0f 100644 (file)
@@ -30,7 +30,7 @@ namespace nlite{
                COLORREF normalSellLineColor;                                                           //\92Ê\8fí\8e\9e\82Ì\98g\90ü
                COLORREF baseStringColor;                                                                       //\8aî\92ê\82Ì\95\8e\9a\90F
                COLORREF ownerStringColor;                                                                      //\89^\89c\95\8e\9a\90F
-               COLORREF linkStringColor;                                                                               //\8aî\92ê\82Ì\83n\83C\83p\81[\83\8a\83\93\83N\82Ì\90F
+               COLORREF linkStringColor;                                                                       //\8aî\92ê\82Ì\83n\83C\83p\81[\83\8a\83\93\83N\82Ì\90F
                COLORREF anonymousIDLinkColor;                                                          //\93½\96¼ID\95\\8e¦\90F
                COLORREF colLineColor;                                                                          //\8d\80\96Ú\82Ì\8fc\90ü
 
index 5e7090d..981d6f6 100644 (file)
@@ -195,7 +195,7 @@ unsigned int WINAPI commentthread(VOID *usadata){
        srand((unsigned int)time(NULL));
 
        for(int indexfirst = 0; indexfirst < STARTRECEVECOUNT;indexfirst++){
-               liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("http://live.nicovideo.jp/watch/lv79715214?alert=1 2545 http://live.nicovideo.jp/watch/lv79715214?alert=1") : TEXT("test");
+               liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("http://live.nicovideo.jp/watch/lv79715214?alert=1 2545 http://live.nicovideo.jp/watch/lv79715214?alert=1") : TEXT("test @\83e\83X\83g\83\86\81[\83U1");
                _stprintf((LPTSTR)liveChat.user_id,user_id_format,rand() % 15);
                commentcount++;
                _stprintf((LPTSTR)liveChat.no,TEXT("%u"),commentcount);
@@ -211,7 +211,7 @@ unsigned int WINAPI commentthread(VOID *usadata){
 
                for(index2 = 0;index2 < ONERECEVECHATCOUNT;index2++){
 
-                       liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("http://live.nicovideo.jp/watch/lv79715214?alert=1 254 http://live.nicovideo.jp/") : TEXT("<font color=FF0000>sm552447 sm1543514 lv25447 </font >");
+                       liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("http://live.nicovideo.jp/watch/lv79715214?alert=1 254 http://live.nicovideo.jp/") : TEXT("<font color=FF0000>sm552447 sm1543514 lv25447 </font >@3333");
                        _stprintf((LPTSTR)liveChat.user_id,TEXT("%s"),TEXT("0NsZs9X9GFLJaE9Ru3QuV2StCIM"));
                        commentcount++;
                        _stprintf((LPTSTR)liveChat.no,TEXT("%u"),commentcount);