diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/Makefile.am | 3 | ||||
-rw-r--r-- | src/common/cfgfiles.c | 2 | ||||
-rw-r--r-- | src/common/common-xp.vcxproj | 160 | ||||
-rw-r--r-- | src/common/common-xp.vcxproj.filters | 200 | ||||
-rw-r--r-- | src/common/common.vcxproj | 14 | ||||
-rw-r--r-- | src/common/common.vcxproj.filters | 6 | ||||
-rw-r--r-- | src/common/servlist.c | 25 | ||||
-rw-r--r-- | src/common/strlutil.c | 84 | ||||
-rw-r--r-- | src/common/strlutil.h | 2 | ||||
-rw-r--r-- | src/common/text.c | 59 | ||||
-rw-r--r-- | src/common/tree.c | 4 | ||||
-rw-r--r-- | src/common/tree.h | 2 | ||||
-rw-r--r-- | src/common/url.c | 27 | ||||
-rw-r--r-- | src/common/util.h | 1 |
14 files changed, 546 insertions, 43 deletions
diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 6a35da91..409aa324 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -28,6 +28,7 @@ EXTRA_DIST = \ servlist.h \ ssl.h \ ssl.c \ + strlutil.c \ text.h \ textenums.h \ textevents.h \ @@ -54,7 +55,7 @@ SUBDIRS = $(dbusdir) . libxchatcommon_a_SOURCES = cfgfiles.c chanopt.c ctcp.c dcc.c history.c ignore.c \ inbound.c modes.c msproxy.c network.c notify.c outbound.c \ plugin.c plugin-timer.c proto-irc.c server.c servlist.c $(ssl_c) \ - text.c tree.c url.c userlist.c util.c xchat.c + strlutil.c text.c tree.c url.c userlist.c util.c xchat.c libxchatcommon_a_CFLAGS = $(LIBPROXY_CFLAGS) textevents: make-te diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 158bc3f7..4485b426 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -744,7 +744,7 @@ load_config (void) prefs.input_tray_priv = prefs.input_tray_hilight = 1; prefs.autodccsend = 2; /* browse mode */ prefs.url_grabber = 1; - prefs.url_grabber_limit = 0; /* 0 means unlimited for backcompat */ + prefs.url_grabber_limit = 100; /* 0 means unlimited */ prefs.text_search_follow = 1; #ifdef WIN32 prefs.identd = 1; diff --git a/src/common/common-xp.vcxproj b/src/common/common-xp.vcxproj new file mode 100644 index 00000000..c20359f4 --- /dev/null +++ b/src/common/common-xp.vcxproj @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\config.h" /> + <ClInclude Include="cfgfiles.h" /> + <ClInclude Include="chanopt.h" /> + <ClInclude Include="ctcp.h" /> + <ClInclude Include="dcc.h" /> + <ClInclude Include="fe.h" /> + <ClInclude Include="history.h" /> + <ClInclude Include="identd.h" /> + <ClInclude Include="ignore.h" /> + <ClInclude Include="inbound.h" /> + <ClInclude Include="inet.h" /> + <ClInclude Include="modes.h" /> + <ClInclude Include="msproxy.h" /> + <ClInclude Include="network.h" /> + <ClInclude Include="notify.h" /> + <ClInclude Include="outbound.h" /> + <ClInclude Include="plugin-timer.h" /> + <ClInclude Include="plugin.h" /> + <ClInclude Include="proto-irc.h" /> + <ClInclude Include="server.h" /> + <ClInclude Include="servlist.h" /> + <ClInclude Include="ssl.h" /> + <ClInclude Include="strlutil.h" /> + <ClInclude Include="text.h" /> + <ClInclude Include="textenums.h" /> + <ClInclude Include="textevents.h" /> + <ClInclude Include="thread.h" /> + <ClInclude Include="tree.h" /> + <ClInclude Include="url.h" /> + <ClInclude Include="userlist.h" /> + <ClInclude Include="util.h" /> + <ClInclude Include="xchat-plugin.h" /> + <ClInclude Include="xchat.h" /> + <ClInclude Include="xchatc.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="cfgfiles.c" /> + <ClCompile Include="chanopt.c" /> + <ClCompile Include="ctcp.c" /> + <ClCompile Include="dcc.c" /> + <ClCompile Include="history.c" /> + <ClCompile Include="identd.c" /> + <ClCompile Include="ignore.c" /> + <ClCompile Include="inbound.c" /> + <ClCompile Include="modes.c" /> + <ClCompile Include="msproxy.c" /> + <ClCompile Include="network.c" /> + <ClCompile Include="notify.c" /> + <ClCompile Include="outbound.c" /> + <ClCompile Include="plugin-timer.c" /> + <ClCompile Include="plugin.c" /> + <ClCompile Include="proto-irc.c" /> + <ClCompile Include="server.c" /> + <ClCompile Include="servlist.c" /> + <ClCompile Include="ssl.c" /> + <ClCompile Include="strlutil.c" /> + <ClCompile Include="text.c" /> + <ClCompile Include="thread.c" /> + <ClCompile Include="tree.c" /> + <ClCompile Include="url.c" /> + <ClCompile Include="userlist.c" /> + <ClCompile Include="util.c" /> + <ClCompile Include="xchat.c" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>common</RootNamespace> + <ProjectName>common</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>WDK7</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>WDK7</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\win32\hexchat-xp.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\win32\hexchat-xp.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(HexChatBin)</OutDir> + <IntDir>$(HexChatObj)$(ProjectName)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(HexChatBin)</OutDir> + <IntDir>$(HexChatObj)$(ProjectName)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level1</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level1</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/src/common/common-xp.vcxproj.filters b/src/common/common-xp.vcxproj.filters new file mode 100644 index 00000000..5be20199 --- /dev/null +++ b/src/common/common-xp.vcxproj.filters @@ -0,0 +1,200 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="cfgfiles.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="chanopt.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="ctcp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="dcc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="fe.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="history.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="identd.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="ignore.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="inbound.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="inet.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="modes.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="msproxy.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="network.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="notify.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="outbound.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="plugin.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="plugin-timer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="proto-irc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="server.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="servlist.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="ssl.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="text.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="textenums.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="textevents.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="thread.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="tree.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="url.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="userlist.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="util.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="xchat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="xchatc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="xchat-plugin.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="strlutil.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="cfgfiles.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="chanopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ctcp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="dcc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="history.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="identd.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ignore.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="inbound.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="modes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="msproxy.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="network.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="notify.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="outbound.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="plugin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="plugin-timer.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="proto-irc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="server.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="servlist.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ssl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="text.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="thread.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="tree.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="url.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="userlist.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="util.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="xchat.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="strlutil.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj index 595a76fc..9615d94c 100644 --- a/src/common/common.vcxproj +++ b/src/common/common.vcxproj @@ -33,6 +33,7 @@ <ClInclude Include="server.h" /> <ClInclude Include="servlist.h" /> <ClInclude Include="ssl.h" /> + <ClInclude Include="strlutil.h" /> <ClInclude Include="text.h" /> <ClInclude Include="textenums.h" /> <ClInclude Include="textevents.h" /> @@ -65,6 +66,7 @@ <ClCompile Include="server.c" /> <ClCompile Include="servlist.c" /> <ClCompile Include="ssl.c" /> + <ClCompile Include="strlutil.c" /> <ClCompile Include="text.c" /> <ClCompile Include="thread.c" /> <ClCompile Include="tree.c" /> @@ -84,14 +86,12 @@ <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>WDK7</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>WDK7</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -106,12 +106,12 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <OutDir>$(SolutionDir)build\$(PlatformName)\bin\</OutDir> - <IntDir>$(SolutionDir)build\$(PlatformName)\obj\$(ProjectName)\</IntDir> + <OutDir>$(HexChatBin)</OutDir> + <IntDir>$(HexChatObj)$(ProjectName)\</IntDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <OutDir>$(SolutionDir)build\$(PlatformName)\bin\</OutDir> - <IntDir>$(SolutionDir)build\$(PlatformName)\obj\$(ProjectName)\</IntDir> + <OutDir>$(HexChatBin)</OutDir> + <IntDir>$(HexChatObj)$(ProjectName)\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> @@ -124,7 +124,6 @@ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <MultiProcessorCompilation>true</MultiProcessorCompilation> - <BufferSecurityCheck>false</BufferSecurityCheck> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -144,7 +143,6 @@ <PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <MultiProcessorCompilation>true</MultiProcessorCompilation> - <BufferSecurityCheck>false</BufferSecurityCheck> </ClCompile> <Link> <SubSystem>Windows</SubSystem> diff --git a/src/common/common.vcxproj.filters b/src/common/common.vcxproj.filters index afb66e63..5be20199 100644 --- a/src/common/common.vcxproj.filters +++ b/src/common/common.vcxproj.filters @@ -110,6 +110,9 @@ <ClInclude Include="..\..\config.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="strlutil.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="cfgfiles.c"> @@ -190,5 +193,8 @@ <ClCompile Include="xchat.c"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="strlutil.c"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> </Project> \ No newline at end of file diff --git a/src/common/servlist.c b/src/common/servlist.c index f58d2ce8..7a4ee94e 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -274,8 +274,9 @@ static const struct defaultserver def[] = {0, "komatu.german-elite.net"}, /* {0, "liberty.german-elite.net"},*/ - {"GimpNet", 0}, + {"GIMPNet", 0}, {0, "irc.gimp.org"}, + {0, "irc.gnome.org"}, /* {0, "irc.au.gimp.org"},*/ {0, "irc.us.gimp.org"}, @@ -288,17 +289,18 @@ static const struct defaultserver def[] = {"IdleMonkeys", 0}, {0, "irc.idlemonkeys.net"}, + {"IndirectIRC", 0}, +#ifdef USE_OPENSSL + {0, "irc.indirectirc.com/+6697"}, +#endif + {0, "irc.indirectirc.com"}, + /* {"Infinity-IRC", 0}, {0, "Atlanta.GA.US.Infinity-IRC.Org"}, {0, "Babylon.NY.US.Infinity-IRC.Org"}, {0, "Sunshine.Ca.US.Infinity-IRC.Org"}, {0, "IRC.Infinity-IRC.Org"},*/ - {"iZ-smart.net", 0}, - {0, "irc.iZ-smart.net/6666"}, - {0, "irc.iZ-smart.net/6667"}, - {0, "irc.iZ-smart.net/6668"}, - {"IrcLink", 0}, {0, "irc.irclink.net"}, {0, "Alesund.no.eu.irclink.net"}, @@ -322,6 +324,17 @@ static const struct defaultserver def[] = {"Irctoo.net", 0}, {0, "irc.irctoo.net"}, + {"IronDust", 0}, +#ifdef USE_OPENSSL + {0, "irc.irondust.net/+6697"}, +#endif + {0, "irc.irondust.net"}, + + {"iZ-smart.net", 0}, + {0, "irc.iZ-smart.net/6666"}, + {0, "irc.iZ-smart.net/6667"}, + {0, "irc.iZ-smart.net/6668"}, + {"Krstarica", 0}, {0, "irc.krstarica.com"}, diff --git a/src/common/strlutil.c b/src/common/strlutil.c new file mode 100644 index 00000000..c823c1e8 --- /dev/null +++ b/src/common/strlutil.c @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> +#include <string.h> + +/* + * Appends src to string dst of size siz (unlike strncat, siz is the + * full size of dst, not space left). At most siz-1 characters + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * If retval >= siz, truncation occurred. + */ +size_t +strlcat(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + size_t dlen; + + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; + + if (n == 0) + return(dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; + n--; + } + s++; + } + *d = '\0'; + + return(dlen + (s - src)); /* count does not include NUL */ +} + +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +size_t +strlcpy(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0) { + while (--n != 0) { + if ((*d++ = *s++) == '\0') + break; + } + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ +} diff --git a/src/common/strlutil.h b/src/common/strlutil.h new file mode 100644 index 00000000..968aab53 --- /dev/null +++ b/src/common/strlutil.h @@ -0,0 +1,2 @@ +size_t strlcat(char *dst, const char *src, size_t siz); +size_t strlcpy(char *dst, const char *src, size_t siz); diff --git a/src/common/text.c b/src/common/text.c index e12021c9..0e8cbc3a 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -570,6 +570,34 @@ log_insert_vars (char *buf, int bufsize, char *fmt, char *c, char *n, char *s) } } +static int +logmask_is_fullpath () +{ + /* Check if final path/filename is absolute or relative. + * If one uses log mask variables, such as "%c/...", %c will be empty upon + * connecting since there's no channel name yet, so we have to make sure + * we won't try to write to the FS root. On Windows we can be sure it's + * full path if the 2nd character is a colon since Windows doesn't allow + * colons in filenames. + */ +#ifdef WIN32 + /* Treat it as full path if it + * - starts with '\' which denotes the root directory of the current drive letter + * - starts with a drive letter and followed by ':' + */ + if (prefs.logmask[0] >= '\\' || ((prefs.logmask[0] >= 'A' && prefs.logmask[0] <= 'Z') || (prefs.logmask[0] >= 'a' && prefs.logmask[0] <= 'z') && prefs.logmask[1] == ':')) +#else + if (prefs.logmask[0] == '/') +#endif + { + return 1; + } + else + { + return 0; + } +} + static char * log_create_pathname (char *servname, char *channame, char *netname) { @@ -580,13 +608,20 @@ log_create_pathname (char *servname, char *channame, char *netname) time_t now; if (!netname) + { netname = "NETWORK"; + } /* first, everything is in UTF-8 */ if (!rfc_casecmp (channame, servname)) + { channame = strdup ("server"); + } else + { channame = log_create_filename (channame); + } + log_insert_vars (fname, sizeof (fname), prefs.logmask, channame, netname, servname); free (channame); @@ -595,18 +630,8 @@ log_create_pathname (char *servname, char *channame, char *netname) tm = localtime (&now); strftime (fnametime, sizeof (fnametime), fname, tm); - /* create final path/filename, check if it's absolute or relative */ -#ifdef WIN32 - if ((fnametime[0] >= 'A' && fnametime[0] <= 'Z') || (fnametime[0] >= 'a' && fnametime[0] <= 'z') && fnametime[1] == ':') -#else - /* If one uses log mask variables, such as "%c/...", %c will be empty upon - * connecting since there's no channel name yet, so we have to make sure - * we won't try to write to the FS root. On Windows we can be sure it's - * full path if the 2nd character is a colon since Windows doesn't allow - * colons in filenames. - */ - if (fnametime[0] == '/' && prefs.logmask[0] != '%') -#endif + /* create final path/filename */ + if (logmask_is_fullpath ()) { snprintf (fname, sizeof (fname), "%s", fnametime); } @@ -620,7 +645,9 @@ log_create_pathname (char *servname, char *channame, char *netname) /* create all the subdirectories */ if (fs) + { mkdir_p (fs); + } return fs; } @@ -666,11 +693,11 @@ log_open (session *sess) if (!log_error && sess->logfd == -1) { char message[512]; - snprintf (message, sizeof (message), - _("* Can't open log file(s) for writing. Check the\n" \ - " permissions on %s/logs"), get_xdir_utf8 ()); - fe_message (message, FE_MSG_WAIT | FE_MSG_ERROR); + snprintf (message, sizeof (message), _("* Can't open log file(s) for writing. Check the\npermissions on %s"), + log_create_pathname (sess->server->servername, sess->channel, server_get_network (sess->server, FALSE))); + + fe_message (message, FE_MSG_WAIT | FE_MSG_ERROR); log_error = TRUE; } } diff --git a/src/common/tree.c b/src/common/tree.c index 0a459779..33fe1d41 100644 --- a/src/common/tree.c +++ b/src/common/tree.c @@ -150,10 +150,11 @@ tree_find (tree *t, void *key, tree_cmp_func *cmp, void *data, int *pos) return mybsearch (key, &t->array[0], t->elements, cmp, data, pos); } -void +void * tree_remove_at_pos (tree *t, int pos) { int post_bytes; + void *ret = t->array[pos]; t->elements--; if (pos != t->elements) @@ -161,6 +162,7 @@ tree_remove_at_pos (tree *t, int pos) post_bytes = (t->elements - pos) * sizeof (void *); memmove (&t->array[pos], &t->array[pos + 1], post_bytes); } + return ret; } int diff --git a/src/common/tree.h b/src/common/tree.h index 96ab6cdb..44e06672 100644 --- a/src/common/tree.h +++ b/src/common/tree.h @@ -10,7 +10,7 @@ tree *tree_new (tree_cmp_func *cmp, void *data); void tree_destroy (tree *t); void *tree_find (tree *t, void *key, tree_cmp_func *cmp, void *data, int *pos); int tree_remove (tree *t, void *key, int *pos); -void tree_remove_at_pos (tree *t, int pos); +void *tree_remove_at_pos (tree *t, int pos); void tree_foreach (tree *t, tree_traverse_func *func, void *data); int tree_insert (tree *t, void *key); void tree_append (tree* t, void *key); diff --git a/src/common/url.c b/src/common/url.c index 2f09ad3c..31a45d49 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -31,6 +31,7 @@ #endif void *url_tree = NULL; +GTree *url_btree = NULL; static int @@ -46,6 +47,8 @@ url_clear (void) tree_foreach (url_tree, (tree_traverse_func *)url_free, NULL); tree_destroy (url_tree); url_tree = NULL; + g_tree_destroy (url_btree); + url_btree = NULL; } static int @@ -80,11 +83,7 @@ url_autosave (void) static int url_find (char *urltext) { - int pos; - - if (tree_find (url_tree, urltext, (tree_cmp_func *)g_ascii_strcasecmp, NULL, &pos)) - return 1; - return 0; + return (g_tree_lookup_extended (url_btree, urltext, NULL, NULL)); } static void @@ -110,15 +109,18 @@ url_add (char *urltext, int len) if (data[len - 1] == ')') /* chop trailing ) */ data[len - 1] = 0; + if (!url_tree) + { + url_tree = tree_new ((tree_cmp_func *)strcasecmp, NULL); + url_btree = g_tree_new ((GCompareFunc)strcasecmp); + } + if (url_find (data)) { free (data); return; } - if (!url_tree) - url_tree = tree_new ((tree_cmp_func *)g_ascii_strcasecmp, NULL); - size = tree_size (url_tree); /* 0 is unlimited */ if (prefs.url_grabber_limit > 0 && size >= prefs.url_grabber_limit) @@ -127,10 +129,17 @@ url_add (char *urltext, int len) xchat is running */ size -= prefs.url_grabber_limit; for(; size > 0; size--) - tree_remove_at_pos (url_tree, 0); + { + char *pos; + + pos = tree_remove_at_pos (url_tree, 0); + g_tree_remove (url_btree, pos); + free (pos); + } } tree_append (url_tree, data); + g_tree_insert (url_btree, data, GINT_TO_POINTER (tree_size (url_tree) - 1)); fe_url_add (data); } diff --git a/src/common/util.h b/src/common/util.h index c2f1e118..e7e22524 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -14,6 +14,7 @@ #ifndef XCHAT_UTIL_H #define XCHAT_UTIL_H +#include "strlutil.h" #define rfc_tolower(c) (rfc_tolowertab[(unsigned char)(c)]) extern const unsigned char rfc_tolowertab[]; |