Compare commits
69 Commits
wip/remove
...
v2.14.3
Author | SHA1 | Date | |
---|---|---|---|
b304cfe850 | |||
ef1aad01bf | |||
8e60546aea | |||
29591e2b67 | |||
7da0a3aa2c | |||
6a7a134170 | |||
60c9263d49 | |||
4ab756af7b | |||
92f58b4420 | |||
b9d1efc2c2 | |||
79f7ff888f | |||
3588c519c3 | |||
ce528b6af8 | |||
a26cc20d21 | |||
3099c652bb | |||
edc7ad83e3 | |||
996b29ccca | |||
6a8b7013af | |||
8665501c77 | |||
7659caada1 | |||
fd47adf595 | |||
cadc51ede9 | |||
57478b6575 | |||
5c5aacd9da | |||
93cc105a40 | |||
33300630a3 | |||
fd2167d856 | |||
08fb808ea4 | |||
c70c1e1896 | |||
5cd70622aa | |||
5ca767f7f8 | |||
111441302c | |||
ed6f544572 | |||
ee85129a9b | |||
93f926bf12 | |||
da56297c5a | |||
5d8b4719a8 | |||
8a875afad0 | |||
dc483b2342 | |||
28a3d42ad1 | |||
eb942fc274 | |||
27acca0f5b | |||
ececf2f640 | |||
d72249d91f | |||
2286990a6f | |||
6ec523423a | |||
77c8fe1421 | |||
740352ceab | |||
541b9ca744 | |||
e9b9ff9f38 | |||
9b8a7eaa01 | |||
cdefb8e2d6 | |||
16ee8eb233 | |||
f6333b592b | |||
6e4fc09ce0 | |||
8aa3b03261 | |||
23c7e7c3da | |||
7510ab36b7 | |||
d3f1ab7813 | |||
4cdf6460b6 | |||
5d3bf39103 | |||
234fe86987 | |||
6ca7f84d02 | |||
7b359875d8 | |||
4a228d1efe | |||
ee8926503c | |||
7d7be83216 | |||
0058587958 | |||
228e08543a |
@ -8,7 +8,7 @@ before_install:
|
||||
install:
|
||||
- docker run -d --privileged --cidfile=/tmp/cid --volume=${PWD}:/opt/hexchat hexchat/ubuntu-ci /bin/systemd --system
|
||||
script:
|
||||
- docker exec `cat /tmp/cid` /bin/sh -c 'meson /opt/hexchat /opt/hexchat-build -Dwith-text=true -Dwith-theme-manager=true && ninja -C /opt/hexchat-build install'
|
||||
- docker exec `cat /tmp/cid` /bin/sh -c 'meson /opt/hexchat /opt/hexchat-build -Dwith-text=true -Dwith-theme-manager=true && ninja -C /opt/hexchat-build install && ninja -C /opt/hexchat-build test'
|
||||
after_script:
|
||||
- docker kill `cat /tmp/cid`
|
||||
notifications:
|
||||
|
@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>hexchat.desktop</id>
|
||||
<name>HexChat</name>
|
||||
<developer_name>HexChat</developer_name>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-2.0+</project_license>
|
||||
<translation type="gettext">hexchat</translation>
|
||||
<summary>IRC Client</summary>
|
||||
<description>
|
||||
<p>HexChat is an easy to use yet extensible IRC Client. It allows you to securely join multiple networks and talk to users privately or in channels using a customizable interface. You can even transfer files.</p>
|
||||
<p>HexChat supports features such as: DCC, SASL, proxies, spellcheck, alerts, logging, custom themes, and Python/Perl scripts.</p>
|
||||
</description>
|
||||
<url type="homepage">http://hexchat.github.io</url>
|
||||
<url type="bugtracker">https://github.com/hexchat/hexchat</url>
|
||||
<url type="translate">https://www.transifex.com/hexchat/hexchat</url>
|
||||
<url type="donation">https://goo.gl/jESZvU</url>
|
||||
<url type="help">https://hexchat.readthedocs.io/en/latest/</url>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>http://i.imgur.com/tLMguQz.png</image>
|
||||
<caption>Main Chat Window</caption>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<releases>
|
||||
<release date="2016-12-10" version="2.12.4">
|
||||
<description>
|
||||
<p>This is another bug fix release:</p>
|
||||
<ul>
|
||||
<li>Fix issue with timers causing ping timeouts</li>
|
||||
<li>Fix building against OpenSSL 1.1</li>
|
||||
<li>Fix /exec output printing invalid utf8</li>
|
||||
<li>Replace doat plugin with an internal command</li>
|
||||
<li>Change how tab colors interact with plugins</li>
|
||||
<li>Enable filtering the beep character by default</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release date="2016-10-22" version="2.12.3">
|
||||
<description>
|
||||
<p>This is a minor bug fix release just cleaning up a few issues:</p>
|
||||
<ul>
|
||||
<li>Fix crash with bad translations</li>
|
||||
<li>Add new mhop command</li>
|
||||
<li>Change ping timeout to 60 by default</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
</releases>
|
||||
<kudos>
|
||||
<kudo>UserDocs</kudo>
|
||||
<kudo>HiDpiIcon</kudo>
|
||||
<kudo>Notifications</kudo>
|
||||
</kudos>
|
||||
<update_contact>tingping_at_fedoraproject.org</update_contact>
|
||||
</component>
|
11
data/misc/io.github.Hexchat.Plugin.metainfo.xml.in
Normal file
11
data/misc/io.github.Hexchat.Plugin.metainfo.xml.in
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="addon">
|
||||
<id>io.github.Hexchat.Plugin.@NAME@</id>
|
||||
<extends>io.github.Hexchat.desktop</extends>
|
||||
<name>@NAME@ Plugin</name>
|
||||
<summary>@SUMMARY@</summary>
|
||||
<url type="homepage">https://hexchat.github.io/</url>
|
||||
<project_license>@LICENSE@</project_license>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<update_contact>tingping_AT_fedoraproject.org</update_contact>
|
||||
</component>
|
118
data/misc/io.github.Hexchat.appdata.xml.in
Normal file
118
data/misc/io.github.Hexchat.appdata.xml.in
Normal file
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>io.github.Hexchat.desktop</id>
|
||||
<name>HexChat</name>
|
||||
<developer_name>HexChat</developer_name>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-2.0+</project_license>
|
||||
<translation type="gettext">hexchat</translation>
|
||||
<summary>IRC Client</summary>
|
||||
<description>
|
||||
<p>HexChat is an easy to use yet extensible IRC Client. It allows you to securely join multiple networks and talk to users privately or in channels using a customizable interface. You can even transfer files.</p>
|
||||
<p>HexChat supports features such as: DCC, SASL, proxies, spellcheck, alerts, logging, custom themes, and Python/Perl scripts.</p>
|
||||
</description>
|
||||
<url type="homepage">http://hexchat.github.io</url>
|
||||
<url type="bugtracker">https://github.com/hexchat/hexchat</url>
|
||||
<url type="donation">https://goo.gl/jESZvU</url>
|
||||
<url type="help">https://hexchat.readthedocs.io/en/latest/</url>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>http://i.imgur.com/tLMguQz.png</image>
|
||||
<caption>Main Chat Window</caption>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<provides>
|
||||
<!-- Renamed from this -->
|
||||
<id>hexchat.desktop</id>
|
||||
</provides>
|
||||
<releases>
|
||||
<release date="2019-12-20" version="2.14.3">
|
||||
<description>
|
||||
<p>This is a bug-fix release:</p>
|
||||
<ul>
|
||||
<li>Fix various incorrect parsing of IRC messages relating to trailing parameters</li>
|
||||
<li>Fix SASL negotiation combined with multi-line cap</li>
|
||||
<li>Fix input box theming with Yaru theme</li>
|
||||
<li>python: Work around Python 3.7 regression causing crash on unload</li>
|
||||
<li>sysinfo: Add support for /etc/os-release</li>
|
||||
<li>sysinfo: Ignore irrelevant mounts when calculating storage size</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release date="2018-08-29" version="2.14.2">
|
||||
<description>
|
||||
<p>This is a minor release:</p>
|
||||
<ul>
|
||||
<li>Remove shift+click to close tab binding</li>
|
||||
<li>Always unminimize when opening from tray</li>
|
||||
<li>Fix some translations containing invalid text events</li>
|
||||
<li>Fix sending server passwords starting with ":"</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release date="2018-03-13" version="2.14.1">
|
||||
<description>
|
||||
<p>This is a very minor bug-fix release:</p>
|
||||
<ul>
|
||||
<li>Fix performance regression</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release date="2018-03-10" version="2.14.0">
|
||||
<description>
|
||||
<p>This is largely a bug fix release though it has some large behind the scenes changes:</p>
|
||||
<ul>
|
||||
<li>Rename data files to use *io.github.Hexchat* name</li>
|
||||
<li>Add option (irc_reconnect_rejoin) to disable auto-rejoin on reconnect</li>
|
||||
<li>Add ability to set custom tray icon separate of app icon</li>
|
||||
<li>Fix Enchant 2.0+ support</li>
|
||||
<li>Fix input box theming with Adwaita-dark</li>
|
||||
<li>Fix custom sounds not respecting omit if away option</li>
|
||||
<li>Fix detecting if a tray doesn't exist on x11</li>
|
||||
<li>Fix cutting off ctcp text after ending \01</li>
|
||||
<li>Fix /ignore not accepting full hosts</li>
|
||||
<li>Fix characters getting cut off when their width changes</li>
|
||||
<li>Fix various possible crashes</li>
|
||||
<li>Change preference window to be scroll-able</li>
|
||||
<li>Remove ctrl+w binding by default</li>
|
||||
<li>doat: Fix channels with / in them</li>
|
||||
<li>fishlim: Fix key exchange</li>
|
||||
<li>fishlim: Fix building against LibreSSL</li>
|
||||
<li>sysinfo: Fix pci.ids file not being found on some distros</li>
|
||||
<li>sysinfo: Make libpci optional</li>
|
||||
<li>lua: Avoid loading the same script multiple times</li>
|
||||
<li>Update translations</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release date="2016-12-10" version="2.12.4">
|
||||
<description>
|
||||
<p>This is another bug fix release:</p>
|
||||
<ul>
|
||||
<li>Fix issue with timers causing ping timeouts</li>
|
||||
<li>Fix building against OpenSSL 1.1</li>
|
||||
<li>Fix /exec output printing invalid utf8</li>
|
||||
<li>Replace doat plugin with an internal command</li>
|
||||
<li>Change how tab colors interact with plugins</li>
|
||||
<li>Enable filtering the beep character by default</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release date="2016-10-22" version="2.12.3">
|
||||
<description>
|
||||
<p>This is a minor bug fix release just cleaning up a few issues:</p>
|
||||
<ul>
|
||||
<li>Fix crash with bad translations</li>
|
||||
<li>Add new mhop command</li>
|
||||
<li>Change ping timeout to 60 by default</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
</releases>
|
||||
<kudos>
|
||||
<kudo>UserDocs</kudo>
|
||||
<kudo>HiDpiIcon</kudo>
|
||||
<kudo>Notifications</kudo>
|
||||
</kudos>
|
||||
<update_contact>tingping_at_fedoraproject.org</update_contact>
|
||||
</component>
|
@ -9,6 +9,7 @@ Terminal=false
|
||||
Type=Application
|
||||
Categories=GTK;Network;IRCClient;
|
||||
StartupNotify=true
|
||||
StartupWMClass=Hexchat
|
||||
X-GNOME-UsesNotifications=true
|
||||
MimeType=x-scheme-handler/irc;x-scheme-handler/ircs;
|
||||
Actions=SafeMode;
|
@ -1,20 +1,23 @@
|
||||
appdir = join_paths(get_option('datadir'), 'applications')
|
||||
metainfodir = join_paths(get_option('datadir'), 'metainfo')
|
||||
desktop_utils = find_program('desktop-file-validate', required: false)
|
||||
|
||||
if get_option('with-gtk')
|
||||
hexchat_appdata = i18n.merge_file(
|
||||
input: 'hexchat.appdata.xml.in',
|
||||
output: 'hexchat.appdata.xml',
|
||||
po_dir: '../../po',
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('datadir'), 'appdata')
|
||||
)
|
||||
|
||||
appstream_util = find_program('appstream-util', required: false)
|
||||
if appstream_util.found()
|
||||
test('Validate hexchat.appdata.xml', appstream_util,
|
||||
args: ['validate', hexchat_appdata]
|
||||
if get_option('with-appdata')
|
||||
hexchat_appdata = i18n.merge_file(
|
||||
input: 'io.github.Hexchat.appdata.xml.in',
|
||||
output: 'io.github.Hexchat.appdata.xml',
|
||||
po_dir: '../../po',
|
||||
install: true,
|
||||
install_dir: metainfodir
|
||||
)
|
||||
|
||||
appstream_util = find_program('appstream-util', required: false)
|
||||
if appstream_util.found()
|
||||
test('Validate io.github.Hexchat.appdata.xml', appstream_util,
|
||||
args: ['validate-relax', hexchat_appdata]
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
||||
desktop_conf = configuration_data()
|
||||
@ -25,14 +28,14 @@ if get_option('with-gtk')
|
||||
endif
|
||||
|
||||
desktop_file = configure_file(
|
||||
input: 'hexchat.desktop.in.in',
|
||||
output: 'hexchat.desktop.in',
|
||||
input: 'io.github.Hexchat.desktop.in.in',
|
||||
output: 'io.github.Hexchat.desktop.in',
|
||||
configuration: desktop_conf
|
||||
)
|
||||
|
||||
hexchat_desktop = i18n.merge_file(
|
||||
input: desktop_file,
|
||||
output: 'hexchat.desktop',
|
||||
output: 'io.github.Hexchat.desktop',
|
||||
po_dir: '../../po',
|
||||
type: 'desktop',
|
||||
install: true,
|
||||
@ -40,7 +43,7 @@ if get_option('with-gtk')
|
||||
)
|
||||
|
||||
if desktop_utils.found()
|
||||
test('Validate hexchat.desktop', desktop_utils,
|
||||
test('Validate io.github.Hexchat.desktop', desktop_utils,
|
||||
args: [hexchat_desktop]
|
||||
)
|
||||
endif
|
||||
@ -48,8 +51,8 @@ endif
|
||||
|
||||
if get_option('with-theme-manager')
|
||||
htm_desktop = i18n.merge_file(
|
||||
input: 'htm.desktop.in',
|
||||
output: 'htm.desktop',
|
||||
input: 'io.github.Hexchat.ThemeManager.desktop.in',
|
||||
output: 'io.github.Hexchat.ThemeManager.desktop',
|
||||
po_dir: '../../po',
|
||||
type: 'desktop',
|
||||
install: true,
|
||||
@ -57,12 +60,68 @@ if get_option('with-theme-manager')
|
||||
)
|
||||
|
||||
if desktop_utils.found()
|
||||
test('Validate htm.desktop', desktop_utils,
|
||||
test('Validate io.github.Hexchat.ThemeManager.desktop', desktop_utils,
|
||||
args: [htm_desktop]
|
||||
)
|
||||
endif
|
||||
|
||||
install_data('htm-mime.xml',
|
||||
install_data('io.github.Hexchat.ThemeManager.xml',
|
||||
install_dir: join_paths(get_option('datadir'), 'mime/packages')
|
||||
)
|
||||
endif
|
||||
|
||||
if get_option('with-plugin') and get_option('with-appdata')
|
||||
plugin_metainfo = []
|
||||
|
||||
# FIXME: These should all get translated somewhere
|
||||
if get_option('with-checksum')
|
||||
plugin_metainfo += [
|
||||
['Checksum', 'Calculates a checksum for all sent and recieved DCC files', 'MIT']
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option('with-fishlim')
|
||||
plugin_metainfo += [
|
||||
['Fishlim', 'Allows setting a key for encrypted conversations', 'MIT AND GPL-2.0+']
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option('with-lua') != 'false'
|
||||
plugin_metainfo += [
|
||||
['Lua', 'Provides a scripting interface in Lua', 'MIT']
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option('with-perl') != 'false'
|
||||
plugin_metainfo += [
|
||||
['Perl', 'Provides a scripting interface in Perl', 'GPL-2.0+']
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option('with-python') != 'false'
|
||||
plugin_metainfo += [
|
||||
['Python', 'Provides a scripting interface in Python', 'GPL-2.0+']
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option('with-sysinfo')
|
||||
plugin_metainfo += [
|
||||
['Sysinfo', 'Adds command to display system information', 'GPL-2.0+']
|
||||
]
|
||||
endif
|
||||
|
||||
foreach metainfo : plugin_metainfo
|
||||
name = metainfo[0]
|
||||
conf = configuration_data()
|
||||
conf.set('NAME', name)
|
||||
conf.set('SUMMARY', metainfo[1])
|
||||
conf.set('LICENSE', metainfo[2])
|
||||
|
||||
configure_file(
|
||||
input: 'io.github.Hexchat.Plugin.metainfo.xml.in',
|
||||
output: 'io.github.Hexchat.Plugin.@0@.metainfo.xml'.format(name),
|
||||
configuration: conf,
|
||||
install_dir: get_option('install-plugin-metainfo') ? metainfodir : '',
|
||||
)
|
||||
endforeach
|
||||
endif
|
@ -2,8 +2,8 @@ pkg_conf = configuration_data()
|
||||
prefix = get_option('prefix')
|
||||
pkg_conf.set('prefix', prefix)
|
||||
pkg_conf.set('VERSION', meson.project_version())
|
||||
pkg_conf.set('hexchatlibdir', join_paths(prefix, plugindir))
|
||||
pkg_conf.set('includedir', join_paths(prefix, get_option('includedir')))
|
||||
pkg_conf.set('hexchatlibdir', join_paths('${prefix}', plugindir))
|
||||
pkg_conf.set('includedir', join_paths('${prefix}', get_option('includedir')))
|
||||
|
||||
configure_file(
|
||||
input: 'hexchat-plugin.pc.in',
|
||||
|
@ -7,9 +7,6 @@ ar = '/usr/bin/x86_64-w64-mingw32-gcc-ar'
|
||||
strip = '/usr/bin/x86_64-w64-mingw32-strip'
|
||||
pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
|
||||
|
||||
[properties]
|
||||
c_args = ['-DNTDDI_VERSION=NTDDI_WIN7', '-D_WIN32_WINNT=_WIN32_WINNT_WIN7']
|
||||
|
||||
[host_machine]
|
||||
system = 'windows'
|
||||
cpu_family = 'x86_64'
|
||||
|
27
meson.build
27
meson.build
@ -1,6 +1,6 @@
|
||||
project('hexchat', 'c',
|
||||
version: '2.12.4',
|
||||
meson_version: '>= 0.38.0',
|
||||
version: '2.14.3',
|
||||
meson_version: '>= 0.40.0',
|
||||
default_options: [
|
||||
'c_std=gnu89',
|
||||
'buildtype=debugoptimized',
|
||||
@ -15,6 +15,7 @@ cc = meson.get_compiler('c')
|
||||
|
||||
libgio_dep = dependency('gio-2.0', version: '>= 2.34.0')
|
||||
libgmodule_dep = dependency('gmodule-2.0')
|
||||
global_deps = []
|
||||
if cc.get_id() == 'msvc'
|
||||
libssl_dep = cc.find_library('libeay32')
|
||||
else
|
||||
@ -76,13 +77,16 @@ configure_file(output: 'config.h', configuration: config_h)
|
||||
config_h_include = include_directories('.')
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
add_project_arguments('-DWIN32', language: 'c')
|
||||
add_project_arguments(
|
||||
'-DWIN32',
|
||||
'-DNTDDI_VERSION=NTDDI_WIN7',
|
||||
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
|
||||
language: 'c')
|
||||
endif
|
||||
|
||||
|
||||
global_cflags = []
|
||||
test_cflags = [
|
||||
'-pipe',
|
||||
'-funsigned-char',
|
||||
'-Wno-conversion',
|
||||
'-Wno-pointer-sign',
|
||||
@ -112,6 +116,10 @@ if get_option('buildtype') != 'plain'
|
||||
}
|
||||
''', args: '-fstack-protector-all')
|
||||
global_cflags += '-fstack-protector-strong'
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
global_deps += cc.find_library('ssp')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
add_project_arguments(global_cflags, language: 'c')
|
||||
@ -121,9 +129,18 @@ global_ldflags = []
|
||||
test_ldflags = [
|
||||
'-Wl,-z,relro',
|
||||
'-Wl,-z,now',
|
||||
# mingw
|
||||
'-Wl,--dynamicbase',
|
||||
'-Wl,--nxcompat',
|
||||
]
|
||||
foreach ldflag : test_ldflags
|
||||
if cc.has_argument(ldflag) and cc.links('int main (void) { return 0; }', args: ldflag)
|
||||
if meson.version().version_compare('>= 0.46.0')
|
||||
has_arg = cc.has_link_argument(ldflag)
|
||||
else
|
||||
has_arg = cc.has_argument(ldflag)
|
||||
endif
|
||||
|
||||
if has_arg and cc.links('int main (void) { return 0; }', args: ldflag)
|
||||
global_ldflags += ldflag
|
||||
endif
|
||||
endforeach
|
||||
|
@ -25,6 +25,12 @@ option('with-libcanberra', type: 'boolean',
|
||||
option('with-theme-manager', type: 'boolean', value: false,
|
||||
description: 'Utility to help manage themes, requires mono/.net'
|
||||
)
|
||||
option('dbus-service-use-appid', type: 'boolean', value: false,
|
||||
description: 'Rename dbus service to match app-id, required for Flatpak'
|
||||
)
|
||||
option('with-appdata', type: 'boolean',
|
||||
description: 'Install appdata files for app stores'
|
||||
)
|
||||
|
||||
# Plugins
|
||||
option('with-checksum', type: 'boolean',
|
||||
@ -39,8 +45,8 @@ option('with-fishlim', type: 'boolean',
|
||||
option('with-lua', type: 'string', value: 'luajit',
|
||||
description: 'Lua scripting plugin, value is pkg-config name to use or "false"'
|
||||
)
|
||||
option('with-perl', type: 'boolean',
|
||||
description: 'Perl scripting plugin'
|
||||
option('with-perl', type: 'string', value: 'perl',
|
||||
description: 'Perl scripting plugin, value is path to perl executable or "false"'
|
||||
)
|
||||
option('with-python', type: 'string', value: 'python3',
|
||||
description: 'Python scripting plugin. value is pkg-config name to use or "false"'
|
||||
@ -54,3 +60,9 @@ option('with-upd', type: 'boolean',
|
||||
option('with-winamp', type: 'boolean',
|
||||
description: 'Winamp plugin, Windows only'
|
||||
)
|
||||
option('install-plugin-metainfo', type: 'boolean', value: false,
|
||||
description: 'Installs metainfo files for enabled plugins, useful when distros create split packages'
|
||||
)
|
||||
option('with-perl-legacy-api', type: 'boolean', value: false,
|
||||
description: 'Enables the legacy IRC perl module for compatibility with old scripts'
|
||||
)
|
||||
|
@ -189,10 +189,12 @@ dh1080_compute_key (const char *priv_key, const char *pub_key, char **secret_key
|
||||
char *pub_key_data;
|
||||
gsize pub_key_len;
|
||||
BIGNUM *pk;
|
||||
BIGNUM *temp_pub_key = BN_new();
|
||||
DH *dh;
|
||||
#ifdef HAVE_DH_SET0_KEY
|
||||
BIGNUM *temp_pub_key = BN_new();
|
||||
#endif
|
||||
|
||||
g_assert (secret_key != NULL);
|
||||
g_assert (secret_key != NULL);
|
||||
|
||||
/* Verify base64 strings */
|
||||
if (strspn (priv_key, B64ABC) != strlen (priv_key)
|
||||
@ -213,7 +215,7 @@ dh1080_compute_key (const char *priv_key, const char *pub_key, char **secret_key
|
||||
int shared_len;
|
||||
BIGNUM *priv_key_num;
|
||||
|
||||
priv_key_data = dh1080_decode_b64 (priv_key, &priv_key_len);
|
||||
priv_key_data = dh1080_decode_b64 (priv_key, &priv_key_len);
|
||||
priv_key_num = BN_bin2bn(priv_key_data, priv_key_len, NULL);
|
||||
#ifndef HAVE_DH_SET0_KEY
|
||||
dh->priv_key = priv_key_num;
|
||||
@ -226,7 +228,7 @@ dh1080_compute_key (const char *priv_key, const char *pub_key, char **secret_key
|
||||
*secret_key = dh1080_encode_b64 (sha256, sizeof(sha256));
|
||||
|
||||
OPENSSL_cleanse (priv_key_data, priv_key_len);
|
||||
g_free (priv_key_data);
|
||||
g_free (priv_key_data);
|
||||
}
|
||||
|
||||
BN_free (pk);
|
||||
|
@ -26,7 +26,7 @@ if get_option('with-lua') != 'false'
|
||||
subdir('lua')
|
||||
endif
|
||||
|
||||
if get_option('with-perl')
|
||||
if get_option('with-perl') != 'false'
|
||||
subdir('perl')
|
||||
endif
|
||||
|
||||
|
@ -1,156 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
char *split(char *text, char separator)
|
||||
{
|
||||
int pos = -1;
|
||||
size_t i;
|
||||
for (i = 0; i < strlen(text); i++)
|
||||
{
|
||||
if (text[i] == separator) {
|
||||
pos = i;
|
||||
i = strlen(text) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos == -1)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
text[pos] = 0;
|
||||
return &(text[pos + 1]);
|
||||
}
|
||||
|
||||
int endsWith(char *text, char *suffix){
|
||||
char *tmp=strstr(text,suffix);
|
||||
if (tmp==NULL) return 0;
|
||||
if (strlen(tmp)==strlen(suffix)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int inStr(char *s1, size_t sl1, char *s2)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < sl1 - strlen(s2); i++)
|
||||
{
|
||||
size_t j;
|
||||
for (j = 0; j < strlen(s2); j++)
|
||||
{
|
||||
if (s1[i + j] != s2[j])
|
||||
{
|
||||
j = strlen(s2) + 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (j == strlen(s2))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char *subString(char *text, int first, int length, int spcKill){
|
||||
//if (DEBUG==1) putlog("creating substring");
|
||||
char *ret = g_new (char, length + 1);
|
||||
int i;
|
||||
ret[length]=0;
|
||||
for (i=0;i<length;i++){
|
||||
ret[i]=text[i+first];
|
||||
//if (ret[i]==0) ret[i]='0';
|
||||
}
|
||||
if (spcKill==1){
|
||||
for (i=length-1;i>=0;i--){
|
||||
if (ret[i]==32) ret[i]=0;
|
||||
else i=-1;
|
||||
}
|
||||
}
|
||||
//if (DEBUG==1) putlog("substring created");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *substring(char *text, int first, int length){return subString(text,first,length,0);}
|
||||
|
||||
|
||||
char *readLine(FILE *f){
|
||||
//if (DEBUG==1) putlog("reading line from file");
|
||||
char *buffer = g_new (char, 1024);
|
||||
int pos=0;
|
||||
int cc=0;
|
||||
while((cc!=EOF)&&(pos<1024)&&(cc!=10)){
|
||||
cc=fgetc(f);
|
||||
if ((cc!=10)&&(cc!=13)){
|
||||
if (cc==EOF) buffer[pos]=0;
|
||||
else buffer[pos]=(char)cc;pos++;
|
||||
}
|
||||
}
|
||||
if (buffer[pos]==EOF) hexchat_printf(ph,"EOF: %i\n",pos);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
char *toUpper(char *text)
|
||||
{
|
||||
char *ret = (char*) calloc(strlen(text) + 1, sizeof(char));
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < strlen(text); i++)
|
||||
{
|
||||
ret[i] = toupper(text[i]);
|
||||
}
|
||||
|
||||
ret[strlen(text)] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *str3cat(char *s1, char *s2, char *s3){
|
||||
//if (DEBUG==1) putlog("cating 3 strings");
|
||||
char *ret=(char*)calloc(strlen(s1)+strlen(s2)+strlen(s3)+1,sizeof(char));
|
||||
strcpy(ret,s1);strcat(ret,s2);strcat(ret,s3);
|
||||
ret[strlen(s1)+strlen(s2)+strlen(s3)]=0;
|
||||
//if (DEBUG==1) putlog("strings cated");
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *replace(char *text, char *from, char *to){
|
||||
//if (DEBUG==1) putlog("replacing");
|
||||
char *ret=(char*)calloc( strlen(text)+(strlen(to)-strlen(from)),sizeof(char));
|
||||
char *left;
|
||||
char *right;
|
||||
int pos=inStr(text,strlen(text),from);
|
||||
if (pos!=-1){
|
||||
left=substring(text,0,pos);
|
||||
right=substring(text,pos+strlen(from),strlen(text)-(pos+strlen(from)));
|
||||
ret=str3cat(left,to,right);
|
||||
return replace(ret,from,to);
|
||||
}
|
||||
//if (DEBUG==1) putlog("replaced");
|
||||
return text;
|
||||
}
|
||||
|
||||
char *intReplaceF(char *text, char *from, int to, char *form){
|
||||
//if (DEBUG==1) putlog("replaceF");
|
||||
char *buffer=(char*) calloc(16,sizeof(char));
|
||||
sprintf(buffer,form,to);
|
||||
//if (DEBUG==1) putlog("replaceF done");
|
||||
return replace(text,from,buffer);
|
||||
}
|
||||
|
||||
char *intReplace(char *text, char *from, int to){return intReplaceF(text,from,to,"%i");}
|
@ -1,334 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
//#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
//#include "functions.c"
|
||||
|
||||
struct tagInfo{
|
||||
int mode;
|
||||
int cbr;
|
||||
int bitrate;
|
||||
unsigned int freq;
|
||||
char *artist;
|
||||
char *title;
|
||||
char *album;
|
||||
char *comment;
|
||||
char *genre;
|
||||
//int genre;
|
||||
//int track;
|
||||
};
|
||||
|
||||
static int RATES[2][3][15]={
|
||||
{//mpeg2
|
||||
{-1,8,16,24,32,64,80,56,64,128,160,112,128,256,320},//layer3 (V2)
|
||||
{-1,32,48,56,64,80,96,112,128,160,192,224,256,320,384},//layer2 (V2)
|
||||
{-1,32,64,96,128,160,192,224,256,288,320,352,384,416,448},//layer1 (V2)
|
||||
},
|
||||
{//mpeg1
|
||||
{-1,32,40,48,56,64,80,96,112,128,160,192,224,256,320},//layer3 (V1)
|
||||
{-1,32,48,56,64,80,96,112,128,160,192,224,256,320,384},//layer2 (V1)
|
||||
{-1,32,64,96,128,160,192,224,256,288,320,352,384,416,448},//layer1 (V1)
|
||||
}};
|
||||
static int FREQS[2][4]={{22050,24000,16000,-1},{44100,48000,32000,-1}};
|
||||
//static double FRATES[]={38.5,32.5,27.8,0.0};
|
||||
|
||||
static char GENRES[][50]={"Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge","Hip-Hop","Jazz","Metal",
|
||||
"New Age","Oldies","Other","Pop","R&B","Rap","Reggae","Rock","Techno","Industrial",
|
||||
"Alternative","Ska","Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient","Trip-Hop","Vocal","Jazz+Funk",
|
||||
"Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound Clip","Gospel","Noise",
|
||||
"AlternRock","Bass","Soul","Punk","Space","Meditative","Instrumental Pop","Instrumental Rock","Ethnic","Gothic",
|
||||
"Darkwave","Techno-Industrial","Electronic","Pop-Folk","Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta",
|
||||
"Top 40","Christian Rap","Pop/Funk","Jungle","Native American","Cabaret","New Wave","Psychadelic","Rave","Showtunes",
|
||||
"Trailer","Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro","Musical","Rock & Roll","Hard Rock",
|
||||
|
||||
//################## END OF OFFICIAL ID3 TAGS, WINAMP TAGS BELOW ########################################
|
||||
|
||||
"Folk","Folk/Rock","National Folk","Swing","Fast Fusion","Bebob","Latin","Revival","Celtic","Bluegrass",
|
||||
"Avantgarde","Gothic Rock","Progressive Rock","Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band","Chorus","Easy Listening","Acoustic",
|
||||
"Humour","Speech","Chanson","Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus","Porn Groove",
|
||||
"Satire","Slow Jam","Club","Tango","Samba","Folklore","Ballad","Poweer Ballad","Rhytmic Soul","Freestyle",
|
||||
"Duet","Punk Rock","Drum Solo","A Capela","Euro-House","Dance Hall",
|
||||
|
||||
//################## FOUND AT http://en.wikipedia.org/wiki/ID3 ###########################################
|
||||
|
||||
"Goa","Drum & Bass","Club-House","Hardcore",
|
||||
"Terror","Indie","BritPop","Negerpunk","Polsk Punk","Beat","Christian Gangsta Rap","Heavy Metal","Black Metal","Crossover",
|
||||
"Contemporary Christian","Christian Rock","Merengue","Salsa","Thrash Metal","Anime","JPop","Synthpop"
|
||||
|
||||
};
|
||||
|
||||
static char MODES [][13]={"Stereo","Joint-Stereo","Dual-Channel","Mono"};
|
||||
|
||||
int iPow(int x, int y){return (int)(pow((double)x,(double) y));}
|
||||
|
||||
int str2int(char *text)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
size_t i;
|
||||
for (i = 1; i <= strlen(text); i++)
|
||||
{
|
||||
if ((text[strlen(text) - i] > 57) || (text[strlen(text) - i] < 48))
|
||||
{
|
||||
hexchat_printf(ph, "invalid char in string: %i", (int) text[strlen(text) - i]);
|
||||
return 255;
|
||||
}
|
||||
|
||||
ret += ((int) text[strlen(text) - i] - 48)*iPow(10, i - 1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *tagExtract(char *tag, int tagLen, char* info){
|
||||
//if (DEBUG==1) putlog("extracting tag");
|
||||
int pos, len, i;
|
||||
pos=inStr(tag,tagLen,info);
|
||||
//hexchat_printf(ph,"pos=%i",pos);
|
||||
if (pos==-1) return "";//NULL;
|
||||
//printf("position of %s = %i\n",info,pos);
|
||||
len=0;
|
||||
//for (i=pos;i<pos+10;i++)printf("tag[%i]=%i \n",i,tag[i]);
|
||||
for (i=0;i<4;i++) {
|
||||
len+=tag[pos+strlen(info)+i]*iPow(255,3-i);
|
||||
}
|
||||
//printf("Tag-Length: %i\n",len);
|
||||
if (strcmp("COMM",info)!=0) return substring(tag,pos+7+strlen(info),len-1);//11
|
||||
return substring(tag,pos+7+strlen(info),len-1);//11
|
||||
//char *ct=substring(tag,pos+7+strlen(info),len-1);//11
|
||||
//return substring(ct,strlen(ct)+1,len-1-strlen(ct)); //<-- do not understand, what i did here :(
|
||||
|
||||
}
|
||||
|
||||
struct tagInfo readID3V1(char *file){
|
||||
//if (DEBUG==1) putlog("reading ID3V1");
|
||||
FILE *f;
|
||||
struct tagInfo ret;
|
||||
int res, i, c, val;
|
||||
char *tag;
|
||||
char *id;
|
||||
char *tmp;
|
||||
ret.artist=NULL;
|
||||
f=fopen(file,"rb");
|
||||
if (f==NULL){
|
||||
hexchat_print(ph,"file not found while trying to read id3v1");
|
||||
//if (DEBUG==1) putlog("file not found while trying to read id3v1");
|
||||
return ret;
|
||||
}
|
||||
//int offset=getSize(file)-128;
|
||||
res=fseek(f,-128,SEEK_END);
|
||||
if (res!=0) {printf("seek failed\n");fclose(f);return ret;}
|
||||
tag = (char*) malloc(sizeof(char)*129);
|
||||
//long int pos=ftell(f);
|
||||
//printf("position= %li\n",pos);
|
||||
for (i=0;i<128;i++) {
|
||||
c=fgetc(f);
|
||||
if (c==EOF) {hexchat_printf(ph,"read ID3V1 failed\n");fclose(f);free(tag);return ret;}
|
||||
tag[i]=(char)c;
|
||||
}
|
||||
fclose(f);
|
||||
//printf("tag readed: \n");
|
||||
id=substring(tag,0,3);
|
||||
//printf("header: %s\n",id);
|
||||
res=strcmp(id,"TAG");
|
||||
free(id);
|
||||
if (res!=0){hexchat_printf(ph,"no id3 v1 found\n");free(tag);return ret;}
|
||||
ret.title=subString(tag,3,30,1);
|
||||
ret.artist=subString(tag,33,30,1);
|
||||
ret.album=subString(tag,63,30,1);
|
||||
ret.comment=subString(tag,97,30,1);
|
||||
tmp=substring(tag,127,1);
|
||||
//ret.genre=substring(tag,127,1);
|
||||
|
||||
val=(int)tmp[0];
|
||||
if (val<0)val+=256;
|
||||
//hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]);
|
||||
if ((val<148)&&(val>=0))
|
||||
ret.genre=GENRES[val];//#############changed
|
||||
else {
|
||||
ret.genre="unknown";
|
||||
//hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]);
|
||||
}
|
||||
//hexchat_printf(ph, "tmp: \"%s\" -> %i",tmp,tmp[0]);
|
||||
//hexchat_printf(ph,"genre \"%s\"",ret.genre);
|
||||
//if (DEBUG==1) putlog("id3v1 extracted");
|
||||
free(tmp);
|
||||
free(tag);
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *extractID3Genre(char *tag)
|
||||
{
|
||||
if (tag[strlen(tag) - 1] == ')')
|
||||
{
|
||||
tag[strlen(tag) - 1] = 0;
|
||||
tag = &tag[1];
|
||||
return GENRES[str2int(tag)];
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < strlen(tag); i++)
|
||||
{
|
||||
if (tag[i] == ')')
|
||||
{
|
||||
tag = &tag[i] + 1;
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "[152] failed";
|
||||
}
|
||||
|
||||
struct tagInfo readID3V2(char *file){
|
||||
//if (DEBUG==1) putlog("reading id3v2");
|
||||
FILE *f;
|
||||
int i, c, len;
|
||||
char header[10];
|
||||
char *tag;
|
||||
struct tagInfo ret;
|
||||
|
||||
f = fopen(file,"rb");
|
||||
//hexchat_printf(ph,"file :%s",file);
|
||||
if (f==NULL)
|
||||
{
|
||||
hexchat_print(ph,"file not found whilt trying to read ID3V2");
|
||||
//if (DEBUG==1)putlog("file not found while trying to read ID3V2");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret.artist=NULL;
|
||||
for (i=0;i<10;i++){
|
||||
c=fgetc(f);
|
||||
if (c==EOF){
|
||||
fclose(f);
|
||||
//putlog("found eof while reading id3v2");
|
||||
return ret;
|
||||
}
|
||||
header[i]=(char)c;
|
||||
}
|
||||
if (strstr(header,"ID3")==header){
|
||||
//hexchat_printf(ph,"found id3v2\n");
|
||||
len=0;
|
||||
for (i=6;i<10;i++) len+=(int)header[i]*iPow(256,9-i);
|
||||
|
||||
//char *tag=(char*)malloc(sizeof(char)*len);
|
||||
tag=(char*) calloc(len,sizeof(char)); //malloc(sizeof(char)*len);
|
||||
for (i=0;i<len;i++){c=fgetc(f);tag[i]=(char)c;}
|
||||
//hexchat_printf(ph,"tag length: %i\n",len);
|
||||
//hexchat_printf(ph,"tag: %s\n",tag);
|
||||
fclose(f);
|
||||
ret.comment=tagExtract(tag,len,"COMM");
|
||||
//hexchat_printf(ph,"Comment: %s\n",ret.comment);
|
||||
ret.genre=tagExtract(tag,len,"TCON");
|
||||
//if (strcmp(ret.genre,"(127)")==0) ret.genre="unknown";
|
||||
//hexchat_printf(ph, "ret.genre = %s",ret.genre);
|
||||
if ((ret.genre!=NULL)&&(ret.genre[0]=='(')) ret.genre=extractID3Genre(ret.genre);
|
||||
//hexchat_printf(ph,"genre: %s\n",ret.genre);
|
||||
ret.title=tagExtract(tag,len,"TIT2");
|
||||
//hexchat_printf(ph,"Title: %s\n",ret.title);
|
||||
ret.album=tagExtract(tag,len,"TALB");
|
||||
//hexchat_printf(ph,"Album: %s\n",ret.album);
|
||||
ret.artist=tagExtract(tag,len,"TPE1");
|
||||
//hexchat_printf(ph,"Artist: %s\n",ret.artist);
|
||||
}
|
||||
else{fclose(f);printf("no id3v2 tag found\n"); return ret;}
|
||||
//printf("id2v2 done\n");
|
||||
//if (DEBUG==1) putlog("id3v2 readed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct tagInfo readHeader(char *file){
|
||||
//if (DEBUG==1) putlog("reading header");
|
||||
FILE *f;
|
||||
//int buffer[5120];
|
||||
int versionB, layerB, bitrateB, freqB, modeB;
|
||||
int header[4];
|
||||
int count=0;
|
||||
int cc=0;
|
||||
struct tagInfo info;
|
||||
info.artist=NULL;
|
||||
|
||||
f = fopen(file,"rb");
|
||||
if (f==NULL)
|
||||
{
|
||||
hexchat_print(ph,"file not found while trying to read mp3 header");
|
||||
//if (DEBUG==1) putlog("file not found while trying to read mp3 header");
|
||||
return info;
|
||||
}
|
||||
//struct tagInfo tagv2
|
||||
|
||||
info=readID3V2(file);
|
||||
//struct tagInfo tagv1;//=readID3V1(file);
|
||||
//if (tagv2.artist!=NULL){info=tagv2;}
|
||||
//else {
|
||||
if (info.artist==NULL){
|
||||
//printf("searching for id3v1\n");
|
||||
//tagv1=readID3V1(file);
|
||||
info=readID3V1(file); //#####################
|
||||
}
|
||||
/*
|
||||
if (tagv1.artist!=NULL){
|
||||
//printf("Artist: %s\nTitle: %s\nAlbum: %s\nComment: %s\nGenre: %s\n",tagv1.artist,tagv1.title,tagv1.album,tagv1.comment,tagv1.genre);
|
||||
info=tagv1;
|
||||
}
|
||||
*/
|
||||
while ((count<5120)&&(cc!=EOF)&&(cc!=255)) {cc=fgetc(f);count++;}
|
||||
if ((cc==EOF)||(count==5119)) printf("no header found\n");
|
||||
else {
|
||||
//printf("located header at %i\n",count);
|
||||
header[0]=255;
|
||||
for (count=1;count<4;count++){
|
||||
header[count]=fgetc(f);
|
||||
//printf("header[%i]=%i\n",count,header[count]);
|
||||
}
|
||||
versionB=(header[1]&8)>>3;
|
||||
layerB=(header[1]&6)>>1;
|
||||
bitrateB=(header[2]&240)>>4; //4
|
||||
freqB=(header[2]&12)>>2;//2
|
||||
modeB=(header[3]&192)>>6;//6
|
||||
//printf("Mpeg: %i\nLayer: %i\nBitrate: %i\nFreq: %i\nMode: %i\n",versionB, layerB, bitrateB, freqB, modeB);
|
||||
//int Bitrate=RATES[versionB][layerB-1][bitrateB];
|
||||
//int Freq=FREQS[versionB][freqB];
|
||||
info.bitrate=RATES[versionB][layerB-1][bitrateB];
|
||||
info.freq=FREQS[versionB][freqB];
|
||||
info.mode=modeB;
|
||||
}
|
||||
fclose(f);
|
||||
//if (DEBUG==1) putlog("header readed");
|
||||
return info;
|
||||
}
|
||||
/*
|
||||
static void printMp3Info(char *file){
|
||||
//printf("\nScanning Mp3-File for Informations: %s\n",file);
|
||||
//printf("size:\t%10d byte\n",getSize(file));
|
||||
struct tagInfo info =readHeader(file);
|
||||
printf("%s | %10d",file,getSize(file));
|
||||
if (info.bitrate>0){
|
||||
//printf("Bitrate: %i\nFreq: %i\nMode: %s\n",info.bitrate,info.freq,MODES[info.mode]);
|
||||
printf(" | %i kbps | %i kHz | %s",info.bitrate,info.freq,MODES[info.mode]);
|
||||
//if (info.artist!=NULL) printf("\nArtist: %s\nTitle: %s\nAlbum: %s\nComment: %s\nGenre: %s\n",info.artist,info.title,info.album,info.comment,info.genre);
|
||||
if (info.artist!=NULL) {
|
||||
printf("| %s | %s | %s | %s | %s",info.artist,info.title,info.album,info.comment,info.genre);
|
||||
//printf("| %s ",info.title);//,info.title,info.album,info.comment,info.genre
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
*/
|
@ -1,160 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
//static int DEBUG=0;
|
||||
static char *VERSION="0.0.6";
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include "hexchat-plugin.h"
|
||||
static hexchat_plugin *ph;
|
||||
|
||||
#include "functions.c"
|
||||
#include "mp3Info.c"
|
||||
#include "oggInfo.c"
|
||||
#include "theme.c"
|
||||
|
||||
static int print_themes (char *word[], char *word_eol[], void *userdata){
|
||||
printThemes();
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int mpc_themeReload(char *word[], char *word_eol[], void *userdata){
|
||||
themeInit();
|
||||
loadThemes();
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int mpc_tell(char *word[], char *word_eol[], void *userdata){
|
||||
char *tTitle, *zero, *oggLine, *line;
|
||||
struct tagInfo info;
|
||||
HWND hwnd = FindWindow("MediaPlayerClassicW",NULL);
|
||||
if (hwnd==0) {hexchat_print(ph, randomLine(notRunTheme));return HEXCHAT_EAT_ALL;}
|
||||
|
||||
tTitle = g_new(char, 1024);
|
||||
GetWindowText(hwnd, tTitle, 1024);
|
||||
zero = strstr (tTitle, " - Media Player Classic");
|
||||
if (zero != NULL)
|
||||
{
|
||||
zero[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free(tTitle);
|
||||
hexchat_print(ph, "pattern not found");
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if ((tTitle[1]==':')&&(tTitle[2]=='\\')){
|
||||
//hexchat_print(ph,"seams to be full path");
|
||||
if (endsWith(tTitle,".mp3")==1){
|
||||
//hexchat_print(ph,"seams to be a mp3 file");
|
||||
info = readHeader(tTitle);
|
||||
|
||||
if ((info.artist!=NULL)&&(strcmp(info.artist,"")!=0)){
|
||||
char *mode=MODES[info.mode];
|
||||
//hexchat_printf(ph,"mode: %s\n",mode);
|
||||
char *mp3Line=randomLine(mp3Theme);
|
||||
mp3Line=replace(mp3Line,"%art",info.artist);
|
||||
mp3Line=replace(mp3Line,"%tit",info.title);
|
||||
mp3Line=replace(mp3Line,"%alb",info.album);
|
||||
mp3Line=replace(mp3Line,"%com",info.comment);
|
||||
mp3Line=replace(mp3Line,"%gen",info.genre);
|
||||
//mp3Line=replace(mp3Line,"%time",pos);
|
||||
//mp3Line=replace(mp3Line,"%length",len);
|
||||
//mp3Line=replace(mp3Line,"%ver",waVers);
|
||||
//mp3Line=intReplace(mp3Line,"%br",br);
|
||||
//mp3Line=intReplace(mp3Line,"%frq",frq);
|
||||
|
||||
mp3Line=intReplace(mp3Line,"%br",info.bitrate);
|
||||
mp3Line=intReplace(mp3Line,"%frq",info.freq);
|
||||
mp3Line=replace(mp3Line,"%mode",mode);
|
||||
//mp3Line=replace(mp3Line,"%size",size);
|
||||
//mp3Line=intReplace(mp3Line,"%perc",perc);
|
||||
//mp3Line=replace(mp3Line,"%plTitle",title);
|
||||
mp3Line=replace(mp3Line,"%file",tTitle);
|
||||
g_free(tTitle);
|
||||
hexchat_command(ph, mp3Line);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
}
|
||||
if (endsWith(tTitle,".ogg")==1){
|
||||
hexchat_printf(ph,"Ogg detected\n");
|
||||
info = getOggHeader(tTitle);
|
||||
if (info.artist!=NULL){
|
||||
char *cbr;
|
||||
if (info.cbr==1) cbr="CBR"; else cbr="VBR";
|
||||
oggLine=randomLine(oggTheme);
|
||||
//if (cue==1) oggLine=cueLine;
|
||||
//hexchat_printf(ph,"ogg-line: %s\n",oggLine);
|
||||
oggLine=replace(oggLine,"%art",info.artist);
|
||||
oggLine=replace(oggLine,"%tit",info.title);
|
||||
oggLine=replace(oggLine,"%alb",info.album);
|
||||
oggLine=replace(oggLine,"%com",info.comment);
|
||||
oggLine=replace(oggLine,"%gen",info.genre);
|
||||
//oggLine=replace(oggLine,"%time",pos);
|
||||
//oggLine=replace(oggLine,"%length",len);
|
||||
//oggLine=replace(oggLine,"%ver",waVers);
|
||||
oggLine=intReplace(oggLine,"%chan",info.mode);
|
||||
oggLine=replace(oggLine,"%cbr",cbr);
|
||||
oggLine=intReplace(oggLine,"%br",info.bitrate/1000);//br);
|
||||
oggLine=intReplace(oggLine,"%frq",info.freq);
|
||||
//oggLine=replace(oggLine,"%size",size);
|
||||
//oggLine=intReplace(oggLine,"%perc",perc);
|
||||
//oggLine=replace(oggLine,"%plTitle",title);
|
||||
oggLine=replace(oggLine,"%file",tTitle);
|
||||
g_free(tTitle);
|
||||
hexchat_command(ph, oggLine);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
line=randomLine(titleTheme);
|
||||
line=replace(line,"%title", tTitle);
|
||||
g_free(tTitle);
|
||||
hexchat_command(ph, line);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg){
|
||||
ph = plugin_handle;
|
||||
*plugin_name = "mpcInfo";
|
||||
*plugin_desc = "Information-Script for Media Player Classic";
|
||||
*plugin_version=VERSION;
|
||||
|
||||
hexchat_hook_command(ph, "mpc", HEXCHAT_PRI_NORM, mpc_tell,"no help text", 0);
|
||||
hexchat_hook_command(ph, "mpc_themes", HEXCHAT_PRI_NORM, print_themes,"no help text", 0);
|
||||
hexchat_hook_command(ph, "mpc_reloadthemes", HEXCHAT_PRI_NORM, mpc_themeReload,"no help text", 0);
|
||||
hexchat_command (ph, "MENU -ishare\\music.png ADD \"Window/Display Current Song (MPC)\" \"MPC\"");
|
||||
|
||||
themeInit();
|
||||
loadThemes();
|
||||
hexchat_printf(ph, "%s plugin loaded\n", *plugin_name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
{
|
||||
hexchat_command (ph, "MENU DEL \"Window/Display Current Song (MPC)\"");
|
||||
hexchat_print (ph, "mpcInfo plugin unloaded\n");
|
||||
return 1;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>mpcinfo</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcmpcinfo</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>mpcinfo.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>mpcinfo.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="mpcinfo.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="mpcInfo.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
@ -1,23 +0,0 @@
|
||||
<?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="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="mpcinfo.def">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="mpcInfo.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,124 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
static int getOggInt(char *buff, int beg, int bytes){
|
||||
//if (DEBUG==1) putlog("getOggInt");
|
||||
int ret=0;
|
||||
int i;
|
||||
for (i=0;i<bytes;i++){
|
||||
if (buff[i+beg]>=0) ret+=buff[i+beg]*iPow(256,i);else ret+=(256+buff[i+beg])*iPow(256,i);
|
||||
//printf("[%i]=%i\n",i,buff[i+beg]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *upperStr(char *text)
|
||||
{
|
||||
char *ret = (char*) malloc(sizeof(char)*(strlen(text) + 1));
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < strlen(text); i++)
|
||||
{
|
||||
ret[i] = toupper(text[i]);
|
||||
}
|
||||
|
||||
ret[strlen(text)] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct tagInfo getOggHeader(char *file){
|
||||
//if (DEBUG==1) putlog("reading ogg header");
|
||||
char header[4096];
|
||||
int i, c;
|
||||
int h1pos, h3pos, maxBr, nomBr, minBr, pos, count, tagLen;
|
||||
char *sub;
|
||||
char *name;
|
||||
char *val;
|
||||
char HEADLOC1[]="_vorbis", HEADLOC3[]="_vorbis", HEADLOC5[]="_vorbis";
|
||||
FILE *f;
|
||||
struct tagInfo info;
|
||||
|
||||
info.artist=NULL;
|
||||
f = fopen(file,"rb");
|
||||
if (f==NULL){
|
||||
hexchat_print(ph,"file not found while trying to read ogg header");
|
||||
//if (DEBUG==1) putlog("file not found while trying to read ogg header");
|
||||
return info;
|
||||
}
|
||||
|
||||
for (i=0;i<4095;i++) {c=fgetc(f);header[i]=(char)c;}
|
||||
fclose(f);
|
||||
HEADLOC1[0]=1;
|
||||
HEADLOC3[0]=3;
|
||||
HEADLOC5[0]=5;
|
||||
h1pos=inStr(header,4096,HEADLOC1);
|
||||
h3pos=inStr(header,4096,HEADLOC3);
|
||||
//int h5pos=inStr(header,4096,HEADLOC5); //not needed
|
||||
|
||||
//printf("loc1: %i\n",h1pos);printf("loc3: %i\n",h3pos);printf("loc5: %i\n",h5pos);
|
||||
maxBr=getOggInt(header,h1pos+7+9,4);
|
||||
nomBr=getOggInt(header,h1pos+7+13,4);
|
||||
minBr=getOggInt(header,h1pos+7+17,4);
|
||||
info.freq=getOggInt(header,h1pos+7+5,4);
|
||||
info.mode=header[h1pos+7+4];
|
||||
info.bitrate=nomBr;
|
||||
if (((maxBr==nomBr)&&(nomBr=minBr))||((minBr==0)&&(maxBr==0))||((minBr=-1)&&(maxBr=-1)) )info.cbr=1;else info.cbr=0;
|
||||
printf("bitrates: %i|%i|%i\n",maxBr,nomBr,minBr);
|
||||
printf("freq: %u\n",info.freq);
|
||||
pos=h3pos+7;
|
||||
pos+=getOggInt(header,pos,4)+4;
|
||||
count=getOggInt(header,pos,4);
|
||||
//printf("tags: %i\n",count);
|
||||
pos+=4;
|
||||
|
||||
info.artist=NULL;info.title=NULL;info.album=NULL;info.comment=NULL;info.genre=NULL;
|
||||
for (i=0;i<count;i++){
|
||||
tagLen=getOggInt(header,pos,4);
|
||||
//printf("taglength: %i\n",tagLen);
|
||||
sub=substring(header,pos+4,tagLen);
|
||||
name=upperStr(substring(sub,0,inStr(sub,tagLen,"=")));
|
||||
val=substring(sub,inStr(sub,tagLen,"=")+1,tagLen-inStr(sub,tagLen,"=")-1);
|
||||
//printf("Tag: %s\n",sub);
|
||||
//printf("Name: %s\n",name);
|
||||
//printf("value: %s\n",val);
|
||||
if (strcmp(name,"ARTIST")==0) info.artist=val;
|
||||
if (strcmp(name,"TITLE")==0) info.title=val;
|
||||
if (strcmp(name,"ALBUM")==0) info.album=val;
|
||||
if (strcmp(name,"GENRE")==0) info.genre=val;
|
||||
if (strcmp(name,"COMMENT")==0) info.comment=val;
|
||||
pos+=4+tagLen;
|
||||
free(name);
|
||||
}
|
||||
if (info.artist==NULL) info.artist="";
|
||||
if (info.album==NULL) info.album ="";
|
||||
if (info.title==NULL) info.title="";
|
||||
if (info.genre==NULL) info.genre="";
|
||||
if (info.comment==NULL) info.comment="";
|
||||
|
||||
printf("Artist: %s\nTitle: %s\nAlbum: %s\n",info.artist,info.title, info.album);
|
||||
printf("Genre: %s\nComment: %s\nMode: %i\nCBR: %i\n",info.genre,info.comment,info.mode,info.cbr);
|
||||
//if (DEBUG==1) putlog("ogg header readed");
|
||||
return info;
|
||||
}
|
||||
|
||||
/*
|
||||
void printOggInfo(char *file){
|
||||
printf("Scanning Ogg-File for Informations: %s\n",file);
|
||||
printf("size:\t%10d byte\n",getSize(file));
|
||||
struct tagInfo info = getOggHeader(file);
|
||||
}
|
||||
*/
|
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
struct theme{
|
||||
int size;
|
||||
char **line;
|
||||
};
|
||||
|
||||
static struct theme notRunTheme;
|
||||
static struct theme titleTheme;
|
||||
static struct theme mp3Theme;
|
||||
static struct theme oggTheme;
|
||||
|
||||
|
||||
void themeInit(){
|
||||
//if (DEBUG==1) putlog("init theme");
|
||||
/*mp3Theme.size=0;oggTheme.size=0;cueTheme.size=0;streamTheme.size=0;etcTheme.size=0;
|
||||
stopTheme.size=0;pauseTheme.size=0;*/
|
||||
|
||||
notRunTheme.size=0;titleTheme.size=0;
|
||||
srand((unsigned int)time((time_t *)NULL));
|
||||
//if (DEBUG==1) putlog("theme init done");
|
||||
}
|
||||
|
||||
void printTheme(struct theme data){
|
||||
int i;
|
||||
for (i=0;i<data.size;i++) hexchat_printf(ph,"line[%i]=%s\n",i,data.line[i]);
|
||||
}
|
||||
|
||||
void printThemes(){
|
||||
hexchat_printf(ph,"\nNotRun-Theme:\n");printTheme(notRunTheme);
|
||||
hexchat_printf(ph,"\nMP3-Theme:\n");printTheme(mp3Theme);
|
||||
hexchat_printf(ph,"\nOGG-Theme:\n");printTheme(oggTheme);
|
||||
hexchat_printf(ph,"\nTitle-Theme:\n");printTheme(titleTheme);
|
||||
}
|
||||
|
||||
void cbFix(char *line)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < strlen(line); i++)
|
||||
{
|
||||
size_t j;
|
||||
|
||||
if (line[i] == '%')
|
||||
{
|
||||
if ((line[i + 1] == 'C') || (line[i + 1] == 'B') || (line[i + 1] == 'U') || (line[i + 1] == 'O') || (line[i + 1] == 'R'))
|
||||
{
|
||||
if (line[i + 1] == 'C') line[i] = 3;
|
||||
if (line[i + 1] == 'B') line[i] = 2;
|
||||
if (line[i + 1] == 'U') line[i] = 37;
|
||||
if (line[i + 1] == 'O') line[i] = 17;
|
||||
if (line[i + 1] == 'R') line[i] = 26;
|
||||
|
||||
for (j = i + 1; j < strlen(line) - 1; j++)
|
||||
{
|
||||
line[j] = line[j + 1];
|
||||
}
|
||||
|
||||
line[strlen(line) - 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct theme themeAdd(struct theme data, char *info){
|
||||
//if (DEBUG==1) putlog("adding theme");
|
||||
struct theme ret;
|
||||
char **newLine=(char **)calloc(data.size+1,sizeof(char*));
|
||||
int i;
|
||||
for (i=0;i<data.size;i++) newLine[i]=data.line[i];
|
||||
cbFix(info);
|
||||
newLine[data.size]=info;
|
||||
ret.line=newLine;ret.size=data.size+1;
|
||||
//if (DEBUG==1) putlog("theme added");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void loadThemes(){
|
||||
char *hDir, *hFile, *line, *lineCap, *val;
|
||||
FILE *f;
|
||||
hexchat_print(ph,"loading themes\n");
|
||||
hDir=(char*)calloc(1024,sizeof(char));
|
||||
strcpy(hDir,hexchat_get_info(ph,"configdir"));
|
||||
hFile=str3cat(hDir,"\\","mpcInfo.theme.txt");
|
||||
f = fopen(hFile,"r");
|
||||
free(hDir);
|
||||
free(hFile);
|
||||
if(f==NULL)
|
||||
{
|
||||
hexchat_print(ph,"no theme in homedir, checking global theme");
|
||||
f=fopen("mpcInfo.theme.txt","r");
|
||||
}
|
||||
//hexchat_printf(ph,"file_desc: %p\n",f);
|
||||
if (f==NULL) hexchat_print(ph, "no theme found, using hardcoded\n");
|
||||
else {
|
||||
if (f > 0)
|
||||
{
|
||||
line=" ";
|
||||
} else
|
||||
{
|
||||
line="\0";
|
||||
}
|
||||
|
||||
while (line[0]!=0)
|
||||
{
|
||||
line=readLine(f);
|
||||
val=split(line,'=');
|
||||
printf("line: %s\n",line);
|
||||
printf("val: %s\n",val);
|
||||
lineCap=toUpper(line);
|
||||
if (strcmp(lineCap,"OFF_LINE")==0) notRunTheme=themeAdd(notRunTheme,val);
|
||||
if (strcmp(lineCap,"TITLE_LINE")==0) titleTheme=themeAdd(titleTheme,val);
|
||||
if (strcmp(lineCap,"MP3_LINE")==0) mp3Theme=themeAdd(mp3Theme,val);
|
||||
if (strcmp(lineCap,"OGG_LINE")==0) mp3Theme=themeAdd(oggTheme,val);
|
||||
free(lineCap);
|
||||
}
|
||||
fclose(f);
|
||||
hexchat_print(ph, "theme loaded successfull\n");
|
||||
}
|
||||
if (notRunTheme.size==0) notRunTheme=themeAdd(notRunTheme,"Media Player Classic not running");
|
||||
if (titleTheme.size==0) titleTheme=themeAdd(titleTheme,"say Playing %title in Media Player Classic");
|
||||
if (mp3Theme.size==0) mp3Theme=themeAdd(mp3Theme,"me listens to %art with %tit from %alb [%gen|%br kbps|%frq kHz|%mode] in Media Player Classic ");
|
||||
if (oggTheme.size==0) oggTheme=themeAdd(oggTheme,"me listens to %art with %tit from %alb [%gen|%br kbps|%frq kHz|%chan channels] in Media Player Classic ");
|
||||
//mp3Theme=themeAdd(mp3Theme,"me listens to %art with %tit from %alb [%time|%length|%perc%|%br kbps|%frq kHz|%mode] in Media Player Classic ");
|
||||
}
|
||||
|
||||
int rnd(int max){
|
||||
return rand()%max;
|
||||
}
|
||||
|
||||
char *randomLine(struct theme data){
|
||||
return data.line[rnd(data.size)];
|
||||
}
|
@ -51,7 +51,7 @@ sub get_context;
|
||||
sub HexChat::Internal::context_info;
|
||||
sub HexChat::Internal::print;
|
||||
|
||||
#keep compability with Xchat scripts
|
||||
#keep compatibility with Xchat scripts
|
||||
sub EAT_XCHAT ();
|
||||
BEGIN {
|
||||
*Xchat:: = *HexChat::;
|
||||
|
@ -13,19 +13,24 @@ hexchat_perl_module = custom_target('hexchat-perl-header',
|
||||
command: [generate_perl_header, '@OUTPUT@', '@INPUT@']
|
||||
)
|
||||
|
||||
irc_perl_module = custom_target('irc-perl-header',
|
||||
input: 'lib/IRC.pm',
|
||||
output: 'irc.pm.h',
|
||||
command: [generate_perl_header, '@OUTPUT@', '@INPUT@']
|
||||
)
|
||||
perl_cflags = []
|
||||
irc_perl_module = []
|
||||
|
||||
perl = find_program('perl')
|
||||
if get_option('with-perl-legacy-api')
|
||||
irc_perl_module = custom_target('irc-perl-header',
|
||||
input: 'lib/IRC.pm',
|
||||
output: 'irc.pm.h',
|
||||
command: [generate_perl_header, '@OUTPUT@', '@INPUT@']
|
||||
)
|
||||
perl_cflags += '-DOLD_PERL'
|
||||
endif
|
||||
|
||||
perl = find_program(get_option('with-perl'))
|
||||
|
||||
ret = run_command([perl, '-MExtUtils::Embed', '-e', 'ccopts'])
|
||||
if ret.returncode() != 0
|
||||
error('perl: Failed to get cflags')
|
||||
endif
|
||||
perl_cflags = []
|
||||
foreach flag : ret.stdout().strip().split(' ')
|
||||
if flag.startswith('-I') or flag.startswith('-D')
|
||||
perl_cflags += flag
|
||||
@ -71,11 +76,14 @@ int main(void) {
|
||||
error('found perl not suitable for plugin')
|
||||
endif
|
||||
|
||||
perl_dep = declare_dependency(
|
||||
compile_args: perl_cflags,
|
||||
link_args: perl_ldflags
|
||||
)
|
||||
|
||||
shared_module('perl',
|
||||
sources: ['perl.c', hexchat_perl_module, irc_perl_module],
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep],
|
||||
c_args: perl_cflags,
|
||||
link_args: perl_ldflags,
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep, perl_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
install_rpath: perl_rpath,
|
||||
|
@ -1532,7 +1532,7 @@ Plugin_New(char *filename, PyObject *xcoobj)
|
||||
if (filename) {
|
||||
#ifdef WIN32
|
||||
char *file;
|
||||
if (!g_file_get_contents_utf8(filename, &file, NULL, NULL)) {
|
||||
if (!g_file_get_contents(filename, &file, NULL, NULL)) {
|
||||
hexchat_printf(ph, "Can't open file %s: %s\n",
|
||||
filename, strerror(errno));
|
||||
goto error;
|
||||
@ -2806,6 +2806,9 @@ hexchat_plugin_deinit(void)
|
||||
xchatout_buffer = NULL;
|
||||
|
||||
if (interp_plugin) {
|
||||
PyThreadState *tstate = ((PluginObject*)interp_plugin)->tstate;
|
||||
PyThreadState_Swap(tstate);
|
||||
Py_EndInterpreter(tstate);
|
||||
Py_DECREF(interp_plugin);
|
||||
interp_plugin = NULL;
|
||||
}
|
||||
|
@ -5,22 +5,23 @@ sysinfo_sources = [
|
||||
|
||||
sysinfo_deps = [
|
||||
libgio_dep,
|
||||
hexchat_plugin_dep
|
||||
hexchat_plugin_dep,
|
||||
common_sysinfo_deps,
|
||||
]
|
||||
|
||||
sysinfo_includes = []
|
||||
sysinfo_cargs = []
|
||||
|
||||
system = host_machine.system()
|
||||
if system == 'linux' or system == 'darwin'
|
||||
if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'darwin'
|
||||
sysinfo_includes += 'shared'
|
||||
sysinfo_sources += [
|
||||
'shared/df.c'
|
||||
]
|
||||
|
||||
if system == 'linux'
|
||||
libpci = dependency('libpci', required: false)
|
||||
if libpci.found() and cc.has_header('pci/pci.h')
|
||||
if system == 'linux' or system == 'gnu' or system.startswith('gnu/')
|
||||
libpci = dependency('libpci', required: false, method: 'pkg-config')
|
||||
if libpci.found()
|
||||
sysinfo_deps += libpci
|
||||
sysinfo_cargs += '-DHAVE_LIBPCI'
|
||||
sysinfo_sources += 'unix/pci.c'
|
||||
@ -41,7 +42,10 @@ if system == 'linux' or system == 'darwin'
|
||||
endif
|
||||
|
||||
elif system == 'windows'
|
||||
sysinfo_sources += 'win32/backend.c'
|
||||
sysinfo_sources += [
|
||||
'win32/backend.c',
|
||||
'../../src/common/sysinfo/win32/backend.c'
|
||||
]
|
||||
else
|
||||
error('sysinfo: Unknown system?')
|
||||
endif
|
||||
|
@ -26,7 +26,7 @@ int xs_parse_df(gint64 *out_total, gint64 *out_free)
|
||||
FILE *pipe;
|
||||
char buffer[bsize];
|
||||
|
||||
pipe = popen("df -k -l -P", "r");
|
||||
pipe = popen("df -k -l -P --exclude-type=squashfs --exclude-type=devtmpfs --exclude-type=tmpfs", "r");
|
||||
if(pipe==NULL)
|
||||
return 1;
|
||||
|
||||
|
@ -269,6 +269,16 @@ int xs_parse_meminfo(unsigned long long *mem_tot, unsigned long long *mem_free,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void strip_quotes(char *string)
|
||||
{
|
||||
size_t len = strlen(string);
|
||||
if (string[len - 1] == '"')
|
||||
string[--len] = '\0';
|
||||
|
||||
if (string[0] == '"')
|
||||
memmove(string, string + 1, len);
|
||||
}
|
||||
|
||||
int xs_parse_distro(char *name)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
@ -320,6 +330,20 @@ int xs_parse_distro(char *name)
|
||||
else
|
||||
g_snprintf(buffer, bsize, "Gentoo Linux %s", keywords);
|
||||
}
|
||||
else if((fp = fopen("/etc/os-release", "r")) != NULL)
|
||||
{
|
||||
char name[bsize], version[bsize];
|
||||
strcpy(name, "?");
|
||||
strcpy(version, "?");
|
||||
while(fgets(buffer, bsize, fp) != NULL)
|
||||
{
|
||||
find_match_char(buffer, "NAME=", name);
|
||||
find_match_char(buffer, "VERSION=", version);
|
||||
}
|
||||
strip_quotes(name);
|
||||
strip_quotes(version);
|
||||
g_snprintf(buffer, bsize, "%s %s", name, version);
|
||||
}
|
||||
else
|
||||
g_snprintf(buffer, bsize, "Unknown Distro");
|
||||
if(fp != NULL)
|
||||
|
@ -142,7 +142,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
|
||||
{
|
||||
position = strstr(buffer, vendor);
|
||||
position += 6;
|
||||
strncpy(vendorname, position, bsize/2);
|
||||
g_strlcpy(vendorname, position, sizeof (vendorname));
|
||||
position = strstr(vendorname, "\n");
|
||||
*(position) = '\0';
|
||||
break;
|
||||
@ -154,7 +154,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
|
||||
{
|
||||
position = strstr(buffer, device);
|
||||
position += 6;
|
||||
strncpy(devicename, position, bsize/2);
|
||||
g_strlcpy(devicename, position, sizeof (devicename));
|
||||
position = strstr(devicename, " (");
|
||||
if (position == NULL)
|
||||
position = strstr(devicename, "\n");
|
||||
|
@ -30,14 +30,7 @@
|
||||
|
||||
#include "../format.h"
|
||||
|
||||
static int command_callback (char *word[], char *word_eol[], void *user_data);
|
||||
|
||||
void print_info (void);
|
||||
|
||||
guint64 hdd_capacity;
|
||||
guint64 hdd_free_space;
|
||||
char *read_hdd_info (IWbemClassObject *object);
|
||||
char *get_memory_info (void);
|
||||
static char *get_memory_info (void);
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_sound (void)
|
||||
@ -98,11 +91,6 @@ sysinfo_backend_get_os (void)
|
||||
return sysinfo_get_os ();
|
||||
}
|
||||
|
||||
static int get_cpu_arch (void)
|
||||
{
|
||||
return sysinfo_get_cpu_arch ();
|
||||
}
|
||||
|
||||
static char *get_memory_info (void)
|
||||
{
|
||||
MEMORYSTATUSEX meminfo = { 0 };
|
||||
|
@ -1,6 +1,6 @@
|
||||
data/misc/hexchat.appdata.xml.in
|
||||
data/misc/hexchat.desktop.in.in
|
||||
data/misc/htm.desktop.in
|
||||
data/misc/io.github.Hexchat.appdata.xml.in
|
||||
data/misc/io.github.Hexchat.desktop.in.in
|
||||
data/misc/io.github.Hexchat.ThemeManager.desktop.in
|
||||
src/common/cfgfiles.c
|
||||
src/common/chanopt.c
|
||||
src/common/dcc.c
|
||||
|
@ -1 +1 @@
|
||||
data/misc/hexchat.desktop.in.in
|
||||
data/misc/io.github.Hexchat.desktop.in.in
|
||||
|
988
po/en_GB.po
988
po/en_GB.po
File diff suppressed because it is too large
Load Diff
877
po/ja_JP.po
877
po/ja_JP.po
File diff suppressed because it is too large
Load Diff
@ -1 +1,9 @@
|
||||
i18n.gettext('hexchat', preset: 'glib')
|
||||
|
||||
validate_translations = find_program('validate-textevent-translations')
|
||||
test('Validate translations', validate_translations,
|
||||
args: [
|
||||
join_paths(meson.current_source_dir(), 'LINGUAS'),
|
||||
meson.current_source_dir(),
|
||||
]
|
||||
)
|
||||
|
933
po/pt_BR.po
933
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
888
po/sr@latin.po
888
po/sr@latin.po
File diff suppressed because it is too large
Load Diff
69
po/validate-textevent-translations
Executable file
69
po/validate-textevent-translations
Executable file
@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
ret = 0
|
||||
|
||||
|
||||
def log(prefix, suffix, fallback):
|
||||
try:
|
||||
print(prefix, suffix) # Non-utf8 output...
|
||||
except UnicodeEncodeError:
|
||||
print(prefix, fallback)
|
||||
|
||||
|
||||
def validate_translation(input, translation):
|
||||
if not translation:
|
||||
return True
|
||||
|
||||
if re.findall(r'(?:(?<!%)%[^%OCRUHBIH]|\$[^at1234])', translation):
|
||||
log('Translation includes invalid formatting:', translation, input)
|
||||
return False
|
||||
|
||||
in_vars = re.findall(r'(\$(?:\d|t))', input)
|
||||
if not all(var in translation for var in in_vars):
|
||||
log('Translation does not contain all variables:', translation, input)
|
||||
return False
|
||||
|
||||
in_ascii = re.findall(r'\$a(\d{3})', translation)
|
||||
if any(int(i) > 256 for i in in_ascii):
|
||||
log('Translation contains invalid ascii value:', translation, input)
|
||||
return False
|
||||
|
||||
# We could try to validate colors but that is pretty flexible
|
||||
return True
|
||||
|
||||
|
||||
def validate_language(path):
|
||||
global ret
|
||||
|
||||
print('Validating', path)
|
||||
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
in_event = False
|
||||
event_input = ''
|
||||
|
||||
for line in f:
|
||||
if 'textevents.h' in line:
|
||||
in_event = True
|
||||
elif in_event is False:
|
||||
continue
|
||||
elif line.startswith('msgid'):
|
||||
event_input = line[7:-2]
|
||||
elif line.startswith('msgstr'):
|
||||
if not validate_translation(event_input, line[8:-2]):
|
||||
ret = 1
|
||||
in_event = False
|
||||
elif line == '\n':
|
||||
print('Failed to find translation for', event_input)
|
||||
in_event = False
|
||||
|
||||
|
||||
with open(sys.argv[1], 'r') as linguas:
|
||||
for lang in linguas:
|
||||
path = os.path.join(sys.argv[2], lang.strip() + '.po')
|
||||
validate_language(path)
|
||||
|
||||
sys.exit(ret)
|
1205
po/zh_CN.po
1205
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
997
po/zh_TW.po
997
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@ -111,11 +111,10 @@
|
||||
<PreBuildEvent>
|
||||
<Command><![CDATA[
|
||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||
"$(HexChatLib)make-te.exe" < "$(ProjectDir)textevents.in" > "$(HexChatLib)textevents.h" 2> "$(HexChatLib)textenums.h"
|
||||
"$(Python3Path)\python.exe" $(ProjectDir)make-te.py "$(ProjectDir)textevents.in" "$(HexChatLib)textevents.h" "$(HexChatLib)textenums.h"
|
||||
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\config.h.tt" "$(HexChatLib)config.h"
|
||||
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --header "$(ProjectDir)marshalers.list" > "$(HexChatLib)marshal.h"
|
||||
"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --body "$(ProjectDir)marshalers.list" > "$(HexChatLib)marshal.c"
|
||||
|
||||
"$(Python3Path)\python.exe" "$(DepsRoot)\bin\glib-genmarshal" --prefix=_hexchat_marshal --header "$(ProjectDir)marshalers.list" --output "$(HexChatLib)marshal.h"
|
||||
"$(Python3Path)\python.exe" "$(DepsRoot)\bin\glib-genmarshal" --prefix=_hexchat_marshal --body "$(ProjectDir)marshalers.list" --output "$(HexChatLib)marshal.c"
|
||||
]]></Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "hexchat.h"
|
||||
#include "hexchatc.h"
|
||||
|
||||
#define DBUS_SERVICE "org.hexchat.service"
|
||||
#define DBUS_REMOTE_PATH "/org/hexchat/Remote"
|
||||
#define DBUS_REMOTE_INTERFACE "org.hexchat.plugin"
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#define PDESC _("plugin for remote access using DBUS")
|
||||
#define PVERSION ""
|
||||
|
||||
#define DBUS_SERVICE "org.hexchat.service"
|
||||
#define DBUS_OBJECT_PATH "/org/hexchat"
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
|
@ -14,11 +14,22 @@ dbus_includes = [
|
||||
|
||||
dbus_service_dir = join_paths(get_option('datadir'), 'dbus-1/services')
|
||||
|
||||
if get_option('dbus-service-use-appid')
|
||||
dbus_service_name = 'io.github.Hexchat'
|
||||
dbus_output_file = 'io.github.Hexchat.service'
|
||||
dbus_cargs = '-DDBUS_SERVICE="io.github.Hexchat"'
|
||||
else
|
||||
dbus_service_name = 'org.hexchat.service'
|
||||
dbus_output_file = 'org.hexchat.service.service'
|
||||
dbus_cargs = '-DDBUS_SERVICE="org.hexchat.service"'
|
||||
endif
|
||||
|
||||
dbus_conf = configuration_data()
|
||||
dbus_conf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
|
||||
dbus_conf.set('service_name', dbus_service_name)
|
||||
configure_file(
|
||||
input: 'org.hexchat.service.service.in',
|
||||
output: 'org.hexchat.service.service',
|
||||
output: dbus_output_file,
|
||||
configuration: dbus_conf,
|
||||
install: true,
|
||||
install_dir: dbus_service_dir
|
||||
@ -34,6 +45,7 @@ dbus_remote_object = custom_target('remote-object-glue',
|
||||
|
||||
hexchat_dbus = static_library('hexchatdbus',
|
||||
sources: [dbus_remote_object, marshal] + dbus_sources,
|
||||
c_args: dbus_cargs,
|
||||
dependencies: common_deps + dbus_deps,
|
||||
include_directories: dbus_includes,
|
||||
pic: true
|
||||
|
@ -1,3 +1,3 @@
|
||||
[D-BUS Service]
|
||||
Name=org.hexchat.service
|
||||
Name=@service_name@
|
||||
Exec=@bindir@/hexchat
|
||||
|
@ -59,8 +59,8 @@
|
||||
#include "hexchatc.h"
|
||||
|
||||
/* Setting _FILE_OFFSET_BITS to 64 doesn't change lseek to use off64_t on Windows, so override lseek to the version that does */
|
||||
#ifdef WIN32
|
||||
#define lseek _lseeki64
|
||||
#if defined(WIN32) && (!defined(__MINGW32__) && !defined(__MINGW64__))
|
||||
#define lseek _lseeki64
|
||||
#endif
|
||||
|
||||
/* interval timer to detect timeouts */
|
||||
@ -1006,7 +1006,7 @@ dcc_socks_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
|
||||
sc.type = 1;
|
||||
sc.port = htons (dcc->port);
|
||||
sc.address = htonl (dcc->addr);
|
||||
strncpy (sc.username, prefs.hex_irc_user_name, 9);
|
||||
g_strlcpy (sc.username, prefs.hex_irc_user_name, sizeof (sc.username));
|
||||
memcpy (proxy->buffer, &sc, sizeof (sc));
|
||||
proxy->buffersize = 8 + strlen (sc.username) + 1;
|
||||
proxy->bufferused = 0;
|
||||
@ -1618,13 +1618,13 @@ dcc_accept (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
|
||||
}
|
||||
|
||||
guint32
|
||||
dcc_get_my_address (void) /* the address we'll tell the other person */
|
||||
dcc_get_my_address (session *sess) /* the address we'll tell the other person */
|
||||
{
|
||||
struct hostent *dns_query;
|
||||
guint32 addr = 0;
|
||||
|
||||
if (prefs.hex_dcc_ip_from_server && prefs.dcc_ip)
|
||||
addr = prefs.dcc_ip;
|
||||
if (prefs.hex_dcc_ip_from_server && sess->server->dcc_ip)
|
||||
addr = sess->server->dcc_ip;
|
||||
else if (prefs.hex_dcc_ip[0])
|
||||
{
|
||||
dns_query = gethostbyname ((const char *) prefs.hex_dcc_ip);
|
||||
@ -1710,7 +1710,7 @@ dcc_listen_init (struct DCC *dcc, session *sess)
|
||||
/*if we have a dcc_ip, we use that, so the remote client can connect*/
|
||||
/*else we try to take an address from hex_dcc_ip*/
|
||||
/*if something goes wrong we tell the client to connect to our LAN ip*/
|
||||
dcc->addr = dcc_get_my_address ();
|
||||
dcc->addr = dcc_get_my_address (sess);
|
||||
|
||||
/*if nothing else worked we use the address we bound to*/
|
||||
if (dcc->addr == 0)
|
||||
|
@ -124,7 +124,7 @@ void dcc_chat (session *sess, char *nick, int passive);
|
||||
void handle_dcc (session *sess, char *nick, char *word[], char *word_eol[],
|
||||
const message_tags_data *tags_data);
|
||||
void dcc_show_list (session *sess);
|
||||
guint32 dcc_get_my_address (void);
|
||||
guint32 dcc_get_my_address (session *sess);
|
||||
void dcc_get_with_destfile (struct DCC *dcc, char *utf8file);
|
||||
|
||||
#endif
|
||||
|
@ -313,7 +313,6 @@ struct hexchatprefs
|
||||
|
||||
/* these are the private variables */
|
||||
guint32 local_ip;
|
||||
guint32 dcc_ip;
|
||||
|
||||
unsigned int wait_on_exit; /* wait for logs to be flushed to disk IF we're connected */
|
||||
|
||||
@ -482,6 +481,10 @@ typedef struct server
|
||||
int proxy_sok4;
|
||||
int proxy_sok6;
|
||||
int id; /* unique ID number (for plugin API) */
|
||||
|
||||
/* dcc_ip moved from haxchatprefs to make it per-server */
|
||||
guint32 dcc_ip;
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
SSL_CTX *ctx;
|
||||
SSL *ssl;
|
||||
@ -575,6 +578,7 @@ typedef struct server
|
||||
unsigned int sasl_mech; /* mechanism for sasl auth */
|
||||
unsigned int sent_capend:1; /* have sent CAP END yet */
|
||||
unsigned int waiting_on_cap:1; /* waiting on another line of CAP LS */
|
||||
unsigned int waiting_on_sasl:1; /* waiting on sasl */
|
||||
#ifdef USE_OPENSSL
|
||||
unsigned int use_ssl:1; /* is server SSL capable? */
|
||||
unsigned int accept_invalid_cert:1;/* ignore result of server's cert. verify */
|
||||
|
@ -340,17 +340,6 @@ flood_autodialog_timeout (gpointer data)
|
||||
int
|
||||
flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ctcp 1=priv */
|
||||
{
|
||||
/*
|
||||
serv
|
||||
int ctcp_counter;
|
||||
time_t ctcp_last_time;
|
||||
prefs
|
||||
unsigned int ctcp_number_limit;
|
||||
unsigned int ctcp_time_limit;
|
||||
*/
|
||||
char buf[512];
|
||||
char real_ip[132];
|
||||
int i;
|
||||
time_t current_time;
|
||||
current_time = time (NULL);
|
||||
|
||||
@ -367,20 +356,24 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
|
||||
serv->ctcp_counter++;
|
||||
if (serv->ctcp_counter == prefs.hex_flood_ctcp_num) /*if we reached the maximun numbers of ctcp in the seconds limits */
|
||||
{
|
||||
char *mask, *message, *real_ip;
|
||||
|
||||
serv->ctcp_last_time = current_time; /*we got the flood, restore all the vars for next one */
|
||||
serv->ctcp_counter = 0;
|
||||
for (i = 0; i < 128; i++)
|
||||
if (ip[i] == '@')
|
||||
break;
|
||||
g_snprintf (real_ip, sizeof (real_ip), "*!*%s", &ip[i]);
|
||||
|
||||
g_snprintf (buf, sizeof (buf),
|
||||
_("You are being CTCP flooded from %s, ignoring %s\n"),
|
||||
nick, real_ip);
|
||||
PrintText (sess, buf);
|
||||
real_ip = strchr (ip, '@');
|
||||
if (real_ip != NULL)
|
||||
mask = g_strdup_printf ("*!*%s", real_ip);
|
||||
else
|
||||
mask = g_strdup_printf ("%s!*", nick);
|
||||
|
||||
/* ignore CTCP */
|
||||
ignore_add (real_ip, IG_CTCP, FALSE);
|
||||
message = g_strdup_printf (_("You are being CTCP flooded from %s, ignoring %s\n"), nick, mask);
|
||||
|
||||
PrintText (sess, message);
|
||||
ignore_add (mask, IG_CTCP, FALSE);
|
||||
|
||||
g_free (message);
|
||||
g_free (mask);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -396,6 +389,7 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
|
||||
if (difftime (current_time, serv->msg_last_time) <
|
||||
prefs.hex_flood_msg_time)
|
||||
{
|
||||
char buf[512];
|
||||
serv->msg_counter++;
|
||||
if (serv->msg_counter == prefs.hex_flood_msg_num) /*if we reached the maximun numbers of ctcp in the seconds limits */
|
||||
{
|
||||
|
@ -1420,7 +1420,7 @@ inbound_foundip (session *sess, char *ip, const message_tags_data *tags_data)
|
||||
HostAddr = gethostbyname (ip);
|
||||
if (HostAddr)
|
||||
{
|
||||
prefs.dcc_ip = ((struct in_addr *) HostAddr->h_addr)->s_addr;
|
||||
sess->server->dcc_ip = ((struct in_addr *) HostAddr->h_addr)->s_addr;
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_FOUNDIP, sess->server->server_session,
|
||||
inet_ntoa (*((struct in_addr *) HostAddr->h_addr)),
|
||||
NULL, NULL, NULL, 0, tags_data->timestamp);
|
||||
@ -1768,7 +1768,6 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
||||
{
|
||||
char buffer[500]; /* buffer for requesting capabilities and emitting the signal */
|
||||
gboolean want_cap = FALSE; /* format the CAP REQ string based on previous capabilities being requested or not */
|
||||
gboolean want_sasl = FALSE; /* CAP END shouldn't be sent when SASL is requested, it needs further responses */
|
||||
char **extensions;
|
||||
int i;
|
||||
|
||||
@ -1816,7 +1815,7 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
||||
serv->sasl_mech = sasl_mech;
|
||||
}
|
||||
want_cap = TRUE;
|
||||
want_sasl = TRUE;
|
||||
serv->waiting_on_sasl = TRUE;
|
||||
g_strlcat (buffer, "sasl ", sizeof(buffer));
|
||||
continue;
|
||||
}
|
||||
@ -1842,7 +1841,7 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
||||
tags_data->timestamp);
|
||||
tcp_sendf (serv, "%s\r\n", g_strchomp (buffer));
|
||||
}
|
||||
if (!want_sasl && !serv->waiting_on_cap)
|
||||
if (!serv->waiting_on_sasl && !serv->waiting_on_cap)
|
||||
{
|
||||
/* if we use SASL, CAP END is dealt via raw numerics */
|
||||
serv->sent_capend = TRUE;
|
||||
@ -1851,13 +1850,25 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
||||
}
|
||||
|
||||
void
|
||||
inbound_cap_nak (server *serv, const message_tags_data *tags_data)
|
||||
inbound_cap_nak (server *serv, char *extensions_str, const message_tags_data *tags_data)
|
||||
{
|
||||
if (!serv->waiting_on_cap && !serv->sent_capend)
|
||||
char **extensions;
|
||||
int i;
|
||||
|
||||
extensions = g_strsplit (extensions_str, " ", 0);
|
||||
for (i=0; extensions[i]; i++)
|
||||
{
|
||||
if (!g_strcmp0 (extensions[i], "sasl"))
|
||||
serv->waiting_on_sasl = FALSE;
|
||||
}
|
||||
|
||||
if (!serv->waiting_on_cap && !serv->waiting_on_sasl && !serv->sent_capend)
|
||||
{
|
||||
serv->sent_capend = TRUE;
|
||||
tcp_send_len (serv, "CAP END\r\n", 9);
|
||||
}
|
||||
|
||||
g_strfreev (extensions);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -92,7 +92,7 @@ void inbound_cap_ack (server *serv, char *nick, char *extensions,
|
||||
const message_tags_data *tags_data);
|
||||
void inbound_cap_ls (server *serv, char *nick, char *extensions,
|
||||
const message_tags_data *tags_data);
|
||||
void inbound_cap_nak (server *serv, const message_tags_data *tags_data);
|
||||
void inbound_cap_nak (server *serv, char *extensions, const message_tags_data *tags_data);
|
||||
void inbound_cap_list (server *serv, char *nick, char *extensions,
|
||||
const message_tags_data *tags_data);
|
||||
void inbound_cap_del (server *serv, char *nick, char *extensions,
|
||||
|
@ -1,100 +0,0 @@
|
||||
/* HexChat
|
||||
* Copyright (C) 1998-2010 Peter Zelezny.
|
||||
* Copyright (C) 2009-2013 Berke Viktor.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/* Process textevents.in with make-te < textevents.in > textevents.h 2> textenums.h
|
||||
*
|
||||
* textevents.in notes:
|
||||
*
|
||||
* - The number in the ending lines indicates the total number of arguments
|
||||
* a text event supports. So don't touch them unless you actually modify the
|
||||
* EMIT_SIGNAL commands, too.
|
||||
*
|
||||
* - The "n" prefix means the event text does not have to be translated thus
|
||||
* the N_() gettext encapsulation will be omitted.
|
||||
*
|
||||
* - EMIT_SIGNAL is just a macro for text_emit() which can take a total amount
|
||||
* of 4 event arguments, so events have a hard limit of 4 arguments.
|
||||
*
|
||||
* - $t means the xtext tab, i.e. the vertical separator line for indented nicks.
|
||||
* That means $t forces a new line for that event.
|
||||
*
|
||||
* - Text events are emitted in ctcp.c, dcc.c, hexchat.c, ignore.c, inbound.c,
|
||||
* modes.c, notify.c, outbound.c, proto-irc.c, server.c and text.c.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char name[512];
|
||||
char num[512];
|
||||
char help[512];
|
||||
char def[512];
|
||||
char args[512];
|
||||
char buf[512];
|
||||
char *defines[512];
|
||||
int i = 0, max;
|
||||
|
||||
printf("/* this file is auto generated, edit textevents.in instead! */\n\nconst struct text_event te[] = {\n");
|
||||
while(fgets(name, sizeof(name), stdin))
|
||||
{
|
||||
name[strlen(name)-1] = 0;
|
||||
fgets(num, sizeof(num), stdin);
|
||||
num[strlen(num)-1] = 0;
|
||||
fgets(help, sizeof(help), stdin);
|
||||
help[strlen(help)-1] = 0;
|
||||
fgets(def, sizeof(def), stdin);
|
||||
def[strlen(def)-1] = 0;
|
||||
fgets(args, sizeof(args), stdin);
|
||||
args[strlen(args)-1] = 0;
|
||||
fgets(buf, sizeof(buf), stdin);
|
||||
|
||||
if (args[0] == 'n')
|
||||
printf("\n{\"%s\", %s, %d, \n\"%s\"},\n",
|
||||
name, help, atoi(args+1) | 128, def);
|
||||
else
|
||||
printf("\n{\"%s\", %s, %d, \nN_(\"%s\")},\n",
|
||||
name, help, atoi(args), def);
|
||||
defines[i] = strdup (num);
|
||||
i++;
|
||||
}
|
||||
|
||||
printf("};\n");
|
||||
|
||||
fprintf(stderr, "/* this file is auto generated, edit textevents.in instead! */\n\nenum\n{\n");
|
||||
max = i;
|
||||
i = 0;
|
||||
while (i < max)
|
||||
{
|
||||
if (i + 1 < max)
|
||||
{
|
||||
fprintf(stderr, "\t%s,\t\t%s,\n", defines[i], defines[i+1]);
|
||||
free (defines[i]);
|
||||
i++;
|
||||
} else
|
||||
fprintf(stderr, "\t%s,\n", defines[i]);
|
||||
free (defines[i]);
|
||||
i++;
|
||||
}
|
||||
fprintf(stderr, "\tNUM_XP\n};\n");
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A7D7CE59-2A31-48AE-BED2-A9828E241832}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>makete</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<PropertyGroup>
|
||||
<OutDir>$(HexChatLib)</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="make-te.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user