Blob Blame History Raw
Index: src/message/post.cpp
===================================================================
--- src/message/post.cpp	(revision 2342)
+++ src/message/post.cpp	(working copy)
@@ -201,6 +201,7 @@
     std::string tag_2ch;
     std::string msg;
     std::string hana;
+    std::string cookie_type, cookie_value;
     std::string conf;
 
     bool ret;
@@ -266,6 +267,13 @@
     regex.exec( ".*<input +type=hidden +name=\"?hana\"? +value=\"?([^\"]*)\"?.*", str, 0, false, false );
     hana = MISC::remove_space( regex.str( 1 ) );
 
+    // 2ch の hana とかその他
+    // 取り敢えず間に合わせ
+    regex.exec( ".*<input +type=hidden +name=\"([^\"]+)\" +value=\"[^\"]+\".*", str, 0, false, false );
+    cookie_type = MISC::remove_space( regex.str( 1 ) );
+    regex.exec( ".*<input +type=hidden +name=\"[^\"]+\" +value=\"([^\"]+)\".*", str, 0, false, false );
+    cookie_value = MISC::remove_space( regex.str( 1 ) );
+
 #ifdef _DEBUG
     std::cout << "TITLE: [" << title << "]\n";
     std::cout << "2ch_X: [" << tag_2ch << "]\n";
@@ -325,7 +333,7 @@
             if( mdiag.get_chkbutton().get_active() ) CONFIG::set_always_write_ok( true );
         }
 
-        set_cookies_and_hana( SKELETON::Loadable::cookies(), hana );
+        set_cookies_and_hana( SKELETON::Loadable::cookies(), cookie_type, cookie_value );
 
         ++m_count; // 永久ループ防止
         post_msg();
@@ -337,7 +345,7 @@
     else if( m_count < 1 // 永久ループ防止
              && ! m_subbbs && conf.find( "書き込み確認" ) != std::string::npos ){
 
-        set_cookies_and_hana( SKELETON::Loadable::cookies(), hana );
+        set_cookies_and_hana( SKELETON::Loadable::cookies(), cookie_type, cookie_value );
 
         // subbbs.cgi にポスト先を変更してもう一回ポスト
         m_subbbs = true;
@@ -367,15 +375,17 @@
 //
 // データベースにクッキーとhanaを登録
 //
-void Post::set_cookies_and_hana( const std::list< std::string >& cookies, const std::string& hana )
+void Post::set_cookies_and_hana( const std::list< std::string >& cookies, 
+	const std::string& cookie_type, const std::string& cookie_value )
 {
+    std::string hana = "&" + cookie_type + "=" + cookie_value;
     if( ! cookies.empty() ) DBTREE::board_set_list_cookies_for_write( m_url, cookies );
 
     if( ! hana.empty() ){
         DBTREE::board_set_hana_for_write( m_url, hana );
 
         // 手抜き。後で直すこと
-        if( m_msg.find( "hana=" ) == std::string::npos ) m_msg += "&hana=" + hana;
+        if( m_msg.find( cookie_type + "=" ) == std::string::npos ) m_msg += hana;
     }
 }
 
Index: src/message/post.h
===================================================================
--- src/message/post.h	(revision 2342)
+++ src/message/post.h	(working copy)
@@ -58,7 +58,8 @@
         virtual void receive_data( const char* data, size_t size );
         virtual void receive_finish();
 
-        void set_cookies_and_hana( const std::list< std::string >& cookies, const std::string& hana );
+        void set_cookies_and_hana( const std::list< std::string >& cookies, 
+		const std::string& cookie_type, const std::string& cookie_value );
     };
     
 }