OSDN Git Service

バタ70(再リリース・バージョン情報不具合のみ修正)
[gikonavigoeson/gikonavi.git] / GikoSystem.pas
index 5cbcdbe..3118e3c 100644 (file)
@@ -188,6 +188,7 @@ type
                function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
 
                function GetShortName(const LongName: string; ALength: integer): string;
+               function TrimThreadTitle(const SrcTitle: string): string;
                function BoolToInt(b: Boolean): Integer;
                function IntToBool(i: Integer): Boolean;
                function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
@@ -277,7 +278,7 @@ const
        ZERO_DATE: Integer      = 25569;
        BETA_VERSION_NAME_E = 'beta';
        BETA_VERSION_NAME_J = 'ÊÞÀ';
-       BETA_VERSION                            = 68;
+       BETA_VERSION                            = 70;
        BETA_VERSION_BUILD      = '';                           //!< debug\94Å\82È\82Ç
        APP_NAME                                                = 'gikoNavi';
        BE_PHP_URL = 'http://be.2ch.net/test/p.php?i=';
@@ -1446,7 +1447,7 @@ var
        S : string;
        i : integer;
 begin
-       s := Trim(LongName);
+    s := TrimThreadTitle(Trim(LongName));
        if (Length(s) <= ALength) then begin
                Result := s;
        end else begin
@@ -1479,6 +1480,33 @@ begin
        end;
 end;
 
+function TGikoSys.TrimThreadTitle(const SrcTitle: string): string;
+const
+    TRIM_STRING: array [1..4] of String =
+        ('[\93]\8dÚ\8bÖ\8e~]', '&copy;2ch.net', '&copy;bbspink.com', #9);
+var
+    i: Integer;
+    Idx: Integer;
+    Len: Integer;
+    DstTitle: String;
+begin
+    if (Setting.ThreadTitleTrim = True) then begin
+        DstTitle := SrcTitle;
+               for i := Low(TRIM_STRING) to High(TRIM_STRING) do begin
+            Len := Length(TRIM_STRING[i]);
+            while (True) do begin
+                Idx := Pos(TRIM_STRING[i], DstTitle);
+                if (Idx < 1) then
+                    Break;
+                Delete(DstTitle, Idx, Len);
+            end;
+        end;
+        Result := Trim(DstTitle);
+    end else begin
+        Result := SrcTitle;
+    end;
+end;
+
 {!
 \brief Boolean \82ð Integer \82É\95Ï\8a·
 \return False..0, True..1