mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-13 11:15:27 +00:00
Add support for $irc
This commit is contained in:
parent
4fe945fbc4
commit
3f7ecb3a26
@ -151,4 +151,6 @@ option(BUILD_APCUPSD "Enable APCUPSD support" true)
|
||||
|
||||
option(BUILD_ICAL "Enable if you want iCalendar (RFC 5545) support" false)
|
||||
|
||||
option(BUILD_IRC "Enable if you want IRC support" false)
|
||||
|
||||
option(BUILD_ICONV "Enable iconv support" false)
|
||||
|
@ -74,6 +74,14 @@ if(BUILD_ICAL)
|
||||
set(conky_libs ${conky_libs} -lical)
|
||||
endif(BUILD_ICAL)
|
||||
|
||||
if(BUILD_IRC)
|
||||
check_include_files(libircclient/libircclient.h IRC_H_)
|
||||
if(NOT IRC_H_)
|
||||
message(FATAL_ERROR "Unable to find libircclient")
|
||||
endif(NOT IRC_H_)
|
||||
set(conky_libs ${conky_libs} -lircclient)
|
||||
endif(BUILD_IRC)
|
||||
|
||||
if(BUILD_BUILTIN_CONFIG)
|
||||
check_function_exists(fopencookie HAVE_FOPENCOOKIE)
|
||||
check_function_exists(funopen HAVE_FUNOPEN)
|
||||
|
@ -89,6 +89,8 @@
|
||||
|
||||
#cmakedefine BUILD_ICAL 1
|
||||
|
||||
#cmakedefine BUILD_IRC 1
|
||||
|
||||
#cmakedefine BUILD_ICONV 1
|
||||
|
||||
#cmakedefine BUILD_LUA_CAIRO 1
|
||||
|
@ -1551,6 +1551,18 @@
|
||||
is DTSTART .
|
||||
<para /></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>
|
||||
<option>irc</option>
|
||||
</command>
|
||||
<option>server(:port) #channel</option>
|
||||
</term>
|
||||
<listitem>Shows everything that's being told in #channel on IRCserver
|
||||
'server'. TCP-port 6667 is used for the connection unless 'port' is
|
||||
specified.
|
||||
<para /></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>
|
||||
|
@ -11,7 +11,7 @@ color green "\<(alignment|append_file|background|border_inner_margin|border_oute
|
||||
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\>"
|
||||
|
||||
## Variables
|
||||
color brightblue "\<(acpiacadapter|acpifan|acpitemp|addr|addrs|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|cmdline_to_pid|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|distribution|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|format_time|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|ical|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|include|ioscheduler|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|memwithbuffers|membar|memwithbuffersbar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|mysql|nameserver|new_mails|nodename|nodename_short|no_update|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|pid_chroot|pid_cmdline|pid_cwd|pid_environ|pid_environ_list|pid_exe|pid_nice|pid_openfiles|pid_parent|pid_priority|pid_state|pid_state_short|pid_stderr|pid_stdin|pid_stdout|pid_threads|pid_thread_list|pid_time_kernelmode|pid_time_usermode|pid_time|pid_uid|pid_euid|pid_suid|pid_fsuid|pid_gid|pid_egid|pid_sgid|pid_fsgid|pid_read|pid_vmpeak|pid_vmsize|pid_vmlck|pid_vmhwm|pid_vmrss|pid_vmdata|pid_vmstk|pid_vmexe|pid_vmlib|pid_vmpte|pid_write|platform|pop3_unseen|pop3_used|pre_exec|processes|read_tcp|read_udp|replied_mails|rss|running_processes|running_threads|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|stock|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_ping|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|texecpi|threads|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|gid_name|uid_name|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|user_time|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\>"
|
||||
color brightblue "\<(acpiacadapter|acpifan|acpitemp|addr|addrs|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|cmdline_to_pid|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|distribution|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|format_time|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|ical|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|include|ioscheduler|irc|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|memwithbuffers|membar|memwithbuffersbar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|mysql|nameserver|new_mails|nodename|nodename_short|no_update|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|pid_chroot|pid_cmdline|pid_cwd|pid_environ|pid_environ_list|pid_exe|pid_nice|pid_openfiles|pid_parent|pid_priority|pid_state|pid_state_short|pid_stderr|pid_stdin|pid_stdout|pid_threads|pid_thread_list|pid_time_kernelmode|pid_time_usermode|pid_time|pid_uid|pid_euid|pid_suid|pid_fsuid|pid_gid|pid_egid|pid_sgid|pid_fsgid|pid_read|pid_vmpeak|pid_vmsize|pid_vmlck|pid_vmhwm|pid_vmrss|pid_vmdata|pid_vmstk|pid_vmexe|pid_vmlib|pid_vmpte|pid_write|platform|pop3_unseen|pop3_used|pre_exec|processes|read_tcp|read_udp|replied_mails|rss|running_processes|running_threads|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|stock|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_ping|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|texecpi|threads|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|gid_name|uid_name|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|user_time|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\>"
|
||||
|
||||
color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
|
@ -50,7 +50,7 @@ syn region ConkyrcVar start=/\$\w\@=/ end=/\W\@=\|$/ contained contains=ConkyrcV
|
||||
|
||||
syn match ConkyrcVarStuff /{\@<=/ms=s contained nextgroup=ConkyrcVarName
|
||||
|
||||
syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite acpiacadapter acpifan acpitemp addr addrs alignc alignr apcupsd apcupsd_cable apcupsd_charge apcupsd_lastxfer apcupsd_linev apcupsd_load apcupsd_loadbar apcupsd_loadgauge apcupsd_loadgraph apcupsd_model apcupsd_name apcupsd_status apcupsd_temp apcupsd_timeleft apcupsd_upsmode apm_adapter apm_battery_life apm_battery_time audacious_bar audacious_bitrate audacious_channels audacious_filename audacious_frequency audacious_length audacious_length_seconds audacious_main_volume audacious_playlist_length audacious_playlist_position audacious_position audacious_position_seconds audacious_status audacious_title battery battery_bar battery_percent battery_short battery_time blink bmpx_album bmpx_artist bmpx_bitrate bmpx_title bmpx_track bmpx_uri buffers cached cmdline_to_pid color color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 combine conky_build_arch conky_build_date conky_version cpu cpubar cpugauge cpugraph curl desktop desktop_name desktop_number disk_protect diskio diskio_read diskio_write diskiograph diskiograph_read diskiograph_write distribution downspeed downspeedf downspeedgraph draft_mails else endif entropy_avail entropy_bar entropy_perc entropy_poolsize eval eve exec execbar execgauge execgraph execi execibar execigauge execigraph execp execpi flagged_mails font format_time forwarded_mails freq freq_g fs_bar fs_bar_free fs_free fs_free_perc fs_size fs_type fs_used fs_used_perc goto gw_iface gw_ip hddtemp head hr hwmon i2c i8k_ac_status i8k_bios i8k_buttons_status i8k_cpu_temp i8k_left_fan_rpm i8k_left_fan_status i8k_right_fan_rpm i8k_right_fan_status i8k_serial i8k_version ibm_brightness ibm_fan ibm_temps ibm_volume ical iconv_start iconv_stop if_empty if_existing if_gw if_match if_mixer_mute if_mounted if_mpd_playing if_running if_smapi_bat_installed if_up if_updatenr if_xmms2_connected image imap_messages imap_unseen include ioscheduler kernel laptop_mode lines loadavg loadgraph lua lua_bar lua_gauge lua_graph lua_parse machine mails mboxscan mem memwithbuffers membar memwithbuffersbar memeasyfree memfree memgauge memgraph memmax memperc mixer mixerbar mixerl mixerlbar mixerr mixerrbar moc_album moc_artist moc_bitrate moc_curtime moc_file moc_rate moc_song moc_state moc_timeleft moc_title moc_totaltime monitor monitor_number mpd_album mpd_artist mpd_bar mpd_bitrate mpd_elapsed mpd_file mpd_length mpd_name mpd_percent mpd_random mpd_repeat mpd_smart mpd_status mpd_title mpd_track mpd_vol mysql nameserver new_mails nodename nodename_short no_update nvidia obsd_product obsd_sensors_fan obsd_sensors_temp obsd_sensors_volt obsd_vendor offset outlinecolor pb_battery pid_chroot pid_cmdline pid_cwd pid_environ pid_environ_list pid_exe pid_nice pid_openfiles pid_parent pid_priority pid_state pid_state_short pid_stderr pid_stdin pid_stdout pid_threads pid_thread_list pid_time_kernelmode pid_time_usermode pid_time pid_uid pid_euid pid_suid pid_fsuid pid_gid pid_egid pid_sgid pid_fsgid pid_read pid_vmpeak pid_vmsize pid_vmlck pid_vmhwm pid_vmrss pid_vmdata pid_vmstk pid_vmexe pid_vmlib pid_vmpte pid_write platform pop3_unseen pop3_used pre_exec processes read_tcp read_udp replied_mails rss running_processes running_threads scroll seen_mails shadecolor smapi smapi_bat_bar smapi_bat_perc smapi_bat_power smapi_bat_temp sony_fanspeed stippled_hr stock swap swapbar swapfree swapmax swapperc sysname tab tail tcp_ping tcp_portmon template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 texeci texecpi threads time to_bytes top top_io top_mem top_time totaldown totalup trashed_mails tztime gid_name uid_name unflagged_mails unforwarded_mails unreplied_mails unseen_mails updates upspeed upspeedf upspeedgraph uptime uptime_short user_names user_number user_terms user_times user_time utime voffset voltage_mv voltage_v weather wireless_ap wireless_bitrate wireless_essid wireless_link_bar wireless_link_qual wireless_link_qual_max wireless_link_qual_perc wireless_mode words xmms2_album xmms2_artist xmms2_bar xmms2_bitrate xmms2_comment xmms2_date xmms2_duration xmms2_elapsed xmms2_genre xmms2_id xmms2_percent xmms2_playlist xmms2_size xmms2_smart xmms2_status xmms2_timesplayed xmms2_title xmms2_tracknr xmms2_url
|
||||
syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite acpiacadapter acpifan acpitemp addr addrs alignc alignr apcupsd apcupsd_cable apcupsd_charge apcupsd_lastxfer apcupsd_linev apcupsd_load apcupsd_loadbar apcupsd_loadgauge apcupsd_loadgraph apcupsd_model apcupsd_name apcupsd_status apcupsd_temp apcupsd_timeleft apcupsd_upsmode apm_adapter apm_battery_life apm_battery_time audacious_bar audacious_bitrate audacious_channels audacious_filename audacious_frequency audacious_length audacious_length_seconds audacious_main_volume audacious_playlist_length audacious_playlist_position audacious_position audacious_position_seconds audacious_status audacious_title battery battery_bar battery_percent battery_short battery_time blink bmpx_album bmpx_artist bmpx_bitrate bmpx_title bmpx_track bmpx_uri buffers cached cmdline_to_pid color color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 combine conky_build_arch conky_build_date conky_version cpu cpubar cpugauge cpugraph curl desktop desktop_name desktop_number disk_protect diskio diskio_read diskio_write diskiograph diskiograph_read diskiograph_write distribution downspeed downspeedf downspeedgraph draft_mails else endif entropy_avail entropy_bar entropy_perc entropy_poolsize eval eve exec execbar execgauge execgraph execi execibar execigauge execigraph execp execpi flagged_mails font format_time forwarded_mails freq freq_g fs_bar fs_bar_free fs_free fs_free_perc fs_size fs_type fs_used fs_used_perc goto gw_iface gw_ip hddtemp head hr hwmon i2c i8k_ac_status i8k_bios i8k_buttons_status i8k_cpu_temp i8k_left_fan_rpm i8k_left_fan_status i8k_right_fan_rpm i8k_right_fan_status i8k_serial i8k_version ibm_brightness ibm_fan ibm_temps ibm_volume ical iconv_start iconv_stop if_empty if_existing if_gw if_match if_mixer_mute if_mounted if_mpd_playing if_running if_smapi_bat_installed if_up if_updatenr if_xmms2_connected image imap_messages imap_unseen include ioscheduler irc kernel laptop_mode lines loadavg loadgraph lua lua_bar lua_gauge lua_graph lua_parse machine mails mboxscan mem memwithbuffers membar memwithbuffersbar memeasyfree memfree memgauge memgraph memmax memperc mixer mixerbar mixerl mixerlbar mixerr mixerrbar moc_album moc_artist moc_bitrate moc_curtime moc_file moc_rate moc_song moc_state moc_timeleft moc_title moc_totaltime monitor monitor_number mpd_album mpd_artist mpd_bar mpd_bitrate mpd_elapsed mpd_file mpd_length mpd_name mpd_percent mpd_random mpd_repeat mpd_smart mpd_status mpd_title mpd_track mpd_vol mysql nameserver new_mails nodename nodename_short no_update nvidia obsd_product obsd_sensors_fan obsd_sensors_temp obsd_sensors_volt obsd_vendor offset outlinecolor pb_battery pid_chroot pid_cmdline pid_cwd pid_environ pid_environ_list pid_exe pid_nice pid_openfiles pid_parent pid_priority pid_state pid_state_short pid_stderr pid_stdin pid_stdout pid_threads pid_thread_list pid_time_kernelmode pid_time_usermode pid_time pid_uid pid_euid pid_suid pid_fsuid pid_gid pid_egid pid_sgid pid_fsgid pid_read pid_vmpeak pid_vmsize pid_vmlck pid_vmhwm pid_vmrss pid_vmdata pid_vmstk pid_vmexe pid_vmlib pid_vmpte pid_write platform pop3_unseen pop3_used pre_exec processes read_tcp read_udp replied_mails rss running_processes running_threads scroll seen_mails shadecolor smapi smapi_bat_bar smapi_bat_perc smapi_bat_power smapi_bat_temp sony_fanspeed stippled_hr stock swap swapbar swapfree swapmax swapperc sysname tab tail tcp_ping tcp_portmon template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 texeci texecpi threads time to_bytes top top_io top_mem top_time totaldown totalup trashed_mails tztime gid_name uid_name unflagged_mails unforwarded_mails unreplied_mails unseen_mails updates upspeed upspeedf upspeedgraph uptime uptime_short user_names user_number user_terms user_times user_time utime voffset voltage_mv voltage_v weather wireless_ap wireless_bitrate wireless_essid wireless_link_bar wireless_link_qual wireless_link_qual_max wireless_link_qual_perc wireless_mode words xmms2_album xmms2_artist xmms2_bar xmms2_bitrate xmms2_comment xmms2_date xmms2_duration xmms2_elapsed xmms2_genre xmms2_id xmms2_percent xmms2_playlist xmms2_size xmms2_smart xmms2_status xmms2_timesplayed xmms2_title xmms2_tracknr xmms2_url
|
||||
|
||||
hi def link ConkyrcComment Comment
|
||||
hi def link ConkyrcSetting Keyword
|
||||
|
@ -170,6 +170,11 @@ if(BUILD_ICAL)
|
||||
set(optional_sources ${optional_sources} ${ical})
|
||||
endif(BUILD_ICAL)
|
||||
|
||||
if(BUILD_IRC)
|
||||
set(irc irc.cc)
|
||||
set(optional_sources ${optional_sources} ${irc})
|
||||
endif(BUILD_IRC)
|
||||
|
||||
if(BUILD_ICONV)
|
||||
set(iconv iconv_tools.cc)
|
||||
set(optional_sources ${optional_sources} ${iconv})
|
||||
|
@ -228,6 +228,9 @@ static void print_version(void)
|
||||
#ifdef BUILD_PORT_MONITORS
|
||||
" * portmon\n"
|
||||
#endif /* BUILD_PORT_MONITORS */
|
||||
#ifdef BUILD_IRC
|
||||
" * IRC\n"
|
||||
#endif
|
||||
#ifdef BUILD_CURL
|
||||
" * Curl\n"
|
||||
#endif /* BUILD_CURL */
|
||||
|
@ -48,6 +48,9 @@
|
||||
#ifdef BUILD_ICAL
|
||||
#include "ical.h"
|
||||
#endif
|
||||
#ifdef BUILD_IRC
|
||||
#include "irc.h"
|
||||
#endif
|
||||
#ifdef BUILD_X11
|
||||
#include "fonts.h"
|
||||
#endif
|
||||
@ -1224,6 +1227,12 @@ struct text_object *construct_text_object(char *s, const char *arg, long
|
||||
obj->callbacks.print = &print_ical;
|
||||
obj->callbacks.free = &free_ical;
|
||||
#endif
|
||||
#ifdef BUILD_IRC
|
||||
END OBJ_ARG(irc, 0, "irc requires arguments")
|
||||
parse_irc_args(obj, arg);
|
||||
obj->callbacks.print = &print_irc;
|
||||
obj->callbacks.free = &free_irc;
|
||||
#endif
|
||||
#ifdef BUILD_ICONV
|
||||
END OBJ_ARG(iconv_start, 0, "Iconv requires arguments")
|
||||
init_iconv_start(obj, free_at_crash, arg);
|
||||
|
203
src/irc.cc
Normal file
203
src/irc.cc
Normal file
@ -0,0 +1,203 @@
|
||||
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
||||
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
|
||||
*
|
||||
* Conky, a system monitor, based on torsmo
|
||||
*
|
||||
* Please see COPYING for details
|
||||
*
|
||||
* Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
|
||||
* (see AUTHORS)
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "logging.h"
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "text_object.h"
|
||||
#include <libircclient/libircclient.h>
|
||||
|
||||
struct ll_text {
|
||||
char *text;
|
||||
struct ll_text *next;
|
||||
};
|
||||
|
||||
struct obj_irc {
|
||||
pthread_t *thread;
|
||||
irc_session_t *session;
|
||||
char *arg;
|
||||
};
|
||||
|
||||
struct ctx {
|
||||
char *chan;
|
||||
struct ll_text *messages;
|
||||
};
|
||||
|
||||
void ev_connected(irc_session_t *session, const char *event, const char *origin, const char **params, unsigned int count) {
|
||||
struct ctx *ctxptr = (struct ctx *) irc_get_ctx(session);
|
||||
if(irc_cmd_join(session, ctxptr->chan, NULL) != 0) {
|
||||
NORM_ERR("irc: %s", irc_strerror(irc_errno(session)));
|
||||
}
|
||||
if(event || origin || params || count) {} //fix gcc warnings
|
||||
}
|
||||
|
||||
void addmessage(struct ctx *ctxptr, char *nick, const char *text) {
|
||||
struct ll_text *lastmsg = ctxptr->messages;
|
||||
struct ll_text *newmsg = (struct ll_text*) malloc(sizeof(struct ll_text));
|
||||
newmsg->text = (char*) malloc(strlen(nick) + strlen(text) + 4); //4 = ": \n"
|
||||
sprintf(newmsg->text, "%s: %s\n", nick, text);
|
||||
newmsg->next = NULL;
|
||||
if(!lastmsg) {
|
||||
ctxptr->messages = newmsg;
|
||||
} else {
|
||||
while(lastmsg->next) {
|
||||
lastmsg = lastmsg->next;
|
||||
}
|
||||
lastmsg->next = newmsg;
|
||||
}
|
||||
}
|
||||
|
||||
void ev_talkinchan(irc_session_t *session, const char *event, const char *origin, const char **params, unsigned int count) {
|
||||
char nickname[64];
|
||||
struct ctx *ctxptr = (struct ctx *) irc_get_ctx(session);
|
||||
|
||||
irc_target_get_nick(origin, nickname, sizeof(nickname));
|
||||
addmessage(ctxptr, nickname, params[1]);
|
||||
if(session || event || count) {} //fix gcc warnings
|
||||
}
|
||||
|
||||
void ev_num(irc_session_t *session, unsigned int event, const char *origin, const char **params, unsigned int count) {
|
||||
char attachment[4]="_00";
|
||||
|
||||
if(event == 433) { //nick in use
|
||||
char *newnick = (char*) malloc(strlen(params[1]) + 4);
|
||||
strcpy(newnick, params[1]);
|
||||
attachment[1] += rand() % 10;
|
||||
attachment[2] += rand() % 10;
|
||||
strcat(newnick, attachment);
|
||||
irc_cmd_nick(session, newnick);
|
||||
free(newnick);
|
||||
}
|
||||
if(origin || count) {} //fix gcc warnings
|
||||
}
|
||||
|
||||
#define IRCSYNTAX "The correct syntax is ${irc server(:port) #channel}"
|
||||
#define IRCPORT 6667
|
||||
#define IRCNICK "conky"
|
||||
#define IRCSERVERPASS NULL
|
||||
#define IRCUSER NULL
|
||||
#define IRCREAL NULL
|
||||
|
||||
void *ircclient(void *ptr) {
|
||||
struct obj_irc *ircobj = (struct obj_irc *) ptr;
|
||||
struct ctx *ctxptr = (struct ctx *) malloc(sizeof(struct ctx));
|
||||
irc_callbacks_t callbacks;
|
||||
char *server;
|
||||
char *strport;
|
||||
unsigned int port;
|
||||
|
||||
memset (&callbacks, 0, sizeof(callbacks));
|
||||
callbacks.event_connect = ev_connected;
|
||||
callbacks.event_channel = ev_talkinchan;
|
||||
callbacks.event_numeric = ev_num;
|
||||
ircobj->session = irc_create_session(&callbacks);
|
||||
server = strtok(ircobj->arg , " ");
|
||||
ctxptr->chan = strtok(NULL , " ");
|
||||
if( ! ctxptr->chan) {
|
||||
NORM_ERR("irc: %s", IRCSYNTAX);
|
||||
}
|
||||
ctxptr->messages = NULL;
|
||||
irc_set_ctx(ircobj->session, ctxptr);
|
||||
server = strtok(server, ":");
|
||||
strport = strtok(NULL, ":");
|
||||
if(strport) {
|
||||
port = strtol(strport, NULL, 10);
|
||||
if(port < 1 || port > 65535)
|
||||
port = IRCPORT;
|
||||
} else {
|
||||
port = IRCPORT;
|
||||
}
|
||||
if(irc_connect(ircobj->session, server, port, IRCSERVERPASS, IRCNICK, IRCUSER, IRCREAL) != 0) {
|
||||
NORM_ERR("irc: %s", irc_strerror(irc_errno(ircobj->session)));
|
||||
}
|
||||
if(irc_run(ircobj->session) != 0) {
|
||||
int ircerror = irc_errno(ircobj->session);
|
||||
if(irc_is_connected(ircobj->session)) {
|
||||
NORM_ERR("irc: %s", irc_strerror(ircerror));
|
||||
} else {
|
||||
NORM_ERR("irc: disconnected");
|
||||
}
|
||||
}
|
||||
free(ircobj->arg);
|
||||
free(ctxptr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void parse_irc_args(struct text_object *obj, const char* arg) {
|
||||
struct obj_irc* opaque = (struct obj_irc *) malloc(sizeof(struct obj_irc));
|
||||
opaque->thread = (pthread_t *) malloc(sizeof(pthread_t));
|
||||
srand(time(NULL));
|
||||
opaque->session = NULL;
|
||||
opaque->arg = strdup(arg);
|
||||
pthread_create(opaque->thread, NULL, ircclient, opaque);
|
||||
obj->data.opaque = opaque;
|
||||
}
|
||||
|
||||
void print_irc(struct text_object *obj, char *p, int p_max_size) {
|
||||
struct obj_irc *ircobj = (struct obj_irc *) obj->data.opaque;
|
||||
struct ctx *ctxptr;
|
||||
struct ll_text *nextmsg, *curmsg;
|
||||
|
||||
if( ! ircobj->session) return;
|
||||
if( ! irc_is_connected(ircobj->session)) return;
|
||||
ctxptr = (struct ctx *) irc_get_ctx(ircobj->session);
|
||||
curmsg = ctxptr->messages;
|
||||
while(curmsg) {
|
||||
nextmsg = curmsg->next;
|
||||
strncat(p, curmsg->text, p_max_size - strlen(p) - 1);
|
||||
free(curmsg->text);
|
||||
free(curmsg);
|
||||
curmsg = nextmsg;
|
||||
}
|
||||
if(p[0] != 0) {
|
||||
p[strlen(p) - 1] = 0;
|
||||
}
|
||||
ctxptr->messages = NULL;
|
||||
}
|
||||
|
||||
void free_irc(struct text_object *obj) {
|
||||
struct obj_irc *ircobj = (struct obj_irc *) obj->data.opaque;
|
||||
struct ctx *ctxptr;
|
||||
struct ll_text *nextmsg, *curmsg = NULL;
|
||||
|
||||
if(ircobj->session) {
|
||||
if( irc_is_connected(ircobj->session)) {
|
||||
ctxptr = (struct ctx *) irc_get_ctx(ircobj->session);
|
||||
curmsg = ctxptr->messages;
|
||||
irc_disconnect(ircobj->session);
|
||||
}
|
||||
pthread_join(*(ircobj->thread), NULL);
|
||||
irc_destroy_session(ircobj->session);
|
||||
}
|
||||
free(ircobj->thread);
|
||||
free(obj->data.opaque);
|
||||
while(curmsg) {
|
||||
nextmsg = curmsg->next;
|
||||
free(curmsg->text);
|
||||
free(curmsg);
|
||||
curmsg = nextmsg;
|
||||
}
|
||||
}
|
33
src/irc.h
Normal file
33
src/irc.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
||||
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
|
||||
*
|
||||
* Conky, a system monitor, based on torsmo
|
||||
*
|
||||
* Please see COPYING for details
|
||||
*
|
||||
* Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
|
||||
* (see AUTHORS)
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IRC_H_
|
||||
#define IRC_H_
|
||||
|
||||
void parse_irc_args(struct text_object *, const char*);
|
||||
void print_irc(struct text_object *, char *, int);
|
||||
void free_irc(struct text_object *);
|
||||
|
||||
#endif /*IRC_H_*/
|
Loading…
Reference in New Issue
Block a user