pork-0.99.8.1/0000755000175000017500000000000010236223214012672 5ustar ryanryan00000000000000pork-0.99.8.1/doc/0000755000175000017500000000000010236222745013447 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/0000755000175000017500000000000010236222745014377 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/win/0000755000175000017500000000000010236222745015174 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/win/set0000644000175000017500000000230610234217323015705 0ustar ryanryan00000000000000SYNTAX: win set [ []] Sets a per-window variable. Each window has a set of per-window variables that control particular settings for only that window. The default values for these variables are inherited from the global variables having the same name, if any. The following per-window variables exist. Type /win set for examples. BEEP_ON_OUTPUT (boolean) Beep when new messages are received in the window. HISTORY_LEN (integer) The maximum number of lines to be saved in the window's input history. LOG (boolean) Log messages in the window. LOGFILE (string) The file to which messages in the window will be logged if LOG is set to true. PRIVATE_INPUT (boolean) Give the window its own input line and history. SCROLL_ON_INPUT (boolean) If the display is scrolled up, scroll to the bottom when any input is received in the window. SCROLL_ON_OUTPUT (boolean) If the display is scrolled up, scroll to the bottom when any new messages are displayed in the window. SCROLLBUF_LEN (integer) The number of lines to retain in the scroll buffer. SHOW_BLIST (boolean) Show the buddy list in the window. TIMESTAMP (boolean) Display timestamps on messages in the window. SEE ALSO set pork-0.99.8.1/doc/help/win/bind0000644000175000017500000000070710234217323016031 0ustar ryanryan00000000000000SYNTAX: win bind Binds the account with the given reference number to the current window. Pork allows for an unlimited number of accounts to be logged in at the same time. Each window has 0 or 1 accounts bound to it. Any commands executed in a window are executed on behalf of the account that is bound to the window. PARAMETERS : The reference number of the account to bind to the current window. SEE ALSO acct list pork-0.99.8.1/doc/help/win/dump0000644000175000017500000000036610234217323016063 0ustar ryanryan00000000000000SYNTAX: win dump Dumps all text in the window to the specified file. If the file exists, the text will be appended. If the file does not exist, it will be created. PARAMETERS : File to which the window's contents will be written. pork-0.99.8.1/doc/help/win/list0000644000175000017500000000017610234217323016070 0ustar ryanryan00000000000000SYNTAX: win list Print a listing of the open windows. The listing displays each window's reference number, target, and type. pork-0.99.8.1/doc/help/win/next0000644000175000017500000000042110234217323016064 0ustar ryanryan00000000000000SYNTAX: win next Switch to the next window in the window list. The window list is circular and sorted by reference number, so executing this command when the window with the highest reference number is active will make the window with the lowest reference number current. pork-0.99.8.1/doc/help/win/prev0000644000175000017500000000042510234217323016066 0ustar ryanryan00000000000000SYNTAX: win prev Switch to the previous window in the window list. The window list is circular and sorted by reference number, so executing this command when the window with the lowest reference number is active will make the window with the highest reference number current. pork-0.99.8.1/doc/help/win/skip0000644000175000017500000000034710234217323016063 0ustar ryanryan00000000000000SYNTAX: win skip Skip a window while cycling through the window list. If no window is specified, the current window is assumed. PARAMETERS : (Optional) The reference of the number to skip. SEE ALSO win unskip pork-0.99.8.1/doc/help/win/swap0000644000175000017500000000024510234217323016064 0ustar ryanryan00000000000000SYNTAX: win swap Switches to the window with the specified reference number. PARAMETERS : The reference number of the window to which to switch. pork-0.99.8.1/doc/help/win/bind_next0000644000175000017500000000036710234217323017071 0ustar ryanryan00000000000000SYNTAX: win bind_next Binds the next screen name in the account list to the current window. This command is only useful when you're logged in with more than one screen name. You can use it to cycle through logged-in accounts. SEE ALSO win bind pork-0.99.8.1/doc/help/win/renumber0000644000175000017500000000051610234217323016732 0ustar ryanryan00000000000000SYNTAX: win renumber Changes the reference number of the current window. If the reference number that is requested is currently in use, the window that has that reference number and the current window will have their reference numbers swapped. PARAMETERS : The new reference number for the current window. pork-0.99.8.1/doc/help/win/unignore0000644000175000017500000000040510234217323016736 0ustar ryanryan00000000000000SYNTAX: win unignore Restore the reporting of activity for a window in the active windows list. If no window is specified, the current window is assumed. PARAMETERS : (Optional) The reference of the number to unignore. SEE ALSO win ignore pork-0.99.8.1/doc/help/win/clear0000644000175000017500000000022010234217323016171 0ustar ryanryan00000000000000SYNTAX: win clear Clears the current window. The text that was displayed in the window before it was cleared can be recovered by scrolling up. pork-0.99.8.1/doc/help/win/close0000644000175000017500000000020710234217323016215 0ustar ryanryan00000000000000SYNTAX: win close Close the current window. If the current window is a chat window, you will exit the chat room bound to that window. pork-0.99.8.1/doc/help/win/erase0000644000175000017500000000022410234217323016206 0ustar ryanryan00000000000000SYNTAX: win erase Clears the current window. The text that was displayed in the window before the win erase command was executed is gone for good. pork-0.99.8.1/doc/help/win/Makefile.am0000644000175000017500000000025410234217323017223 0ustar ryanryan00000000000000win_DATA = \ bind \ bind_next \ clear \ close \ dump \ erase \ list \ next \ prev \ rename \ renumber \ set \ swap windir = $(pkgdatadir)/help/win pork-0.99.8.1/doc/help/win/Makefile.in0000644000175000017500000002156310236222653017246 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/win DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(windir)" winDATA_INSTALL = $(INSTALL_DATA) DATA = $(win_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ win_DATA = \ bind \ bind_next \ clear \ close \ dump \ erase \ list \ next \ prev \ rename \ renumber \ set \ swap windir = $(pkgdatadir)/help/win all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/win/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/win/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-winDATA: $(win_DATA) @$(NORMAL_INSTALL) test -z "$(windir)" || $(mkdir_p) "$(DESTDIR)$(windir)" @list='$(win_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(winDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(windir)/$$f'"; \ $(winDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(windir)/$$f"; \ done uninstall-winDATA: @$(NORMAL_UNINSTALL) @list='$(win_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(windir)/$$f'"; \ rm -f "$(DESTDIR)$(windir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(windir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-winDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-winDATA .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip install-winDATA installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-info-am uninstall-winDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/win/ignore0000644000175000017500000000037010234217323016374 0ustar ryanryan00000000000000SYNTAX: win ignore Do not report activity for a window in the active windows list. If no window is specified, the current window is assumed. PARAMETERS : (Optional) The reference of the number to ignore. SEE ALSO win unignore pork-0.99.8.1/doc/help/win/rename0000644000175000017500000000014610234217323016361 0ustar ryanryan00000000000000SYNTAX: win rename Renames a window. PARAMETERS : The new name of the window. pork-0.99.8.1/doc/help/win/unskip0000644000175000017500000000050610234217323016423 0ustar ryanryan00000000000000SYNTAX: win skip No longer skip a window while cycling through the window list. This command is used to restore a window that was skipped with the "win skip" command. If no window is specified, the current window is assumed. PARAMETERS : (Optional) The reference of the number to skip. SEE ALSO win skip pork-0.99.8.1/doc/help/chat/0000755000175000017500000000000010236222745015316 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/chat/ban0000644000175000017500000000000010234217323015761 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/chat/who0000644000175000017500000000046110234217323016031 0ustar ryanryan00000000000000SYNTAX: chat who [] Prints a list of users in the specified chat room. If no chat room is specified and the current window is a chat window, the chat room displayed in that window is assumed. PARAMETERS : The name/exchange combination of the chat room whose users will be listed. pork-0.99.8.1/doc/help/chat/join0000644000175000017500000000024010234217323016166 0ustar ryanryan00000000000000SYNTAX: chat join Joins the specified chat room. PARAMETERS : The name/exchange combination of the chat room to join. SEE ALSO chat pork-0.99.8.1/doc/help/chat/kick0000644000175000017500000000000010234217323016142 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/chat/list0000644000175000017500000000012410234217323016203 0ustar ryanryan00000000000000SYNTAX: chat list Prints the list of the chats that the current user is joined to. pork-0.99.8.1/doc/help/chat/send0000644000175000017500000000034110234217323016162 0ustar ryanryan00000000000000SYNTAX: chat send [] Sends a message to the specified chat room. PARAMETERS : The name/exchange combination of the chat room to which to send the message. : The message to send. pork-0.99.8.1/doc/help/chat/unignore0000644000175000017500000000061210234217323017060 0ustar ryanryan00000000000000SYNTAX: chat ignore [] Unignores a user in a chat room. The parameter may be omitted of the current window is a chat window, in which case the chat room displayed in the current window is assumed. PARAMETERS : The name/exchange combination of the chat room in which to unignore the specified user. : The user to unignore. SEE ALSO chat pork-0.99.8.1/doc/help/chat/leave0000644000175000017500000000043610234217323016332 0ustar ryanryan00000000000000SYNTAX: chat leave [] Leaves a chat room. If the parameter is omitted, and the current window is a chat window, the chat room displayed in that window is assumed. PARAMETERS : The name/exchange combination of the chat room to leave. SEE ALSO chat pork-0.99.8.1/doc/help/chat/topic0000644000175000017500000000000010234217323016337 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/chat/Makefile.am0000644000175000017500000000023110234217323017340 0ustar ryanryan00000000000000chat_DATA = \ ban \ ignore \ invite \ join \ kick \ leave \ list \ send \ topic \ unignore \ who chatdir = $(pkgdatadir)/help/chat pork-0.99.8.1/doc/help/chat/Makefile.in0000644000175000017500000002157310236222652017370 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/chat DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(chatdir)" chatDATA_INSTALL = $(INSTALL_DATA) DATA = $(chat_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ chat_DATA = \ ban \ ignore \ invite \ join \ kick \ leave \ list \ send \ topic \ unignore \ who chatdir = $(pkgdatadir)/help/chat all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/chat/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/chat/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-chatDATA: $(chat_DATA) @$(NORMAL_INSTALL) test -z "$(chatdir)" || $(mkdir_p) "$(DESTDIR)$(chatdir)" @list='$(chat_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(chatDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(chatdir)/$$f'"; \ $(chatDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(chatdir)/$$f"; \ done uninstall-chatDATA: @$(NORMAL_UNINSTALL) @list='$(chat_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(chatdir)/$$f'"; \ rm -f "$(DESTDIR)$(chatdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(chatdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-chatDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-chatDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-chatDATA install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-chatDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/chat/ignore0000644000175000017500000000061110234217323016514 0ustar ryanryan00000000000000SYNTAX: chat ignore [] Ignores a user in a chat room. The parameter may be omitted of the current window is a chat window, in which case the chat room displayed in the current window is assumed. PARAMETERS : The name/exchange combination of the chat room in which to ignore the specified user user. : The user to ignore. SEE ALSO chat pork-0.99.8.1/doc/help/chat/invite0000644000175000017500000000074310234217323016535 0ustar ryanryan00000000000000SYNTAX: chat invite [] [] Invites a user to a chat room with an optional message. The parameter may be omitted of the current window is a chat window, in which case the chat room displayed in the current window is assumed. PARAMETERS : The name/exchange combination of the chat room to which to invite the user. : The user to invite. : (Optional) A message to be sent with the chat invitation. SEE ALSO chat pork-0.99.8.1/doc/help/file/0000755000175000017500000000000010236222745015316 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/file/get0000644000175000017500000000035510234217323016015 0ustar ryanryan00000000000000SYNTAX: file get Accepts the file transfer whose reference number is specified. This command is used to accept files sent by other users. PARAMETERS : The reference number of the transfer to accept. pork-0.99.8.1/doc/help/file/list0000644000175000017500000000013310234217323016203 0ustar ryanryan00000000000000SYNTAX: file list Lists all active file transfers and all pending file transfer requests. pork-0.99.8.1/doc/help/file/send0000644000175000017500000000024510234217323016165 0ustar ryanryan00000000000000SYNTAX: file send Initiates a request to send a file to a user. PARAMETERS : The user to whom to send the file. : The file to be sent. pork-0.99.8.1/doc/help/file/cancel0000644000175000017500000000040310234217323016455 0ustar ryanryan00000000000000SYNTAX: file cancel Cancels the file transfer with the specified reference number. If the transfer is a receive, the partially transferred file is not deleted. PARAMETERS : The reference number of the transfer to cancel. pork-0.99.8.1/doc/help/file/Makefile.am0000644000175000017500000000012110234217323017336 0ustar ryanryan00000000000000file_DATA = \ cancel \ get \ list \ send filedir = $(pkgdatadir)/help/file pork-0.99.8.1/doc/help/file/Makefile.in0000644000175000017500000002146010236222652017363 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/file DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(filedir)" fileDATA_INSTALL = $(INSTALL_DATA) DATA = $(file_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ file_DATA = \ cancel \ get \ list \ send filedir = $(pkgdatadir)/help/file all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/file/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/file/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-fileDATA: $(file_DATA) @$(NORMAL_INSTALL) test -z "$(filedir)" || $(mkdir_p) "$(DESTDIR)$(filedir)" @list='$(file_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(fileDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(filedir)/$$f'"; \ $(fileDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(filedir)/$$f"; \ done uninstall-fileDATA: @$(NORMAL_UNINSTALL) @list='$(file_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(filedir)/$$f'"; \ rm -f "$(DESTDIR)$(filedir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(filedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-fileDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-fileDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-fileDATA install-info install-info-am \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-fileDATA uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/main/0000755000175000017500000000000010236222745015323 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/main/me0000644000175000017500000000020010234217323015631 0ustar ryanryan00000000000000SYNTAX: me Sends an action (if the current user's protocol supports it). PARAMETERS : The action message to send. pork-0.99.8.1/doc/help/main/disconnect0000644000175000017500000000051110234217323017366 0ustar ryanryan00000000000000SYNTAX: disconnect [ ] Disconnects a screen name. If no account refnum is given, the account bound to the current window is disconnected. PARAMETERS : (Optional) The refnum of the account to disconnect. : (Optional) Quit message, if the account's protocol supports it. pork-0.99.8.1/doc/help/main/msg0000644000175000017500000000022310234217323016023 0ustar ryanryan00000000000000SYNTAX: msg Sends a message (IM). PARAMETERS : The user to whom to send the message. : The message to send. pork-0.99.8.1/doc/help/main/set0000644000175000017500000004233410234217324016042 0ustar ryanryan00000000000000SYNTAX: set [ []] Sets a global variable. Many global variables have analogous per-window options. For example, there's a global LOG option and a per-window LOG option. Changing a global variable has no effect on per-window options in currently open windows. Any new windows that are created, though, will inherit the applicable global options when they are created. There are 5 types of values set variable can take: boolean, integer, string, format string, and color string. The argument for a boolean variable can either be true (or on or 1), false (or off or 0), or toggle. Toggle reverses the variables current value. Integer variables take integer values. String variables take strings that may contain embedded color codes. Color strings take one color code without the leading '%' char, or take a color code string that must begin with '%' and may specify highlighting attributes (see the help for 'color' for info). Format strings contain strings that may contain embedded color codes. Additionally, each format string recognizes one or more variables beginning with a '$' character that will be filled-in dynamically. All format variables for each format string are described below. The following global variables exist. Type /set for examples, or type /set for an example for a particular global variable. AUTO_RECONNECT (boolean) Automatically reconnect when disconnected. AUTO_REJOIN (boolean) Automatically rejoin chat rooms when kicked. AUTOSEND_AWAY (boolean) When away, respond to messages by replying with your away message. BANNER (string) The banner used to display status messages ('*** ' by default). BEEP (boolean) Beep when a ^G (control-G) character is printed. BEEP_MAX (integer) The maximum number of times to beep when a string containing one or more ^G characters is printed. BEEP_ON_OUTPUT (boolean) Beep when new messages are received. CMDCHARS (character) The character that denotes that an input string is a command. COLOR_BLIST_FOCUS (color string) The color of the buddy list's border when the buddy list has input focus. COLOR_BLIST_NOFOCUS (color string) The color of the buddy list's border when the buddy list has input focus. COLOR_BLIST_SELECTOR (color string) The color of the buddy list's cursor. CONNECT_TIMEOUT (integer) Number of seconds after which connections will be aborted if they haven't completed successfully. DUMP_MSGS_TO_STATUS (boolean) Print private messages (both those sent and received) in the status window instead of creating separate query windows for each conversation. FORMAT_ACTION_RECV (format string) FORMAT_ACTION_RECV_STATUS (format string) The format string that specifies how private actions will be displayed. Variables: $N - Action sender's screen name. $R - Action recipient's screen name. $r - Action recipient as specified by its sender. $M - Action text. $H - Userhost of $R, if available. $h - Userhost of $N, if available. FORMAT_BLIST (format string) The format string that specifies how buddy list entries will be displayed. Variables: $B - Buddy status (active/idle/away) string. $N - Buddy's username. $I - Buddy's idle time. $i - Buddy's idle time (evaluates to the empty string if idle time is 0). $W - Buddy's warning level. $w - Buddy's warning level (evaluates to the empty string if warning level is 0). $> - Right-justify anything that follows. FORMAT_BLIST_GROUP (format string) The format string that specifies how buddy list group entries will be displayed. Variables: $E - Expanded / collapsed text. $N - Group name. $T - The number of buddies in the group. $O - The number of buddies in the group who are signed on. $> - Right-justify anything that follows. FORMAT_BLIST_IDLE (format string) The format string that specifies how buddies' idle time is displayed in the buddy list window. Variables: $I - Buddy's idle time. FORMAT_BLIST_WARN (format string) The format string that specifies how users' warning times will be displayed in the buddy list window. Variables: $W - Buddy's warning level. FORMAT_CHAT_CREATE (format string) The format string that specifies how the announcement that a new chat room has been created will be displayed. Variables: $N - User who created the chat room. $R - Chat room's name. $U - Chat room's full name. $H - Hostname of $N (if available). FORMAT_CHAT_IGNORE (format string) The format string that specifies how announcements of users being ignored will be displayed. Variables: $N - User who ignored another user. $D - User who was ignored. $R - Chat room's name. $M - Chat room's full name. $H - Hostname of $N (if available). $h - Hostname of $D (if available). FORMAT_CHAT_INVITE (format string) The format string that specifies how announcements of having been invited to a chat room will be displayed. Variables: $N - Username of the user who sent the invitation. $D - User who was invited. $R - Chat room's name. $U - Chat room's full name. $H - Hostname of $N (if available). $h - Hostname of $D (if available). FORMAT_CHAT_JOIN (format_string) The format string that specifies how chat join notices will be displayed. Varibles: $N - Username of the user who joined. $R - Chat room's name. $U - Chat room's full name. $H - Hostname of $N (if available). FORMAT_CHAT_KICK (format string) The format string that specifies how announcements of users being forcibly removed from chat rooms will be displayed. Variables: $N - Username of the user who initiated the kick. $D - User who was kicked. $R - Chat room's name. $U - Chat room's full name. $M - Kick message (if any). $H - Hostname of $N (if available). $h - hostname of $D (if available). FORMAT_CHAT_LEAVE (format_string) The format string that specifies how chat part notices will be displayed. Varibles: $N - Username of the user who left. $R - Chat room's name. $U - Chat room's full name. $H - Hostname of $N (if available). FORMAT_CHAT_LEAVE (format_string) The format string that specifies how channel mode changes will be displayed. Varibles: $N - Username of the user changed the mode. $R - Chat room's name. $U - Chat room's full name. $H - Hostname of $N (if available). $M - Mode string that was set. FORMAT_CHAT_QUIT (format string) The format string that specifies how chat quit notices will be displayed. Varibles: $N - Username of the user who quit. $R - Chat room's name. $U - Chat room's full name. $M - Quit message (if any). $H - Hostname of $N (if available). FORMAT_CHAT_RECV FORMAT_CHAT_RECV_ACTION FORMAT_CHAT_RECV_NOTICE The format string that specifies how incoming chat messages will be displayed. Variables: $C - The chatroom in which the message was received. $c - The message destination as specified by its sender. $N - Message sender. $h - Userhost of $N, if available. $M - Message text. FORMAT_CHAT_SEND FORMAT_CHAT_SEND_ACTION FORMAT_CHAT_SEND_NOTICE The format string that specifies how outgoing chat messages will be displayed. Variables: $C - The chatroom to which the message was sent. $c - The message destination as specified by its sender. $N - Message sender. $H - Userhost of $N, if available. $M - Message text. FORMAT_CHAT_UNIGNORE (format string) The format string that specifies how announcements of users being unignored will be displayed. Variables: $N - User who unignored another user. $D - User who was unignored. $R - Chat room's name. $U - Chat room's full name. $H - Hostname of $N (if available). $h - Hostname of $D (if available). FORMAT_IM_RECV (format string) FORMAT_IM_RECV_STATUS (format string) The format string that specifies how incoming messages will be displayed. Variables: $N - Message sender's screen name. $R - Message recipient's screen name. $r - Message recipient as specified by its sender. $M - Message text. $H - Userhost of $R, if available. $h - Userhost of $N, if available. FORMAT_IM_RECV_AUTO (format string) The format string that specifies how incoming auto-reply messages will be displayed. Variables: $N - Message sender's screen name. $M - Message text. FORMAT_IM_SEND (format string) FORMAT_IM_SEND_STATUS (format string) The format string that specifies how outgoing messages will be displayed. Variables: $N - Notice sender's screen name. $R - Notice recipient's screen name. $r - Notice recipient as specified by its sender. $M - Notice text. $H - Userhost of $R, if available. $h - Userhost of $N, if available. FORMAT_NOTICE_RECV (format string) FORMAT_NOTICE_RECV_STATUS (format string) The format string that specifies how private notices will be displayed. Variables: $N - Notice sender's screen name. $R - Notice recipient's screen name. $M - Notice text. $H - Userhost of $R, if available. $h - Userhost of $N, if available. FORMAT_STATUS (format string) FORMAT_STATUS_CHAT (format string) The format string that specifies how the status bar will be displayed. FORMAT_STATUS_CHAT controls the appearance of the status bar in chat windows. FORMAT_STATUS controls the appearance of the status bar in all other windows. Variables: $N - Current screen name. $Z - Current window's name. $C - Chat room inactive string. $T - Timestamp string. $S - Current server. $P - Current port on remote server. $A - Activity string. $Y - Typing string. $H - Held string. $I - Idle time string. $W - Warning level string. $M - Chat room mode, including arguments (keys, limit numbers, etc.), if applicable. $m - Chat room mode, excluding arguments, if applicable. $@ - Chat room status (op, halfop, voice), if applicable. $U - User mode. $! - User status (online/away/disconnected/reconnecting). $? - Account protocol. $> - Right-justify everything that follows (can be specified only once). FORMAT_STATUS_ACTIVITY (format string) The format string that specifies how active windows (i.e. windows in which a message has been received since the last time they were visible) will be denoted in the status bar. Variables: $A - A comma-delimited list of the reference numbers of windows in which there is activity. FORMAT_STATUS_HELD (format string) The format string that specifies the way the number of held lines will be displayed in the status bar. Variables: $H - The number of held lines. FORMAT_STATUS_IDLE (format string) The format string that specifies how the current account's idle time will be displayed in the status bar. Variables: $I - The current username's idle time. $i - If the current window is an IM window, the target's idle time. If it's not an IM window, the current username's idle time. FORMAT_STATUS_TIMESTAMP (format string) The format string that specifies how the current time will be displayed in the status bar. Variables: $H - Hour (24 hour format). $h - Hour (12 hour format). $m - Minutes. $s - Seconds. $h - AM/PM FORMAT_STATUS_TYPING (format string) The format string that specifies how typing notifications will be displayed in the status bar. Variables: $Y - Typing status (typing/paused) FORMAT_STATUS_WARN (format string) The format string that specifies how the current account's warning level will be displayed in the status bar. Variables: $W - The current username's warning level. $w - If the current window is an IM window, the target's warning level. If it's not an IM window, the current username's warning level. FORMAT_WARN (format string) The format string that specifies how the status message announcing that the current account's username has been warned by another user will be displayed. Variables: $N - The user who was warned. $U - The user who sent the warning. $W - The new warning level of the user who was warned. FORMAT_WHOIS_AWAY (format string) The format string that controls the appearance of the away line in /whois output. FORMAT_WHOIS_IDLE (format string) The format string that controls the appearance of the idle time line in /whois output. Variables $I - The idle time. FORMAT_WHOIS_MEMBER (format string) The format string that controls the appearance of the member since line in /whois output. Variables $D - The date the user became a member. FORMAT_WHOIS_NAME (format string) The format string that controls the appearance of the username line in /whois output. Variables $N - Username. FORMAT_WHOIS_SIGNON (format string) The format string that controls the appearance of the signon time line in /whois output. Variables $S - Time of login. FORMAT_WHOIS_USERINFO (format string) The format string that controls the appearance of the user info line in /whois output. FORMAT_WHOIS_WARNLEVEL (format string) The format string that controls the appearance of the warning level line in /whois output. Variables $W - Warning level. HISTORY_LEN (integer) The maximum number of input lines to be retained in the input history. IDLE_AFTER (integer) The number of seconds after which accounts will be set idle. LOG (boolean) Log all screen output to log files. LOGIN_ON_STARTUP (boolean) Log in when the client is started. OUTGOING_MSG_FONT (string) The font to be used for outgoing messages on AIM. OUTGOING_MSG_FONT_BGCOLOR (string) The background color to be used for outgoing messages on AIM. Specify colors as you would in an HTML font tag (e.g., "white" or "#ffffff"). OUTGOING_MSG_FONT_FGCOLOR (string) The foreground color to be used for outgoing messages on AIM. Specify colors as you would in an HTML font tag (e.g., "white" or "#ffffff"). OUTGOING_MSG_FONT_SIZE (string) The font size to be used for outgoing messages on AIM. Specify size as you would in an HTML font tag (e.g., "+3" or "-1"). PORK_DIR (string) The directory where pork stores user-preferences and account information. PRIVATE_INPUT (boolean) Give each window its own input line and history. By default, all windows share a global input line and history. PROMPT (string) The string to be used as the input prompt. RECONNECT_INTERVAL (integer) The interval used to determine the next time to try to reconnect a disconnected account. An account will attempt to be reconnected every (number_of_tries * reconnect_interval) seconds. RECONNECT_MAX_INTERVAL (integer) The maximum amount of time to wait between attempts to reconnect an account that has been disconnected. RECONNECT_TRIES (integer) Number of times to attempt to reconnect a disconnect account before giving up. RECURSIVE_EVENTS (boolean) Allow events to be recursively generated. For example, if a handler for the event SEND_PROFILE called a function that generated the SEND_PROFILE event, if RECURSIVE_EVENTS were enabled, the second event would be generated. If it were disabled, the second event would not be generated. REPORT_IDLE (boolean) Report idle time. SAVE_PASSWD (boolean) Save the passwords for accounts in PORK_DIR//account. SCROLL_ON_INPUT (boolean) If a window is scrolled up, scroll it down on any user input. SCROLL_ON_OUTPUT (boolean) If a window is scrolled up, scroll it down on any new window messages. SCROLLBUF_LEN (integer) The number of lines of text to be saved in each window. SEND_REMOVES_AWAY (boolean) If the current account is away and it sends a message, remove its away status. SHOW_BLIST (boolean) Show the buddy list in all windows. SHOW_BUDDY_AWAY (boolean) Show announcements that a user has gone away and returned from being away in conversation windows with the user, if any. SHOW_BUDDY_IDLE (boolean) Show announcements that a user has become idle and become not idle in conversation windows with the user, if any. SHOW_BUDDY_SIGNOFF (boolean) Show announcements that a user has signed on and signed off in conversation windows with the user, if any. TEXT_BUDDY_ACTIVE (string) The format string that specifies how the buddy list status indicator for active (not idle or away) users will be displayed. The status indicator is the string that appears to the left of users' names on the buddy list, and is a colored '*' character by default. TEXT_BLIST_GROUP_EXPANDED (string) The string used to denote a group node in the buddy list that has been expanded. TEXT_BLIST_GROUP_COLLAPSED (string) The string used to denote a group node in the buddy list that has been expanded. TEXT_BUDDY_AWAY (string) The format string that specifies how the buddy list status indicator for users who are away will be displayed. TEXT_BUDDY_IDLE (string) The format string that specifies how the buddy list status indicator for idle users will be displayed. TEXT_NO_NAME (string) The string displayed in the status bar to indicate that no screen name has been specified yet. This string is displayed before logging in with any account. TEXT_NO_ROOM (string) The string displayed in the status bar of chat windows that indicates that you are not presently joined to the chat room that is bound to the window. TEXT_TYPING (string) The string displayed when a user is actively typing to you. TEXT_TYPING_PAUSED (string) The string displayed when a user has begun typing to you and then paused typing. TEXT_WARN_ANONYMOUS (string) The text that's displayed when warned anonymously. TIMESTAMP (boolean) Display timestamps for messages. pork-0.99.8.1/doc/help/main/who0000644000175000017500000000000010234217324016024 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/main/win0000644000175000017500000000012510234217324016034 0ustar ryanryan00000000000000THE WIN COMMAND SET The win command set provides commands for manipulating windows. pork-0.99.8.1/doc/help/main/acct0000644000175000017500000000017110234217324016152 0ustar ryanryan00000000000000SYNTAX: acct Prints a list of the names, protocols, and reference numbers of all connected accounts. SEE ALSO connect pork-0.99.8.1/doc/help/main/bind0000644000175000017500000000044210234217324016155 0ustar ryanryan00000000000000SYNTAX: bind [ []] Binds a key to a command; whenever the key is pressed, its binding, if any, will be executed. PARAMETERS : The key to which to bind the specified command. : The command to execute when the specified key is pressed. SEE ALSO keys pork-0.99.8.1/doc/help/main/auto0000644000175000017500000000025110234217324016207 0ustar ryanryan00000000000000SYNTAX: auto Sends an auto-reply message, if supported. PARAMETERS : The user to whom to send the message. : The message to send. pork-0.99.8.1/doc/help/main/away0000644000175000017500000000056110234217324016204 0ustar ryanryan00000000000000SYNTAX: away [] Marks a screen name away or marks it not away, if it is already away. If a parameter is specified, the current screen name will be set away with the away message specified by the parameter. If no parameters are given, the screen name will be set as no longer away if it was away. PARAMETERS : (Optional) The away message. pork-0.99.8.1/doc/help/main/chat0000644000175000017500000000046610234217324016166 0ustar ryanryan00000000000000THE CHAT COMMAND SET The chat command set is made-up of commands that implement functionality used for chat rooms. AIM chat rooms are identified by a name/exchange combination. Names consist of alphanumeric characters. The exchange portion of the chat room's name is an integer between 4 and 16, inclusive. pork-0.99.8.1/doc/help/main/echo0000644000175000017500000000027210234217324016160 0ustar ryanryan00000000000000SYNTAX: echo Writes the specified string to the currently window. The string may contain embedded color codes. PARAMETERS : The string to be echoed. SEE ALSO color pork-0.99.8.1/doc/help/main/file0000644000175000017500000000016510234217324016162 0ustar ryanryan00000000000000THE FILE COMMAND SET The file commands are used to send files to other users and to receive files from other users. pork-0.99.8.1/doc/help/main/eval0000644000175000017500000000002710234217324016167 0ustar ryanryan00000000000000SYNTAX: eval pork-0.99.8.1/doc/help/main/idle0000644000175000017500000000046410234217324016162 0ustar ryanryan00000000000000SYNTAX: idle [] Sets the idle time for the current screen name to the specified number of seconds. If no parameter is specified, the idle time for the current screen name is set to 0. PARAMETERS : (Optional) The time, in seconds, to which to mark the current screen name idle. pork-0.99.8.1/doc/help/main/keys0000644000175000017500000000426710234217324016225 0ustar ryanryan00000000000000PORK KEYCODES Pork allows keys to be bound such that when a bound key is pressed, the command to which it is bound is executed. This help text describes the format of keycodes used by the commands that manipulate key bindings. The following strings are names of keycodes: BACKSPACE - The backspace key. BREAK - The break key. DELETE - The delete key. DOWN_ARROW - The down arrow key. END - The end key. ENTER - The enter key. F1 - The F1 key. F2 - The F2 key. F3 - The F3 key. F4 - The F4 key. F5 - The F5 key. F6 - The F6 key. F7 - The F7 key. F8 - The F8 key. F9 - The F9 key. F10 - The F10 key. F11 - The F11 key. F12 - The F12 key. HOME - The home key. INSERT - The insert key. LEFT_ARROW - The left arrow key. PAGE_DOWN - The page down key. PAGE_UP - The page up key. RETURN - The return key. RIGHT_ARROW - The right arrow key. SPACE - The spacebar key. SUSPEND - The suspend key. TAB - The tab key. UP_ARROW - The up arrow key. The keys that cause printing characters (see isprint(3)) to be entered may be bound by specifying the character entered by pressing the key (e.g. the A key can be bound by specifying A). Control keys can be specified using the ^ format (e.g. CTRL-A can be specified by ^A). Note that ^a and ^A are equivalent. Meta key sequences can be specified by prepending META- to a keycode (e.g. META-a). The meta key is "alt" key on PC keyboards. The escape key will work on all keyboards. Note that META-a and META-A are not equivalent and refer to different keycodes. METAN- can be used to specify multiple instances of the meta key being pressed. For example, META2-1 corresponds to ALT+ESC-1 (or ESC-ESC-1). Keycodes can also be specified by their hexadecimal values. EXAMPLES META-^C - meta+control-C META-a - meta+lowercase a META10-^A - the escape key pressed 10 times followed by control-A b - lowercase b D - uppercase d PAGE_UP - the page up key 0x41 - A SEE ALSO bind unbind pork-0.99.8.1/doc/help/main/load0000644000175000017500000000023110234217324016154 0ustar ryanryan00000000000000SYNTAX: load Loads a porkrc-style file. The format of this file is one pork command per line. PARAMETERS : The filename to load. pork-0.99.8.1/doc/help/main/nick0000644000175000017500000000016610234217324016170 0ustar ryanryan00000000000000SYNTAX: nick Changes the current user's nick (username), if supported. PARAMETERS : New nick. pork-0.99.8.1/doc/help/main/perl0000644000175000017500000000037010234217324016203 0ustar ryanryan00000000000000SYNTAX: perl or Runs the specified perl function with the specified arguments. The perl function must either be built-in or have been loaded with the perl_load command. SEE ALSO perl_load pork-0.99.8.1/doc/help/main/quit0000644000175000017500000000021410234217324016220 0ustar ryanryan00000000000000SYNTAX: quit <[quit message]> Exits the program. PARAMETERS : (Optional) Quit message (not supported by all protocols). pork-0.99.8.1/doc/help/main/save0000644000175000017500000000021010234217324016170 0ustar ryanryan00000000000000SYNTAX: save Writes a new porkrc file containing the current aliases, bindings, and global /set options. SEE ALSO: alias bind set pork-0.99.8.1/doc/help/main/connect0000644000175000017500000000147410234217324016700 0ustar ryanryan00000000000000SYNTAX: connect [-] [] This command connects the account with the given user name. If no protocol is specified, AIM is assumed. PARAMETERS : (Optional) The protocol to use. Examples are irc and aim. : The screen name to connect. : (Optional) Arguments specific to the protocol of the account being connected. EXAMPLES %Gconnect exampleuser%x Connects "exampleuser" to AIM. %Gconnect -aim exampleuser%x Same as above. %Gconnect exampleuser pencil%x Connects "exampleuser" to AIM and uses the password "pencil" to login. %Gconnect -irc test irc.example.org:6667%x Connects to irc.example.org, port 6667 and uses the nick test. %Gconnect -irc test irc.example.org:6667:pencil%x Same as above but also uses "pencil" as the server password. pork-0.99.8.1/doc/help/main/refresh0000644000175000017500000000015110234217324016674 0ustar ryanryan00000000000000SYNTAX: refresh Repaints and refreshes the terminal. This is useful for when the screen gets messed up. pork-0.99.8.1/doc/help/main/alias0000644000175000017500000000060110234217324016327 0ustar ryanryan00000000000000SYNTAX: alias Makes an alias for . PARAMETERS : The name of the new alias. : The value of the new alias. EXAMPLES alias ws win swap - Adds an alias such that typing /ws 1 is equivalent to typing win swap 1 Type /alias or consult the global porkrc file for more examples. SEE ALSO unalias pork-0.99.8.1/doc/help/main/blist0000644000175000017500000000013610234217324016356 0ustar ryanryan00000000000000BLIST COMMAND SET The blist command set provides commands relating to the buddy list window. pork-0.99.8.1/doc/help/main/buddy0000644000175000017500000000032610234217324016351 0ustar ryanryan00000000000000THE BUDDY COMMAND SET The buddy command set is comprised of commands relating to the management of AIM buddy, blocked users, and permitted users list, as well as commands that display information about AIM users. pork-0.99.8.1/doc/help/main/color0000644000175000017500000000374410234217324016367 0ustar ryanryan00000000000000PORK COLOR CODES Pork defines color codes that allow the color of characters in strings to be specified. Color codes are of the format %%[,]. Foreground and background are valid color specifiers (described below). The comma and parameter are optional. If no background color is specified, the default background color will be assumed. Background colors will show up as non-bold, even if they're specified as bold. This is a limitation of the terminal. Valid color codes are: d = black (%dsample%x) D = bold black (%Dsample%x) r = red (%rsample%x) R = bold red (%Rsample%x) g = green (%gsample%x) G = bold green (%Gsample%x) y = yellow (%ysample%x) Y = bold yellow (%Ysample%x) b = blue (%bsample%x) B = bold blue (%Bsample%x) m = magenta (%msample%x) P = bold magenta (%Msample%x) c = cyan (%csample%x) C = bold cyan (%Csample%x) w = white (%wsample%x) W = bold white (%Wsample%x) x = clear all color codes for the current string. In addition, the following highlighting attributes can be used: 1 = bold (%1sample%x) 2 = reverse (%2sample%x) 3 = underline (%3sample%x) 4 = blink (%4sample%x) 5 = standout (%5sample%x) 6 = dim (%6sample%x) Highligting modes can be turned off by using -. For example, '%%1bold%%-1 not bold' is displayed as '%1bold%-1 not bold'. Highlighting attributes, unlike colors, cascade, meaning you can accumulate highlighting attributes by specifing them one after another in a string. For example '%%b%%1%%2%%3' is bold, reverse, underline blue (%b%1%2%3like this%x). Specifying a color code in a string causes all attributes in the string to that point to be cleared. For example, '%%1%%2%%3%%b' is just blue (%1%2%3%blike this%x); '%%1%%2%%b%%3' is underline blue (%1%2%b%3like this%x). %%%% = literal '%' EXAMPLES %%Y,b is yellow text on a blue background. (%Y,bsample%x) %%m is magenta text on a black background. (%msample%x) pork-0.99.8.1/doc/help/main/event0000644000175000017500000003364210234217324016372 0ustar ryanryan00000000000000THE EVENT COMMAND SET The pork events system allows zero or more event handlers to be installed for each of the events described below. Event handlers are executed when the event they're handling occurs. Event handlers are normally Perl functions. Many events pass parameters to their event handlers; the parameters passed into each event handler are enumerated and described below. For events that send something, event handlers are executed before whatever is to be sent is actually sent. For events that are triggered upon receiving something (e.g. receiving an IM), event handlers are executed before any output that normally accompanies the event is printed. The events system allows for event handlers to break the chain of control and fully handle events themselves. This is accomplished by returning a non-zero value from an event handler. For example, an event handler for the SEND_IDLE event could send the server 30 + the number of idle seconds that would have been reported, then return 1, letting the client know that it has fully handled the event, and all the processing that normally occurs for the event will be bypassed. EVENTS %cBUDDY_AWAY This event signal is received when a user on the current account's buddy_list goes away. Parameters: (string) The username of the user who went away. (integer) The reference number of the account on which the event was triggered. %cBUDDY_BACK This event signal is received when a user on the current account's buddy list returns from being away. Parameters: (string) The username of the user who returned from being away. (integer) The reference number of the account on which the event was triggered. %cBUDDY_IDLE This event signal is received when a user on the current account's buddy list becomes idle. Parameters: (string) The username of the user who became idle. (integer) The reference number of the account on which the event was triggered. %cBUDDY_SIGNOFF This event signal is received when a user on the current account's buddy list signs off. Parameters: (string) The username of the user who signed off. (integer) The reference number of the account on which the event was triggered. %cBUDDY_SIGNON This event signal is received when a user on the current account's buddy list signs on. Parameters: (string) The username of the user who signed on. (integer) The reference number of the account on which the event was triggered. %cBUDDY_UNIDLE This event signal is received when a user on the current account's user list is no longer idle. Parameters: (string) The username of the user who is no longer idle. (integer) The reference number of the account on which the event was triggered. %cQUIT This event signal is generated when the /quit command is executed. Parameters: : The quit message, if any. %cRECV_ACTION This event signal is generated when an action is received from another user. Paramters: (string) The user who sent the action. (string) The userhost of the sender, if available. (string) The destination, as specified, by the sender. (string) The text of the action message. (integer) The reference number of the account on which the event was triggered. %cRECV_AWAYMSG This event signal is generated when a user's away message is received. Parameters: (string) The user whose away message was received. (integer, UNIX time format) The time since the user's account has existed. (integer, UNIX time format) The time the user signed on. (integer) The user's idle time. (integer) The user's warning level. (string) The user's away message. (integer) The reference number of the account that received the away message. %cRECV_CHAT_ACTION This event signal is generated when an action is received in a chat room. Paramters: (string) The name of the chat room. (string) The destination of the action as specified by the sender. (string) The user who sent the action. (string) The userhost of the the sender, if available. (string) The text of the action message. (integer) The reference number of the account on which the event was triggered. %cRECV_CHAT_INVITE This event signal is generated when an invitation to a chat room received. Parameters: (string) The name of the chat room. (string) The user who sent the chat invitation. (string) The userhost of the the sender of the chat invitation, if available. (string) The message that accompanied the chat invitation or undef if none was given. (integer) The reference number of the account that was invited to a chat room. %cRECV_CHAT_JOIN This event signal is generated when a chat room is joined. Parameters: (string) The name of the chat room. (string) The user who joined the chat room. (string) The userhost of the user who joined, if available. (integer) The reference number of the account on which the event was triggered. %cRECV_CHAT_KICK This event signal is generated when a user is forcibly removed from a chat room. Parameters: (string) The name of the chat room. (string) The username of the person who was kicked. (string) The username of the person who initiated the kick. (string) The reason, if any, given for the kick. (integer) The reference number of the account on which the event was triggered. %cRECV_CHAT_LEAVE This event signal is generated when leaving a chat room. Parameters: (string) The name of the chat room. (string) The user who left the chat room. (integer) The reference number of the account on which the event was triggered. %cRECV_CHAT_MSG This event signal is generated when a message is received in a chat room. Parameters: (string) The name of the chat room. (string) The destination of the message as specified by the sender. (string) The user who sent the message. (string) The userhost of the the sender, if available. (string) The text of the message. (integer) The reference number of the account that received the chat message. %cRECV_CHAT_NOTICE This event signal is generated when a notice is received in a chat room. Parameters: (string) The name of the chat room. (string) The destination of the notice as specified by the sender. (string) The user who sent the notice. (string) The userhost of the the sender, if available. (string) The notice text. (integer) The reference number of the account that received the chat message. %cRECV_CHAT_MODE (string) The name of the chat room. (string) The user who set the mode. (string) The mode string. (integer) The reference number of the account that received the chat message. %cRECV_CHAT_QUIT (string) The name of the chat room. (string) The user who quit. (string) The quit message, if any. (integer) The reference number of the account that received the chat message. %cRECV_IM This event signal is generated when a private message is received. Parameters: (string) The user who sent the IM. (string) The userhost of the sender, if available. (string) The destination, as specified, by the sender. (boolean) 0 if the IM is not an auto-reply. 1 if the IM is an auto-reply. (string) The message that was received. (integer) The reference number of the account that received the IM. %cRECV_NOTICE This event signal is generated when a notice is received. Parameters: (string) The user who sent the IM. (string) The userhost of the sender, if available. (string) The destination, as specified, by the sender. (string) The message that was received. (integer) The reference number of the account that received the IM. %cRECV_PROFILE This event signal is generated when a user's profile is received. Parameters: (string) The user whose profile was received. (integer, UNIX time format) The time since the user's account has existed. (integer, UNIX time format) The time the user signed on. (integer) The user's idle time. (integer) The user's warning level. (string) The user's profile. (integer) The reference number of the account that received the profile. %cRECV_RAW This event is generated for text-based protocols (e.g., IRC) when raw data is received from the server. Parameters: (string) The command (or numeric) received. (string) The complete line of text received. %cRECV_SEARCH_RESULT This event signal is generated when the results of a search command are received. Parameters: (string) The string for which the search was initiated. (string) The results of the search. (integer) The reference number of the account that initiated the search. %cRECV_WARN This event signal is generated when a warning is received. Parameters: (string) The user who sent the warning or undef if it was anonymous. (integer) The new warning level of the user who was warned. (integer) The reference number of the account that was warned. %cSEND_ACTION This event signal is generated when a local screen name sends an action to another user. Parameters: (string) The user to whom the action was sent. (string) The text of the action message that was sent. (integer) The reference number of the account that sent the action. %cSEND_AWAY This event signal is generated when a local screen name sends an away message. Parameters: (string) The text of the away message or undef if none was given. (integer) The reference number of the account that sent the away message. %cSEND_CHAT_MSG This event signal is generated when a local screen name sends an action in a chat room. Parameters: (string) The name of the chat room. (string) The text of the action message. (integer) The reference number of the account that sent the message. %cSEND_CHAT_INVITE This event signal is generated when a local screen name sends a chat invitation. Parameters: (string) The name of the chat room. (string) The message that was sent with the invitation or undef if no message was sent. (integer) The reference number of the account on which the event was triggered. %cSEND_CHAT_JOIN This event signal is generated when a local screen name joins a chat room. Parameters: (string) The name of the chat room. (integer) The reference number of the account on which the event was triggered. %cSEND_CHAT_LEAVE This event signal is generated when a local screen name leaves a chat room. Parameters: (string) The name of the chat room. (integer) The reference number of the account the generated the event. %cSEND_CHAT_MSG This event signal is generated when a local screen name sends a chat message. Parameters: (string) The name of the chat room. (string) The text of the message to be sent. (integer) The reference number of the account that sent the message. %cSEND_IDLE This event signal is generated when a local screen name reports its idle time. Parameters: (integer) The idle time in seconds that is to be reported. (integer) The reference number of the account that reported its idle time. %cSEND_IM This event signal is generated when an IM is sent. Parameters: (string) The user to whom the IM is to be sent. (string) The text of the IM to be sent. (integer) The reference number of the account that sent the IM. %cSEND_LINE This event signal is generated when the "/input send" command is executed (e.g. by pressing enter on the input line). Parameters: (string) The input line that is to be sent. (integer) The reference number of the account on which the event was triggered. %cSEND_PROFILE This event signal is generated when a local screen name sends its profile. Parameters: (string) The contents of the profile that is to be sent. (integer) The reference number of the account whose profile is to be sent. %cSEND_WARN This event signal is generated when a local screen name sends a warning. Parameters: (string) The person who is to be warned. (boolean) 0 is the warning is not anonymous. 1 if the warning is anonymous. (integer) The reference number of the account on which the event was triggered. %cSIGNOFF This event signal is generated when a local screen name has been signed off. Parameters: (integer) The reference number of the account that signed off. %cSIGNON This event signal is generated when a local screen name has been successfully signed on. Parameters: (integer) The reference number of the account that signed on. %cUNLOAD This event signal is generated when the "/perl_dump" command is executed. No parameters pork-0.99.8.1/doc/help/main/input0000644000175000017500000000016410234217324016401 0ustar ryanryan00000000000000THE INPUT COMMAND SET The input command set provides commands that manipulate the input line and the input cursor. pork-0.99.8.1/doc/help/main/laddr0000644000175000017500000000040210234217324016323 0ustar ryanryan00000000000000SYNTAX: laddr [] Sets the local address for all outgoing connections. PARAMETERS : (Optional) The address to use. If this parameter is omitted, the current local address that outgoing connections will use is displayed. pork-0.99.8.1/doc/help/main/lport0000644000175000017500000000036210234217324016402 0ustar ryanryan00000000000000SYNTAX: lport [] Sets the port number for the main connection. PARAMETERS : (Optional) The port number to use. If this parameter is omitted, the current local port number that the main connection will use is displayed. pork-0.99.8.1/doc/help/main/query0000644000175000017500000000041110234217324016402 0ustar ryanryan00000000000000SYNTAX: query [] Opens a new query window with a user. If there is already a query window open with that user, that query window is made visible. If no screen name is specified and the current window is an IM (query) window, it will be closed. pork-0.99.8.1/doc/help/main/quote0000644000175000017500000000024610234217324016400 0ustar ryanryan00000000000000SYNTAX: quote Sends the string specified to the server as a raw command. This command is only supported for IRC. PARAMETERS : The string to send. pork-0.99.8.1/doc/help/main/timer0000644000175000017500000000066110234217324016364 0ustar ryanryan00000000000000THE TIMER COMMAND SET Pork supports a timer system that allows commands to be executed at a regular interval a specified number of times. For example, it's possible to add a timer that causes the command "echo hi" to be executed every 2 seconds, 10 times (/timer add 2 10 echo hi). Specifying 0 for the number of times the command should be executed means it will be executed at the specified interval an unlimited number of times. pork-0.99.8.1/doc/help/main/lastlog0000644000175000017500000000064610234217324016714 0ustar ryanryan00000000000000SYNTAX: lastlog [flags] [regex] Search the current window's history buffer for strings matching an extended regular expression, and print all matches to the screen. The lastlog command supports the following optional flags: -b Don't use extended regular expressions; use basic regular expressions. -i Ignore case. PARAMETERS : (Optional) Options for the search. : Regular expression to match. pork-0.99.8.1/doc/help/main/perl_load0000644000175000017500000000022610234217324017202 0ustar ryanryan00000000000000SYNTAX: perl_load Loads the specified Perl script. PARAMETERS : The filename of the Perl script to be loaded. SEE ALSO perl pork-0.99.8.1/doc/help/main/Makefile.am0000644000175000017500000000072510234217324017356 0ustar ryanryan00000000000000main_DATA = \ acct \ alias \ auto \ away \ bind \ blist \ buddy \ chat \ color \ connect \ disconnect \ echo \ eval \ event \ file \ history \ idle \ input \ keys \ laddr \ lastlog \ load \ lport \ msg \ nick \ notice \ perl \ perl_load \ profile \ query \ quit \ quote \ refresh \ save \ scroll \ set \ timer \ unalias \ unbind \ who \ whowas \ win maindir = $(pkgdatadir)/help/main pork-0.99.8.1/doc/help/main/Makefile.in0000644000175000017500000002226410236222652017373 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/main DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(maindir)" mainDATA_INSTALL = $(INSTALL_DATA) DATA = $(main_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ main_DATA = \ acct \ alias \ auto \ away \ bind \ blist \ buddy \ chat \ color \ connect \ disconnect \ echo \ eval \ event \ file \ history \ idle \ input \ keys \ laddr \ lastlog \ load \ lport \ msg \ nick \ notice \ perl \ perl_load \ profile \ query \ quit \ quote \ refresh \ save \ scroll \ set \ timer \ unalias \ unbind \ who \ whowas \ win maindir = $(pkgdatadir)/help/main all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/main/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/main/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-mainDATA: $(main_DATA) @$(NORMAL_INSTALL) test -z "$(maindir)" || $(mkdir_p) "$(DESTDIR)$(maindir)" @list='$(main_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(mainDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(maindir)/$$f'"; \ $(mainDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(maindir)/$$f"; \ done uninstall-mainDATA: @$(NORMAL_UNINSTALL) @list='$(main_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(maindir)/$$f'"; \ rm -f "$(DESTDIR)$(maindir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(maindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-mainDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-mainDATA .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-mainDATA \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-info-am uninstall-mainDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/main/notice0000644000175000017500000000021510234217324016520 0ustar ryanryan00000000000000SYNTAX: notice Sends a notice. PARAMETERS : The user to whom to send the notice. : The notice to send. pork-0.99.8.1/doc/help/main/unalias0000644000175000017500000000016710234217324016701 0ustar ryanryan00000000000000SYNTAX: unalias Removes an alias. PARAMETERS : The name of the alias to be removed. SEE ALSO alias pork-0.99.8.1/doc/help/main/scroll0000644000175000017500000000020210234217324016531 0ustar ryanryan00000000000000THE SCROLL COMMAND SET The scroll command set contains commands that provide functionality for scrolling the display of windows. pork-0.99.8.1/doc/help/main/unbind0000644000175000017500000000027110234217324016520 0ustar ryanryan00000000000000SYNTAX: unbind Removes the binding, if any, that exist for a keycode. PARAMETERS : The name of the key for which bindings are to be removed. SEE ALSO bind keys pork-0.99.8.1/doc/help/main/history0000644000175000017500000000015610234217324016744 0ustar ryanryan00000000000000HISTORY COMMAND SET The history command set provides commands relating to the input history line and buffer. pork-0.99.8.1/doc/help/main/whowas0000644000175000017500000000022510234217324016550 0ustar ryanryan00000000000000SYNTAX: whowas Retrieves the userinfo of the user specified. PARAMETERS : The screen name whose userinfo is to be retrieved. pork-0.99.8.1/doc/help/main/profile0000644000175000017500000000033410234217324016701 0ustar ryanryan00000000000000SYNTAX: profile [] Sets the profile for the current screen name. If no parameters are specified, the profile for the current user is removed. PARAMETERS : (Optional) The profile to be set. pork-0.99.8.1/doc/help/perl/0000755000175000017500000000000010236222745015341 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/win_erase0000644000175000017500000000057210234217324017237 0ustar ryanryan00000000000000SYNTAX: PORK::win_erase([refnum]) Clears the current window. The text that was displayed in the window before the win erase command was executed is gone for good. INPUT PARAMETERS refnum: (Optional) The reference number of the window to erase. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO win erase pork-0.99.8.1/doc/help/perl/disconnect0000644000175000017500000000000010234217324017376 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/bind_get0000644000175000017500000000000010234217324017020 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/buddy_get_groups0000644000175000017500000000000010234217324020612 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/bind0000644000175000017500000000000010234217324016161 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/echo0000644000175000017500000000045110234217324016175 0ustar ryanryan00000000000000SYNTAX: PORK::echo(msg) Echo a string to the screen. The string may contain embedded color attributes. This function is analogous to the echo command. INPUT PARAMETERS msg: The text of the message to be echoed. RETURN VALUE Returns -1 if no message is specified, 0 otherwise. SEE ALSO echo pork-0.99.8.1/doc/help/perl/load0000644000175000017500000000034610234217324016201 0ustar ryanryan00000000000000SYNTAX: PORK::load(filename) Loads a porkrc-style file. The format of this file is one pork command per line. INPUT PARAMETERS filename: The filename to load. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO load pork-0.99.8.1/doc/help/perl/quit0000644000175000017500000000033110234217324016236 0ustar ryanryan00000000000000SYNTAX: PORK::quit([exit_status]) Exit the client. INPUT PARAMETERS exit_status: (Optional) The exit status of the process. RETURN VALUE Returns -1 if more than one parameter is passed, otherwise doesn't return. pork-0.99.8.1/doc/help/perl/save0000644000175000017500000000031610234217324016215 0ustar ryanryan00000000000000SYNTAX: PORK::save() Writes a new porkrc file containing the current aliases, bindings, and global /set options. INPUT PARAMETERS None RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO save pork-0.99.8.1/doc/help/perl/warn0000644000175000017500000000045610234217324016233 0ustar ryanryan00000000000000SYNTAX: PORK::warn(user, how, [account]) Warns a user. INPUT PARAMETERS user : The user to warn. how : 1 to warn the user anonymously, 0 otherwise. account: The account from which to send the warning. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy warn buddy warn_anon pork-0.99.8.1/doc/help/perl/blist_page_up0000644000175000017500000000072210234217324020075 0ustar ryanryan00000000000000SYNTAX: PORK::blist_page_up([account]) Moves a buddy list's cursor up one "screenful" down, if possible. A screenful here is defined as the number of buddy list lines that are visible on the buddy list's display. INPUT PARAMETERS account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the account that's bound to the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist page_up pork-0.99.8.1/doc/help/perl/chat_get_window0000644000175000017500000000000010234217324020412 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/blist_bind_get0000644000175000017500000000000010234217324020215 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/connect0000644000175000017500000000000010234217324016676 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/send_msg_auto0000644000175000017500000000051510234217324020107 0ustar ryanryan00000000000000SYNTAX: PORK::send_msg_auto(destination, msg, [account]) Sends an auto-reply message. INPUT PARAMETERS destination: The screen name to send the message to. msg : The message to send. account : (Optional) The account from which to send the message. RETURN VALUE Returns 0 on success and -1 on failure. SEE ALSO msg pork-0.99.8.1/doc/help/perl/refresh0000644000175000017500000000016410234217324016716 0ustar ryanryan00000000000000SYNTAX: PORK::refresh() Refreshes the screen. INPUT PARAMETERS None RETURN VALUE Returns 0. SEE ALSO refresh pork-0.99.8.1/doc/help/perl/chat_get_users0000644000175000017500000000000010234217324020244 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/buddy_get_permit0000644000175000017500000000000010234217324020573 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/buddy_add_block0000644000175000017500000000074210234217324020353 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_add_block(user, [account]) Adds a screen name to an account's blocked users list. Note that for AIM, in order to activate the blocked users list, your privacy mode must be set to 4. INPUT PARAMETERS user : The screen name to block. account: (Optional) The account whose block list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy block buddy privacy_mode pork-0.99.8.1/doc/help/perl/win_find_name0000644000175000017500000000000010234217324020042 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/buddy_add_group0000644000175000017500000000055110234217324020413 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_add_group(group, [account]) Adds a new group to an account's buddy list. INPUT PARAMETERS group : The name of the group to add. account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy add_group pork-0.99.8.1/doc/help/perl/event_purge0000644000175000017500000000020210234217324017574 0ustar ryanryan00000000000000SYNTAX: PORK::event_purge() Removes all event handlers. INPUT PARAMETERS None RETURN VALUE Returns 0. SEE ALSO event purge pork-0.99.8.1/doc/help/perl/alias0000644000175000017500000000000010234217324016336 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/scroll_start0000644000175000017500000000045210234217324017773 0ustar ryanryan00000000000000SYNTAX: PORK::scroll_start([refnum]) Scrolls a window's display up to its top. INPUT PARAMETERS refnum: (Optional) The reference number of the window to scroll. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO scroll start pork-0.99.8.1/doc/help/perl/quote0000644000175000017500000000044410234217324016416 0ustar ryanryan00000000000000SYNTAX: PORK::quote(string, [account]) Send a command string directly to the server. This is supported only by IRC. INPUT PARAMETERS string : Command string. account: (Optional) The refnum of the account from which to send the command. RETURN VALUE Returns -1 on failure, 0 on success. pork-0.99.8.1/doc/help/perl/win_rename0000644000175000017500000000046710234217324017412 0ustar ryanryan00000000000000SYNTAX: PORK::win_rename(name, [refnum]) Renames a window. INPUT PARAMETERS name: The new name of the window. refnum: (Optional) The reference number of the window to rename. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO win rename pork-0.99.8.1/doc/help/perl/report_idle0000644000175000017500000000052110234217324017565 0ustar ryanryan00000000000000SYNTAX: PORK::report_idle(boolean, [account]) Control whether idle time is reported for an account. INPUT PARAMETERS boolean: 1 to enable reporting idle time, 0 to disable it. account: The account for which to enable or disable reporting idle time. RETURN VALUE Returns 0 on success and -1 on failure. SEE ALSO buddy report_idle pork-0.99.8.1/doc/help/perl/chat_unignore0000644000175000017500000000102010234217324020075 0ustar ryanryan00000000000000SYNTAX: PORK::chat_unignore(chat_room, user, [account]) Stop ignoring a user in a chat room. INPUT PARAMETERS chat_room: The name/exchange combination of the chat room in which to unignore the specified user user. user : The user to unignore. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO perl chat_ignore chat ignore chat unignore pork-0.99.8.1/doc/help/perl/win_get_opt0000644000175000017500000000000010234217324017563 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/set_profile0000644000175000017500000000050710234217324017574 0ustar ryanryan00000000000000SYNTAX: PORK::set_profile([profile], [account]) Sets the profile for an account and stores the profile locally. INPUT PARAMETERS away_msg: (Optional) The text of the profile. account : (Optional) The account whose profile to set. RETURN VALUE Returns 0 on success and -1 on failure. SEE ALSO profile perl send_profile pork-0.99.8.1/doc/help/perl/event_del_type0000644000175000017500000000036710234217324020273 0ustar ryanryan00000000000000SYNTAX: PORK::event_del_type(event_type) Remove all event handlers for an event type. INPUT PARAMETERS event_type: The type of event for which all handlers will be removed. RETURN VALUE Returns 0 on success, -1 on error. SEE ALSO event del pork-0.99.8.1/doc/help/perl/scroll_page_up0000644000175000017500000000054010234217324020254 0ustar ryanryan00000000000000SYNTAX: PORK::scroll_page_up([refnum]) Scrolls a window's display up by one page (i.e. the number of visible rows in the display). INPUT PARAMETERS refnum: (Optional) The reference number of the window to scroll. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO scroll page_up pork-0.99.8.1/doc/help/perl/timer_add0000644000175000017500000000127710234217324017216 0ustar ryanryan00000000000000SYNTAX: PORK::timer_add(interval, times, command) Adds a timer event that will cause a command to be run some number of times at a specified interval. INPUT PARAMETERS interval: The interval at which the command will be run. times : The number of times to run the command. 0 means unlimited. command : The command that will be run. The command can be any command that can be entered on the command line. RETURN VALUE On success, returns the reference number of the timer event that was installed, on failure, returns -1. EXAMPLES PORK::timer_add(30, 10, "echo testing"); - Causes the command "echo testing" to be executed every 30 seconds, a total of 10 times. SEE ALSO timer timer add pork-0.99.8.1/doc/help/perl/timer_del0000644000175000017500000000062410234217324017225 0ustar ryanryan00000000000000SYNTAX: PORK::timer_del(command) Delete the timer entry that executes the specified command. If there are multiple timer entries that execute the same command, the first (i.e. the most recently added) matching timer event will be deleted. INPUT PARAMETERS command: The command executed by the timer event that is to be deleted. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO timer del pork-0.99.8.1/doc/help/perl/set_opt0000644000175000017500000000000010234217324016722 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/get_acct_list0000644000175000017500000000025710234217324020067 0ustar ryanryan00000000000000SYNTAX: PORK::get_acct_list() Returns a list of the currently connected accounts. INPUT PARAMETERS none RETURN VALUE Returns a list of the currently logged in usernames. pork-0.99.8.1/doc/help/perl/send_profile0000644000175000017500000000046410234217324017734 0ustar ryanryan00000000000000SYNTAX: PORK::send_profile(profile, [account]) Sets the profile for an account on the server without saving it locally. INPUT PARAMETERS profile: The profile text. account: The account for which the profile will be sent. RETURN VALUE Returns 0 on success and -1 on failure. SEE ALSO perl set_profile pork-0.99.8.1/doc/help/perl/get_cur_user0000644000175000017500000000026610234217324017751 0ustar ryanryan00000000000000SYNTAX: PORK::get_cur_user() Retrieves the currently active account's user name. INPUT PARAMETERS none RETURN VALUE Returns the screen name of the currently active screen name. pork-0.99.8.1/doc/help/perl/buddy_remove0000644000175000017500000000055410234217324017747 0ustar ryanryan00000000000000SYNTAX: buddy_remove(user, [account]) Removes a screen name from an account's buddy list. INPUT PARAMETERS user : The screen name that is to be removed. account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy remove pork-0.99.8.1/doc/help/perl/chat_ban0000644000175000017500000000076010234217324017021 0ustar ryanryan00000000000000SYNTAX: PORK::chat_ban(chat_room, user, [account]) Bans a user from a chat room. INPUT PARAMETERS chat_room: The name/exchange combination of the chat room in which to ban the specified user user. user : The user to ban. This may be a hostmask. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO chat ban. pork-0.99.8.1/doc/help/perl/run_cmd0000644000175000017500000000040710234217324016707 0ustar ryanryan00000000000000SYNTAX: PORK::run_cmd(cmd1,...,cmdN) Runs the list of commands as if entered from the input line. INPUT PARAMETERS cmd1: Command to run. The command must not be prefixed with a '/'. RETURN VALUE Returns 0 on success and -1 on failure. SEE ALSO input send pork-0.99.8.1/doc/help/perl/blist_end0000644000175000017500000000054310234217324017224 0ustar ryanryan00000000000000SYNTAX: PORK::blist_start([account]) Moves a buddy list's cursor to the bottom line of that buddy list. INPUT PARAMETERS account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the account that's bound to the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist start pork-0.99.8.1/doc/help/perl/chat_join0000644000175000017500000000062010234217324017213 0ustar ryanryan00000000000000SYNTAX: PORK::chat_join(chat_room, [account]) Joins a chat room. INPUT PARAMETERS chat_room: The name/exchange combination of the chat room to join. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO chat chat join pork-0.99.8.1/doc/help/perl/chat_kick0000644000175000017500000000100710234217324017175 0ustar ryanryan00000000000000SYNTAX: PORK::chat_kick(chat_room, user, reason, [account]) Kicks a user from a chat room. INPUT PARAMETERS chat_room: The name/exchange combination of the chat room from which to kick the specified user user. user : The user to kick. reason : Reason for the kick. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO chat kick pork-0.99.8.1/doc/help/perl/chat_send0000644000175000017500000000072210234217324017210 0ustar ryanryan00000000000000SYNTAX: PORK::chat_send(chat_room, msg, [account]) Sends a message to a chat room. INPUT PARAMETERS chat_room: The name/exchange combination of the chat room to which to send the message. message : The message to send. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO chat send pork-0.99.8.1/doc/help/perl/blist_refresh0000644000175000017500000000047110234217324020114 0ustar ryanryan00000000000000SYNTAX: PORK::blist_refresh([account]) Refresh a buddy list's display. INPUT PARAMETERS account: The account whose buddy list will be refreshed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist refresh pork-0.99.8.1/doc/help/perl/err_msg0000644000175000017500000000033710234217324016720 0ustar ryanryan00000000000000SYNTAX: PORK::err_msg(msg) Prints a error message to the screen. INPUT PARAMETERS msg: The text of the message to be printed. RETURN VALUE Returns -1 if no message is specified, 0 otherwise. SEE ALSO perl status_msg pork-0.99.8.1/doc/help/perl/blist_up0000644000175000017500000000052010234217324017075 0ustar ryanryan00000000000000SYNTAX: PORK::blist_up([account]) Moves a buddy list's cursor up one line, if possible. INPUT PARAMETERS account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the account that's bound to the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist up pork-0.99.8.1/doc/help/perl/buddy_add_permit0000644000175000017500000000075210234217324020562 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_add_permit(user, [account]) Adds a screen name to an account's permitted users list. Note that for AIM, in order to activate the permitted users list, your privacy mode must be set to 3. INPUT PARAMETERS user : The screen name to permit. account: (Optional) The account whose permit list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy permit buddy privacy_mode pork-0.99.8.1/doc/help/perl/load_perl0000644000175000017500000000033010234217324017214 0ustar ryanryan00000000000000SYNTAX: load_perl(filename) Loads the specified Perl script. INPUT PARAMETERS filename: The filename of the Perl script to be loaded. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO perl perl_load pork-0.99.8.1/doc/help/perl/get_buddy_profile0000644000175000017500000000063310234217324020747 0ustar ryanryan00000000000000SYNTAX: PORK::get_buddy_profile(person, [account]) Requests the profile for 'person'. INPUT PARAMETERS person : The user whose profile is requested. account : (Optional) The account from which to send the request. RETURN VALUE Returns 0 on success and -1 on failure. To retrieve the results of the lookup, you'll have to install an event handler to catch the RECV_PROFILE event. SEE ALSO buddy profile pork-0.99.8.1/doc/help/perl/event_add0000644000175000017500000000056410234217324017215 0ustar ryanryan00000000000000SYNTAX: PORK::event_add(type, handler) INPUT PARAMETERS type : The type of event for which the handler will be installed. handler: The name of the Perl function that will be called when the specified event type occurs. RETURN VALUE On success, returns the reference number of the event handler that was installed, on failure returns -1. SEE ALSO event event add pork-0.99.8.1/doc/help/perl/event_del0000644000175000017500000000045210234217324017225 0ustar ryanryan00000000000000SYNTAX: PORK::event_del(type, handler) Removes an event handler for an event type. INPUT PARAMETERS type : The type of event for which a handler will be removed. handler: The name of the handler function to be removed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO event del pork-0.99.8.1/doc/help/perl/buddy_get_alias0000644000175000017500000000000010234217324020364 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/buddy_get_block0000644000175000017500000000000010234217324020365 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/blist_collapse0000644000175000017500000000000010234217324020244 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/blist_cursor0000644000175000017500000000000010234217324017757 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/get_opt0000644000175000017500000000000010234217324016706 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/scroll_end0000644000175000017500000000045310234217324017405 0ustar ryanryan00000000000000SYNTAX: PORK::scroll_end([refnum]) Scrolls a window's display down to its bottom. INPUT PARAMETERS refnum: (Optional) The reference number of the window to scroll. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO scroll end pork-0.99.8.1/doc/help/perl/alias_get0000644000175000017500000000000010234217324017175 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/Makefile.am0000644000175000017500000000362110234217324017372 0ustar ryanryan00000000000000perl_DATA = \ alias \ alias_get \ bind \ bind_get \ blist_bind \ blist_bind_get \ blist_collapse \ blist_cursor \ blist_down \ blist_end \ blist_hide \ blist_page_down \ blist_page_up \ blist_refresh \ blist_select \ blist_show \ blist_start \ blist_unbind \ blist_up \ blist_width \ buddy_add \ buddy_add_block \ buddy_add_group \ buddy_add_permit \ buddy_alias \ buddy_clear_block \ buddy_clear_permit \ buddy_get_alias \ buddy_get_block \ buddy_get_group_members \ buddy_get_groups \ buddy_get_permit \ buddy_remove \ buddy_remove_block \ buddy_remove_group \ buddy_remove_permit \ chat_ban \ chat_get_list \ chat_get_users \ chat_get_window \ chat_ignore \ chat_invite \ chat_join \ chat_kick \ chat_leave \ chat_send \ chat_topic \ chat_unignore \ connect \ disconnect \ echo \ err_msg \ event_add \ event_del \ event_del_refnum \ event_del_type \ event_purge \ get_acct_list \ get_buddy_away \ get_buddy_profile \ get_cur_user \ get_opt \ get_profile \ load \ load_perl \ privacy_mode \ quit \ quote \ refresh \ report_idle \ run_cmd \ save \ scroll_by \ scroll_down \ scroll_end \ scroll_page_down \ scroll_page_up \ scroll_start \ scroll_up \ search \ send_msg \ send_msg_auto \ send_profile \ set_away \ set_idle \ set_opt \ set_profile \ status_msg \ timer_add \ timer_del \ timer_del_refnum \ timer_purge \ unalias \ unbind \ warn \ win_bind \ win_clear \ win_close \ win_erase \ win_find_name \ win_find_target \ win_get_opt \ win_next \ win_prev \ win_rename \ win_renumber \ win_set_opt \ win_swap perldir = $(pkgdatadir)/help/perl pork-0.99.8.1/doc/help/perl/Makefile.in0000644000175000017500000002516010236222652017407 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/perl DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(perldir)" perlDATA_INSTALL = $(INSTALL_DATA) DATA = $(perl_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ perl_DATA = \ alias \ alias_get \ bind \ bind_get \ blist_bind \ blist_bind_get \ blist_collapse \ blist_cursor \ blist_down \ blist_end \ blist_hide \ blist_page_down \ blist_page_up \ blist_refresh \ blist_select \ blist_show \ blist_start \ blist_unbind \ blist_up \ blist_width \ buddy_add \ buddy_add_block \ buddy_add_group \ buddy_add_permit \ buddy_alias \ buddy_clear_block \ buddy_clear_permit \ buddy_get_alias \ buddy_get_block \ buddy_get_group_members \ buddy_get_groups \ buddy_get_permit \ buddy_remove \ buddy_remove_block \ buddy_remove_group \ buddy_remove_permit \ chat_ban \ chat_get_list \ chat_get_users \ chat_get_window \ chat_ignore \ chat_invite \ chat_join \ chat_kick \ chat_leave \ chat_send \ chat_topic \ chat_unignore \ connect \ disconnect \ echo \ err_msg \ event_add \ event_del \ event_del_refnum \ event_del_type \ event_purge \ get_acct_list \ get_buddy_away \ get_buddy_profile \ get_cur_user \ get_opt \ get_profile \ load \ load_perl \ privacy_mode \ quit \ quote \ refresh \ report_idle \ run_cmd \ save \ scroll_by \ scroll_down \ scroll_end \ scroll_page_down \ scroll_page_up \ scroll_start \ scroll_up \ search \ send_msg \ send_msg_auto \ send_profile \ set_away \ set_idle \ set_opt \ set_profile \ status_msg \ timer_add \ timer_del \ timer_del_refnum \ timer_purge \ unalias \ unbind \ warn \ win_bind \ win_clear \ win_close \ win_erase \ win_find_name \ win_find_target \ win_get_opt \ win_next \ win_prev \ win_rename \ win_renumber \ win_set_opt \ win_swap perldir = $(pkgdatadir)/help/perl all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/perl/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/perl/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-perlDATA: $(perl_DATA) @$(NORMAL_INSTALL) test -z "$(perldir)" || $(mkdir_p) "$(DESTDIR)$(perldir)" @list='$(perl_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(perlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(perldir)/$$f'"; \ $(perlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(perldir)/$$f"; \ done uninstall-perlDATA: @$(NORMAL_UNINSTALL) @list='$(perl_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(perldir)/$$f'"; \ rm -f "$(DESTDIR)$(perldir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(perldir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-perlDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-perlDATA .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-perlDATA install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-info-am uninstall-perlDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/perl/blist_bind0000644000175000017500000000000010234217324017356 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/blist_down0000644000175000017500000000052610234217324017426 0ustar ryanryan00000000000000SYNTAX: PORK::blist_down([account]) Moves a buddy list's cursor down one line, if possible. INPUT PARAMETERS account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the account that's bound to the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist down pork-0.99.8.1/doc/help/perl/get_profile0000644000175000017500000000060310234217324017555 0ustar ryanryan00000000000000SYNTAX: get_profile([account]) Returns the currently stored profile for a (local) account. INPUT PARAMETERS account: (Optional) The account for which to return a profile. RETURN VALUE On success, returns the profile of the requested account, or the profile for the account that's active in the current window, if no account name is specified. If an error occurs, undef is returned. pork-0.99.8.1/doc/help/perl/blist_hide0000644000175000017500000000057210234217324017371 0ustar ryanryan00000000000000SYNTAX: PORK::blist_hide([refnum]) Hides the buddy list display in a current window. If it's already hidden, no action is taken. INPUT PARAMETERS refnum: (Optional) The reference number of the window in which the buddy list will be hidden. If this parameter is omitted, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist hide pork-0.99.8.1/doc/help/perl/blist_show0000644000175000017500000000064310234217324017437 0ustar ryanryan00000000000000SYNTAX: PORK::blist_show([refnum]) Shows the buddy list owned by the account bound to a window in that window. If the buddy list is already visible, no action is taken. INPUT PARAMETERS refnum: (Optional) The reference number of the window in which the buddy list will be hidden. If this parameter is omitted, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist show pork-0.99.8.1/doc/help/perl/chat_ignore0000644000175000017500000000074310234217324017545 0ustar ryanryan00000000000000SYNTAX: PORK::chat_ignore(chat_room, user, [account]) Ignores a user in a chat room. INPUT PARAMETERS chat_room: The name/exchange combination of the chat room in which to ignore the specified user user. user : The user to ignore. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO chat ignore pork-0.99.8.1/doc/help/perl/buddy_get_group_members0000644000175000017500000000000010234217324022141 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/chat_get_list0000644000175000017500000000000010234217324020056 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/chat_invite0000644000175000017500000000111710234217324017554 0ustar ryanryan00000000000000SYNTAX: PORK::chat_invite(chat_room, user, msg, [account]) Invites a user to a chat room with an optional message. INPUT PARAMETERS chat_room: The name/exchange combination of the chat room to which to invite the user. user : The user to invite. msg : A message to be sent with the chat invitation. Specify undef to send no message. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO chat invite pork-0.99.8.1/doc/help/perl/scroll_down0000644000175000017500000000045310234217324017606 0ustar ryanryan00000000000000SYNTAX: PORK::scroll_down([refnum]) Scrolls a window's display down by one line. INPUT PARAMETERS refnum: (Optional) The reference number of the window to scroll. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO scroll down pork-0.99.8.1/doc/help/perl/chat_leave0000644000175000017500000000061010234217324017347 0ustar ryanryan00000000000000SYNTAX: PORK::chat_leave(chat_room, [account]) Leaves a chat room. PARAMETERS chat_room: The name/exchange combination of the chat room to leave. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO chat leave pork-0.99.8.1/doc/help/perl/event_del_refnum0000644000175000017500000000040710234217324020601 0ustar ryanryan00000000000000SYNTAX: PORK::event_del_refnum(refnum) Removes the event handler with the specified reference number. INPUT PARAMETERS refnum: The reference number of the event handler to remove. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO event del_refnum pork-0.99.8.1/doc/help/perl/timer_purge0000644000175000017500000000020010234217324017571 0ustar ryanryan00000000000000SYNTAX: PORK::timer_purge() Deletes all timer events. INPUT PARAMETERS None RETURN VALUE Returns 0. SEE ALSO timer purge pork-0.99.8.1/doc/help/perl/chat_topic0000644000175000017500000000117210234217324017375 0ustar ryanryan00000000000000SYNTAX: PORK::chat_topic(chat_room, new_topic, account) Sets the topic in a chat room. INPUT PARAMETERS chat_room: The name/exchange combination of the chat room in which to set the topic. new_topic: The new topic. If this parameter is undefined, the current chat topic will be returned. account : (Optional) The account on whose behalf the action will be performed. If this parameter is omitted, the account active in the current window will be assumed. RETURN VALUE Returns 0 on success, -1 on failure, when setting a topic. If the new_topic parameter is undefined, the current chat topic is returned. SEE ALSO chat topic pork-0.99.8.1/doc/help/perl/buddy_remove_permit0000644000175000017500000000063510234217324021327 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_remove_permit(user, [account]) Removes a screen name from an account's permitted users list. INPUT PARAMETERS user : The screen name to remove from the permitted users list. account: (Optional) The account whose permit list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy remove_permit pork-0.99.8.1/doc/help/perl/win_renumber0000644000175000017500000000105310234217324017752 0ustar ryanryan00000000000000SYNTAX: PORK::win_renumber(new_refnum, [old_refnum]) Changes the reference number of a window. If the reference number that is requested is currently in use, the window that has that reference number and the specified window will have their reference numbers swapped. INPUT PARAMETERS new_refnum: The new reference number for the specified window. old_refnum: (Optional) The reference number of the window to change. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO win renumber pork-0.99.8.1/doc/help/perl/win_find_target0000644000175000017500000000000010234217324020410 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/win_bind0000644000175000017500000000113410234217324017047 0ustar ryanryan00000000000000SYNTAX: PORK::win_bind(account, [refnum]) Binds a screen name to a window. Pork allows for an unlimited number of screen names to be signed on at the same time. Each window has 0 or 1 screen names bound to it. Any commands executed in a window are executed on behalf of the screen name that is bound to the window. INPUT PARAMETERS account: The account to bind to the specified window. refnum: (Optional) The reference number of the window the account will be bound to. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO win bind pork-0.99.8.1/doc/help/perl/win_next0000644000175000017500000000053710234217324017117 0ustar ryanryan00000000000000SYNTAX: PORK::win_next() Switch to the next window in the window list. The window list is circular and sorted by reference number, so executing this command when the window with the highest reference number is active will make the window with the lowest reference number current. INPUT PARAMETERS None RETURN VALUE Returns 0. SEE ALSO win next pork-0.99.8.1/doc/help/perl/unalias0000644000175000017500000000000010234217324016701 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/win_prev0000644000175000017500000000054310234217324017112 0ustar ryanryan00000000000000SYNTAX: PORK::win_prev() Switch to the previous window in the window list. The window list is circular and sorted by reference number, so executing this command when the window with the lowest reference number is active will make the window with the highest reference number current. INPUT PARAMETERS None RETURN VALUE Returns 0. SEE ALSO win prev pork-0.99.8.1/doc/help/perl/win_swap0000644000175000017500000000036610234217324017113 0ustar ryanryan00000000000000SYNTAX: PORK::win_swap(refnum) Switches to the window with the specified reference number. INPUT PARAMETERS refnum: The reference number of the window to which to switch. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO win swap pork-0.99.8.1/doc/help/perl/search0000644000175000017500000000072610234217324016531 0ustar ryanryan00000000000000SYNTAX: PORK::search(email_address, [account]) Request a list of all the screen names that the specified email address has registered. INPUT PARAMETERS email address: The email address of interest. account : (Optional) The account from which to send the request. RETURN VALUE Returns 0 on success and -1 on failure. To retrieve the results of the lookup, you'll have to install an event handler to handle the RECV_SEARCH_RESULT event. SEE ALSO buddy search pork-0.99.8.1/doc/help/perl/send_msg0000644000175000017500000000050410234217324017055 0ustar ryanryan00000000000000SYNTAX: PORK::send_msg(destination, msg, [account]) Sends a private message. INPUT PARAMETERS destination: The screen name to send the message to. msg : The message to send. account : (Optional) The account from which to send the message. RETURN VALUE Returns 0 on success and -1 on failure. SEE ALSO msg pork-0.99.8.1/doc/help/perl/blist_select0000644000175000017500000000116710234217324017740 0ustar ryanryan00000000000000SYNTAX: PORK::blist_select([account]) If the entry a buddy list cursor is on is a group entry, this command has the same effect as PORK::blist_collapse. If the entry the cursor is on is a user entry, this command will open a query window with the user named by the entry, if one doesn't already exist, and that query window will be made visible. INPUT PARAMETERS account: (Optional) The account whose buddy list will be used. If this parameter is omitted, the account that's bound to the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO perl blist_collapse blist select blist collapse pork-0.99.8.1/doc/help/perl/blist_page_down0000644000175000017500000000073010234217324020417 0ustar ryanryan00000000000000SYNTAX: PORK::blist_page_down([account]) Moves a buddy list's cursor down one "screenful" down, if possible. A screenful here is defined as the number of buddy list lines that are visible on the buddy list's display. INPUT PARAMETERS account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the account that's bound to the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist page_down pork-0.99.8.1/doc/help/perl/unbind0000644000175000017500000000000010234217324016524 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/blist_start0000644000175000017500000000053710234217324017616 0ustar ryanryan00000000000000SYNTAX: PORK::blist_start([account]) Moves a buddy list's cursor to the top line of the buddy list. INPUT PARAMETERS account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the account that's bound to the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist start pork-0.99.8.1/doc/help/perl/blist_width0000644000175000017500000000065310234217324017577 0ustar ryanryan00000000000000SYNTAX: PORK::blist_width(width, [account]) Changes the width of a buddy list window to the specified number of columns. PARAMETERS width : The new width in columns of the buddy list window. account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the account that's bound to the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO blist width pork-0.99.8.1/doc/help/perl/blist_unbind0000644000175000017500000000000010234217324017721 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/set_away0000644000175000017500000000070310234217324017073 0ustar ryanryan00000000000000SYNTAX: PORK::set_away([away_msg], [account]) Sets a user idle with an away message. If the 'away_msg' parameter is omitted, the user will be set "unaway", if already away. If the 'account' parameter is omitted, the action will apply to the current account. INPUT PARAMETERS away_msg: (Optional) The text of the away message. account : (Optional) The account to mark as away. RETURN VALUE Returns 0 on success and -1 on failure. SEE ALSO away pork-0.99.8.1/doc/help/perl/set_idle0000644000175000017500000000055310234217324017052 0ustar ryanryan00000000000000SYNTAX: PORK::set_idle(seconds, [account]) Sets the idle time for the specified account. If no account is specified, the idle time is set for the current account. INPUT PARAMETERS seconds: The number of seconds to which idle time will be set. account: (Optional) The account to set idle. RETURN VALUE Returns 0 on success and -1 on failure. SEE ALSO idle pork-0.99.8.1/doc/help/perl/buddy_remove_block0000644000175000017500000000061310234217324021115 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_remove_block(user, [account]) Removes a screen name from an account's blocked users list. PARAMETERS user : The screen name to remove from the blocked users list. account: (Optional) The account whose block list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy unblock pork-0.99.8.1/doc/help/perl/buddy_remove_group0000644000175000017500000000063710234217324021165 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_remove_group(group, [account]) Removes a group and all the buddies who are members of that group from an account's buddy list. PARAMETERS group : The name of the group to remove. account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy remove_group pork-0.99.8.1/doc/help/perl/buddy_clear_permit0000644000175000017500000000051710234217324021117 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_clear_permit([account]) Removes all entries from an account's permitted users list. INPUT PARAMETERS account: (Optional) The account whose block list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy clear_permit pork-0.99.8.1/doc/help/perl/buddy_alias0000644000175000017500000000107110234217324017536 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_alias(user, alias, [account]) Causes the specified user on an account's buddy list to be called the specified alias everywhere the buddy's screen name is displayed. The buddy for whom an alias is set must be on the account's buddy list. INPUT PARAMETERS user : The buddy for whom the alias will apply. alias : The alias for the buddy. account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy alias pork-0.99.8.1/doc/help/perl/status_msg0000644000175000017500000000034010234217324017445 0ustar ryanryan00000000000000SYNTAX: PORK::status_msg(msg) Prints a status message to the screen. INPUT PARAMETERS msg: The text of the message to be printed. RETURN VALUE Returns -1 if no message is specified, 0 otherwise. SEE ALSO perl err_msg pork-0.99.8.1/doc/help/perl/buddy_add0000644000175000017500000000073110234217324017177 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_add(user, group, [account]) Adds a user to an account's buddy list as a member of the specified group. The group must already exist. INPUT PARAMETERS user : The screen name of the user to be added. group : The group to add the screen name to. account: (Optional) The account whose buddy list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy add pork-0.99.8.1/doc/help/perl/buddy_clear_block0000644000175000017500000000051310234217324020705 0ustar ryanryan00000000000000SYNTAX: PORK::buddy_clear_block([account]) Removes all entries from an account's blocked users list. INPUT PARAMETERS account: (Optional) The account whose block list will be affected. If this parameter is omitted, the current account is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy clear_block pork-0.99.8.1/doc/help/perl/privacy_mode0000644000175000017500000000123210234217324017736 0ustar ryanryan00000000000000SYNTAX: PORK::privacy_mode(mode, [account]) DESCRIPTION Sets the privacy mode for an account. Below are the valid mode values for AIM and the settings to which they correspond: 1 - Allow all users. 2 - Block all users. 3 - Allow only the users on the permit list. 4 - Block only the users on the block list. 5 - Allow only users on my buddy list. INPUT PARAMETERS mode : The privacy mode to be set. account: (Optional) The account for which to set the specified mode. If no account is specified, the account that's bound to the currently visible window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO buddy privacy_mode pork-0.99.8.1/doc/help/perl/timer_del_refnum0000644000175000017500000000041510234217324020577 0ustar ryanryan00000000000000SYNTAX: PORK::timer_del_refnum(refnum) Deletes the timer event that has the specified reference number. INPUT PARAMETERS refnum: The reference number of the timer that is to be deleted. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO timer del_refnum pork-0.99.8.1/doc/help/perl/win_set_opt0000644000175000017500000000000010234217324017577 0ustar ryanryan00000000000000pork-0.99.8.1/doc/help/perl/scroll_by0000644000175000017500000000077010234217324017253 0ustar ryanryan00000000000000SYNTAX: PORK::scroll_by(lines, [refnum]) Scrolls a window's display by the specified number of lines. INPUT PARAMETERS lines: The number of lines by which the window will be scrolled. A negative number will cause the display to be scroll up. A positive number will cause the display to be scrolled down. refnum: (Optional) The reference number of the window to scroll. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO scroll by pork-0.99.8.1/doc/help/perl/scroll_up0000644000175000017500000000044510234217324017264 0ustar ryanryan00000000000000SYNTAX: PORK::scroll_up([refnum]) Scrolls a window's display up by one line. INPUT PARAMETERS refnum: (Optional) The reference number of the window to scroll. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO scroll up pork-0.99.8.1/doc/help/perl/get_buddy_away0000644000175000017500000000065110234217324020250 0ustar ryanryan00000000000000SYNTAX: PORK::get_buddy_away(person, [account]) Requests the away message for the specified user. INPUT PARAMETERS person : The user whose away message is requested. account : (Optional) The account from which to send the request. RETURN VALUE Returns 0 on success and -1 on failure. To retrieve the results of the lookup, you'll have to install an event handler to catch the RECV_AWAYMSG event. SEE ALSO buddy away pork-0.99.8.1/doc/help/perl/scroll_page_down0000644000175000017500000000054610234217324020605 0ustar ryanryan00000000000000SYNTAX: PORK::scroll_page_down([refnum]) Scrolls a window's display down by one page (i.e. the number of visible rows in the display). INPUT PARAMETERS refnum: (Optional) The reference number of the window to scroll. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO scroll page_down pork-0.99.8.1/doc/help/perl/win_clear0000644000175000017500000000052210234217324017221 0ustar ryanryan00000000000000SYNTAX: PORK::win_clear([refnum]) Clears a window. The text that was displayed in the window before it was cleared can be recovered by scrolling up. INPUT PARAMETERS refnum: (Optional) The reference number of the window to clear. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0. SEE ALSO win clear pork-0.99.8.1/doc/help/perl/win_close0000644000175000017500000000054510234217324017245 0ustar ryanryan00000000000000SYNTAX: PORK::win_close([refnum]) Close a window. If the specified window is a chat window, you will exit the chat room bound to that window. INPUT PARAMETERS refnum: (Optional) The reference number of the window to close. If no refnum is specified, the current window is assumed. RETURN VALUE Returns 0 on success, -1 on failure. SEE ALSO win close pork-0.99.8.1/doc/help/blist/0000755000175000017500000000000010236222745015514 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/blist/up0000644000175000017500000000011210234217324016050 0ustar ryanryan00000000000000SYNTAX: blist up Moves the buddy list's cursor up one line, if possible. pork-0.99.8.1/doc/help/blist/end0000644000175000017500000000013110234217324016173 0ustar ryanryan00000000000000SYNTAX: blist start Moves the buddy list's cursor to the bottom line of the buddy list. pork-0.99.8.1/doc/help/blist/warn_anon0000644000175000017500000000022310234217324017411 0ustar ryanryan00000000000000SYNTAX: blist warn_anon Warns the user the buddy list cursor is on anonymously. If the buddy list cursor is on a group entry, no action is taken. pork-0.99.8.1/doc/help/blist/away0000644000175000017500000000025110234217324016371 0ustar ryanryan00000000000000SYNTAX: blist away Retrieves the away message and related information for the user that the buddy list's cursor is on. If the cursor is on a group, no action is taken. pork-0.99.8.1/doc/help/blist/down0000644000175000017500000000011610234217324016377 0ustar ryanryan00000000000000SYNTAX: blist down Moves the buddy list's cursor down one line, if possible. pork-0.99.8.1/doc/help/blist/goto0000644000175000017500000000036710234217324016410 0ustar ryanryan00000000000000SYNTAX: blist goto Opens a new query window for the user that the buddy list cursor is currently on. If there is already a query window open for that user, that query window is made visible. If the cursor is on a group entry, no action is taken. pork-0.99.8.1/doc/help/blist/hide0000644000175000017500000000015410234217324016343 0ustar ryanryan00000000000000SYNTAX: blist hide Hides the buddy list in the current window. If it's already hidden, no action is taken. pork-0.99.8.1/doc/help/blist/show0000644000175000017500000000017210234217324016412 0ustar ryanryan00000000000000SYNTAX: blist show Shows the buddy list in the current window. If the buddy list is already visible, no action is taken. pork-0.99.8.1/doc/help/blist/warn0000644000175000017500000000020210234217324016373 0ustar ryanryan00000000000000SYNTAX: blist warn Warns the user the buddy list cursor is on. If the buddy list cursor is on a group entry, no action is taken. pork-0.99.8.1/doc/help/blist/refresh0000644000175000017500000000006610234217324017072 0ustar ryanryan00000000000000SYNTAX: blist refresh Refresh the buddy list window. pork-0.99.8.1/doc/help/blist/start0000644000175000017500000000012610234217324016566 0ustar ryanryan00000000000000SYNTAX: blist start Moves the buddy list's cursor to the top line of the buddy list. pork-0.99.8.1/doc/help/blist/width0000644000175000017500000000030310234217324016545 0ustar ryanryan00000000000000SYNTAX: blist width Changes the width of the buddy list window to the specified number of columns. PARAMETERS : The requested width in columns of the buddy list window. pork-0.99.8.1/doc/help/blist/remove_block0000644000175000017500000000024710234217324020104 0ustar ryanryan00000000000000SYNTAX: blist remove_block Removes the user the buddy list cursor is on to the current account's blocked users list. If the cursor is on a group, no action is taken. pork-0.99.8.1/doc/help/blist/page_down0000644000175000017500000000031310234217324017372 0ustar ryanryan00000000000000SYNTAX: blist page_down Moves the buddy list's cursor down one "screenful" down, if possible. A screenful here is defined as the number of buddy list lines that are visible on the buddy list's display. pork-0.99.8.1/doc/help/blist/collapse0000644000175000017500000000110210234217324017226 0ustar ryanryan00000000000000SYNTAX: blist collapse [] "Collapses" the display of a group in the current account's buddy list. Collapsing a group amounts to hiding all the members of a group from the buddy list display. If the specified group is already collapsed, it will be uncollapsed, which is to say all its cells that were hidden when it was collapsed will be shown. PARAMETERS : (Optional) The group to collapse. If this parameter is not specified, the group that the buddy list's cursor is on will be collapsed. If the cursor is not on a group, no action will be taken. pork-0.99.8.1/doc/help/blist/remove_permit0000644000175000017500000000025210234217324020306 0ustar ryanryan00000000000000SYNTAX: blist remove_permit Removes the user the buddy list cursor is on to the current account's permitted users list. If the cursor is on a group, no action is taken. pork-0.99.8.1/doc/help/blist/Makefile.am0000644000175000017500000000050710234217324017545 0ustar ryanryan00000000000000blist_DATA = \ add_block \ add_permit \ away \ collapse \ down \ end \ goto \ hide \ page_down \ page_up \ profile \ refresh \ remove \ remove_block \ remove_permit \ select \ show \ start \ toggle \ up \ warn \ warn_anon \ width blistdir = $(pkgdatadir)/help/blist pork-0.99.8.1/doc/help/blist/Makefile.in0000644000175000017500000002210110236222651017551 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/blist DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(blistdir)" blistDATA_INSTALL = $(INSTALL_DATA) DATA = $(blist_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ blist_DATA = \ add_block \ add_permit \ away \ collapse \ down \ end \ goto \ hide \ page_down \ page_up \ profile \ refresh \ remove \ remove_block \ remove_permit \ select \ show \ start \ toggle \ up \ warn \ warn_anon \ width blistdir = $(pkgdatadir)/help/blist all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/blist/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/blist/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-blistDATA: $(blist_DATA) @$(NORMAL_INSTALL) test -z "$(blistdir)" || $(mkdir_p) "$(DESTDIR)$(blistdir)" @list='$(blist_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(blistDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(blistdir)/$$f'"; \ $(blistDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(blistdir)/$$f"; \ done uninstall-blistDATA: @$(NORMAL_UNINSTALL) @list='$(blist_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(blistdir)/$$f'"; \ rm -f "$(DESTDIR)$(blistdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(blistdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-blistDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-blistDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-blistDATA install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-blistDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/blist/remove0000644000175000017500000000022510234217324016726 0ustar ryanryan00000000000000SYNTAX: blist remove Remove the user the buddy list cursor is on from the current user's buddy list. If the cursor is on a group entry, do nothing. pork-0.99.8.1/doc/help/blist/select0000644000175000017500000000054510234217324016715 0ustar ryanryan00000000000000SYNTAX: blist select If the entry the buddy list cursor is on is a group entry, the "blist collapse" command is run. If the entry the cursor is on is a user entry, the "blist goto" command is run. This command exists to provide the current behavior of hitting the enter key while the buddy list bindings are active. SEE ALSO blist select blist collapse pork-0.99.8.1/doc/help/blist/toggle0000644000175000017500000000022210234217324016707 0ustar ryanryan00000000000000SYNTAX: blist toggle Shows the buddy list in the current window, if it is hidden. Hides the buddy list in the current window, if it is visible. pork-0.99.8.1/doc/help/blist/page_up0000644000175000017500000000030710234217324017052 0ustar ryanryan00000000000000SYNTAX: blist page_up Moves the buddy list's cursor up one "screenful" down, if possible. A screenful here is defined as the number of buddy list lines that are visible on the buddy list's display. pork-0.99.8.1/doc/help/blist/add_permit0000644000175000017500000000024410234217324017542 0ustar ryanryan00000000000000SYNTAX: blist add_permit Adds the user the buddy list cursor is on to the current account's permitted users list. If the cursor is on a group, no action is taken. pork-0.99.8.1/doc/help/blist/add_block0000644000175000017500000000024110234217324017331 0ustar ryanryan00000000000000SYNTAX: blist add_block Adds the user the buddy list cursor is on to the current account's blocked users list. If the cursor is on a group, no action is taken. pork-0.99.8.1/doc/help/blist/profile0000644000175000017500000000026010234217324017070 0ustar ryanryan00000000000000SYNTAX: blist profile Request the profile and away message, if any, for the user the buddy list cursor is currently on. If the cursor is on a group entry, no action is taken. pork-0.99.8.1/doc/help/buddy/0000755000175000017500000000000010236222745015506 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/buddy/add0000644000175000017500000000043510234217324016156 0ustar ryanryan00000000000000SYNTAX: buddy add Adds a user to the current account's buddy list as a member of the specified group. The group must already exist. PARAMETERS : The screen name of the user to be added. : The group to add the screen name to. SEE ALSO buddy add_group pork-0.99.8.1/doc/help/buddy/warn_anon0000644000175000017500000000020210234217324017400 0ustar ryanryan00000000000000SYNTAX: buddy warn_anon Warns a user anonymously. PARAMETERS : The screen name to warn anonymously. pork-0.99.8.1/doc/help/buddy/clear_block0000644000175000017500000000013610234217324017664 0ustar ryanryan00000000000000SYNTAX: buddy clear_block Removes all entries from the current account's blocked users list. pork-0.99.8.1/doc/help/buddy/list0000644000175000017500000000011310234217324016372 0ustar ryanryan00000000000000SYNTAX: buddy list Prints the current account's buddy list to the screen. pork-0.99.8.1/doc/help/buddy/seen0000644000175000017500000000027110234217324016356 0ustar ryanryan00000000000000SYNTAX: buddy seen Displays the time the specified user was last seen online by the currently active account. PARAMETERS : The user whose "last online" time to display. pork-0.99.8.1/doc/help/buddy/warn0000644000175000017500000000014510234217324016373 0ustar ryanryan00000000000000SYNTAX: buddy warn Warns a user. PARAMETERS : The screen name to warn. pork-0.99.8.1/doc/help/buddy/alias0000644000175000017500000000055110234217324016516 0ustar ryanryan00000000000000SYNTAX: buddy alias Causes the specified user on the current account's buddy list to be called the specified alias everywhere the buddy's screen name is displayed. The buddy for whom an alias is set must be on the current account's buddy list. PARAMETERS : The buddy for whom the alias will apply. : The alias for the buddy. pork-0.99.8.1/doc/help/buddy/block0000644000175000017500000000043310234217324016516 0ustar ryanryan00000000000000SYNTAX: buddy block Adds a screen name to the current account's blocked users list. Note that for AIM, in order to activate the blocked users list, your privacy mode must be set to 4. PARAMETERS : The screen name to block. SEE ALSO buddy privacy_mode pork-0.99.8.1/doc/help/buddy/report_idle0000644000175000017500000000032610234217324017735 0ustar ryanryan00000000000000SYNTAX: buddy report_idle Turns the reporting of the current screen name's idle time on and off. PARAMETERS : An integer value. 0 disables the reporting of idle time. Any non-zero value enables it. pork-0.99.8.1/doc/help/buddy/remove_group0000644000175000017500000000031610234217324020135 0ustar ryanryan00000000000000SYNTAX: buddy remove_group Removes a group and all the buddies who are members of that group from the current account's buddy list. PARAMETERS : The name of the group to remove. pork-0.99.8.1/doc/help/buddy/list_block0000644000175000017500000000016510234217324017553 0ustar ryanryan00000000000000SYNTAX: buddy list_block Prints the list of screen names in the current account's blocked users list to the screen. pork-0.99.8.1/doc/help/buddy/clear_permit0000644000175000017500000000014110234217324020066 0ustar ryanryan00000000000000SYNTAX: buddy clear_permit Removes all entries from the current account's permitted users list. pork-0.99.8.1/doc/help/buddy/remove_permit0000644000175000017500000000030710234217324020301 0ustar ryanryan00000000000000SYNTAX: buddy remove_permit Removes a screen name from the current account's permitted users list. PARAMETERS : The screen name to remove from the permitted users list. pork-0.99.8.1/doc/help/buddy/Makefile.am0000644000175000017500000000052610234217324017540 0ustar ryanryan00000000000000buddy_DATA = \ add \ add_group \ alias \ awaymsg \ block \ clear_block \ clear_permit \ list \ list_block \ list_permit \ privacy_mode \ permit \ profile \ remove \ remove_group \ remove_permit \ report_idle \ search \ seen \ unblock \ warn \ warn_anon buddydir = $(pkgdatadir)/help/buddy pork-0.99.8.1/doc/help/buddy/Makefile.in0000644000175000017500000002212010236222652017545 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/buddy DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(buddydir)" buddyDATA_INSTALL = $(INSTALL_DATA) DATA = $(buddy_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ buddy_DATA = \ add \ add_group \ alias \ awaymsg \ block \ clear_block \ clear_permit \ list \ list_block \ list_permit \ privacy_mode \ permit \ profile \ remove \ remove_group \ remove_permit \ report_idle \ search \ seen \ unblock \ warn \ warn_anon buddydir = $(pkgdatadir)/help/buddy all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/buddy/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/buddy/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-buddyDATA: $(buddy_DATA) @$(NORMAL_INSTALL) test -z "$(buddydir)" || $(mkdir_p) "$(DESTDIR)$(buddydir)" @list='$(buddy_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(buddyDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(buddydir)/$$f'"; \ $(buddyDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(buddydir)/$$f"; \ done uninstall-buddyDATA: @$(NORMAL_UNINSTALL) @list='$(buddy_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(buddydir)/$$f'"; \ rm -f "$(DESTDIR)$(buddydir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(buddydir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-buddyDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-buddyDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-buddyDATA install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-buddyDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/buddy/permit0000644000175000017500000000044110234217324016723 0ustar ryanryan00000000000000SYNTAX: buddy permit Adds a screen name to the current account's permitted users list. Note that for AIM, in order to activate the permitted users list, your privacy mode must be set to 3. PARAMETERS : The screen name to permit. SEE ALSO buddy privacy_mode pork-0.99.8.1/doc/help/buddy/unblock0000644000175000017500000000027510234217324017065 0ustar ryanryan00000000000000SYNTAX: buddy unblock Removes a screen name from the current account's blocked users list. PARAMETERS : The screen name to remove from the blocked users list. pork-0.99.8.1/doc/help/buddy/remove0000644000175000017500000000024410234217324016721 0ustar ryanryan00000000000000SYNTAX: buddy remove Removes a screen name from the current account's buddy list. PARAMETERS : The screen name that is to be removed. pork-0.99.8.1/doc/help/buddy/search0000644000175000017500000000031010234217324016663 0ustar ryanryan00000000000000SYNTAX: buddy search Searches for any screen names that are registered to an email address. PARAMETERS : The email address whose screen names are to be searched for. pork-0.99.8.1/doc/help/buddy/awaymsg0000644000175000017500000000030110234217324017066 0ustar ryanryan00000000000000SYNTAX: buddy away Retrieves the away message, if one is set, for a specified screen name. PARAMETERS : The screen name whose away information is to be retrieved. pork-0.99.8.1/doc/help/buddy/list_permit0000644000175000017500000000017010234217324017755 0ustar ryanryan00000000000000SYNTAX: buddy list_permit Prints the list of screen names in the current account's permitted users list to the screen. pork-0.99.8.1/doc/help/buddy/privacy_mode0000644000175000017500000000063110234217324020105 0ustar ryanryan00000000000000SYNTAX: buddy privacy_mode Sets the privacy mode for the current account. Below are the valid mode values and the settings to which they correspond: 1 - Allow all users. 2 - Block all users. 3 - Allow only the users on the permit list. 4 - Block only the users on the block list. 5 - Allow only users on my buddy list. PARAMETERS : The privacy mode to set for the current account. pork-0.99.8.1/doc/help/buddy/add_group0000644000175000017500000000022510234217324017367 0ustar ryanryan00000000000000SYNTAX: buddy add_group Adds a new group to the current account's buddy list. PARAMETERS : The name of the group to add. pork-0.99.8.1/doc/help/buddy/profile0000644000175000017500000000043510234217324017066 0ustar ryanryan00000000000000SYNTAX: buddy profile Retrieves the profile and away message, if one is set for a specified screen name. It is analogous to the "get info" functionality in the Windows AIM client. PARAMETERS : The screen name whose profile information is to be retrieved. pork-0.99.8.1/doc/help/event/0000755000175000017500000000000010236222745015520 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/event/add0000644000175000017500000000064710234217324016175 0ustar ryanryan00000000000000SYNTAX: event add Adds a handler for an event type. When the specified event occurs, pork will call the Perl function specified, passing it relevant parameters. See the help page for 'event' for a full description of the events system. PARAMETERS : The event to be handled. : The name of the Perl function that will be called when the event occurs. SEE ALSO event pork-0.99.8.1/doc/help/event/del0000644000175000017500000000066210234217324016206 0ustar ryanryan00000000000000SYNTAX: event del [] Removes one or more event handlers for the specified event type. PARAMETERS : The event type of the handler(s) that are to be removed. : (Optional) The command such that any event handlers of the specified type that call this command will be removed. If this parameter is omitted, all handlers for the specified event type will be removed. SEE ALSO event pork-0.99.8.1/doc/help/event/list0000644000175000017500000000057010234217324016413 0ustar ryanryan00000000000000SYNTAX: event list [] Lists event handlers. The event handler list will display event handler reference number information, which is used by the 'event del_refnum' command. PARAMETERS : (Optional) The event type for which handlers will be listed. If this parameter is omitted, all event handlers for all event types will be listed. SEE ALSO event pork-0.99.8.1/doc/help/event/purge0000644000175000017500000000006110234217324016555 0ustar ryanryan00000000000000SYNTAX: event purge Removes all event handlers. pork-0.99.8.1/doc/help/event/Makefile.am0000644000175000017500000000014410234217324017546 0ustar ryanryan00000000000000event_DATA = \ add \ del \ del_refnum \ list \ purge eventdir = $(pkgdatadir)/help/event pork-0.99.8.1/doc/help/event/Makefile.in0000644000175000017500000002153610236222652017571 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/event DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(eventdir)" eventDATA_INSTALL = $(INSTALL_DATA) DATA = $(event_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ event_DATA = \ add \ del \ del_refnum \ list \ purge eventdir = $(pkgdatadir)/help/event all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/event/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/event/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-eventDATA: $(event_DATA) @$(NORMAL_INSTALL) test -z "$(eventdir)" || $(mkdir_p) "$(DESTDIR)$(eventdir)" @list='$(event_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(eventDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(eventdir)/$$f'"; \ $(eventDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(eventdir)/$$f"; \ done uninstall-eventDATA: @$(NORMAL_UNINSTALL) @list='$(event_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(eventdir)/$$f'"; \ rm -f "$(DESTDIR)$(eventdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(eventdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-eventDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-eventDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-eventDATA install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-eventDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/event/del_refnum0000644000175000017500000000041710234217324017560 0ustar ryanryan00000000000000SYNTAX: event del_refnum Deletes an event handler by reference number. The reference number for event handlers can be obtained using the 'event list' command. PARAMETERS : The reference number of the event handler to be deleted. SEE ALSO event list pork-0.99.8.1/doc/help/input/0000755000175000017500000000000010236222745015536 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/input/end0000644000175000017500000000010210234217324016213 0ustar ryanryan00000000000000SYNTAX: input end Moves the cursor to the end of the input line. pork-0.99.8.1/doc/help/input/left0000644000175000017500000000006410234217324016406 0ustar ryanryan00000000000000SYNTAX: input left Moves the cursor left one cell. pork-0.99.8.1/doc/help/input/send0000644000175000017500000000107110234217324016404 0ustar ryanryan00000000000000SYNTAX: input send [] "Sends" the input line. If the input line begins with the command character ('/' by default), the contents of the input line will be treated as a command. If not, and the current window is an IM window, the contents of the input line will be sent as an IM to the target of the window. If the current window is a chat window, the contents of the input line will be send to the chat room bound to the current window. PARAMETERS : (Optional) A string to send. If this parameter is specified, it will be sent instead of the input buffer. pork-0.99.8.1/doc/help/input/clear_prev_word0000644000175000017500000000011210234217324020623 0ustar ryanryan00000000000000SYNTAX: input clear_prev_word Clears the word to the left of the cursor. pork-0.99.8.1/doc/help/input/clear0000644000175000017500000000005410234217324016541 0ustar ryanryan00000000000000SYNTAX: input clear Clears the input line. pork-0.99.8.1/doc/help/input/next_word0000644000175000017500000000011110234217324017456 0ustar ryanryan00000000000000SYNTAX: input next_word Moves the cursor to the start of the next word. pork-0.99.8.1/doc/help/input/right0000644000175000017500000000007410234217324016572 0ustar ryanryan00000000000000SYNTAX: input right Moves the input cursor right one cell. pork-0.99.8.1/doc/help/input/start0000644000175000017500000000010610234217324016606 0ustar ryanryan00000000000000SYNTAX: input start Moves the cursor to the start of the input line. pork-0.99.8.1/doc/help/input/find_next_cmd0000644000175000017500000000023310234217324020253 0ustar ryanryan00000000000000SYNTAX: input find_next_cmd Cycles through the commands that will complete the partial string typed so far. Often used for 'tab completion' of commands. pork-0.99.8.1/doc/help/input/clear_to_start0000644000175000017500000000012510234217324020457 0ustar ryanryan00000000000000SYNTAX: input clear_to_start Clears from the cursor to the start of the input line. pork-0.99.8.1/doc/help/input/clear_to_end0000644000175000017500000000012110234217324020064 0ustar ryanryan00000000000000SYNTAX: input clear_to_end Clears from the cursor to the end of the input line. pork-0.99.8.1/doc/help/input/delete0000644000175000017500000000010310234217324016710 0ustar ryanryan00000000000000SYNTAX: input delete Deletes the character that the cursor is on. pork-0.99.8.1/doc/help/input/prev_word0000644000175000017500000000012310234217324017457 0ustar ryanryan00000000000000SYNTAX: input prev_word Moves the input cursor to the start of the previous word. pork-0.99.8.1/doc/help/input/Makefile.am0000644000175000017500000000044510234217324017570 0ustar ryanryan00000000000000input_DATA = \ backspace \ clear \ clear_next_word \ clear_prev_word \ clear_to_end \ clear_to_start \ delete \ end \ find_next_cmd \ focus_next \ insert \ left \ next_word \ prev_word \ prompt \ right \ send \ start inputdir = $(pkgdatadir)/help/input pork-0.99.8.1/doc/help/input/Makefile.in0000644000175000017500000002203410236222652017601 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/input DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(inputdir)" inputDATA_INSTALL = $(INSTALL_DATA) DATA = $(input_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ input_DATA = \ backspace \ clear \ clear_next_word \ clear_prev_word \ clear_to_end \ clear_to_start \ delete \ end \ find_next_cmd \ focus_next \ insert \ left \ next_word \ prev_word \ prompt \ right \ send \ start inputdir = $(pkgdatadir)/help/input all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/input/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/input/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-inputDATA: $(input_DATA) @$(NORMAL_INSTALL) test -z "$(inputdir)" || $(mkdir_p) "$(DESTDIR)$(inputdir)" @list='$(input_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(inputDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdir)/$$f'"; \ $(inputDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdir)/$$f"; \ done uninstall-inputDATA: @$(NORMAL_UNINSTALL) @list='$(input_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(inputdir)/$$f'"; \ rm -f "$(DESTDIR)$(inputdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(inputdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-inputDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-inputDATA .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-inputDATA \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-info-am uninstall-inputDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/input/insert0000644000175000017500000000017210234217324016760 0ustar ryanryan00000000000000SYNTAX: input insert Inserts a string at the cursor position. PARAMETERS : The string to be inserted. pork-0.99.8.1/doc/help/input/prompt0000644000175000017500000000027110234217324016775 0ustar ryanryan00000000000000SYNTAX: input prompt Sets the input prompt. PARAMETERS : The string to which to set the input prompt. This string may contain embedded color codes. SEE ALSO color pork-0.99.8.1/doc/help/input/clear_next_word0000644000175000017500000000011310234217324020626 0ustar ryanryan00000000000000SYNTAX: input clear_next_word Clears the word to the right of the cursor. pork-0.99.8.1/doc/help/input/backspace0000644000175000017500000000012110234217324017362 0ustar ryanryan00000000000000SYNTAX: input backspace Deletes the character directly before the input cursor. pork-0.99.8.1/doc/help/input/focus_next0000644000175000017500000000041110234217324017625 0ustar ryanryan00000000000000SYNTAX: input focus_next Changes the input focus. If the current input bindings are the buddy list bindings, this command will make the main input bindings active. If the main input bindings are active, this command will make the buddy list input bindings active. pork-0.99.8.1/doc/help/timer/0000755000175000017500000000000010236222745015517 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/timer/add0000644000175000017500000000105710234217324016170 0ustar ryanryan00000000000000SYNTAX: timer add Add a timer event that will cause a command to be run some number of times at a specified interval. PARAMETERS : The interval at which the command will be run. : The number of times to run the command. 0 means unlimited. : The command that will be run. The command can be any command that can be entered on the command line. EXAMPLES timer_add 30 10 echo testing - Causes the command "echo testing" to be executed every 30 seconds, a total of 10 times. pork-0.99.8.1/doc/help/timer/del0000644000175000017500000000050410234217324016200 0ustar ryanryan00000000000000SYNTAX: timer del Delete the timer entry that executes the specified command. If there are multiple timer entries that execute the same command, the first (i.e. the most recently added) matching timer event will be deleted. PARAMETERS : The command executed by the timer event that is to be deleted. pork-0.99.8.1/doc/help/timer/list0000644000175000017500000000031110234217324016403 0ustar ryanryan00000000000000SYNTAX: timer list Print the list of timer events to the screen. This command can be used to obtain the reference number for timer events that is used by timer del_refnum. SEE ALSO timer del_refnum pork-0.99.8.1/doc/help/timer/purge0000644000175000017500000000005610234217324016560 0ustar ryanryan00000000000000SYNTAX: timer purge Delete all timer events. pork-0.99.8.1/doc/help/timer/Makefile.am0000644000175000017500000000014410234217324017545 0ustar ryanryan00000000000000timer_DATA = \ add \ del \ del_refnum \ list \ purge timerdir = $(pkgdatadir)/help/timer pork-0.99.8.1/doc/help/timer/Makefile.in0000644000175000017500000002153310236222653017566 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/timer DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(timerdir)" timerDATA_INSTALL = $(INSTALL_DATA) DATA = $(timer_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ timer_DATA = \ add \ del \ del_refnum \ list \ purge timerdir = $(pkgdatadir)/help/timer all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/timer/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/timer/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-timerDATA: $(timer_DATA) @$(NORMAL_INSTALL) test -z "$(timerdir)" || $(mkdir_p) "$(DESTDIR)$(timerdir)" @list='$(timer_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(timerDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(timerdir)/$$f'"; \ $(timerDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(timerdir)/$$f"; \ done uninstall-timerDATA: @$(NORMAL_UNINSTALL) @list='$(timer_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(timerdir)/$$f'"; \ rm -f "$(DESTDIR)$(timerdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(timerdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-timerDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-timerDATA .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip install-timerDATA installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-info-am uninstall-timerDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/timer/del_refnum0000644000175000017500000000044110234217324017554 0ustar ryanryan00000000000000SYNTAX: timer del_refnum Delete the timer event that has the specified reference number. The reference number for timer events can be obtained via the timer list command. PARAMETERS : The reference number of the timer that is to be deleted. SEE ALSO timer del_refnum pork-0.99.8.1/doc/help/Makefile.am0000644000175000017500000000017610234217323016431 0ustar ryanryan00000000000000SUBDIRS = \ blist \ buddy \ chat \ event \ file \ history \ input \ main \ perl \ scroll \ timer \ win pork-0.99.8.1/doc/help/Makefile.in0000644000175000017500000003205110236222651016441 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = \ blist \ buddy \ chat \ event \ file \ history \ input \ main \ perl \ scroll \ timer \ win all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="../$(top_distdir)" \ distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-recursive ctags ctags-recursive \ distclean distclean-generic distclean-recursive distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/scroll/0000755000175000017500000000000010236222745015675 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/scroll/by0000644000175000017500000000047210234217324016230 0ustar ryanryan00000000000000SYNTAX: scroll by Scrolls the current window's display by the specified number of lines. PARAMETERS : The number of lines by which the current window will be scrolled. A negative number will cause the display to be scroll up. A positive number will cause the display to be scrolled down. pork-0.99.8.1/doc/help/scroll/up0000644000175000017500000000011010234217324016227 0ustar ryanryan00000000000000SYNTAX: scroll up Scrolls the current window's display up by one line. pork-0.99.8.1/doc/help/scroll/end0000644000175000017500000000011510234217324016356 0ustar ryanryan00000000000000SYNTAX: scroll end Scrolls the current window's display down to its bottom. pork-0.99.8.1/doc/help/scroll/down0000644000175000017500000000011410234217324016556 0ustar ryanryan00000000000000SYNTAX: scroll down Scrolls the current window's display down by one line. pork-0.99.8.1/doc/help/scroll/start0000644000175000017500000000011210234217324016742 0ustar ryanryan00000000000000SYNTAX: scroll start Scrolls the current window's display up to its top. pork-0.99.8.1/doc/help/scroll/page_down0000644000175000017500000000020210234217324017550 0ustar ryanryan00000000000000SYNTAX: scroll page_down Scrolls the current window's display down by one page (i.e. the number of visible rows in the display). pork-0.99.8.1/doc/help/scroll/Makefile.am0000644000175000017500000000017010234217324017722 0ustar ryanryan00000000000000scroll_DATA = \ by \ down \ end \ page_down \ page_up \ start \ up scrolldir = $(pkgdatadir)/help/scroll pork-0.99.8.1/doc/help/scroll/Makefile.in0000644000175000017500000002160710236222653017746 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/scroll DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(scrolldir)" scrollDATA_INSTALL = $(INSTALL_DATA) DATA = $(scroll_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ scroll_DATA = \ by \ down \ end \ page_down \ page_up \ start \ up scrolldir = $(pkgdatadir)/help/scroll all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/scroll/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/scroll/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-scrollDATA: $(scroll_DATA) @$(NORMAL_INSTALL) test -z "$(scrolldir)" || $(mkdir_p) "$(DESTDIR)$(scrolldir)" @list='$(scroll_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(scrollDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(scrolldir)/$$f'"; \ $(scrollDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(scrolldir)/$$f"; \ done uninstall-scrollDATA: @$(NORMAL_UNINSTALL) @list='$(scroll_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(scrolldir)/$$f'"; \ rm -f "$(DESTDIR)$(scrolldir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(scrolldir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-scrollDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-scrollDATA .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-scrollDATA install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-info-am uninstall-scrollDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/help/scroll/page_up0000644000175000017500000000017610234217324017237 0ustar ryanryan00000000000000SYNTAX: scroll page_up Scrolls the current window's display up by one page (i.e. the number of visible rows in the display). pork-0.99.8.1/doc/help/history/0000755000175000017500000000000010236222745016100 5ustar ryanryan00000000000000pork-0.99.8.1/doc/help/history/list0000644000175000017500000000010010234217324016760 0ustar ryanryan00000000000000SYNTAX: history [list] Prints the input history to the screen. pork-0.99.8.1/doc/help/history/next0000644000175000017500000000025010234217324016771 0ustar ryanryan00000000000000SYNTAX: history next Writes the next entry in the history list to the command-line. This command has a similar effect to hitting the up arrow on a shell command line. pork-0.99.8.1/doc/help/history/prev0000644000175000017500000000025610234217324016775 0ustar ryanryan00000000000000SYNTAX: history prev Writes the previous entry in the history list to the command-line. This command has a similar effect to hitting the down arrow on a shell command line. pork-0.99.8.1/doc/help/history/clear0000644000175000017500000000006110234217324017101 0ustar ryanryan00000000000000SYNTAX: history clear Clears the input history. pork-0.99.8.1/doc/help/history/Makefile.am0000644000175000017500000000012110234217324020121 0ustar ryanryan00000000000000history_DATA = \ clear \ next \ prev historydir = $(pkgdatadir)/help/history pork-0.99.8.1/doc/help/history/Makefile.in0000644000175000017500000002157310236222652020152 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc/help/history DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(historydir)" historyDATA_INSTALL = $(INSTALL_DATA) DATA = $(history_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ history_DATA = \ clear \ next \ prev historydir = $(pkgdatadir)/help/history all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/help/history/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/help/history/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-historyDATA: $(history_DATA) @$(NORMAL_INSTALL) test -z "$(historydir)" || $(mkdir_p) "$(DESTDIR)$(historydir)" @list='$(history_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(historyDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(historydir)/$$f'"; \ $(historyDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(historydir)/$$f"; \ done uninstall-historyDATA: @$(NORMAL_UNINSTALL) @list='$(history_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(historydir)/$$f'"; \ rm -f "$(DESTDIR)$(historydir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(historydir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-historyDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-historyDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-historyDATA install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-historyDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/Makefile.am0000644000175000017500000000007310234217323015475 0ustar ryanryan00000000000000SUBDIRS = help pork_DATA = porkrc porkdir = $(pkgdatadir) pork-0.99.8.1/doc/Makefile.in0000644000175000017500000003350510236222651015516 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__installdirs = "$(DESTDIR)$(porkdir)" porkDATA_INSTALL = $(INSTALL_DATA) DATA = $(pork_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = help pork_DATA = porkrc porkdir = $(pkgdatadir) all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-porkDATA: $(pork_DATA) @$(NORMAL_INSTALL) test -z "$(porkdir)" || $(mkdir_p) "$(DESTDIR)$(porkdir)" @list='$(pork_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(porkDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(porkdir)/$$f'"; \ $(porkDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(porkdir)/$$f"; \ done uninstall-porkDATA: @$(NORMAL_UNINSTALL) @list='$(pork_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(porkdir)/$$f'"; \ rm -f "$(DESTDIR)$(porkdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="../$(top_distdir)" \ distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(porkdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-porkDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-porkDATA uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-recursive ctags ctags-recursive \ distclean distclean-generic distclean-recursive distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-porkDATA install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-info-am uninstall-porkDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/doc/pork.10000644000175000017500000000115110234217323014474 0ustar ryanryan00000000000000.TH "pork" 1 .SH NAME pork \- An AOL Instant Messenger client for the UNIX console. .SH VERSION .TP .B version 0.99.0 .SH SYNOPSIS .B pork .SH DESCRIPTION Pork is a console based client for the AOL Instant Messenger service that uses the ncurses screen library. Pork is intended to be fast, useable, and stable. Pork was written by Ryan McCabe. .SH OPTIONS .TP None as yet. .SH FILES .TP .B ~/.pork/porkrc \- The pork configuration file .TP .B ~/.pork/screenname.blist \- The buddy list for "screenname" .SH BUGS .TP .B ryan@numb.org \- Please report bugs to this address .SH HOMEPAGE .TP .B http://dev.ojnk.org pork-0.99.8.1/doc/porkrc0000644000175000017500000000451310234217323014667 0ustar ryanryan00000000000000## ## This file is important. If you delete it, you'll probably have ## trouble running pork. ## ## ## Bindings for the main input set. ## bind RETURN input send bind BACKSPACE input backspace bind DELETE input delete bind TAB input focus_next bind 0x7f input backspace bind META-^H input clear_prev_word bind META-0x7f input clear_prev_word bind META-BACKSPACE input clear_prev_word bind META-/ input find_next_cmd bind META-^X win bind_next bind META-TAB blist toggle bind ^A input start bind ^B input prev_word bind ^E input end bind ^F input next_word bind ^H input backspace bind ^K win close bind ^L refresh bind ^T win set timestamp toggle bind ^U input clear bind ^X win next bind ^Y win prev bind DOWN_ARROW history next bind UP_ARROW history prev bind LEFT_ARROW input left bind RIGHT_ARROW input right bind HOME scroll start bind END scroll end bind PAGE_DOWN scroll page_down bind PAGE_UP scroll page_up bind META-1 win swap 1 bind META-2 win swap 2 bind META-3 win swap 3 bind META-4 win swap 4 bind META-5 win swap 5 bind META-6 win swap 6 bind META-7 win swap 7 bind META-8 win swap 8 bind META-9 win swap 9 bind META-0 win swap 10 bind META2-1 win swap 11 bind META-w chat who ## ## Bindings for the buddy input set. ## bind -buddy META-b blist remove_block bind -buddy META-B blist add_block bind -buddy META-P blist add_permit bind -buddy META-p blist remove_permit bind -buddy META-W blist warn_anon bind -buddy META-w blist warn bind -buddy a blist away bind -buddy i blist profile bind -buddy ^L blist refresh bind -buddy TAB input focus_next bind -buddy RETURN blist select bind -buddy PAGE_UP blist page_up bind -buddy PAGE_DOWN blist page_down bind -buddy UP_ARROW blist up bind -buddy DOWN_ARROW blist down bind -buddy END blist end bind -buddy HOME blist start bind -buddy ^X win next bind -buddy ^Y win prev ## ## Aliases that make things more pleasant. ## alias window win alias clear win clear alias erase win erase alias close win close alias ws win swap alias add buddy add alias warn buddy warn alias block buddy block alias unblock buddy unblock alias permit buddy permit alias whois buddy profile alias seen buddy seen alias invite chat invite alias join chat join alias part chat leave alias leave chat leave alias ignore chat ignore alias unignore chat unignore alias signon connect alias signoff disconnect alias exit quit pork-0.99.8.1/src/0000755000175000017500000000000010236222746013472 5ustar ryanryan00000000000000pork-0.99.8.1/src/pork_help.c0000644000175000017500000000631510234217324015620 0ustar ryanryan00000000000000/* ** pork_help.c - /help command implementation. ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static int pork_help_is_section(char *string) { char path[4096]; struct stat st; snprintf(path, sizeof(path), "%s/%s", HELP_PATH, string); if (stat(path, &st) != 0 || !S_ISDIR(st.st_mode)) return (0); return (1); } int pork_help_get_cmds(char *section, char *buf, size_t len) { DIR *dir; struct dirent *de; char path[4096]; char cwd[4096]; int i = 0; int ret; if (section == NULL) section = "main"; ret = snprintf(path, sizeof(path), "%s/%s", HELP_PATH, section); if (ret < 0 || (size_t) ret >= sizeof(path)) return (-1); dir = opendir(path); if (dir == NULL) return (-1); if (getcwd(cwd, sizeof(cwd)) == NULL) goto out_fail; if (chdir(path) != 0) goto out_fail; while (len > 0 && (de = readdir(dir)) != NULL) { struct stat st; ret = stat(de->d_name, &st); if (ret != 0 || !S_ISREG(st.st_mode)) continue; ret = snprintf(&buf[i], len, "%s%s%%x ", (pork_help_is_section(de->d_name) ? HELP_SECTION_STYLE : ""), de->d_name); if (ret < 0 || (size_t) ret >= len) goto out_fail2; len -= ret; i += ret; } if (i > 0) buf[i - 1] = '\0'; closedir(dir); return (0); out_fail2: chdir(cwd); out_fail: closedir(dir); return (-1); } int pork_help_print(char *section, char *command) { FILE *fp; char buf[8192]; int ret; if (command == NULL) return (-1); if (section == NULL) section = "main"; ret = snprintf(buf, sizeof(buf), "%s/%s/%s", HELP_PATH, section, command); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); fp = fopen(buf, "r"); if (fp == NULL) return (-1); while (fgets(buf, sizeof(buf), fp) != NULL) { char *p; char outbuf[8192]; size_t len = sizeof(outbuf) - 1; char *out = outbuf; *out = '\0'; p = strchr(buf, '\n'); if (p == NULL) goto out_fail; *p = '\0'; p = buf; while (len > 0 && *p != '\0') { if (p == buf && isupper(*p) && isupper(*(p + 1))) { /* ** This is a section heading. */ int ret; ret = xstrncpy(out, HELP_HEADER_STYLE, len); if (ret == -1) goto out_fail; out += ret; len -= ret; } if (*p == '\t') { int i; for (i = 0 ; i < HELP_TABSTOP ; i++) { *out++ = ' '; len--; if (len <= 0) goto out_fail; } } else if (isprint(*p)) { *out++ = *p; len--; } p++; } if (len <= 0) goto out_fail; *out = '\0'; screen_win_msg(cur_window(), 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%s", outbuf); } fclose(fp); return (0); out_fail: fclose(fp); return (-1); } pork-0.99.8.1/src/pork_help.h0000644000175000017500000000112110234217324015613 0ustar ryanryan00000000000000/* ** pork_help.h - /help command implementation. ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_HELP_H #define __PORK_HELP_H #define HELP_TABSTOP 4 #define HELP_SECTION_STYLE "%W" #define HELP_HEADER_STYLE "%W" #define HELP_HEADER_STYLE_END "%x" int pork_help_print(char *section, char *command); int pork_help_get_cmds(char *section, char *buf, size_t len); #endif pork-0.99.8.1/src/pork_html.c0000644000175000017500000001714610234217324015640 0ustar ryanryan00000000000000/* ** pork_html.c - functions for dealing with HTML ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* ** Strip any html tags from "str" ** Replace common "&*;" forms with their ascii representation. ** ** This function uses xmalloc() to grab its memory and so it must be ** free()'d when you're done using it. */ char *strip_html(char *str) { char *p; char *buf; char *ret; int ignore = 0; char *last_tag = NULL; char last_url[512]; size_t len; if (str == NULL) return (xstrdup("")); len = strlen(str) * 2 + 1; last_url[0] = '\0'; buf = xmalloc(len); ret = buf; for (p = str ; *p != '\0' ; p++) { if (ignore == 1) { if (*p == '>') { ignore = 0; if (last_tag != NULL) { if (!strncasecmp(last_tag, "
", 4) || !strncasecmp(last_tag, "

", 3)) { if (len < 2) goto out_oom; len--; *buf++ = '\n'; } else if (!strncasecmp(last_tag, "", 4)) { if (last_url[0] != '\0') { size_t url_len = strlen(last_url); /* ** URL len + " (URL: " + ')' + '\0' */ if (len < url_len + 7 + 1 + 1) goto out_oom; strcpy(buf, " (URL: "); buf += 7; strcpy(buf, last_url); buf += url_len; *buf++ = ')'; len -= url_len + 8; last_url[0] = '\0'; } } else if (!strncasecmp(last_tag, "'); if (end != NULL) { char *close_tag = end; size_t i = 0; end = strchr(start, '"'); if (end == NULL) { end = strchr(start, ' '); if (end == NULL) { end = strchr(start, '\t'); if (end == NULL) end = close_tag; } } while (start != end && *start != '\0' && i < sizeof(last_url) - 1) { if (*start == '%') { last_url[i++] = '%'; if (i >= sizeof(last_url) - 1) break; } last_url[i++] = *start++; } last_url[i] = '\0'; } } } } last_tag = NULL; } } else if (*p == '<') last_tag = p; continue; } if (*p == '<') { ignore = 1; last_tag = p; continue; } else if (*p == '\f') { if (len < 2) goto out_oom; *buf++ = ' '; len--; continue; } else if (*p == '%') { if (len < 3) goto out_oom; /* ** Double any '%' characters in HTML messages. */ buf[0] = '%'; buf[1] = '%'; buf += 2; len -= 2; } else if (*p == '&') { char *q = strchr(p, ';'); char result; if (q != NULL) { p++; *q = '\0'; if (!strcasecmp(p, "nbsp")) result = ' '; else if (!strcasecmp(p, "lt")) result = '<'; else if (!strcasecmp(p, "gt")) result = '>'; else if (!strcasecmp(p, "amp")) result = '&'; else if (!strcasecmp(p, "quot")) result = '"'; else if (!strcasecmp(p, "apos")) result = '\''; else if (!strcasecmp(p, "hyphen")) result = '-'; else if (!strcasecmp(p, "comma")) result = ','; else if (!strcasecmp(p, "excl")) result = '!'; else if (!strcasecmp(p, "iexcl")) result = 'i'; else if (!strcasecmp(p, "percnt")) result = '%'; else if (!strcasecmp(p, "num")) result = '#'; else if (!strcasecmp(p, "ast") || !strcasecmp(p, "mul")) result = '*'; else if (!strcasecmp(p, "commat")) result = '@'; else if (!strcasecmp(p, "lsqb")) result = '['; else if (!strcasecmp(p, "rsqb")) result = ']'; else if (!strcasecmp(p, "bsol")) result = '\\'; else if (!strcasecmp(p, "lcub")) result = '{'; else if (!strcasecmp(p, "plus")) result = '+'; else if (!strcasecmp(p, "divide")) result = '/'; else if (!strcasecmp(p, "rcub")) result = '}'; else if (!strcasecmp(p, "colon")) result = ':'; else if (!strcasecmp(p, "period")) result = '.'; else if (!strcasecmp(p, "semi")) result = ';'; else { if (len < 2) goto out_oom; p--; *q = ';'; *buf++ = '&'; len--; continue; } if (len < 2) goto out_oom; p = q; *buf++ = result; len--; continue; } else { if (len < 2) goto out_oom; *buf++ = '&'; len--; continue; } } else if (*p == '\r') { if (len < 2) goto out_oom; *buf++ = '\n'; len--; } else { if (len < 2) goto out_oom; *buf++ = *p; len--; } } if (len < 1) goto out_oom; *buf++ = '\0'; return (ret); out_oom: free(ret); return (NULL); } /* ** Converts plaintext to HTML. ** ** This returns a pointer to a static buffer to speed ** things up slightly. Don't call free on the pointer ** it returns. */ char *text_to_html(const char *src) { static char buf[8192]; u_int32_t i = 0; char *font_face; char *font_size; char *font_bgcolor; char *font_fgcolor; int ret; /* ** Message is already formatted as HTML -- leave it alone. */ if (!strncasecmp(src, "", 6)) { xstrncpy(buf, src, sizeof(buf)); return (buf); } buf[0] = '\0'; font_face = opt_get_str(OPT_OUTGOING_MSG_FONT); font_size = opt_get_str(OPT_OUTGOING_MSG_FONT_SIZE); font_bgcolor = opt_get_str(OPT_OUTGOING_MSG_FONT_BGCOLOR); font_fgcolor = opt_get_str(OPT_OUTGOING_MSG_FONT_FGCOLOR); ret = snprintf(buf, sizeof(buf), "= sizeof(buf)) return (NULL); i += ret; if (font_face != NULL && *font_face != '\0') { ret = snprintf(&buf[i], sizeof(buf) - i, " FACE=\"%s\"", font_face); if (ret < 0 || (size_t) ret >= sizeof(buf) - i) return (NULL); i += ret; } if (font_size != NULL && *font_size != '\0') { ret = snprintf(&buf[i], sizeof(buf) - i, " SIZE=\"%s\"", font_size); if (ret < 0 || (size_t) ret >= sizeof(buf) - i) return (NULL); i += ret; } if (font_bgcolor != NULL && *font_bgcolor != '\0') { ret = snprintf(&buf[i], sizeof(buf) - i, " BACK=\"%s\"", font_bgcolor); if (ret < 0 || (size_t) ret >= sizeof(buf) - i) return (NULL); i += ret; } if (font_fgcolor != NULL && *font_fgcolor != '\0') { ret = snprintf(&buf[i], sizeof(buf) - i, " COLOR=\"%s\"", font_fgcolor); if (ret < 0 || (size_t) ret >= sizeof(buf) - i) return (NULL); i += ret; } if (i < sizeof(buf) - 1) buf[i++] = '>'; while (*src != '\0' && i < sizeof(buf) - 1) { switch (*src) { int ret; case '<': ret = xstrncpy(&buf[i], "<", sizeof(buf) - i); if (ret == -1) return (buf); i += ret; break; case '>': ret = xstrncpy(&buf[i], ">", sizeof(buf) - i); if (ret == -1) return (buf); i += ret; break; case '&': ret = xstrncpy(&buf[i], "&", sizeof(buf) - i); if (ret == -1) return (buf); i += ret; break; default: buf[i++] = *src; break; } src++; } buf[i] = '\0'; return (buf); } pork-0.99.8.1/src/pork_html.h0000644000175000017500000000064510234217324015641 0ustar ryanryan00000000000000/* ** pork_html.h - functions for dealing with HTML ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_HTML_H #define __PORK_HTML_H char *strip_html(char *str); char *text_to_html(const char *in); #endif pork-0.99.8.1/src/pork_inet.c0000644000175000017500000001733410236222245015632 0ustar ryanryan00000000000000/* ** pork_inet.c ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* ** Write to a socket, deal with interrupted and incomplete writes. Returns ** the number of characters written to the socket on success, -1 on failure. */ ssize_t sock_write(int sock, void *buf, size_t len) { ssize_t n, written = 0; while (len > 0) { n = write(sock, buf, len); if (n == -1) { if (errno == EINTR || errno == EAGAIN) continue; debug("sock: %s", strerror(errno)); return (-1); } written += n; len -= n; buf = (char *) buf + n; } return (written); } /* ** printf-like function that writes to sockets. */ #ifdef HAVE_VASPRINTF int sockprintf(int fd, const char *fmt, ...) { va_list ap; char *buf; ssize_t ret; va_start(ap, fmt); ret = vasprintf(&buf, fmt, ap); va_end(ap); ret = sock_write(fd, buf, ret); free(buf); return (ret); } #else int sockprintf(int fd, const char *fmt, ...) { va_list ap; char buf[4096]; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); return (sock_write(fd, buf, strlen(buf))); } #endif inline int get_peer_addr(int sock, struct sockaddr_storage *ss) { socklen_t len = sizeof(*ss); int ret; ret = getpeername(sock, (struct sockaddr *) ss, &len); if (ret != 0) debug("getpeername: %s", strerror(errno)); return (ret); } inline int get_local_addr(int sock, struct sockaddr_storage *ss) { socklen_t len = sizeof(*ss); int ret; ret = getsockname(sock, (struct sockaddr *) ss, &len); if (ret != 0) debug("getsockname: %s", strerror(errno)); return (ret); } /* ** Return string IPv4 or IPv6 address. */ inline void get_ip( struct sockaddr_storage *ss, char *buf, size_t len) { if (inet_ntop(ss->ss_family, sin_addr(ss), buf, len) == NULL) debug("inet_ntop: %s", strerror(errno)); } /* ** Returns the address set in the appropriate ** sockaddr struct. */ inline void *sin_addr(struct sockaddr_storage *ss) { if (ss->ss_family == AF_INET6) return (&SIN6(ss)->sin6_addr); return (&SIN4(ss)->sin_addr); } /* ** Returns the length of the sockaddr struct. */ inline size_t sin_len(const struct sockaddr_storage *ss) { if (ss->ss_family == AF_INET6) return (sizeof(struct sockaddr_in6)); return (sizeof(struct sockaddr_in)); } /* ** Returns the port set in the sockaddr struct. */ inline in_port_t sin_port(const struct sockaddr_storage *ss) { if (ss->ss_family == AF_INET6) return (SIN6(ss)->sin6_port); return (SIN4(ss)->sin_port); } /* ** Sets the port for the approprite socket family. */ inline void sin_set_port(struct sockaddr_storage *ss, in_port_t port) { if (ss->ss_family == AF_INET6) SIN6(ss)->sin6_port = port; SIN4(ss)->sin_port = port; } /* ** Return the canonical hostname of the given address. */ inline int get_hostname(struct sockaddr_storage *addr, char *hostbuf, size_t len) { int ret; ret = getnameinfo((struct sockaddr *) addr, sizeof(struct sockaddr_storage), hostbuf, len, NULL, 0, 0); if (ret != 0) debug("getnameinfo: %s", strerror(errno)); return (ret); } /* ** Get the port associated with a tcp service name. */ int get_port(const char *name, in_port_t *port) { struct servent *servent; servent = getservbyname(name, "tcp"); if (servent != NULL) *port = ntohs(servent->s_port); else { char *end; long temp_port; temp_port = strtol(name, &end, 10); if (*end != '\0') { debug("invalid port: %s", name); return (-1); } if (!VALID_PORT(temp_port)) { debug("invalid port: %s", name); return (-1); } *port = temp_port; } return (0); } /* ** Return a network byte ordered ipv4 or ipv6 address. */ int get_addr(const char *hostname, struct sockaddr_storage *addr) { struct addrinfo *res = NULL; size_t len; int ret; if ((ret = getaddrinfo(hostname, NULL, NULL, &res)) != 0) { if (res != NULL) freeaddrinfo(res); debug("getaddrinfo: %s: %s", hostname, gai_strerror(ret)); return (-1); } switch (res->ai_addr->sa_family) { case AF_INET: len = sizeof(struct sockaddr_in); break; case AF_INET6: len = sizeof(struct sockaddr_in6); break; default: debug("unknown family: %d", res->ai_addr->sa_family); goto out_fail; } if (len < res->ai_addrlen) { debug("%u < %u", len, res->ai_addrlen); goto out_fail; } memcpy(addr, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); return (0); out_fail: freeaddrinfo(res); return (-1); } inline int sock_setflags(int sock, u_int32_t flags) { int ret; ret = fcntl(sock, F_SETFL, flags); if (ret == -1) debug("fnctl: %s", strerror(errno)); return (ret); } int nb_connect( struct sockaddr_storage *ss, struct sockaddr_storage *laddr, in_port_t port, int *dsock) { int sock; int ret = 0; sock = socket(ss->ss_family, SOCK_STREAM, 0); if (sock < 0) { debug("socket: %s", strerror(errno)); return (-1); } if (laddr != NULL) { if (bind(sock, (struct sockaddr *) laddr, sin_len(laddr)) != 0) { debug("bind: %s", strerror(errno)); goto err_out; } } if (sock_setflags(sock, O_NONBLOCK) == -1) goto err_out; sin_set_port(ss, htons(port)); if (connect(sock, (struct sockaddr *) ss, sin_len(ss)) != 0) { if (errno != EINPROGRESS) { debug("connect: %s", strerror(errno)); goto err_out; } ret = -EINPROGRESS; } else { if (sock_setflags(sock, 0) == -1) goto err_out; } if (ret == 0) debug("immediate connect"); *dsock = sock; return (ret); err_out: close(sock); return (-1); } int sock_is_error(int sock) { int error; socklen_t errlen = sizeof(error); int ret; ret = getsockopt(sock, SOL_SOCKET, SO_ERROR, &error, &errlen); if (ret == -1) { if (errno == ENOTSOCK) return (0); debug("getsockopt: %d: %s", sock, strerror(errno)); return (errno); } return (error); } /* ** Listen to the specified port (passed in host byte order) on the address ** specified by ss. */ int sock_listen(struct sockaddr_storage *ss, in_port_t listen_port) { int sock; struct addrinfo *cur; const int one = 1; if (ss == NULL) return (-1); cur = xcalloc(1, sizeof(*cur)); cur->ai_family = ss->ss_family; switch (cur->ai_family) { case AF_INET6: cur->ai_addrlen = sizeof(struct sockaddr_in6); break; case AF_INET: cur->ai_addrlen = sizeof(struct sockaddr_in); break; default: debug("unknown family: %d", cur->ai_family); free(cur); return (-1); } cur->ai_addr = xmalloc(cur->ai_addrlen); memcpy(cur->ai_addr, ss, cur->ai_addrlen); if (cur->ai_family == AF_INET) SIN4(cur->ai_addr)->sin_port = htons(listen_port); else SIN6(cur->ai_addr)->sin6_port = htons(listen_port); sock = socket(cur->ai_family, SOCK_STREAM, 0); if (sock == -1) { debug("socket: %s", strerror(errno)); goto done; } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) != 0) { debug("setsockopt: %s", strerror(errno)); close(sock); sock = -1; goto done; } if (bind(sock, cur->ai_addr, cur->ai_addrlen) != 0) { debug("bind: %s", strerror(errno)); close(sock); sock = -1; goto done; } if (listen(sock, SOMAXCONN) != 0) { debug("listen: %s", strerror(errno)); close(sock); sock = -1; goto done; } if (fcntl(sock, F_SETFL, O_NONBLOCK) == -1) { debug("fcntl: %s", strerror(errno)); close(sock); sock = -1; } done: free(cur->ai_addr); free(cur); return (sock); } pork-0.99.8.1/src/pork_inet.h0000644000175000017500000000424110234217324015630 0ustar ryanryan00000000000000/* ** pork_inet.h ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_INET_H #define __PORK_INET_H #ifdef INET6_ADDRSTRLEN # define MAX_IPLEN INET6_ADDRSTRLEN #elif defined INET_ADDRSTRLEN # define MAX_IPLEN INET_ADDRSTRLEN #else # define MAX_IPLEN 46 #endif #define MAX_HOSTLEN 256 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE struct sockaddr_storage { struct sockaddr __ss_sockaddr; char __ss_pad[128 - sizeof(struct sockaddr)]; }; # define ss_family __ss_sockaddr.sa_family #endif #ifndef HAVE_STRUCT_IN6_ADDR struct in6_addr { u_int8_t s6_addr[16]; }; #endif #ifndef HAVE_STRUCT_SOCKADDR_IN6 struct sockaddr_in6 { unsigned short sin6_family; u_int16_t sin6_port; u_int32_t sin6_flowinfo; struct in6_addr sin6_addr; }; #endif #ifdef HAVE___SS_FAMILY #define ss_family __ss_family #endif #define SIN4(x) ((struct sockaddr_in *) (x)) #define SIN6(x) ((struct sockaddr_in6 *) (x)) #define VALID_PORT(x) ((((x) & 0xffff) == (x)) && ((x) != 0)) int nb_connect( struct sockaddr_storage *ss, struct sockaddr_storage *local, in_port_t port, int *dsock); ssize_t sock_write(int sock, void *buf, size_t len); int sockprintf(int fd, const char *fmt, ...); int get_port(const char *name, in_port_t *port); int get_addr(const char *hostname, struct sockaddr_storage *addr); inline int get_peer_addr(int sock, struct sockaddr_storage *ss); inline int get_local_addr(int sock, struct sockaddr_storage *ss); inline void *sin_addr(struct sockaddr_storage *ss); inline size_t sin_len(const struct sockaddr_storage *ss); inline in_port_t sin_port(const struct sockaddr_storage *ss); inline void sin_set_port(struct sockaddr_storage *ss, in_port_t port); inline int sock_setflags(int sock, u_int32_t flags); int sock_is_error(int sock); int sock_listen(struct sockaddr_storage *ss, in_port_t port); inline int get_hostname(struct sockaddr_storage *addr, char *hostbuf, size_t len); inline void get_ip( struct sockaddr_storage *ss, char *buf, size_t len); #endif pork-0.99.8.1/src/pork_imsg.c0000644000175000017500000000711110234217324015622 0ustar ryanryan00000000000000/* ** pork_imsg.c ** Copyright (C) 2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static u_int32_t imsg_wordwrapped_lines(struct swindow *swindow, struct imsg *imsg) { u_int32_t len = imsg->len; chtype *ch = imsg->text; chtype *end = &ch[len - 1]; u_int32_t lines = 0; int add = 0; chtype cont_char = opt_get_char(OPT_WORDWRAP_CHAR); if (len <= swindow->cols) return (1); if (swindow->cols == 1) return (len); while (*ch != 0) { chtype *p; p = &ch[swindow->cols - 1 - add]; if (p >= end) { ++lines; break; } /* ** If the last character on current line or the first character ** on the next line is a space, there's no need to break the line */ if (chtype_get(p[0]) != ' ' && chtype_get(p[1]) != ' ') { chtype *temp = p; /* Find the last space, if any */ do { temp--; if (temp <= ch) { /* ** No spaces on the line, just split it at the ** last column */ goto out; } } while (chtype_get(*temp) != ' '); /* Found a space, split the line after the space. */ p = temp; } out: if (cont_char != 0) add = 1; ch = &p[1]; lines++; } return (lines); } /* ** Compute the number of rows the message will occupy ** on the screen. */ u_int32_t imsg_lines(struct swindow *swindow, struct imsg *imsg) { if (imsg->len <= swindow->cols) return (1); if (!swindow->wordwrap) return ((imsg->len / swindow->cols) + (imsg->len % swindow->cols != 0)); return (imsg_wordwrapped_lines(swindow, imsg)); } struct imsg *imsg_new(struct swindow *swindow, chtype *msg, size_t len) { struct imsg *imsg; imsg = xmalloc(sizeof(*imsg)); imsg->text = msg; imsg->serial = swindow->serial++; imsg->len = len; imsg->lines = imsg_lines(swindow, imsg); return (imsg); } struct imsg *imsg_copy(struct swindow *swindow, struct imsg *imsg) { struct imsg *new_imsg; size_t msg_size; /* ** I could add reference counting to imsg to avoid ** having to make a copy, but I think it'd be a net ** loss, considering the frequency of use of this function ** relative to the overhead of the reference counting. */ new_imsg = xmalloc(sizeof(*new_imsg)); new_imsg->len = imsg->len; new_imsg->lines = imsg->lines; new_imsg->serial = swindow->serial++; msg_size = (imsg->len + 1) * sizeof(imsg->text[0]); new_imsg->text = xmalloc(msg_size); memcpy(new_imsg->text, imsg->text, msg_size); return (new_imsg); } /* ** Return a pointer to the first character of the nth ** line of the message, given the current screen width. */ chtype *imsg_partial(struct swindow *swindow, struct imsg *imsg, u_int32_t n) { chtype *text = imsg->text; u_int32_t offset; static chtype nul_ch = 0; if (n <= 1) return (text); offset = --n * swindow->cols; /* ** offset can end up larger than the length ** of the string when the screen has been cleared. */ if (offset < imsg->len) { text += offset; return (text); } /* ** If the offset is greater than the string's length ** the caller doesn't want to write anything to the screen */ return (&nul_ch); } pork-0.99.8.1/src/pork_imsg.h0000644000175000017500000000411410234217324015627 0ustar ryanryan00000000000000/* ** pork_imsg.h ** Copyright (C) 2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_IMSG_H #define __PORK_IMSG_H #define IMSG(x) ((struct imsg *) (x)) struct swindow; enum { MSG_TYPE_PRIVMSG_RECV = (1 << 0), MSG_TYPE_PRIVMSG_SEND = (1 << 1), MSG_TYPE_NOTICE_RECV = (1 << 2), MSG_TYPE_NOTICE_SEND = (1 << 3), MSG_TYPE_NOTICE_BROADCAST_RECV = (1 << 4), MSG_TYPE_NOTICE_BROADCAST_SEND = (1 << 5), MSG_TYPE_CHAT_ACTION_SEND = (1 << 6), MSG_TYPE_CHAT_ACTION_RECV = (1 << 7), MSG_TYPE_CHAT_MSG_RECV = (1 << 8), MSG_TYPE_CHAT_MSG_SEND = (1 << 9), MSG_TYPE_CHAT_MSG_RESTRICT_RECV = (1 << 10), MSG_TYPE_CHAT_MSG_RESTRICT_SEND = (1 << 11), MSG_TYPE_CHAT_NOTICE_RECV = (1 << 12), MSG_TYPE_CHAT_NOTICE_RESTRICT_RECV = (1 << 13), MSG_TYPE_CHAT_NOTICE_SEND = (1 << 14), MSG_TYPE_CHAT_NOTICE_RESTRICT_SEND = (1 << 15), MSG_TYPE_CHAT_STATUS = (1 << 16), MSG_TYPE_BACK = (1 << 17), MSG_TYPE_AWAY = (1 << 18), MSG_TYPE_IDLE = (1 << 19), MSG_TYPE_UNIDLE = (1 << 20), MSG_TYPE_SIGNON = (1 << 21), MSG_TYPE_SIGNOFF = (1 << 22), MSG_TYPE_FILE_XFER_STATUS = (1 << 23), MSG_TYPE_FILE_XFER_START = (1 << 24), MSG_TYPE_FILE_XFER_FIN = (1 << 25), MSG_TYPE_CMD_OUTPUT = (1 << 26), MSG_TYPE_STATUS = (1 << 27), MSG_TYPE_ERROR = (1 << 28), MSG_TYPE_LASTLOG = (1 << 29), MSG_TYPE_ALL = ~0, }; enum { MSG_OPT_NONE = 0, MSG_OPT_TIMESTAMP = (1 << 0), MSG_OPT_BANNER = (1 << 1), MSG_OPT_COLOR = (1 << 2), MSG_OPT_ALL = ~0, }; struct imsg { chtype *text; u_int32_t serial; u_int32_t len; u_int32_t lines; }; u_int32_t imsg_lines(struct swindow *swindow, struct imsg *imsg); struct imsg *imsg_new(struct swindow *swindow, chtype *msg, size_t len); struct imsg *imsg_copy(struct swindow *swindow, struct imsg *imsg); chtype *imsg_partial(struct swindow *swindow, struct imsg *imsg, u_int32_t n); #endif pork-0.99.8.1/src/pork_command_defs.h0000644000175000017500000001260110234217324017307 0ustar ryanryan00000000000000/* ** pork_command_defs.h - static declarations needed in pork_command.c ** Copyright (C) 2002-2005 Ryan McCabe ** ** I moved this stuff here so that the pork_command.c file might ** be slightly less cluttered. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_COMMAND_DEFS_H #define __PORK_COMMAND_DEFS_H USER_COMMAND(cmd_acct); USER_COMMAND(cmd_alias); USER_COMMAND(cmd_auto); USER_COMMAND(cmd_away); USER_COMMAND(cmd_bind); USER_COMMAND(cmd_compose); USER_COMMAND(cmd_connect); USER_COMMAND(cmd_ctcp); USER_COMMAND(cmd_disconnect); USER_COMMAND(cmd_echo); USER_COMMAND(cmd_eval); USER_COMMAND(cmd_help); USER_COMMAND(cmd_idle); USER_COMMAND(cmd_laddr); USER_COMMAND(cmd_lastlog); USER_COMMAND(cmd_load); USER_COMMAND(cmd_lport); USER_COMMAND(cmd_me); USER_COMMAND(cmd_mode); USER_COMMAND(cmd_msg); USER_COMMAND(cmd_nick); USER_COMMAND(cmd_notice); USER_COMMAND(cmd_perl); USER_COMMAND(cmd_perl_dump); USER_COMMAND(cmd_perl_load); USER_COMMAND(cmd_ping); USER_COMMAND(cmd_profile); USER_COMMAND(cmd_query); USER_COMMAND(cmd_quit); USER_COMMAND(cmd_quote); USER_COMMAND(cmd_refresh); USER_COMMAND(cmd_save); USER_COMMAND(cmd_send); USER_COMMAND(cmd_set); USER_COMMAND(cmd_unbind); USER_COMMAND(cmd_unalias); USER_COMMAND(cmd_who); USER_COMMAND(cmd_whowas); USER_COMMAND(cmd_acct_list); USER_COMMAND(cmd_acct_save); USER_COMMAND(cmd_acct_set); USER_COMMAND(cmd_file); USER_COMMAND(cmd_file_cancel); USER_COMMAND(cmd_file_list); USER_COMMAND(cmd_file_get); USER_COMMAND(cmd_file_resume); USER_COMMAND(cmd_file_send); USER_COMMAND(cmd_win); USER_COMMAND(cmd_win_bind); USER_COMMAND(cmd_win_bind_next); USER_COMMAND(cmd_win_clear); USER_COMMAND(cmd_win_close); USER_COMMAND(cmd_win_dump); USER_COMMAND(cmd_win_erase); USER_COMMAND(cmd_win_ignore); USER_COMMAND(cmd_win_list); USER_COMMAND(cmd_win_next); USER_COMMAND(cmd_win_prev); USER_COMMAND(cmd_win_rename); USER_COMMAND(cmd_win_renumber); USER_COMMAND(cmd_win_set); USER_COMMAND(cmd_win_skip); USER_COMMAND(cmd_win_swap); USER_COMMAND(cmd_win_unignore); USER_COMMAND(cmd_win_unskip); USER_COMMAND(cmd_scroll); USER_COMMAND(cmd_scroll_by); USER_COMMAND(cmd_scroll_down); USER_COMMAND(cmd_scroll_end); USER_COMMAND(cmd_scroll_pgdown); USER_COMMAND(cmd_scroll_pgup); USER_COMMAND(cmd_scroll_start); USER_COMMAND(cmd_scroll_up); USER_COMMAND(cmd_input); USER_COMMAND(cmd_input_bkspace); USER_COMMAND(cmd_input_clear); USER_COMMAND(cmd_input_clear_prev); USER_COMMAND(cmd_input_clear_next); USER_COMMAND(cmd_input_clear_to_end); USER_COMMAND(cmd_input_clear_to_start); USER_COMMAND(cmd_input_delete); USER_COMMAND(cmd_input_end); USER_COMMAND(cmd_input_find_next_cmd); USER_COMMAND(cmd_input_focus_next); USER_COMMAND(cmd_input_insert); USER_COMMAND(cmd_input_left); USER_COMMAND(cmd_input_prev_word); USER_COMMAND(cmd_input_prompt); USER_COMMAND(cmd_input_next_word); USER_COMMAND(cmd_input_right); USER_COMMAND(cmd_input_send); USER_COMMAND(cmd_input_start); USER_COMMAND(cmd_history); USER_COMMAND(cmd_history_clear); USER_COMMAND(cmd_history_list); USER_COMMAND(cmd_history_next); USER_COMMAND(cmd_history_prev); USER_COMMAND(cmd_buddy); USER_COMMAND(cmd_buddy_add); USER_COMMAND(cmd_buddy_add_group); USER_COMMAND(cmd_buddy_alias); USER_COMMAND(cmd_buddy_awaymsg); USER_COMMAND(cmd_buddy_block); USER_COMMAND(cmd_buddy_clear_block); USER_COMMAND(cmd_buddy_clear_permit); USER_COMMAND(cmd_buddy_list); USER_COMMAND(cmd_buddy_list_block); USER_COMMAND(cmd_buddy_list_permit); USER_COMMAND(cmd_buddy_permit); USER_COMMAND(cmd_buddy_privacy_mode); USER_COMMAND(cmd_buddy_profile); USER_COMMAND(cmd_buddy_remove); USER_COMMAND(cmd_buddy_remove_group); USER_COMMAND(cmd_buddy_remove_permit); USER_COMMAND(cmd_buddy_report_idle); USER_COMMAND(cmd_buddy_seen); USER_COMMAND(cmd_buddy_unblock); USER_COMMAND(cmd_buddy_warn); USER_COMMAND(cmd_buddy_warn_anon); USER_COMMAND(cmd_blist); USER_COMMAND(cmd_blist_add_block); USER_COMMAND(cmd_blist_add_permit); USER_COMMAND(cmd_blist_away); USER_COMMAND(cmd_blist_collapse); USER_COMMAND(cmd_blist_down); USER_COMMAND(cmd_blist_end); USER_COMMAND(cmd_blist_goto); USER_COMMAND(cmd_blist_hide); USER_COMMAND(cmd_blist_pgdown); USER_COMMAND(cmd_blist_pgup); USER_COMMAND(cmd_blist_profile); USER_COMMAND(cmd_blist_refresh); USER_COMMAND(cmd_blist_remove); USER_COMMAND(cmd_blist_remove_block); USER_COMMAND(cmd_blist_remove_permit); USER_COMMAND(cmd_blist_select); USER_COMMAND(cmd_blist_show); USER_COMMAND(cmd_blist_start); USER_COMMAND(cmd_blist_toggle); USER_COMMAND(cmd_blist_up); USER_COMMAND(cmd_blist_warn); USER_COMMAND(cmd_blist_warn_anon); USER_COMMAND(cmd_blist_width); USER_COMMAND(cmd_timer); USER_COMMAND(cmd_timer_add); USER_COMMAND(cmd_timer_del); USER_COMMAND(cmd_timer_del_refnum); USER_COMMAND(cmd_timer_list); USER_COMMAND(cmd_timer_purge); USER_COMMAND(cmd_event); USER_COMMAND(cmd_event_add); USER_COMMAND(cmd_event_del); USER_COMMAND(cmd_event_del_refnum); USER_COMMAND(cmd_event_list); USER_COMMAND(cmd_event_purge); USER_COMMAND(cmd_chat); USER_COMMAND(cmd_chat_ban); USER_COMMAND(cmd_chat_ignore); USER_COMMAND(cmd_chat_invite); USER_COMMAND(cmd_chat_join); USER_COMMAND(cmd_chat_kick); USER_COMMAND(cmd_chat_leave); USER_COMMAND(cmd_chat_list); USER_COMMAND(cmd_chat_send); USER_COMMAND(cmd_chat_topic); USER_COMMAND(cmd_chat_unignore); USER_COMMAND(cmd_chat_who); USER_COMMAND(cmd_protocol); #endif pork-0.99.8.1/src/pork_list.c0000644000175000017500000001252010234217324015636 0ustar ryanryan00000000000000/* ** pork_list.c - Generic doubly linked lists and hash tables. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include /* ** Returns the length of the list whose head ** node is passed in. */ size_t dlist_len(dlist_t *head) { size_t len = 0; while (head != NULL) { ++len; head = head->next; } return (len); } /* ** Add a node containing the data specified in "data" ** to the head of the list specified by "head" */ dlist_t *dlist_add_head(dlist_t *head, void *data) { dlist_t *new_node = xmalloc(sizeof(dlist_t)); new_node->data = data; new_node->prev = NULL; new_node->next = head; if (head != NULL) head->prev = new_node; return (new_node); } /* ** Add a node containing the data specified in "data" ** to the list specified by "head" after the node "node" */ dlist_t *dlist_add_after(dlist_t *head, dlist_t *node, void *data) { dlist_t *new_node = xmalloc(sizeof(dlist_t)); new_node->data = data; new_node->prev = node; new_node->next = node->next; if (node->next != NULL) node->next->prev = new_node; node->next = new_node; return (head); } /* ** Return the last node in the list ** specified by "head" */ dlist_t *dlist_tail(dlist_t *head) { dlist_t *cur = head; if (cur == NULL) return (head); while (cur->next != NULL) cur = cur->next; return (cur); } /* ** Add a node containing the data specified in "data" ** to the tail of the list specified by "head" */ dlist_t *dlist_add_tail(dlist_t *head, void *data) { dlist_t *tail = dlist_tail(head); if (tail == NULL) return (dlist_add_head(head, data)); return (dlist_add_after(head, tail, data)); } /* ** Remove the node that's at the head of the list ** and adjust the pointer to the the head of the list ** to point to the node after the one we removed. */ void *dlist_remove_head(dlist_t **list_head) { dlist_t *next_node = (*list_head)->next; void *ret = (*list_head)->data; free(*list_head); *list_head = next_node; if (next_node != NULL) next_node->prev = NULL; return (ret); } /* ** Remove "node" from the list pointed to by "head" */ dlist_t *dlist_remove(dlist_t *head, dlist_t *node) { dlist_t *ret = head; if (node->prev != NULL) node->prev->next = node->next; else ret = node->next; if (node->next != NULL) node->next->prev = node->prev; free(node); return (ret); } /* ** Destroy the list pointed to by "head", run the "cleanup" ** function on the data in each node, if it's specified. */ void dlist_destroy( dlist_t *head, void *param, void (*cleanup)(void *, void *)) { dlist_t *cur = head; while (cur != NULL) { dlist_t *next = cur->next; if (cleanup != NULL) cleanup(param, cur->data); free(cur); cur = next; } } static int dlist_default_compare(void *l, void *r) { if (l != r) return (-1); return (0); } /* ** Find the node in the list specified by "head" ** whose data field is "data". Use the function ** comp() to determine if the fields are the same. */ dlist_t *dlist_find(dlist_t *head, void *data, int (*comp)(void *, void *)) { dlist_t *cur; if (comp == NULL) comp = dlist_default_compare; for (cur = head ; cur != NULL ; cur = cur->next) { if (comp(data, cur->data) == 0) return (cur); } return (NULL); } /* ** Iterate through the list specified by "head", calling ** the function func(node, "data") for each node. */ void dlist_iterate(dlist_t *head, void (*func)(void *, void *), void *data) { dlist_t *cur; for (cur = head ; cur != NULL ; cur = cur->next) func(cur->data, data); } int hash_init( hash_t *hash, u_int32_t order, int (*compare)(void *, void *), void (*rem)(void *param, void *data)) { if (compare == NULL) return (-1); if (order > sizeof(long) * 4) return (-1); hash->order = order; hash->compare = compare; hash->remove = rem; hash->map = xcalloc((u_int32_t) (1 << order), sizeof(dlist_t *)); return (0); } inline dlist_t *hash_find(hash_t *hash, void *data, u_int32_t cur_hash) { return (dlist_find(hash->map[cur_hash], data, hash->compare)); } inline void hash_add(hash_t *hash, void *data, u_int32_t cur_hash) { hash->map[cur_hash] = dlist_add_head(hash->map[cur_hash], data); } int hash_remove(hash_t *hash, void *data, u_int32_t cur_hash) { dlist_t *node = hash_find(hash, data, cur_hash); if (node == NULL) return (-1); if (hash->remove != NULL) hash->remove(NULL, node->data); hash->map[cur_hash] = dlist_remove(hash->map[cur_hash], node); return (0); } void hash_clear(hash_t *hash) { if (hash->order > 0) { u_int32_t i; for (i = 0 ; i < (u_int32_t) (1 << hash->order) ; i++) { dlist_destroy(hash->map[i], NULL, hash->remove); hash->map[i] = NULL; } } } void hash_destroy(hash_t *hash) { hash_clear(hash); free(hash->map); } void hash_iterate(hash_t *hash, void (*func)(void *, void *), void *data) { u_int32_t i; for (i = 0 ; i < (u_int32_t) (1 << hash->order) ; i++) dlist_iterate(hash->map[i], func, data); } inline int hash_exists(hash_t *hash, void *data, u_int32_t cur_hash) { dlist_t *ret = hash_find(hash, data, cur_hash); return (ret != NULL); } pork-0.99.8.1/src/pork_list.h0000644000175000017500000000324010234217324015642 0ustar ryanryan00000000000000/* ** pork_list.h - Generic doubly linked lists and hash tables. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_LIST_H #define __PORK_LIST_H typedef struct dlist { struct dlist *next; struct dlist *prev; void *data; } dlist_t; dlist_t *dlist_add_head(dlist_t *head, void *data); void dlist_destroy(dlist_t *head, void *param, void (*cleanup)(void *, void *)); void *dlist_remove_head(dlist_t **list); dlist_t *dlist_remove(dlist_t *head, dlist_t *node); dlist_t *dlist_find(dlist_t *head, void *data, int (*comp)(void *, void *)); dlist_t *dlist_add_after(dlist_t *head, dlist_t *node, void *data); dlist_t *dlist_add_tail(dlist_t *head, void *data); dlist_t *dlist_tail(dlist_t *head); void dlist_iterate(dlist_t *head, void (*func)(void *, void *), void *data); size_t dlist_len(dlist_t *head); typedef struct hash { u_int32_t order; int (*compare)(void *l, void *r); void (*remove)(void *param, void *data); dlist_t **map; } hash_t; int hash_init( hash_t *hash, u_int32_t order, int (*compare)(void *, void *), void (*rem)(void *param, void *data)); dlist_t *hash_find(hash_t *hash, void *data, u_int32_t cur_hash); void hash_add(hash_t *hash, void *data, u_int32_t cur_hash); int hash_remove(hash_t *hash, void *data, u_int32_t cur_hash); void hash_clear(hash_t *hash); void hash_destroy(hash_t *hash); int hash_exists(hash_t *hash, void *data, u_int32_t cur_hash); void hash_iterate(hash_t *hash, void (*func)(void *, void *), void *data); #endif pork-0.99.8.1/src/pork_misc.c0000644000175000017500000001063410234217324015622 0ustar ryanryan00000000000000/* ** pork_misc.c - miscellaneous functions. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void resize_terminal(int rows, int cols) { #ifdef HAVE_RESIZETERM resizeterm(rows, cols); #else endwin(); doupdate(); #endif } /* ** Sets default options for windows. */ void set_default_win_opts(WINDOW *win) { leaveok(win, FALSE); scrollok(win, FALSE); meta(win, TRUE); keypad(win, TRUE); idlok(win, TRUE); } /* ** Setup the ncurses environment. */ int initialize_environment(void) { WINDOW *win; win = initscr(); if (win == NULL) return (-1); halfdelay(10); noecho(); raw(); set_default_win_opts(win); return (0); } int wgetinput(WINDOW *win) { int c; int meta_cnt = 0; while ((c = wgetch(win)) == 0x1b) meta_cnt++; if (meta_cnt > 15) meta_cnt = 15; if (c == -1) return (-1); if (meta_cnt > 0) c = META_KEY(c, meta_cnt); return (c); } /* ** "Normalize" the string "str" ** ** AIM screen names need to be normalized ** before they're sent to the server. ** ** What this means is converting alphabetic characters ** to lowercase and removing any space characters. */ int normalize(char *buf, const char *str, size_t len) { size_t i; len--; for (i = 0 ; *str != '\0' && i < len ; str++) { if (*str == ' ') continue; buf[i++] = tolower(*str); } buf[i] = '\0'; return (0); } int date_to_str(time_t timespec, char *buf, size_t len) { char *p; p = asctime(localtime(×pec)); if (p == NULL) return (-1); if (xstrncpy(buf, p, len) == -1) return (-1); p = strchr(buf, '\n'); if (p != NULL) *p = '\0'; return (0); } /* ** Convert "timespec" (in minutes) to a string of the ** form "DAYSd HOURSh MINm" */ int time_to_str(u_int32_t timespec, char *buf, size_t len) { u_int32_t days; u_int32_t hours; u_int32_t min; u_int32_t i = 0; if (timespec == 0) { int ret; ret = snprintf(buf, len, "0m"); if (ret < 0 || (size_t) ret >= len) { *buf = '\0'; return (-1); } return (0); } days = timespec / (60 * 24); hours = (timespec % (60 * 24)) / 60; min = timespec - (days * (60 * 24)) - (hours * 60); if (days > 0) { int ret; ret = snprintf(buf, len, "%ud", days); if (ret < 0 || (size_t) ret >= len) { *buf = '\0'; return (-1); } len -= ret; i += ret; } if (hours > 0) { int ret; ret = snprintf(&buf[i], len, "%uh", hours); if (ret < 0 || (size_t) ret >= len) { *buf = '\0'; return (-1); } len -= ret; i += ret; } if (min > 0) { int ret; ret = snprintf(&buf[i], len, "%um", min); if (ret < 0 || (size_t) ret >= len) { *buf = '\0'; return (-1); } } return (0); } int time_to_str_full(u_int32_t timespec, char *buf, size_t len) { u_int32_t days; u_int32_t hours; u_int32_t min; u_int32_t seconds; u_int32_t i = 0; days = timespec / (60 * 60 * 24); timespec -= days * (60 * 60 * 24); hours = timespec / (60 * 60); timespec -= hours * 60 * 60; min = timespec / 60; timespec -= min * 60; seconds = timespec; if (days > 0) { int ret; ret = snprintf(buf, len, "%u day%s ", days, (days != 1 ? "s" : "")); if (ret < 0 || (size_t) ret >= len) { *buf = '\0'; return (-1); } len -= ret; i += ret; } if (hours > 0) { int ret; ret = snprintf(&buf[i], len, "%u hour%s ", hours, (hours != 1 ? "s" : "")); if (ret < 0 || (size_t) ret >= len) { *buf = '\0'; return (-1); } len -= ret; i += ret; } if (min > 0) { int ret; ret = snprintf(&buf[i], len, "%u minute%s ", min, (min != 1 ? "s" : "")); if (ret < 0 || (size_t) ret >= len) { *buf = '\0'; return (-1); } len -= ret; i += ret; } if (seconds > 0) { int ret; ret = snprintf(&buf[i], len, "%u second%s ", seconds, (seconds != 1 ? "s" : "")); if (ret < 0 || (size_t) ret >= len) { *buf = '\0'; return (-1); } len -= ret; i += ret; } if (i > 0) { buf[i - 1] = '\0'; return (0); } if (xstrncpy(buf, "0 seconds", len) == -1) return (-1); return (0); } pork-0.99.8.1/src/pork_misc.h0000644000175000017500000000136310234217324015626 0ustar ryanryan00000000000000/* ** pork_misc.h - miscellaneous functions. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_MISC_H #define __PORK_MISC_H #define NUSER_LEN 128 int initialize_environment(void); void set_default_win_opts(WINDOW *win); void resize_terminal(int rows, int cols); int normalize(char *dest, const char *src, size_t len); int time_to_str(u_int32_t timespec, char *buf, size_t len); int time_to_str_full(u_int32_t timespec, char *buf, size_t len); int date_to_str(time_t timespec, char *buf, size_t len); int wgetinput(WINDOW *win); #endif pork-0.99.8.1/src/pork_alias.c0000644000175000017500000001006510234217324015756 0ustar ryanryan00000000000000/* ** pork_alias.c - interface to aliases. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include static int alias_compare(void *l, void *r) { const char *str = l; const struct alias *alias = r; return (strcasecmp(str, alias->alias)); } static void alias_hash_remove(void *param __notused, void *data) { struct alias *alias = data; free(alias->alias); free(alias->orig); free(alias->args); free(alias); } inline int alias_remove(hash_t *alias_hash, char *alias) { int ret; ret = hash_remove(alias_hash, alias, string_hash(alias, alias_hash->order)); return (ret); } int alias_add(hash_t *alias_hash, char *alias, char *str) { char *temp; char *args; u_int32_t hash; struct alias *new_alias; alias_remove(alias_hash, alias); new_alias = xmalloc(sizeof(*new_alias)); new_alias->alias = xstrdup(alias); temp = xstrdup(str); args = strchr(temp, ' '); if (args != NULL) { new_alias->args = xstrdup(args); *args = '\0'; } else new_alias->args = NULL; new_alias->orig = xstrdup(temp); hash = string_hash(alias, alias_hash->order); hash_add(alias_hash, new_alias, hash); free(temp); return (0); } struct alias *alias_find(hash_t *alias_hash, char *str) { dlist_t *node; u_int32_t hash = string_hash(str, alias_hash->order); node = hash_find(alias_hash, str, hash); if (node != NULL) return (node->data); return (NULL); } /* ** Like strcpy(3), only it doesn't terminate strings. */ static inline void alias_strcpy(char *dest, char *src, size_t len) { char save = dest[len]; strcpy(dest, src); dest[len] = save; } /* ** This resolves an alias. Given a string " " ** if is an alias, this function will look up the ** alias it refers to, then effectively replace with ** its alias and its alias' arguments. The function will iterate ** until the first word is no longer an alias. ** ** Returns -1 if the original string wasn't an alias. ** ** Returns 1 if we ran out of space while pasting together a chain ** of aliases. ** ** Returns 0 on success. */ int alias_resolve(hash_t *alias_hash, char *str, char **result) { static char buf[8192]; u_int32_t num_left = sizeof(buf) - 1; char *p; u_int32_t iterations; p = strchr(str, ' '); if (p != NULL) *p = '\0'; /* ** Avoid doing extra work if first word of the string ** passed to us isn't an alias. */ if (alias_find(alias_hash, str) == NULL) { if (p != NULL) *p = ' '; return (-1); } buf[num_left] = '\0'; if (p != NULL) { size_t len; *p = ' '; len = strlen(p); if (len > num_left) return (1); num_left -= len; alias_strcpy(&buf[num_left], p, len); *p = '\0'; } /* ** Keep people from doing stupid things. ** I can't imagine this number has to be anywhere near as high ** as 20000, but it's not like it matters. If they want to waste ** some CPU time, let them, just don't loop forever. */ for (iterations = 0 ; iterations < 20000 ; iterations++) { struct alias *alias; /* ** If the current string is not an alias, ** we've completely resolved the original alias string. */ alias = alias_find(alias_hash, str); if (alias == NULL) { size_t len = strlen(str); if (len > num_left) return (1); num_left -= len; alias_strcpy(&buf[num_left], str, len); *result = &buf[num_left]; return (0); } if (alias->args != NULL) { size_t len = strlen(alias->args); if (len > num_left) return (1); num_left -= len; alias_strcpy(&buf[num_left], alias->args, len); } str = alias->orig; } return (1); } inline int alias_init(hash_t *alias_hash) { memset(alias_hash, 0, sizeof(*alias_hash)); return (hash_init(alias_hash, 5, alias_compare, alias_hash_remove)); } pork-0.99.8.1/src/pork_alias.h0000644000175000017500000000125310234217324015762 0ustar ryanryan00000000000000/* ** pork_alias.h - interface to aliases. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_ALIAS_H #define __PORK_ALIAS_H struct alias { char *alias; char *orig; char *args; }; inline int alias_init(hash_t *alias_hash); struct alias *alias_find(hash_t *alias_hash, char *str); int alias_add(hash_t *alias_hash, char *alias, char *str); int alias_remove(hash_t *alias_hash, char *alias); int alias_resolve(hash_t *alias_hash, char *str, char **result); #endif pork-0.99.8.1/src/pork_perl.c0000644000175000017500000002331310236222245015627 0ustar ryanryan00000000000000/* ** pork_perl.c - Perl scripting support ** Copyright (C) 2002-2005 Ryan McCabe ** ** The init, execute_perl, and destroy functions were pretty much copied ** from the gaim perl.c source file. ** Copyrights there apply here. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #undef PACKAGE #undef instr #define HAS_BOOL #include #include #include #include #include #include #include #include #include #include #ifdef OLD_PERL extern void boot_DynaLoader _((CV * cv)); #define init_args void #else extern void boot_DynaLoader(pTHX_ CV* cv); #define init_args pTHX #endif static void xs_init(init_args); static PerlInterpreter *perl_inter; void xs_init(init_args) { char *file = __FILE__; newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); newXS("PORK::alias", PORK_alias, file); newXS("PORK::alias_get", PORK_alias_get, file); newXS("PORK::bind", PORK_bind, file); newXS("PORK::bind_get", PORK_bind_get, file); newXS("PORK::blist_bind", PORK_blist_bind, file); newXS("PORK::blist_bind_get", PORK_blist_bind_get, file); newXS("PORK::blist_unbind", PORK_blist_unbind, file); newXS("PORK::connect", PORK_connect, file); newXS("PORK::disconnect", PORK_disconnect, file); newXS("PORK::echo", PORK_echo, file); newXS("PORK::err_msg", PORK_err_msg, file); newXS("PORK::get_cur_user", PORK_get_cur_user, file); newXS("PORK::get_opt", PORK_get_opt, file); newXS("PORK::load", PORK_load, file); newXS("PORK::load_perl", PORK_load_perl, file); newXS("PORK::prompt_user", PORK_prompt_user, file); newXS("PORK::quit", PORK_quit, file); newXS("PORK::quote", PORK_quote, file); newXS("PORK::refresh", PORK_refresh, file); newXS("PORK::run_cmd", PORK_run_cmd, file); newXS("PORK::save", PORK_save, file); newXS("PORK::cur_user", PORK_cur_user, file); newXS("PORK::set_opt", PORK_set_opt, file); newXS("PORK::status_msg", PORK_status_msg, file); newXS("PORK::unbind", PORK_unbind, file); newXS("PORK::unalias", PORK_unalias, file); newXS("PORK::win_bind", PORK_win_bind, file); newXS("PORK::win_clear", PORK_win_clear, file); newXS("PORK::win_close", PORK_win_close, file); newXS("PORK::win_erase", PORK_win_erase, file); newXS("PORK::win_find_name", PORK_win_find_name, file); newXS("PORK::win_find_target", PORK_win_find_target, file); newXS("PORK::win_get_opt", PORK_win_get_opt, file); newXS("PORK::win_next", PORK_win_next, file); newXS("PORK::win_prev", PORK_win_prev, file); newXS("PORK::win_rename", PORK_win_rename, file); newXS("PORK::win_renumber", PORK_win_renumber, file); newXS("PORK::win_set_opt", PORK_win_set_opt, file); newXS("PORK::win_swap", PORK_win_swap, file); newXS("PORK::win_target", PORK_win_target, file); newXS("PORK::buddy_add", PORK_buddy_add, file); newXS("PORK::buddy_add_block", PORK_buddy_add_block, file); newXS("PORK::buddy_add_group", PORK_buddy_add_group, file); newXS("PORK::buddy_add_permit", PORK_buddy_add_permit, file); newXS("PORK::buddy_alias", PORK_buddy_alias, file); newXS("PORK::buddy_clear_block", PORK_buddy_clear_block, file); newXS("PORK::buddy_clear_permit", PORK_buddy_clear_permit, file); newXS("PORK::buddy_get_alias", PORK_buddy_get_alias, file); newXS("PORK::buddy_get_block", PORK_buddy_get_block, file); newXS("PORK::buddy_get_groups", PORK_buddy_get_groups, file); newXS("PORK::buddy_get_group_members", PORK_buddy_get_group_members, file); newXS("PORK::buddy_get_permit", PORK_buddy_get_permit, file); newXS("PORK::buddy_remove", PORK_buddy_remove, file); newXS("PORK::buddy_remove_group", PORK_buddy_add_group, file); newXS("PORK::buddy_remove_block", PORK_buddy_remove_block, file); newXS("PORK::buddy_remove_permit", PORK_buddy_remove_permit, file); newXS("PORK::get_acct_list", PORK_get_acct_list, file); newXS("PORK::get_buddy_away", PORK_get_buddy_away, file); newXS("PORK::get_buddy_profile", PORK_get_buddy_profile, file); newXS("PORK::get_profile", PORK_get_profile, file); newXS("PORK::privacy_mode", PORK_privacy_mode, file); newXS("PORK::report_idle", PORK_report_idle, file); newXS("PORK::search", PORK_search, file); newXS("PORK::send_msg", PORK_send_msg, file); newXS("PORK::send_msg_auto", PORK_send_msg_auto, file); newXS("PORK::set_away", PORK_set_away, file); newXS("PORK::set_idle", PORK_set_idle, file); newXS("PORK::set_profile", PORK_set_profile, file); newXS("PORK::send_profile", PORK_send_profile, file); newXS("PORK::warn", PORK_warn, file); newXS("PORK::scroll_by", PORK_scroll_by, file); newXS("PORK::scroll_down", PORK_scroll_down, file); newXS("PORK::scroll_end", PORK_scroll_end, file); newXS("PORK::scroll_page_down", PORK_scroll_page_down, file); newXS("PORK::scroll_page_up", PORK_scroll_page_up, file); newXS("PORK::scroll_start", PORK_scroll_start, file); newXS("PORK::scroll_up", PORK_scroll_up, file); newXS("PORK::timer_add", PORK_timer_add, file); newXS("PORK::timer_del", PORK_timer_del, file); newXS("PORK::timer_del_refnum", PORK_timer_del_refnum, file); newXS("PORK::timer_purge", PORK_timer_purge, file); newXS("PORK::blist_collapse", PORK_blist_collapse, file); newXS("PORK::blist_cursor", PORK_blist_cursor, file); newXS("PORK::blist_down", PORK_blist_down, file); newXS("PORK::blist_end", PORK_blist_end, file); newXS("PORK::blist_hide", PORK_blist_hide, file); newXS("PORK::blist_page_down", PORK_blist_page_down, file); newXS("PORK::blist_page_up", PORK_blist_page_up, file); newXS("PORK::blist_refresh", PORK_blist_refresh, file); newXS("PORK::blist_show", PORK_blist_show, file); newXS("PORK::blist_start", PORK_blist_start, file); newXS("PORK::blist_up", PORK_blist_up, file); newXS("PORK::blist_width", PORK_blist_width, file); newXS("PORK::event_add", PORK_event_add, file); newXS("PORK::event_del", PORK_event_del, file); newXS("PORK::event_del_type", PORK_event_del_type, file); newXS("PORK::event_del_refnum", PORK_event_del_refnum, file); newXS("PORK::event_purge", PORK_event_purge, file); newXS("PORK::chat_ban", PORK_chat_ban, file); newXS("PORK::chat_kick", PORK_chat_kick, file); newXS("PORK::chat_topic", PORK_chat_topic, file); newXS("PORK::chat_get_list", PORK_chat_get_list, file); newXS("PORK::chat_get_users", PORK_chat_get_users, file); newXS("PORK::chat_get_window", PORK_chat_get_window, file); newXS("PORK::chat_ignore", PORK_chat_ignore, file); newXS("PORK::chat_invite", PORK_chat_invite, file); newXS("PORK::chat_join", PORK_chat_join, file); newXS("PORK::chat_leave", PORK_chat_leave, file); newXS("PORK::chat_send", PORK_chat_send, file); newXS("PORK::chat_target", PORK_chat_target, file); newXS("PORK::chat_topic", PORK_chat_topic, file); newXS("PORK::chat_unignore", PORK_chat_unignore, file); newXS("PORK::input_send", PORK_input_send, file); newXS("PORK::input_get_data", PORK_input_get_data, file); } int perl_load_file(char *filename) { char *args[] = { filename, NULL }; return (execute_perl("load_n_eval", args)); } int execute_perl_va(char *function, const char *fmt, va_list ap) { u_int32_t i; int count; int ret_value = -1; dSP; ENTER; SAVETMPS; PUSHMARK(sp); for (i = 0 ; fmt[i] != '\0'; i++) { switch (fmt[i]) { case 'S': case 's': { char *str; str = va_arg(ap, char *); if (str != NULL) { size_t len; len = strlen(str); XPUSHs(sv_2mortal(newSVpv(str, len))); } else XPUSHs(sv_2mortal(newSVsv(&PL_sv_undef))); break; } case 'i': { int int_arg; int_arg = va_arg(ap, int); XPUSHs(sv_2mortal(newSViv(int_arg))); break; } } } PUTBACK; count = perl_call_pv(function, G_EVAL | G_SCALAR); SPAGAIN; if (SvTRUE(ERRSV)) { size_t notused; char *err_msg = SvPV(ERRSV, notused); screen_err_msg("Perl error: %s", err_msg); (void) POPs; ret_value = 0; } else if (count != 1) { screen_err_msg("Perl error: expected 1 value from %s, got %d", function, count); ret_value = 0; } else ret_value = POPi; PUTBACK; FREETMPS; LEAVE; return (ret_value); } int execute_perl(char *function, char **args) { int count; int ret_value = 1; dSP; ENTER; SAVETMPS; PUSHMARK(sp); count = perl_call_argv(function, G_EVAL | G_SCALAR, args); SPAGAIN; if (SvTRUE(ERRSV)) { size_t notused; char *err_msg = SvPV(ERRSV, notused); screen_err_msg("Perl error: %s", err_msg); (void) POPs; } else if (count != 1) { screen_err_msg("Perl error: expected 1 value from %s, got %d", function, count); } else { ret_value = POPi; } PUTBACK; FREETMPS; LEAVE; return (ret_value); } int perl_init(void) { static char *perl_args[] = { "", "-e", "0", "-w" }; static char perl_definitions[] = { "sub load_file{" "my $f_name=shift;" "local $/=undef;" "open FH,$f_name or return \"__FAILED__\";" "$_=;" "close FH;" "return $_;" "}" "sub load_n_eval{" "my $f_name=shift;" "my $strin=load_file($f_name);" "return 2 if($strin eq \"__FAILED__\");" "eval $strin;" "if($@){" /*" #something went wrong\n"*/ "PORK::err_msg(\"While loading file '$f_name': $@\");" "return 1;" "}" "return 0;" "}" }; perl_inter = perl_alloc(); if (perl_inter == NULL) return (-1); perl_construct(perl_inter); perl_parse(perl_inter, xs_init, 3, perl_args, NULL); #ifdef HAVE_PERL_EVAL_PV eval_pv(perl_definitions, TRUE); #else perl_eval_pv(perl_definitions, TRUE); #endif return (0); } int perl_destroy(void) { if (perl_inter != NULL) { perl_destruct(perl_inter); perl_free(perl_inter); return (0); } return (-1); } pork-0.99.8.1/src/pork_perl.h0000644000175000017500000000103510234217324015631 0ustar ryanryan00000000000000/* ** pork_perl.h - Perl scripting support ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_PERL_H #define __PORK_PERL_H int perl_init(void); int perl_destroy(void); int perl_load_file(char *filename); int execute_perl(char *function, char **args); int execute_perl_va(char *function, const char *fmt, va_list ap); #endif pork-0.99.8.1/src/pork_screen_io.c0000644000175000017500000001375510236222245016644 0ustar ryanryan00000000000000/* ** pork_screen_io.c - screen management. ** Copyright (C) 2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. ** ** The functions in this file are mostly wrappers around ** functions that do the actual work. The difference is ** these functions do any necessary updating of the contents ** of the screen (i.e. refreshing, redrawing, etc). */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include inline void screen_doupdate(void) { int cur_old = curs_set(0); wmove(screen.status_bar, STATUS_ROWS - 1, input_get_cursor_pos(cur_window()->input)); wnoutrefresh(screen.status_bar); doupdate(); curs_set(cur_old); } int screen_draw_input(void) { struct input *input = cur_window()->input; if (input->dirty) { char *input_line; int len; len = input->width; input_line = input_partial(input); if (input_line == NULL) return (0); wmove(screen.status_bar, STATUS_ROWS - 1, 0); wclrtoeol(screen.status_bar); if (input_line == input->input_buf && input->prompt != NULL) { wputnstr(screen.status_bar, input->prompt, min(input->width, input->prompt_len)); len -= input->prompt_len; } if (len < 0) return (1); wputncstr(screen.status_bar, input_line, len); /* ** We don't need a wnoutfresh here for this window. Since it's ** dirty (implying we return 1), screen_doupdate() will be called, ** which redraws the cursor and calls wnoutrefresh on the status ** window, which happens to be the window the input is drawn in. */ input->dirty = 0; return (1); } return (0); } inline int screen_set_quiet(int status) { int ret = screen.quiet; screen.quiet = status; return (ret); } int screen_prompt_user(char *prompt, char *buf, size_t len) { int ret; buf[0] = '\0'; wmove(screen.status_bar, 1, 0); wclrtoeol(screen.status_bar); if (prompt != NULL) waddstr(screen.status_bar, prompt); wrefresh(screen.status_bar); ret = wgetnstr(screen.status_bar, buf, len); return (ret); } static void __screen_win_msg( struct imwindow *win, u_int32_t opt, u_int32_t msgtype, char *fmt, va_list ap) { char *buf = NULL; chtype *ch; size_t chlen = 0; int (*cstr_conv)(chtype *, size_t, ...) = plaintext_to_cstr; char tstxt[128]; char *banner_txt = "\0"; char *p; int ret; if (!(opt & MSG_OPT_COLOR)) cstr_conv = plaintext_to_cstr_nocolor; if (opt & MSG_OPT_TIMESTAMP) { ret = fill_format_str(OPT_FORMAT_STATUS_TIMESTAMP, tstxt, sizeof(tstxt)); if (ret < 1) tstxt[0] = '\0'; else chlen += ret; } else tstxt[0] = '\0'; if (opt & MSG_OPT_BANNER) { banner_txt = opt_get_str(OPT_BANNER); if (banner_txt == NULL) banner_txt = "\0"; else chlen += strlen(banner_txt); } ret = vasprintf(&buf, fmt, ap); if (ret < 0) { debug("unable to allocate string for %s", fmt); return; } p = strchr(buf, '\n'); if (p != NULL) { *p++ = '\0'; chlen += ret - (p - buf); } else chlen += ret + 1; /* ** This is a horrible, horrible hack to handle ** embedded tabs. */ chlen += 128; ch = xmalloc(sizeof(chtype) * chlen); chlen = cstr_conv(ch, chlen, tstxt, banner_txt, buf, NULL); ch = xrealloc(ch, sizeof(chtype) * (chlen + 1)); imwindow_add(win, imsg_new(&win->swindow, ch, chlen), msgtype); while (p != NULL) { char *next; size_t len; next = strchr(p, '\n'); if (next != NULL) { *next++ = '\0'; len = next - p + 1; } else len = strlen(p); len += 128; ch = xmalloc(sizeof(chtype) * len); /* XXX - this should be configurable */ len = cstr_conv(ch, len, " ", p, NULL); ch = xrealloc(ch, sizeof(chtype) * (len + 1)); imwindow_add(win, imsg_new(&win->swindow, ch, len), msgtype); p = next; } free(buf); } void screen_print_str(struct imwindow *win, char *buf, size_t chlen, int type) { char *p; chtype *ch; p = strchr(buf, '\n'); if (p != NULL) { chlen = p - buf - 1; *p++ = '\0'; } chlen += 128; ch = xmalloc(sizeof(chtype) * (chlen + 1)); chlen = plaintext_to_cstr(ch, chlen + 1, buf, NULL); ch = xrealloc(ch, sizeof(chtype) * (chlen + 1)); imwindow_add(win, imsg_new(&win->swindow, ch, chlen), type); while (p != NULL) { chtype *ch; char *next; size_t len; next = strchr(p, '\n'); if (next != NULL) { *next++ = '\0'; len = next - p + 1; } else len = strlen(p) + 1; len += 128; ch = xmalloc(sizeof(chtype) * len); len = plaintext_to_cstr(ch, len, " ", p, NULL); ch = xrealloc(ch, sizeof(chtype) * (len + 1)); imwindow_add(win, imsg_new(&win->swindow, ch, len), type); p = next; } } inline void screen_win_msg( struct imwindow *win, int ts, int banner, int color, int type, char *fmt, ...) { va_list ap; va_start(ap, fmt); __screen_win_msg(win, (ts * MSG_OPT_TIMESTAMP) | (banner * MSG_OPT_BANNER) | (color * MSG_OPT_COLOR), 1, fmt, ap); va_end(ap); } inline void screen_err_msg(char *fmt, ...) { va_list ap; va_start(ap, fmt); __screen_win_msg(cur_window(), MSG_OPT_TIMESTAMP | MSG_OPT_BANNER | MSG_OPT_COLOR, MSG_TYPE_ERROR, fmt, ap); va_end(ap); } inline void screen_cmd_output(char *fmt, ...) { va_list ap; va_start(ap, fmt); if (!screen.quiet) { __screen_win_msg(cur_window(), MSG_OPT_BANNER | MSG_OPT_COLOR, MSG_TYPE_CMD_OUTPUT, fmt, ap); } va_end(ap); } inline void screen_nocolor_msg(char *fmt, ...) { va_list ap; va_start(ap, fmt); if (!screen.quiet) __screen_win_msg(cur_window(), MSG_OPT_BANNER, 1, fmt, ap); va_end(ap); } pork-0.99.8.1/src/pork_screen_io.h0000644000175000017500000000353010234217325016640 0ustar ryanryan00000000000000/* ** pork_screen_io.h - screen management. ** Copyright (C) 2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_SCREEN_IO_H #define __PORK_SCREEN_IO_H struct imwindow; struct pork_acct; void screen_print_str(struct imwindow *, char *buf, size_t len, int type); void screen_win_msg(struct imwindow *win, int ts, int banner, int color, int type, char *fmt, ...) __format((printf, 6, 7)); inline void screen_nocolor_msg(char *fmt, ...) __format((printf, 1, 2)); inline void screen_err_msg(char *fmt, ...) __format((printf, 1, 2)); inline void screen_cmd_output(char *fmt, ...) __format((printf, 1, 2)); void screen_win_target_msg( struct pork_acct *acct, char *target, int timestamp, char *fmt, ...) __format((printf, 4, 5)); int screen_get_query_window(struct pork_acct *acct, char *name, struct imwindow **winr); int screen_make_query_window(struct pork_acct *acct, char *name, struct imwindow **winr); int screen_draw_input(void); int screen_set_quiet(int status); int screen_prompt_user(char *prompt, char *buf, size_t len); void screen_doupdate(void); /* yeah, yeah */ #ifdef ENABLE_DEBUGGING #define pork_sock_err(a, x) \ do { \ int __psockerr; \ if ((__psockerr = sock_is_error((x)))) { \ screen_err_msg("(%s:%d) network error: %s: %s", __FILE__, __LINE__, ((struct pork_acct *) (a))->username, strerror(__psockerr)); \ } \ } while (0) #else #define pork_sock_err(a, x) \ do { \ int __psockerr; \ if ((__psockerr = sock_is_error((x)))) { \ screen_err_msg("network error: %s: %s", ((struct pork_acct *) (a))->username, strerror(__psockerr)); \ } \ } while (0) #endif #endif pork-0.99.8.1/src/pork_util.c0000644000175000017500000001300710236222245015641 0ustar ryanryan00000000000000/* ** pork_util.c - utility functions ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* ** Convert all the alphabetic characters in the string to uppercase. This ** modifies the string. */ void strtoupper(char *s) { if (s == NULL) return; for (; *s != '\0' ; s++) *s = toupper(*s); } void *xrealloc(void *ptr, size_t size) { void *ret = realloc(ptr, size); if (ret == NULL) { debug("out of memory: %u", size); exit(-1); } return (ret); } void *xmalloc(size_t len) { void *ret = malloc(len); if (ret == NULL) { debug("out of memory: %u", len); exit(-1); } return (ret); } void *xcalloc(size_t nmemb, size_t len) { void *ret = calloc(nmemb, len); if (ret == NULL) { debug("out of memory: %u", len); exit(-1); } return (ret); } char *xstrdup(const char *str) { char *ret = strdup(str); if (ret == NULL) { debug("out of memory: %p", str); exit(-1); } return (ret); } void free_str_wipe(char *str) { if (str == NULL) return; memset(str, 0, strlen(str)); free(str); } /* ** Copy at most n-1 characters from src to dest and nul-terminate dest. ** Returns the number of characters copied (excluding the '\0') if the whole ** string was copied, -1 otherwise. */ int xstrncpy(char *dest, const char *src, size_t n) { size_t len; int ret; if (n == 0) return (0); len = strlen(src); if (len >= n) { len = n - 1; ret = -1; debug("string too long src=%s", src); } else ret = (int) len; memcpy(dest, src, len); dest[len] = '\0'; return (ret); } /* ** Append at most n-1 characters from src to dest and nul-terminate dest. ** Returns the number of characters copied (excluding the '\0') if the whole ** string was copied, -1 otherwise. */ int xstrncat(char *dest, const char *src, size_t n) { if (n == 0) return (0); for (; *dest != '\0' && n > 0 ; dest++, n--) ; if (n == 0) { debug("src too long: %s", src); return (-1); } return (xstrncpy(dest, src, n)); } char *xstrndup(const char *str, size_t len) { char *dst; char *ret; if (len == 0) return (NULL); dst = xmalloc(len + 1); ret = dst; while (*str != '\0' && len > 0) { *dst++ = *str++; len--; } if (dst[-1] != '\0') *dst = '\0'; return (ret); } /* ** Returns 1 if the string is blank (i.e. contains ** nothing but space characters), 0 if it's not blank. */ int blank_str(const char *str) { const char *p = str; while (*p != '\0') { if (*p != ' ') return (0); p++; } return (1); } /* ** Returns the portion of the string starting with token number "tok_num". ** Returns NULL if there are less tokens than "tok_num" in the string. */ char *str_from_tok(char *str, u_int32_t tok_num) { char *p; u_int32_t i; if (tok_num <= 1) return (str); p = str; for (i = 0 ; i < tok_num - 1 && (p = strchr(p, ' ')) != NULL ; i++) p++; if (i != tok_num - 1 || p == NULL) return (NULL); return (p); } /* ** Trims any trailing whitespace characters from the string. */ void str_trim(char *str) { char *p; size_t len; len = strlen(str); p = &str[len - 1]; while (*p == ' ' || *p == '\t') *p-- = '\0'; } /* ** Hash by Karl Nelson ** ** See http://mail.gnome.org/archives/gtk-devel-list/2000-February/msg00057.html ** for details. */ inline u_int32_t string_hash(const char *str, u_int32_t order) { u_int32_t hash = 0; while (*str != '\0') hash = (hash << 5) - hash + *str++; return (hash & ((1 << order) - 1)); } inline u_int32_t int_hash(int num, u_int32_t order) { return (num & ((1 << order) - 1)); } inline int str_to_uint(const char *str, u_int32_t *val) { char *end; u_int32_t temp; temp = strtoul(str, &end, 0); if (*end != '\0') return (-1); *val = temp; return (0); } inline int str_to_int(const char *str, int *val) { char *end; int temp; temp = strtol(str, &end, 0); if (*end != '\0') return (-1); *val = temp; return (0); } char *terminate_quote(char *buf) { char *p = buf; if (*p == '\"') p++; while ((p = strchr(p, '\"')) != NULL) { if (p[-1] != '\\') { *p++ = '\0'; return (p); } memmove(&p[-1], p, strlen(p) + 1); } return (NULL); } int expand_path(char *path, char *dest, size_t len) { int ret; if (*path == '~') { struct passwd *pw; path++; if (*path == '/') { pw = getpwuid(getuid()); path++; } else { char *p = strchr(path, '/'); if (p == NULL) { if (*path == '\0') pw = getpwuid(getuid()); else pw = getpwnam(path); if (pw != NULL) path = NULL; } else { char *user = xstrndup(path, p - path); pw = getpwnam(user); free(user); if (pw != NULL) path = ++p; } } if (pw != NULL) { if (path != NULL) { ret = snprintf(dest, len, "%s/%s", pw->pw_dir, path); if (ret < 1 || (size_t) ret >= len) ret = -1; } else ret = xstrncpy(dest, pw->pw_dir, len); } else { path--; ret = xstrncpy(dest, path, len); } } else ret = xstrncpy(dest, path, len); return (ret); } int file_get_size(FILE *fp, size_t *result) { struct stat st; if (fstat(fileno(fp), &st) != 0) { debug("fstat: %s", strerror(errno)); return (-1); } *result = st.st_size; return (0); } pork-0.99.8.1/src/pork_util.h0000644000175000017500000000333210236222245015646 0ustar ryanryan00000000000000/* ** pork_util.h - utility functions ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_UTIL_H #define __PORK_UTIL_H #define array_elem(x) (sizeof((x)) / sizeof((x)[0])) #if SIZEOF_VOID_P == 8 #define POINTER_TO_INT(p) ((int) (long) (p)) #define POINTER_TO_UINT(p) ((unsigned int) (unsigned long) (p)) #define INT_TO_POINTER(i) ((void *) (long) (i)) #define UINT_TO_POINTER(u) ((void *) (unsigned long) (u)) #else #define POINTER_TO_INT(p) ((int) (p)) #define POINTER_TO_UINT(p) ((unsigned int) (p)) #define INT_TO_POINTER(i) ((void *) (i)) #define UINT_TO_POINTER(u) ((void *) (u)) #endif #ifndef min # define min(x,y) ((x) < (y) ? (x) : (y)) #endif #ifndef max # define max(x,y) ((x) > (y) ? (x) : (y)) #endif char *xstrdup(const char *str); void *xmalloc(size_t len); void *xcalloc(size_t nmemb, size_t len); char *xstrndup(const char *str, size_t len); void *xrealloc(void *ptr, size_t size); void strtoupper(char *s); void free_str_wipe(char *str); int xstrncpy(char *dest, const char *src, size_t n); int xstrncat(char *dest, const char *src, size_t n); char *str_from_tok(char *str, u_int32_t tok_num); void str_trim(char *str); char *terminate_quote(char *buf); int expand_path(char *path, char *dest, size_t len); int blank_str(const char *str); u_int32_t string_hash(const char *str, u_int32_t order); u_int32_t int_hash(int num, u_int32_t order); inline int str_to_uint(const char *str, u_int32_t *val); inline int str_to_int(const char *str, int *val); int file_get_size(FILE *fp, size_t *result); #endif pork-0.99.8.1/src/pork_transfer.c0000644000175000017500000003350710234217325016520 0ustar ryanryan00000000000000/* ** file_transfer.c ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static u_int32_t next_xfer_refnum; static dlist_t *transfer_find_node_refnum( struct pork_acct *acct, u_int32_t refnum) { dlist_t *cur = acct->transfer_list; while (cur != NULL) { struct file_transfer *xfer = cur->data; if (xfer->refnum == refnum) return (cur); cur = cur->next; } return (NULL); } struct file_transfer *transfer_new( struct pork_acct *acct, char *peer, int direction, char *filename, size_t size) { struct file_transfer *xfer; char *p; xfer = xcalloc(1, sizeof(*xfer)); xfer->peer_username = xstrdup(peer); xfer->type = direction; xfer->acct = acct; xfer->sock = -1; xfer->start_offset = 0; xfer->fname_orig = xstrdup(filename); xfer->fname_local = xstrdup(filename); xfer->file_len = size; xfer->status = TRANSFER_STATUS_WAITING; xfer->refnum = next_xfer_refnum++; p = xstrdup(filename); xfer->fname_base = xstrdup(basename(p)); if (strchr(xfer->fname_base, ' ') != NULL) xfer->quote_fname = 1; acct->transfer_list = dlist_add_head(acct->transfer_list, xfer); free(p); return (xfer); } int transfer_bind_listen_sock(struct file_transfer *xfer, int sock) { in_port_t lport; in_port_t lport_max; int temp; int listenfd; if (get_local_addr(sock, &xfer->laddr) != 0) return (-1); temp = opt_get_int(OPT_TRANSFER_PORT_MIN); if (temp < 1024 || temp > 0xffff) temp = 1024; lport = temp; temp = opt_get_int(OPT_TRANSFER_PORT_MAX); if (temp < lport) temp = lport + 500; lport_max = temp; do { listenfd = sock_listen(&xfer->laddr, lport); if (listenfd >= 0) break; lport++; } while (lport < lport_max); if (listenfd < 0) return (-1); xfer->lport = lport; xfer->sock = listenfd; get_ip(&xfer->laddr, xfer->laddr_ip, sizeof(xfer->laddr_ip)); return (0); } int transfer_resume(struct file_transfer *xfer, off_t offset) { int ret; if (xfer->fp == NULL) return (-1); if (offset < 0 || offset >= xfer->file_len) return (-1); xfer->start_offset = offset; ret = fseek(xfer->fp, offset, SEEK_SET); if (ret < 0) debug("fseek: %lld %s", offset, strerror(errno)); return (ret); } inline struct file_transfer *transfer_find_refnum( struct pork_acct *acct, u_int32_t refnum) { dlist_t *node; node = transfer_find_node_refnum(acct, refnum); if (node != NULL) return (node->data); return (NULL); } void transfer_recv_data(int fd __notused, u_int32_t cond __notused, void *data) { int ret; int written; char buf[4096]; struct file_transfer *xfer = data; ret = read(xfer->sock, buf, sizeof(buf)); if (ret < 1) { transfer_lost(xfer); return; } written = fwrite(buf, 1, (size_t) ret, xfer->fp); if (written != ret) { screen_err_msg("Error writing file %s: %s", xfer->fname_local, strerror(errno)); transfer_lost(xfer); return; } if (xfer->bytes_sent == 0) gettimeofday(&xfer->time_started, NULL); xfer->bytes_sent += written; if (xfer->acct->proto->file_recv_data != NULL) xfer->acct->proto->file_recv_data(xfer, buf, ret); } void transfer_send_data(int fd __notused, u_int32_t cond __notused, void *data) { int ret; int sent; char buf[4096]; struct file_transfer *xfer = data; ret = fread(buf, 1, sizeof(buf), xfer->fp); if (ret < 0) { debug("fread: %s", strerror(errno)); transfer_lost(xfer); return; } if (xfer->bytes_sent == 0) gettimeofday(&xfer->time_started, NULL); sent = sock_write(xfer->sock, buf, ret); if (sent != ret) { screen_err_msg("Error sending data for file %s: %s", xfer->fname_local, strerror(errno)); transfer_lost(xfer); return; } xfer->bytes_sent += sent; if (xfer->bytes_sent + xfer->start_offset >= xfer->file_len) xfer->status = TRANSFER_STATUS_COMPLETE; if (xfer->acct->proto->file_send_data != NULL) xfer->acct->proto->file_send_data(xfer, buf, ret); } double transfer_time_elapsed(struct file_transfer *xfer) { struct timeval time_now; double start_time; double end_time; gettimeofday(&time_now, NULL); end_time = time_now.tv_sec + (double) time_now.tv_usec / 1000000; start_time = xfer->time_started.tv_sec + (double) xfer->time_started.tv_usec / 1000000; return (end_time - start_time); } inline double transfer_avg_speed(struct file_transfer *xfer) { return ((xfer->bytes_sent >> 10) / transfer_time_elapsed(xfer)); } int transfer_recv_complete(struct file_transfer *xfer) { char buf[4096]; int ret; if (xfer->acct->proto->file_recv_complete != NULL && xfer->acct->proto->file_recv_complete(xfer) == -1) { screen_err_msg( "There was an error finishing transfer refnum %u for %s from %s", xfer->refnum, xfer->fname_local, xfer->peer_username); transfer_abort(xfer); return (-1); } ret = fill_format_str(OPT_FORMAT_FILE_RECV_COMPLETE, buf, sizeof(buf), xfer); if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_FIN); } return (transfer_destroy(xfer)); } int transfer_send_complete(struct file_transfer *xfer) { char buf[4096]; int ret; if (xfer->acct->proto->file_send_complete != NULL && xfer->acct->proto->file_send_complete(xfer) == -1) { screen_err_msg( "There was an error finishing transfer refnum %u for %s to %s", xfer->refnum, xfer->fname_local, xfer->peer_username); transfer_abort(xfer); return (-1); } ret = fill_format_str(OPT_FORMAT_FILE_SEND_COMPLETE, buf, sizeof(buf), xfer); if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_FIN); } return (transfer_destroy(xfer)); } static int transfer_find_filename(struct file_transfer *xfer, char *filename) { char buf[4096]; int ret; int fd; FILE *fp; int tries = 0; char *fname_orig; if (filename == NULL) { size_t offset = 0; char *download_dir = opt_get_str(OPT_DOWNLOAD_DIR); char *p; /* ** We're going to accept the filename given by our peer. */ filename = xfer->fname_orig; fname_orig = xfer->fname_orig; if (download_dir != NULL && !blank_str(download_dir)) { ret = xstrncpy(buf, download_dir, sizeof(buf) - 1); if (ret == -1) return (-1); buf[ret] = '/'; offset = ret + 1; } ret = xstrncpy(&buf[offset], filename, sizeof(buf) - offset); if (ret == -1) return (-1); /* ** Don't let people play tricks with '.' and '/' characters in ** file names. */ p = &buf[offset]; if (p[0] == '.') p[0] = '_'; while ((p = strchr(p, '/')) != NULL) *p = '_'; } else { /* ** The user requested a particular name for the file. Use it. */ ret = expand_path(filename, buf, sizeof(buf)); fname_orig = filename; } fd = open(buf, O_WRONLY | O_EXCL | O_CREAT, 0600); while (fd == -1 && errno == EEXIST && tries < 300) { if (xstrncat(buf, "_", sizeof(buf)) == -1) return (-EEXIST); fd = open(buf, O_WRONLY | O_EXCL | O_CREAT, 0600); tries++; } if (fd == -1) return (-1); if (tries >= 300) return (-EEXIST); if (tries > 0) { screen_err_msg("%s already exists -- using %s instead", fname_orig, buf); } fp = fdopen(fd, "w"); if (fp == NULL) { unlink(buf); close(fd); return (-1); } free(xfer->fname_local); xfer->fname_local = xstrdup(buf); xfer->fp = fp; return (0); } int transfer_get(struct file_transfer *xfer, char *filename) { int ret; if (transfer_find_filename(xfer, filename) == -1) { screen_err_msg("Error finding a suitable filename. Specify one explictly"); return (-1); } ret = xfer->acct->proto->file_accept(xfer); if (ret == -1) { screen_err_msg("Error accepting %s", xfer->fname_local); transfer_lost(xfer); return (-1); } xfer->status = TRANSFER_STATUS_ACTIVE; return (0); } u_int32_t transfer_get_all(struct pork_acct *acct) { dlist_t *cur; u_int32_t successes = 0; cur = acct->transfer_list; while (cur != NULL) { struct file_transfer *xfer = cur->data; dlist_t *next = cur->next; if (xfer->type == TRANSFER_DIR_RECV && xfer->status == TRANSFER_STATUS_WAITING) { if (transfer_get(xfer, xfer->fname_local) != -1) successes++; } cur = next; } return (successes); } u_int32_t transfer_abort_all(struct pork_acct *acct, u_int32_t type) { dlist_t *cur; u_int32_t successes = 0; cur = acct->transfer_list; while (cur != NULL) { struct file_transfer *xfer = cur->data; dlist_t *next = cur->next; if (type == TRANSFER_DIR_ANY || xfer->type == type) { transfer_abort(xfer); successes++; } cur = next; } return (successes); } struct file_transfer *transfer_find(struct pork_acct *acct, char *peer, char *file) { dlist_t *cur; for (cur = acct->transfer_list ; cur != NULL ; cur = cur->next) { struct file_transfer *xfer = cur->data; if (!acct->proto->user_compare(peer, xfer->peer_username) && !strcmp(file, xfer->fname_base)) { return (xfer); } } return (NULL); } int transfer_send(struct pork_acct *acct, char *dest, char *filename) { FILE *fp; size_t len; struct file_transfer *xfer; char buf[4096]; if (acct->proto->file_send == NULL) return (-1); if (expand_path(filename, buf, sizeof(buf)) == -1) { screen_err_msg("Error: The path is too long"); return (-1); } fp = fopen(buf, "r"); if (fp == NULL) { debug("fopen: %s: %s", buf, strerror(errno)); screen_err_msg("Error: Cannot open %s for reading", buf); return (-1); } if (file_get_size(fp, &len) != 0) { screen_err_msg("Error: Cannot determine the size of %s", buf); fclose(fp); return (-1); } xfer = transfer_new(acct, dest, TRANSFER_DIR_SEND, buf, len); if (xfer == NULL) { screen_err_msg("Error sending %s to %s -- aborting", buf, dest); fclose(fp); return (-1); } xfer->fp = fp; if (acct->proto->file_send(xfer) == -1) { transfer_lost(xfer); return (-1); } return (0); } int transfer_abort(struct file_transfer *xfer) { int ret = 0; if (xfer->acct->proto->file_abort != NULL) ret = xfer->acct->proto->file_abort(xfer); transfer_destroy(xfer); return (ret); } int transfer_destroy(struct file_transfer *xfer) { struct pork_acct *acct = xfer->acct; dlist_t *node; node = transfer_find_node_refnum(acct, xfer->refnum); if (node == NULL) return (-1); acct->transfer_list = dlist_remove(acct->transfer_list, node); free(xfer->peer_username); free(xfer->fname_orig); free(xfer->fname_local); free(xfer->fname_base); if (xfer->fp != NULL) fclose(xfer->fp); free(xfer); return (0); } inline char *transfer_get_local_hostname(struct file_transfer *xfer) { if (xfer->laddr_host[0] == '\0') { get_hostname(&xfer->laddr, xfer->laddr_host, sizeof(xfer->laddr_host)); } return (xfer->laddr_host); } inline char *transfer_get_remote_hostname(struct file_transfer *xfer) { if (xfer->faddr_host[0] == '\0') { get_hostname(&xfer->faddr, xfer->faddr_host, sizeof(xfer->faddr_host)); } return (xfer->laddr_host); } int transfer_recv_accepted(struct file_transfer *xfer) { char buf[4096]; int ret; if (xfer->start_offset != 0) { ret = fill_format_str(OPT_FORMAT_FILE_RECV_RESUME, buf, sizeof(buf), xfer); } else { ret = fill_format_str(OPT_FORMAT_FILE_RECV_ACCEPT, buf, sizeof(buf), xfer); } if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_STATUS); } return (0); } int transfer_request_recv(struct file_transfer *xfer) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_FILE_RECV_ASK, buf, sizeof(buf), xfer); if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_STATUS); } return (0); } int transfer_request_send(struct file_transfer *xfer) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_FILE_SEND_ASK, buf, sizeof(buf), xfer); if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_STATUS); } return (0); } int transfer_send_accepted(struct file_transfer *xfer) { char buf[4096]; int ret; if (xfer->start_offset != 0) { ret = fill_format_str(OPT_FORMAT_FILE_SEND_RESUME, buf, sizeof(buf), xfer); } else { ret = fill_format_str(OPT_FORMAT_FILE_SEND_ACCEPT, buf, sizeof(buf), xfer); } if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_START); } xfer->status = TRANSFER_STATUS_ACTIVE; return (0); } int transfer_lost(struct file_transfer *xfer) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_FILE_LOST, buf, sizeof(buf), xfer); if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_STATUS); } return (transfer_abort(xfer)); } int transfer_cancel_local(struct file_transfer *xfer) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_FILE_CANCEL_LOCAL, buf, sizeof(buf), xfer); if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_FIN); } return (transfer_abort(xfer)); } int transfer_cancel_remote(struct file_transfer *xfer) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_FILE_CANCEL_REMOTE, buf, sizeof(buf), xfer); if (ret > 0) { screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_FILE_XFER_FIN); } return (transfer_abort(xfer)); } char *transfer_status_str(struct file_transfer *xfer) { static char *file_status[] = { "WAITING", "ACTIVE", "COMPLETE" }; return (file_status[xfer->status]); } pork-0.99.8.1/src/pork_transfer.h0000644000175000017500000000562410234217325016524 0ustar ryanryan00000000000000/* ** pork_transfer.h ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_TRANSFER_H #define __PORK_TRANSFER_H #include #include #include #include struct pork_acct; enum { TRANSFER_DIR_SEND, TRANSFER_DIR_RECV, TRANSFER_DIR_ANY, }; enum { TRANSFER_STATUS_WAITING, TRANSFER_STATUS_ACTIVE, TRANSFER_STATUS_COMPLETE, }; struct file_transfer { u_int32_t refnum; u_int16_t type; u_int16_t status; u_int32_t protocol_flags:24; u_int32_t quote_fname:1; in_port_t lport; in_port_t fport; char *peer_username; char *fname_local; char *fname_base; char *fname_orig; int sock; off_t bytes_sent; off_t file_len; off_t start_offset; struct pork_acct *acct; FILE *fp; void *data; struct timeval time_started; char faddr_ip[MAX_IPLEN]; char laddr_ip[MAX_IPLEN]; char faddr_host[MAX_HOSTLEN]; char laddr_host[MAX_HOSTLEN]; struct sockaddr_storage faddr; struct sockaddr_storage laddr; }; struct file_transfer *transfer_find_refnum( struct pork_acct *acct, u_int32_t refnum); int transfer_send_accepted(struct file_transfer *xfer); int transfer_recv_accepted(struct file_transfer *xfer); int transfer_request_send(struct file_transfer *xfer); int transfer_request_recv(struct file_transfer *xfer); int transfer_bind_listen_sock(struct file_transfer *xfer, int sock); int transfer_resume(struct file_transfer *xfer, off_t offset); int transfer_get(struct file_transfer *xfer, char *filename); int transfer_abort(struct file_transfer *xfer); int transfer_send_complete(struct file_transfer *xfer); int transfer_recv_complete(struct file_transfer *xfer); int transfer_destroy(struct file_transfer *xfer); int transfer_send(struct pork_acct *acct, char *dest, char *filename); char *transfer_status_str(struct file_transfer *xfer); void transfer_recv_data(int fd, u_int32_t cond, void *data); void transfer_send_data(int fd, u_int32_t cond, void *data); double transfer_time_elapsed(struct file_transfer *xfer); inline double transfer_avg_speed(struct file_transfer *xfer); inline char *transfer_get_local_hostname(struct file_transfer *xfer); inline char *transfer_get_remote_hostname(struct file_transfer *xfer); int transfer_cancel_local(struct file_transfer *xfer); int transfer_cancel_remote(struct file_transfer *xfer); int transfer_lost(struct file_transfer *xfer); u_int32_t transfer_get_all(struct pork_acct *acct); u_int32_t transfer_abort_all(struct pork_acct *acct, u_int32_t type); struct file_transfer *transfer_new( struct pork_acct *acct, char *peer, int direction, char *filename, size_t size); struct file_transfer *transfer_find(struct pork_acct *acct, char *peer, char *file); #endif pork-0.99.8.1/src/pork_perl_xs.c0000644000175000017500000013766510234301511016351 0ustar ryanryan00000000000000/* ** pork_perl_xs.c - Perl scripting support ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #undef PACKAGE #undef instr #ifndef HAS_BOOL # define HAS_BOOL #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern struct screen screen; XS(PORK_run_cmd) { char *command_str; size_t notused; u_int32_t i = 0; dXSARGS; (void) cv; if (items < 1) XSRETURN_IV(-1); while (items-- > 0) { command_str = SvPV(ST(i), notused); i++; if (command_str == NULL) continue; run_command(command_str); } XSRETURN_IV(0); } XS(PORK_connect) { char *username = NULL; size_t notused; dXSARGS; (void) cv; if (items != 0) username = SvPV(ST(0), notused); cmd_connect(username); XSRETURN_IV(0); } XS(PORK_input_send) { char *args; size_t notused; dXSARGS; (void) cv; if (items == 0) XSRETURN_IV(-1); args = SvPV(ST(0), notused); if (args == NULL) XSRETURN_IV(-1); cmd_input_send(args); XSRETURN_IV(0); } XS(PORK_input_get_data) { dXSARGS; (void) cv; (void) items; XSRETURN_PV(input_get_buf_str(cur_window()->input)); } XS(PORK_disconnect) { struct pork_acct *acct; char *reason = NULL; dXSARGS; (void) cv; if (items >= 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); if (items >= 2) { size_t notused; reason = SvPV(ST(1), notused); } } else acct = cur_window()->owner; if (!acct->can_connect) XSRETURN_IV(-1); XSRETURN_IV(pork_acct_del_refnum(acct->refnum, reason)); } XS(PORK_cur_user) { dXSARGS; (void) cv; (void) items; XSRETURN_PV(cur_window()->owner->username); } XS(PORK_err_msg) { size_t notused; char *msg; dXSARGS; (void) cv; if (items != 1) XSRETURN_IV(-1); msg = SvPV(ST(0), notused); if (msg == NULL) XSRETURN_IV(-1); screen_err_msg("%s", msg); XSRETURN_IV(0); } XS(PORK_prompt_user) { dXSARGS; char buf[4096]; int ret; char *prompt = NULL; (void) cv; if (items > 0) { size_t notused; prompt = SvPV(ST(0), notused); } screen_prompt_user(prompt, buf, sizeof(buf)); ret = strlen(buf); if (ret <= 0) XSRETURN_UNDEF; XSRETURN_PV(buf); } XS(PORK_status_msg) { size_t notused; char *msg; dXSARGS; (void) cv; if (items != 1) XSRETURN_IV(-1); msg = SvPV(ST(0), notused); if (msg == NULL) XSRETURN_IV(-1); screen_win_msg(cur_window(), 1, 1, 1, MSG_TYPE_STATUS, "%s", msg); XSRETURN_IV(0); } XS(PORK_load) { int args = 0; dXSARGS; (void) cv; if (items < 1) XSRETURN_IV(-1); while (items > 0) { char *file; size_t notused; file = SvPV(ST(args), notused); if (file == NULL) XSRETURN_IV(-1); if (read_conf(file) != 0) XSRETURN_IV(-1); args++; items--; } XSRETURN_IV(0); } XS(PORK_load_perl) { int args = 0; dXSARGS; (void) cv; if (items < 1) XSRETURN_IV(-1); while (items > 0) { char *file; size_t notused; file = SvPV(ST(args), notused); if (file == NULL) XSRETURN_IV(-1); if (perl_load_file(file) != 0) XSRETURN_IV(-1); args++; items--; } XSRETURN_IV(0); } XS(PORK_echo) { size_t notused; char *msg; dXSARGS; (void) cv; if (items < 1) XSRETURN_IV(-1); msg = SvPV(ST(0), notused); screen_win_msg(cur_window(), 0, 0, 1, MSG_TYPE_CMD_OUTPUT, msg); XSRETURN_IV(0); } XS(PORK_quit) { int exit_val = 0; char *reason = NULL; dXSARGS; (void) cv; if (items >= 1) exit_val = SvIV(ST(0)); if (items >= 2) { size_t notused; reason = SvPV(ST(1), notused); } pork_exit(exit_val, reason, NULL); XSRETURN_IV(0); } XS(PORK_quote) { struct pork_acct *acct; char *str; size_t notused; dXSARGS; (void) cv; str = SvPV(ST(0), notused); if (str == NULL) XSRETURN_IV(-1); if (items > 1) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (acct->proto->quote == NULL) XSRETURN_IV(-1); XSRETURN_IV(acct->proto->quote(acct, str)); } XS(PORK_refresh) { dXSARGS; (void) cv; (void) items; screen_refresh(); XSRETURN_IV(0); } XS(PORK_save) { dXSARGS; (void) cv; (void) items; XSRETURN_IV(save_global_config()); } XS(PORK_bind) { char *key_str; int key; char *command; size_t notused; dXSARGS; (void) cv; if (items != 2) XSRETURN_IV(-1); key_str = SvPV(ST(0), notused); command = SvPV(ST(1), notused); if (key_str == NULL || command == NULL) XSRETURN_IV(-1); key = bind_get_keycode(key_str); if (key == -1) XSRETURN_IV(-1); bind_add(&screen.binds.main, key, command); XSRETURN_IV(0); } XS(PORK_unbind) { char *key_str; int key; size_t notused; dXSARGS; (void) cv; if (items != 1) XSRETURN_IV(-1); key_str = SvPV(ST(0), notused); if (key_str == NULL) XSRETURN_IV(-1); key = bind_get_keycode(key_str); if (key == -1) XSRETURN_IV(-1); key = bind_remove(&screen.binds.main, key); XSRETURN_IV(0); } XS(PORK_bind_get) { char *key_str; int key; size_t notused; struct binding *binding; dXSARGS; (void) cv; if (items != 1) XSRETURN_EMPTY; key_str = SvPV(ST(0), notused); if (key_str == NULL) XSRETURN_EMPTY; key = bind_get_keycode(key_str); if (key == -1) XSRETURN_EMPTY; binding = bind_find(&screen.binds.main, key); if (binding == NULL) XSRETURN_EMPTY; XSRETURN_PV(binding->binding); } XS(PORK_blist_bind) { char *key_str; int key; char *command; size_t notused; dXSARGS; (void) cv; if (items != 2) XSRETURN_IV(-1); key_str = SvPV(ST(0), notused); command = SvPV(ST(1), notused); if (key_str == NULL || command == NULL) XSRETURN_IV(-1); key = bind_get_keycode(key_str); if (key == -1) XSRETURN_IV(-1); bind_add(&screen.binds.blist, key, command); XSRETURN_IV(0); } XS(PORK_blist_unbind) { char *key_str; int key; size_t notused; dXSARGS; (void) cv; if (items != 1) XSRETURN_IV(-1); key_str = SvPV(ST(0), notused); if (key_str == NULL) XSRETURN_IV(-1); key = bind_get_keycode(key_str); if (key == -1) XSRETURN_IV(-1); key = bind_remove(&screen.binds.blist, key); XSRETURN_IV(0); } XS(PORK_blist_bind_get) { char *key_str; int key; size_t notused; struct binding *binding; dXSARGS; (void) cv; if (items != 1) XSRETURN_EMPTY; key_str = SvPV(ST(0), notused); if (key_str == NULL) XSRETURN_EMPTY; key = bind_get_keycode(key_str); if (key == -1) XSRETURN_EMPTY; binding = bind_find(&screen.binds.blist, key); if (binding == NULL) XSRETURN_EMPTY; XSRETURN_PV(binding->binding); } XS(PORK_alias) { char *alias; char *cmd; size_t notused; dXSARGS; (void) cv; if (items != 2) XSRETURN_IV(-1); alias = SvPV(ST(0), notused); cmd = SvPV(ST(1), notused); if (alias == NULL || cmd == NULL) XSRETURN_IV(-1); XSRETURN_IV(alias_add(&screen.alias_hash, alias, cmd)); } XS(PORK_alias_get) { char *str; size_t notused; struct alias *alias; dXSARGS; (void) cv; if (items != 1) XSRETURN_EMPTY; str = SvPV(ST(0), notused); if (str == NULL) XSRETURN_EMPTY; alias = alias_find(&screen.alias_hash, str); if (alias == NULL) XSRETURN_EMPTY; SP -= items; XPUSHs(sv_2mortal(newSVpv(alias->orig, 0))); if (alias->args != NULL) { XPUSHs(sv_2mortal(newSVpv(alias->args, 0))); XSRETURN(2); } XSRETURN(1); } XS(PORK_unalias) { char *alias; size_t notused; dXSARGS; (void) cv; if (items != 1) XSRETURN_IV(-1); alias = SvPV(ST(0), notused); if (alias == NULL) XSRETURN_IV(-1); XSRETURN_IV(alias_remove(&screen.alias_hash, alias)); } XS(PORK_set_opt) { char *var; char *val; size_t notused; int opt; dXSARGS; (void) cv; if (items != 2) XSRETURN_IV(-1); var = SvPV(ST(0), notused); val = SvPV(ST(1), notused); if (var == NULL || var == NULL) XSRETURN_IV(-1); opt = opt_find(var); if (opt == -1) XSRETURN_IV(-1); XSRETURN_IV(opt_set(opt, val)); } XS(PORK_get_cur_user) { dXSARGS; (void) cv; (void) items; XSRETURN_PV(cur_window()->owner->username); } XS(PORK_get_opt) { char *val; size_t notused; char buf[2048]; dXSARGS; (void) cv; if (items != 1) XSRETURN_EMPTY; val = SvPV(ST(0), notused); if (val == NULL) XSRETURN_EMPTY; if (opt_get_val(val, buf, sizeof(buf)) == -1) XSRETURN_EMPTY; XSRETURN_PV(buf); } XS(PORK_send_profile) { size_t notused; char *profile; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); profile = SvPV(ST(0), notused); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(acct->proto->set_profile(acct, profile)); } /* XXX - fix */ XS(PORK_get_acct_list) { dlist_t *cur = screen.acct_list; int args = 0; dXSARGS; (void) cv; if (items != 0 || cur == NULL) XSRETURN_EMPTY; SP -= items; do { struct pork_acct *acct = cur->data; if (acct->can_connect) { XPUSHs(sv_2mortal(newSVpv(acct->username, 0))); args++; } cur = cur->next; } while (cur != NULL); XSRETURN(args); } XS(PORK_set_profile) { size_t notused; char *profile; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); profile = SvPV(ST(0), notused); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; free(acct->profile); if (profile != NULL) acct->profile = xstrdup(profile); else acct->profile = NULL; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(pork_set_profile(acct, profile)); } XS(PORK_get_profile) { struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 0) XSRETURN_EMPTY; if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_EMPTY; } else acct = cur_window()->owner; if (acct->profile == NULL) XSRETURN_EMPTY; XSRETURN_PV(acct->profile); } XS(PORK_send_msg) { size_t notused; char *dest; char *msg; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); dest = SvPV(ST(0), notused); msg = SvPV(ST(1), notused); if (dest == NULL || msg == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); return (XSRETURN_IV(pork_msg_send(acct, dest, msg))); } XS(PORK_send_msg_auto) { size_t notused; char *dest; char *msg; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); dest = SvPV(ST(0), notused); msg = SvPV(ST(1), notused); if (dest == NULL || msg == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); return (XSRETURN_IV(pork_msg_autoreply(acct, dest, msg))); } XS(PORK_get_buddy_profile) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(acct->proto->get_profile(acct, target)); } XS(PORK_get_buddy_away) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(acct->proto->get_away_msg(acct, target)); } XS(PORK_privacy_mode) { int privacy_mode; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); privacy_mode = SvIV(ST(0)); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(acct->proto->set_privacy_mode(acct, privacy_mode)); } XS(PORK_report_idle) { int report_idle; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); report_idle = SvIV(ST(0)); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(acct->proto->set_report_idle(acct, report_idle)); } XS(PORK_search) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(acct->proto->who(acct, target)); } XS(PORK_set_away) { size_t notused; char *msg = NULL; struct pork_acct *acct; dXSARGS; (void) cv; if (items > 2) XSRETURN_IV(-1); if (items >= 1 && SvTRUE(ST(0))) msg = SvPV(ST(0), notused); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(pork_set_away(acct, msg)); } XS(PORK_set_idle) { int seconds; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); seconds = SvIV(ST(0)); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(pork_set_idle_time(acct, seconds)); } XS(PORK_warn) { size_t notused; char *target; int anon; struct pork_acct *acct; int ret; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); target = SvPV(ST(0), notused); anon = SvIV(ST(1)); if (target == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); if (anon != 0) ret = pork_send_warn(acct, target); else ret = pork_send_warn_anon(acct, target); XSRETURN_IV(ret); } /* ** Wrappers for non-aim /buddy commands. */ XS(PORK_buddy_add) { size_t notused; char *target; char *group; struct pork_acct *acct; struct bgroup *bgroup; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); target = SvPV(ST(0), notused); group = SvPV(ST(1), notused); if (target == NULL || group == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; bgroup = group_find(acct, group); if (group == NULL) XSRETURN_IV(-1); XSRETURN_IV(buddy_add(acct, target, bgroup, 1) == NULL); } XS(PORK_buddy_add_block) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(buddy_add_block(acct, target, 1)); } XS(PORK_buddy_clear_permit) { struct pork_acct *acct; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; buddy_clear_permit(acct); XSRETURN_IV(0); } XS(PORK_buddy_clear_block) { struct pork_acct *acct; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; buddy_clear_block(acct); XSRETURN_IV(0); } XS(PORK_buddy_add_permit) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(buddy_add_permit(acct, target, 1)); } XS(PORK_buddy_alias) { size_t notused; char *target; char *alias; struct buddy *buddy; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); target = SvPV(ST(0), notused); alias = SvPV(ST(1), notused); if (target == NULL || alias == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; buddy = buddy_find(acct, target); if (buddy == NULL) XSRETURN_IV(-1); buddy_alias(acct, buddy, alias, 0); XSRETURN_IV(0); } XS(PORK_buddy_get_alias) { size_t notused; char *target; struct buddy *buddy; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_EMPTY; target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_EMPTY; if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_EMPTY; } else acct = cur_window()->owner; buddy = buddy_find(acct, target); if (buddy == NULL) XSRETURN_EMPTY; XSRETURN_PV(buddy->name); } XS(PORK_buddy_remove_block) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(buddy_remove_block(acct, target, 1)); } XS(PORK_buddy_get_groups) { dlist_t *cur; int args = 0; struct pork_acct *acct; dXSARGS; (void) cv; if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_EMPTY; } else acct = cur_window()->owner; if (acct->buddy_pref == NULL) XSRETURN_EMPTY; SP -= items; for (cur = acct->buddy_pref->group_list ; cur != NULL ; cur = cur->next) { struct bgroup *group = cur->data; XPUSHs(sv_2mortal(newSVpv(group->name, 0))); args++; } XSRETURN(args); } XS(PORK_buddy_get_block) { dlist_t *cur; int args = 0; struct pork_acct *acct; dXSARGS; (void) cv; if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_EMPTY; } else acct = cur_window()->owner; if (acct->buddy_pref == NULL) XSRETURN_EMPTY; SP -= items; for (cur = acct->buddy_pref->block_list ; cur != NULL ; cur = cur->next) { XPUSHs(sv_2mortal(newSVpv(cur->data, 0))); args++; } XSRETURN(args); } XS(PORK_buddy_get_permit) { dlist_t *cur; int args = 0; struct pork_acct *acct; dXSARGS; (void) cv; if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_EMPTY; } else acct = cur_window()->owner; if (acct->buddy_pref == NULL) XSRETURN_EMPTY; SP -= items; for (cur = acct->buddy_pref->permit_list ; cur != NULL ; cur = cur->next) { XPUSHs(sv_2mortal(newSVpv(cur->data, 0))); args++; } XSRETURN(args); } XS(PORK_buddy_get_group_members) { dlist_t *cur; char *group; struct bgroup *bgroup; size_t notused; int args = 0; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_EMPTY; group = SvPV(ST(0), notused); if (group == NULL) XSRETURN_EMPTY; if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_EMPTY; } else acct = cur_window()->owner; bgroup = group_find(acct, group); if (bgroup == NULL) XSRETURN_EMPTY; SP -= items; for (cur = bgroup->member_list ; cur != NULL ; cur = cur->next) { struct buddy *buddy = cur->data; XPUSHs(sv_2mortal(newSVpv(buddy->nname, 0))); args++; } XSRETURN(args); } XS(PORK_buddy_remove) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(buddy_remove(acct, target, 1)); } XS(PORK_buddy_remove_group) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(group_remove(acct, target, 1)); } XS(PORK_buddy_add_group) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (group_add(acct, target) == NULL) XSRETURN_IV(-1); XSRETURN_IV(0); } XS(PORK_buddy_remove_permit) { size_t notused; char *target; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); target = SvPV(ST(0), notused); if (target == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(buddy_remove_permit(acct, target, 1)); } /* ** Scroll commands */ XS(PORK_scroll_by) { int lines; struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); lines = SvIV(ST(0)); if (items == 2) { u_int32_t refnum = SvIV(ST(1)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_scroll_by(imwindow, lines); XSRETURN_IV(0); } XS(PORK_scroll_down) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_scroll_down(imwindow); XSRETURN_IV(0); } XS(PORK_scroll_end) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_scroll_end(imwindow); XSRETURN_IV(0); } XS(PORK_scroll_page_down) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_scroll_page_down(imwindow); XSRETURN_IV(0); } XS(PORK_scroll_page_up) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_scroll_page_up(imwindow); XSRETURN_IV(0); } XS(PORK_scroll_start) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_scroll_start(imwindow); XSRETURN_IV(0); } XS(PORK_scroll_up) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_scroll_up(imwindow); XSRETURN_IV(0); } /* ** window commands */ XS(PORK_win_find_name) { char *str; size_t notused; struct pork_acct *acct; struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); str = SvPV(ST(0), notused); if (str == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; imwindow = imwindow_find_name(acct, str); if (imwindow == NULL) XSRETURN_IV(-1); XSRETURN_IV(imwindow->refnum); } XS(PORK_win_target) { u_int32_t win_refnum; struct imwindow *imwindow; struct pork_acct *acct; dXSARGS; (void) cv; if (items == 0) XSRETURN_PV(cur_window()->target); win_refnum = SvIV(ST(0)); if (items > 1) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_UNDEF; } else acct = cur_window()->owner; imwindow = imwindow_find_refnum(win_refnum); if (imwindow == NULL) XSRETURN_UNDEF; XSRETURN_PV(imwindow->target); } XS(PORK_win_find_target) { char *str; size_t notused; struct imwindow *imwindow; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); str = SvPV(ST(0), notused); if (str == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; imwindow = imwindow_find(acct, str); if (imwindow == NULL) XSRETURN_IV(-1); XSRETURN_IV(imwindow->refnum); } XS(PORK_win_bind) { u_int32_t acct_refnum; struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); acct_refnum = SvIV(ST(0)); if (items == 2) { u_int32_t refnum = SvIV(ST(1)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); XSRETURN_IV(imwindow_bind_acct(imwindow, acct_refnum)); } XS(PORK_win_clear) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_clear(imwindow); XSRETURN_IV(0); } XS(PORK_win_close) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); XSRETURN_IV(screen_close_window(imwindow)); } XS(PORK_win_erase) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_erase(imwindow); XSRETURN_IV(0); } XS(PORK_win_next) { dXSARGS; (void) cv; if (items != 0) XSRETURN_IV(-1); screen_cycle_fwd(); XSRETURN_IV(0); } XS(PORK_win_prev) { dXSARGS; (void) cv; if (items != 0) XSRETURN_IV(-1); screen_cycle_bak(); XSRETURN_IV(0); } XS(PORK_win_rename) { dXSARGS; struct imwindow *imwindow; char *new_name; size_t notused; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); new_name = SvPV(ST(0), notused); if (new_name == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t refnum = SvIV(ST(1)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_rename(imwindow, new_name); XSRETURN_IV(0); } XS(PORK_win_renumber) { dXSARGS; struct imwindow *imwindow; u_int32_t new_refnum; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); new_refnum = SvIV(ST(0)); if (items == 2) { u_int32_t refnum = SvIV(ST(1)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); XSRETURN_IV(screen_renumber(imwindow, new_refnum)); } XS(PORK_win_get_opt) { struct imwindow *imwindow; char *val; size_t notused; char buf[2048]; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_EMPTY; val = SvPV(ST(0), notused); if (val == NULL) XSRETURN_EMPTY; if (items == 2) { u_int32_t refnum = SvIV(ST(1)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_EMPTY; } else imwindow = cur_window(); if (wopt_get_val(imwindow, val, buf, sizeof(buf)) == -1) XSRETURN_EMPTY; XSRETURN_PV(buf); } XS(PORK_win_set_opt) { char *var; char *val; size_t notused; int opt; struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); var = SvPV(ST(0), notused); val = SvPV(ST(1), notused); if (var == NULL || var == NULL) XSRETURN_IV(-1); opt = wopt_find(var); if (opt == -1) XSRETURN_IV(-1); if (items == 3) { u_int32_t refnum = SvIV(ST(2)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); XSRETURN_IV(wopt_set(imwindow, opt, val)); } XS(PORK_win_swap) { u_int32_t refnum; dXSARGS; (void) cv; if (items != 1) XSRETURN_IV(-1); refnum = SvIV(ST(0)); XSRETURN_IV(screen_goto_window(refnum)); } /* ** Timer commands. */ XS(PORK_timer_add) { char *command; u_int32_t interval; u_int32_t times; size_t notused; dXSARGS; (void) cv; if (items != 3) XSRETURN_UNDEF; interval = SvIV(ST(0)); times = SvIV(ST(1)); command = SvPV(ST(2), notused); if (command == NULL) XSRETURN_UNDEF; XSRETURN_IV(timer_add(&screen.timer_list, command, interval, times)); } XS(PORK_timer_del) { char *command; size_t notused; dXSARGS; (void) cv; if (items != 1) XSRETURN_IV(-1); command = SvPV(ST(0), notused); if (command == NULL) XSRETURN_IV(-1); XSRETURN_IV(timer_del(&screen.timer_list, command)); } XS(PORK_timer_del_refnum) { u_int32_t refnum; dXSARGS; (void) cv; if (items != 1) XSRETURN_IV(-1); refnum = SvIV(ST(0)); XSRETURN_IV(timer_del_refnum(&screen.timer_list, refnum)); } XS(PORK_timer_purge) { dXSARGS; (void) items; (void) cv; timer_destroy(&screen.timer_list); XSRETURN_IV(0); } /* ** /blist commands. */ XS(PORK_blist_collapse) { struct pork_acct *acct; struct blist *blist; size_t notused; char *group; struct bgroup *bgroup; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); group = SvPV(ST(0), notused); if (group == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; bgroup = group_find(acct, group); if (bgroup == NULL) XSRETURN_IV(-1); blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); blist_collapse_group(blist, bgroup); XSRETURN_IV(0); } XS(PORK_blist_cursor) { struct pork_acct *acct; struct blist *blist; struct slist_cell *cell; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_EMPTY; if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_EMPTY; } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_EMPTY; cell = blist_get_cursor(blist); if (cell == NULL) XSRETURN_EMPTY; SP -= items; if (cell->type == TYPE_FLAT_CELL) { struct buddy *buddy = cell->data; XPUSHs(sv_2mortal(newSVpv(buddy->nname, 0))); } else { struct bgroup *group = cell->data; XPUSHs(sv_2mortal(newSVpv(group->name, 0))); } XPUSHs(sv_2mortal(newSViv(cell->type))); XSRETURN(2); } XS(PORK_blist_down) { struct pork_acct *acct; struct blist *blist; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); XSRETURN_IV(blist_cursor_down(blist)); } XS(PORK_blist_end) { struct pork_acct *acct; struct blist *blist; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); XSRETURN_IV(blist_cursor_end(blist)); } XS(PORK_blist_hide) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_blist_hide(imwindow); XSRETURN_IV(0); } XS(PORK_blist_page_down) { struct pork_acct *acct; struct blist *blist; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); XSRETURN_IV(blist_cursor_pgdown(blist)); } XS(PORK_blist_page_up) { struct pork_acct *acct; struct blist *blist; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); XSRETURN_IV(blist_cursor_pgup(blist)); } XS(PORK_blist_refresh) { struct pork_acct *acct; struct blist *blist; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); XSRETURN_IV(blist_refresh(blist)); } XS(PORK_blist_show) { struct imwindow *imwindow; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t refnum = SvIV(ST(0)); imwindow = imwindow_find_refnum(refnum); if (imwindow == NULL) XSRETURN_IV(-1); } else imwindow = cur_window(); imwindow_blist_show(imwindow); XSRETURN_IV(0); } XS(PORK_blist_start) { struct pork_acct *acct; struct blist *blist; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); XSRETURN_IV(blist_cursor_start(blist)); } XS(PORK_blist_up) { struct pork_acct *acct; struct blist *blist; dXSARGS; (void) cv; if (items != 0 && items != 1) XSRETURN_IV(-1); if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); XSRETURN_IV(blist_cursor_up(blist)); } XS(PORK_blist_width) { struct pork_acct *acct; struct blist *blist; int new_width; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); new_width = SvIV(ST(0)); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; blist = acct->blist; if (blist == NULL) XSRETURN_IV(-1); XSRETURN_IV(screen_blist_width(blist, new_width)); } /* ** Event commands. */ XS(PORK_event_add) { struct pork_acct *acct; char *type; char *handler; size_t notused; dXSARGS; u_int32_t refnum; (void) cv; if (items != 2 && items != 3) XSRETURN_UNDEF; type = SvPV(ST(0), notused); handler = SvPV(ST(1), notused); if (type == NULL || handler == NULL) XSRETURN_UNDEF; if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_UNDEF; } else acct = cur_window()->owner; if (event_add(acct->events, type, handler, &refnum) != 0) XSRETURN_UNDEF; XSRETURN_IV(refnum); } XS(PORK_event_del) { struct pork_acct *acct; size_t notused; char *type; char *handler; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); type = SvPV(ST(0), notused); handler = SvPV(ST(1), notused); if (type == NULL || handler == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(event_del_type(acct->events, type, handler)); } XS(PORK_event_del_type) { struct pork_acct *acct; size_t notused; char *type; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); type = SvPV(ST(0), notused); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(event_del_type(acct->events, type, NULL)); } XS(PORK_event_del_refnum) { struct pork_acct *acct; u_int32_t refnum; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); refnum = SvIV(ST(0)); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(event_del_refnum(acct->events, refnum)); } XS(PORK_event_purge) { struct pork_acct *acct; dXSARGS; (void) cv; if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; event_purge(acct->events); XSRETURN_IV(0); } /* ** /chat commands. */ XS(PORK_chat_ban) { char *chat_name; char *ban_user; size_t notused; struct pork_acct *acct; struct chatroom *chat; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); chat_name = SvPV(ST(0), notused); ban_user = SvPV(ST(1), notused); if (chat_name == NULL || ban_user == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; chat = chat_find(acct, chat_name); if (chat == NULL) XSRETURN_IV(-1); XSRETURN_IV(chat_ban(acct, chat, ban_user)); } XS(PORK_chat_kick) { char *chat_name; char *user; char *reason = NULL; size_t notused; struct pork_acct *acct; struct chatroom *chat; dXSARGS; (void) cv; if (items < 2) XSRETURN_IV(-1); chat_name = SvPV(ST(0), notused); user = SvPV(ST(1), notused); if (items > 2) reason = SvPV(ST(2), notused); if (chat_name == NULL || user == NULL) XSRETURN_IV(-1); if (reason == NULL) reason = ""; if (items == 4) { u_int32_t acct_refnum = SvIV(ST(3)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; chat = chat_find(acct, chat_name); if (chat == NULL) XSRETURN_IV(-1); XSRETURN_IV(chat_kick(acct, chat, user, reason)); } XS(PORK_chat_topic) { char *chat_name; char *topic; size_t notused; struct pork_acct *acct; struct chatroom *chat; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); chat_name = SvPV(ST(0), notused); topic = SvPV(ST(1), notused); if (chat_name == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; chat = chat_find(acct, chat_name); if (chat == NULL) XSRETURN_IV(-1); if (topic == NULL || *topic == '\0') { if (chat->topic != NULL) XSRETURN_PV(chat->topic); else XSRETURN_UNDEF; } XSRETURN_IV(chat_set_topic(acct, chat, topic)); } XS(PORK_chat_get_list) { dXSARGS; dlist_t *cur; struct pork_acct *acct; u_int32_t i = 0; (void) cv; if (items == 1) { u_int32_t acct_refnum = SvIV(ST(0)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; SP -= items; for (cur = acct->chat_list ; cur != NULL ; cur = cur->next) { struct chatroom *chat = cur->data; XPUSHs(sv_2mortal(newSVpv(chat->title, 0))); i++; } XSRETURN(i); } XS(PORK_chat_get_window) { char *chat_name; size_t notused; struct pork_acct *acct; struct imwindow *win; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); chat_name = SvPV(ST(0), notused); if (chat_name == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; win = imwindow_find_chat_target(acct, chat_name); if (win == NULL) XSRETURN_IV(-1); XSRETURN_IV(win->refnum); } XS(PORK_chat_get_users) { char *chat_name; size_t notused; dlist_t *node; struct pork_acct *acct; struct chatroom *chat; u_int32_t flags = 0; u_int32_t args = 0; u_int32_t invert = 0; dXSARGS; (void) cv; if (items < 3) XSRETURN_EMPTY; chat_name = SvPV(ST(0), notused); if (chat_name == NULL) XSRETURN_EMPTY; flags = SvIV(ST(1)); invert = SvIV(ST(2)); if (items == 4) { u_int32_t acct_refnum = SvIV(ST(3)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_EMPTY; } else acct = cur_window()->owner; chat = chat_find(acct, chat_name); if (chat == NULL) XSRETURN_EMPTY; SP -= items; for (node = chat->user_list ; node != NULL ; node = node->next) { struct chat_user *user = node->data; if (!flags || (!!(user->status & flags)) ^ invert) { XPUSHs(sv_2mortal(newSVpv(user->nname, 0))); args++; } } XSRETURN(args); } XS(PORK_chat_ignore) { char *name; char *dest; size_t notused; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); name = SvPV(ST(0), notused); dest = SvPV(ST(1), notused); if (name == NULL || dest == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(chat_ignore(acct, name, dest)); } XS(PORK_chat_invite) { char *name; char *dest; char *msg; size_t notused; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 3 && items != 4) XSRETURN_IV(-1); name = SvPV(ST(0), notused); dest = SvPV(ST(1), notused); msg = SvPV(ST(2), notused); if (name == NULL || dest == NULL) XSRETURN_IV(-1); if (items == 4) { u_int32_t acct_refnum = SvIV(ST(3)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; if (!acct->connected) XSRETURN_IV(-1); XSRETURN_IV(chat_invite(acct, name, dest, msg)); } XS(PORK_chat_join) { char *chat_name; size_t notused; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); chat_name = SvPV(ST(0), notused); if (chat_name == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(chat_join(acct, chat_name)); } XS(PORK_chat_leave) { char *chat_name; size_t notused; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 1 && items != 2) XSRETURN_IV(-1); chat_name = SvPV(ST(0), notused); if (chat_name == NULL) XSRETURN_IV(-1); if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(chat_leave(acct, chat_name, 0)); } XS(PORK_chat_send) { struct pork_acct *acct; char *msg; char *chat_name; size_t notused; struct chatroom *chat; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); chat_name = SvPV(ST(0), notused); msg = SvPV(ST(1), notused); if (chat_name == NULL || msg == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; chat = chat_find(acct, chat_name); if (chat == NULL) XSRETURN_IV(-1); XSRETURN_IV(chat_send_msg(acct, chat, chat_name, msg)); } XS(PORK_chat_unignore) { char *name; char *dest; size_t notused; struct pork_acct *acct; dXSARGS; (void) cv; if (items != 2 && items != 3) XSRETURN_IV(-1); name = SvPV(ST(0), notused); dest = SvPV(ST(1), notused); if (name == NULL || dest == NULL) XSRETURN_IV(-1); if (items == 3) { u_int32_t acct_refnum = SvIV(ST(2)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_IV(-1); } else acct = cur_window()->owner; XSRETURN_IV(chat_unignore(acct, name, dest)); } XS(PORK_chat_target) { char *name = NULL; size_t notused; struct pork_acct *acct; struct chatroom *chat; dXSARGS; (void) cv; if (items > 0) { name = SvPV(ST(0), notused); if (name == NULL) XSRETURN_UNDEF; } else { if (cur_window()->type != WIN_TYPE_CHAT) XSRETURN_UNDEF; chat = cur_window()->data; XSRETURN_PV(chat->title); } if (items == 2) { u_int32_t acct_refnum = SvIV(ST(1)); acct = pork_acct_get_data(acct_refnum); if (acct == NULL) XSRETURN_UNDEF; } else acct = cur_window()->owner; chat = chat_find(acct, name); if (chat == NULL) XSRETURN_UNDEF; XSRETURN_PV(chat->title); } pork-0.99.8.1/src/pork_perl_xs.h0000644000175000017500000000545310234301511016343 0ustar ryanryan00000000000000/* ** pork_perl_xs.h - Perl scripting support ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_PERL_XS_H #define __PORK_PERL_XS_H XS(PORK_alias); XS(PORK_alias_get); XS(PORK_bind); XS(PORK_bind_get); XS(PORK_blist_bind); XS(PORK_blist_bind_get); XS(PORK_blist_unbind); XS(PORK_connect); XS(PORK_disconnect); XS(PORK_echo); XS(PORK_err_msg); XS(PORK_get_cur_user); XS(PORK_get_opt); XS(PORK_load); XS(PORK_load_perl); XS(PORK_prompt_user); XS(PORK_quit); XS(PORK_quote); XS(PORK_refresh); XS(PORK_run_cmd); XS(PORK_cur_user); XS(PORK_save); XS(PORK_set_opt); XS(PORK_status_msg); XS(PORK_unalias); XS(PORK_unbind); XS(PORK_win_find_target); XS(PORK_win_find_name); XS(PORK_win_bind); XS(PORK_win_clear); XS(PORK_win_close); XS(PORK_win_erase); XS(PORK_win_next); XS(PORK_win_prev); XS(PORK_win_rename); XS(PORK_win_renumber); XS(PORK_win_get_opt); XS(PORK_win_set_opt); XS(PORK_win_swap); XS(PORK_win_target); XS(PORK_get_acct_list); XS(PORK_set_profile); XS(PORK_send_profile); XS(PORK_get_profile); XS(PORK_send_msg); XS(PORK_send_msg_auto); XS(PORK_get_buddy_profile); XS(PORK_get_buddy_away); XS(PORK_privacy_mode); XS(PORK_report_idle); XS(PORK_search); XS(PORK_set_away); XS(PORK_set_idle); XS(PORK_warn); XS(PORK_buddy_add); XS(PORK_buddy_add_block); XS(PORK_buddy_add_group); XS(PORK_buddy_add_permit); XS(PORK_buddy_alias); XS(PORK_buddy_clear_block); XS(PORK_buddy_clear_permit); XS(PORK_buddy_get_alias); XS(PORK_buddy_get_block); XS(PORK_buddy_get_groups); XS(PORK_buddy_get_group_members); XS(PORK_buddy_get_permit); XS(PORK_buddy_remove); XS(PORK_buddy_remove_block); XS(PORK_buddy_remove_group); XS(PORK_buddy_remove_permit); XS(PORK_scroll_by); XS(PORK_scroll_down); XS(PORK_scroll_end); XS(PORK_scroll_page_down); XS(PORK_scroll_page_up); XS(PORK_scroll_start); XS(PORK_scroll_up); XS(PORK_timer_add); XS(PORK_timer_del); XS(PORK_timer_del_refnum); XS(PORK_timer_purge); XS(PORK_blist_collapse); XS(PORK_blist_cursor); XS(PORK_blist_down); XS(PORK_blist_end); XS(PORK_blist_hide); XS(PORK_blist_page_down); XS(PORK_blist_page_up); XS(PORK_blist_refresh); XS(PORK_blist_select); XS(PORK_blist_show); XS(PORK_blist_start); XS(PORK_blist_up); XS(PORK_blist_width); XS(PORK_event_add); XS(PORK_event_del); XS(PORK_event_del_refnum); XS(PORK_event_del_type); XS(PORK_event_purge); XS(PORK_chat_ban); XS(PORK_chat_get_list); XS(PORK_chat_get_users); XS(PORK_chat_get_window); XS(PORK_chat_ignore); XS(PORK_chat_invite); XS(PORK_chat_join); XS(PORK_chat_kick); XS(PORK_chat_leave); XS(PORK_chat_send); XS(PORK_chat_target); XS(PORK_chat_topic); XS(PORK_chat_unignore); XS(PORK_input_send); XS(PORK_input_get_data); #endif pork-0.99.8.1/src/pork_input.c0000644000175000017500000002631410234217325016031 0ustar ryanryan00000000000000/* ** pork_input.c - line editing and history ** Copyright (C) 2002-2005 Ryan McCabe ** ** I've tried to keep the input handler code independent of everything else ** so that it might be useful outside this particular program. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static inline void input_free(void *param __notused, void *data); /* ** Deletes the character at the cursor position. */ inline void input_delete(struct input *input) { u_int32_t cur = input->cur - input->prompt_len; if (input->input_buf[cur] == '\0') return; input->cur++; memmove(&input->input_buf[cur], &input->input_buf[cur + 1], input->len - cur); input->cur--; input->begin_completion = input->cur; input->len--; input->dirty = 1; } /* ** Deletes the character before the cursor. */ inline void input_bkspace(struct input *input) { u_int32_t cur = input->cur - input->prompt_len; if (cur == 0) return; cur--; memmove(&input->input_buf[cur], &input->input_buf[cur + 1], input->len - cur); input->cur = cur + input->prompt_len; input->begin_completion = input->cur; input->len--; input->dirty = 1; } /* ** Add the character "c" at the cursor position. */ inline void input_insert(struct input *input, int c) { u_int32_t cur = input->cur - input->prompt_len; if (input->len >= sizeof(input->input_buf) - 1) { beep(); return; } memmove(&input->input_buf[cur + 1], &input->input_buf[cur], input->len - cur + 1); input->input_buf[cur] = c; input->cur++; input->begin_completion = input->cur; input->len++; input->dirty = 1; } /* ** Insert the string "str" at the cursor position. */ inline void input_insert_str(struct input *input, char *str) { u_int32_t cur = input->cur - input->prompt_len; size_t len = strlen(str); if (input->len + len >= sizeof(input->input_buf)) return; memmove(&input->input_buf[cur + len], &input->input_buf[cur], input->len - cur + 1); memcpy(&input->input_buf[cur], str, len); input->cur += len; input->begin_completion = input->cur; input->len += len; input->dirty = 1; } /* ** Clear the input line. */ inline void input_clear_line(struct input *input) { input->input_buf[0] = '\0'; input->cur = input->prompt_len; input->begin_completion = input->cur; input->len = 0; input->dirty = 1; } /* ** Clear from the cursor position the start of the line. */ inline void input_clear_to_start(struct input *input) { u_int32_t cur = input->cur - input->prompt_len; u_int32_t new_len = input->len - cur; memmove(&input->input_buf[0], &input->input_buf[cur], new_len + 1); input->len = new_len; input->cur = input->prompt_len; input->begin_completion = input->cur; input->dirty = 1; } /* ** Clear from the cursor position to the end of the line. */ inline void input_clear_to_end(struct input *input) { u_int32_t cur = input->cur - input->prompt_len; input->len = cur; input->input_buf[cur] = '\0'; input->begin_completion = input->cur; input->dirty = 1; } /* ** Move to the start of the line. */ inline void input_home(struct input *input) { input->cur = input->prompt_len; input->begin_completion = input->cur; input->dirty = 1; } /* ** Move to the end of the line. */ inline void input_end(struct input *input) { input->cur = input->len + input->prompt_len; input->begin_completion = input->cur; input->dirty = 1; } /* ** Move the cursor left. */ inline void input_move_left(struct input *input) { if (input->cur > input->prompt_len) { input->cur--; input->dirty = 1; } input->begin_completion = input->cur; } /* ** Move the cursor right. */ inline void input_move_right(struct input *input) { if (input->cur < input->len + input->prompt_len) { input->cur++; input->dirty = 1; } input->begin_completion = input->cur; } /* ** Move the cursor to the start of the previous ** word. */ void input_prev_word(struct input *input) { u_int32_t cur = input->cur - input->prompt_len; if (cur == 0) return; while (cur > 0 && input->input_buf[--cur] == ' ') ; if (input->input_buf[cur] == ' ') goto start_of_line; while (input->input_buf[cur] != ' ') { if (cur == 0) goto start_of_line; cur--; } input->cur = cur + 1 + input->prompt_len; input->begin_completion = input->cur; input->dirty = 1; return; start_of_line: input->cur = input->prompt_len; input->begin_completion = input->cur; input->dirty = 1; } /* ** Clear from the cursor position to the start of the ** previous word. */ void input_clear_prev_word(struct input *input) { u_int32_t cur; u_int32_t del_end = input->cur - input->prompt_len; u_int32_t old_end = input->len; if (input->cur == input->prompt_len) return; input_prev_word(input); cur = input->cur - input->prompt_len; memmove(&input->input_buf[cur], &input->input_buf[del_end], old_end - del_end + 1); input->len -= del_end - cur; input->begin_completion = input->cur; input->dirty = 1; } /* ** Move the cursor to the start of the next word. */ void input_next_word(struct input *input) { u_int32_t cur = input->cur - input->prompt_len; if (cur == input->len) return; while (cur < input->len && input->input_buf[cur] == ' ') cur++; while (cur < input->len && input->input_buf[cur] != ' ') cur++; input->cur = cur + input->prompt_len; if (input->input_buf[cur] == ' ') input->cur++; input->begin_completion = input->cur; input->dirty = 1; } /* ** Clear the next word after the cursor. */ void input_clear_next_word(struct input *input) { u_int32_t cur; u_int32_t del_start = input->cur - input->prompt_len; u_int32_t old_end = input->len; if (input->cur == input->len + input->prompt_len) return; input_next_word(input); cur = input->cur - input->prompt_len; memmove(&input->input_buf[del_start], &input->input_buf[cur], old_end - cur + 1); input->len -= cur - del_start; input->cur = del_start + input->prompt_len; input->begin_completion = input->cur; input->dirty = 1; } /* ** Trim the command history list so that it doesn't ** exceed the maximum length that's been set for it. */ void input_history_prune(struct input *input) { dlist_t *cur = input->history_end; while (input->history_len > input->max_history_len && cur != NULL) { dlist_t *prev = cur->prev; free(cur->data); dlist_remove(input->history, cur); input->history_len--; cur = prev; } input->history_end = cur; } /* ** Add a line to the history list. */ void input_history_add(struct input *input) { input->history = dlist_add_head(input->history, xstrdup(input->input_buf)); input->history_cur = NULL; input->history_len++; if (input->history_end == NULL) input->history_end = input->history; if (input->history_len > input->max_history_len) input_history_prune(input); } /* ** Extract a line from the history list, and ** copy it to the input line. */ void input_history_prev(struct input *input) { if (input->history == NULL) return; if (input->history_cur == NULL) { dlist_t *cur = input->history; if (input->len != 0) input_history_add(input); input->history_cur = cur; } else if (input->history_cur->next != NULL) input->history_cur = input->history_cur->next; else return; xstrncpy(input->input_buf, (char *) input->history_cur->data, sizeof(input->input_buf)); input->cur = strlen(input->input_buf) + input->prompt_len; input->len = input->cur - input->prompt_len; input->begin_completion = input->cur; input->dirty = 1; } /* ** Select the next (a more recent) line from the ** history buffer, and write it to the input line. */ void input_history_next(struct input *input) { if (input->history_cur == NULL) return; input->dirty = 1; /* ** If the user hits down when they're already at the end ** of the history list, clear the line. */ if (input->history_cur->prev == NULL) { input->history_cur = NULL; input->input_buf[0] = '\0'; input->cur = input->prompt_len; input->begin_completion = input->cur; input->len = 0; return; } input->history_cur = input->history_cur->prev; xstrncpy(input->input_buf, (char *) input->history_cur->data, sizeof(input->input_buf)); input->cur = strlen(input->input_buf) + input->prompt_len; input->len = input->cur - input->prompt_len; input->begin_completion = input->cur; } /* ** Clear the input history list. */ inline void input_history_clear(struct input *input) { dlist_destroy(input->history, NULL, input_free); input->history = NULL; input->history_end = NULL; input->history_cur = NULL; input->history_len = 0; input->input_buf[0] = '\0'; input->cur = input->prompt_len; input->begin_completion = input->cur; input->len = 0; input->dirty = 1; } /* ** Initialize the input handler. */ void input_init(struct input *input, u_int32_t width) { char *prompt; memset(input, 0, sizeof(*input)); input->width = width; input->max_history_len = MAX_HISTORY_LEN; input->dirty = 1; prompt = opt_get_str(OPT_PROMPT); if (prompt != NULL) input_set_prompt(input, prompt); } static inline void input_free(void *param __notused, void *data) { free(data); } inline void input_destroy(struct input *input) { free(input->prompt); dlist_destroy(input->history, NULL, input_free); } inline void input_resize(struct input *input, u_int32_t width) { input->width = width; input->dirty = 1; } char *input_partial(struct input *input) { u_int32_t offset; if (input->prompt_len >= input->width) return (NULL); if (input->cur >= input->width) offset = (input->cur / input->width) * input->width - input->prompt_len; else offset = 0; return (&input->input_buf[offset]); } /* ** Returns the x position of the cursor. */ inline u_int32_t input_get_cursor_pos(struct input *input) { return (input->cur % input->width); } /* ** Set the input prompt to the string specified by "prompt" */ int input_set_prompt(struct input *input, char *prompt) { u_int32_t cur; if (prompt != NULL && strlen(prompt) >= input->width) return (-1); cur = input->cur - input->prompt_len; free(input->prompt); if (prompt == NULL) { input->prompt = NULL; input->prompt_len = 0; } else { size_t tmp_len = strlen(prompt) + 1; input->prompt = xmalloc(sizeof(chtype) * tmp_len); plaintext_to_cstr(input->prompt, tmp_len, prompt, NULL); input->prompt_len = cstrlen(input->prompt); } input->cur = cur + input->prompt_len; input->begin_completion = input->cur; input->dirty = 1; return (0); } /* ** Fetches the contents of the input buffer as a C string. */ inline char *input_get_buf_str(struct input *input) { return (input->input_buf); } /* ** Sets the input buffer to the specified string. */ int input_set_buf(struct input *input, char *str) { size_t len = strlen(str); if (str == NULL || len >= sizeof(input->input_buf) - 1) return (-1); if (xstrncpy(input->input_buf, str, sizeof(input->input_buf)) == -1) { input->input_buf[0] = '\0'; input->len = 0; input->cur = 0; return (-1); } input->len = len; input->cur = len; input->begin_completion = input->cur; return (0); } pork-0.99.8.1/src/pork_input.h0000644000175000017500000000420410234217325016030 0ustar ryanryan00000000000000/* ** pork_input.h - line editing and history ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_INPUT_H #define __PORK_INPUT_H #define INPUT_BUFFER_LEN 4096 #define MAX_HISTORY_LEN 150 #define META_MASK (0xf << 28) #define META_NUM(x) (((x) & META_MASK) >> 28) #define META_KEY(x, n) ((x) | ((n) << 28)) #define CTRL_KEY(x) ((x) & 0x1f) struct input { u_int32_t width; u_int16_t cur; u_int16_t len; u_int16_t begin_completion; u_int16_t max_history_len; u_int16_t history_len; u_int16_t prompt_len; u_int16_t dirty:1; chtype *prompt; dlist_t *history; dlist_t *history_cur; dlist_t *history_end; char input_buf[INPUT_BUFFER_LEN]; }; char *input_partial(struct input *input); void input_resize(struct input *input, u_int32_t width); void input_destroy(struct input *input); void input_init(struct input *input, u_int32_t width); void input_delete(struct input *input); void input_bkspace(struct input *input); void input_insert(struct input *input, int c); void input_insert_str(struct input *input, char *str); void input_clear_line(struct input *input); void input_clear_to_end(struct input *input); void input_clear_to_start(struct input *input); void input_home(struct input *input); void input_end(struct input *input); void input_prev_word(struct input *input); void input_next_word(struct input *input); void input_clear_prev_word(struct input *input); void input_clear_next_word(struct input *input); void input_move_left(struct input *input); void input_move_right(struct input *input); void input_history_prune(struct input *input); void input_history_add(struct input *input); void input_history_next(struct input *input); void input_history_prev(struct input *input); void input_history_clear(struct input *input); int input_set_buf(struct input *input, char *str); int input_set_prompt(struct input *input, char *prompt); char *input_get_buf_str(struct input *input); u_int32_t input_get_cursor_pos(struct input *input); #endif pork-0.99.8.1/src/pork_buddy.c0000644000175000017500000003710710234217325016003 0ustar ryanryan00000000000000/* ** pork_buddy.c - Buddy list / permit / deny management. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static int buddy_hash_compare(void *l, void *r) { char *str = l; struct buddy *buddy = r; return (strcasecmp(str, buddy->nname)); } static void buddy_hash_cleanup(void *param __notused, void *data) { struct buddy *buddy = data; free(buddy->nname); free(buddy->name); free(buddy->userhost); free(buddy); } static void group_cleanup(void *param __notused, void *data) { struct bgroup *group = data; /* ** The memory allocated for the buddies in the member_list of ** each group is freed when the buddy hash is destroyed, so ** we don't have to do it here. */ dlist_destroy(group->member_list, NULL, NULL); free(group->name); free(group); } static void generic_cleanup(void *param __notused, void *data) { free(data); } static int buddy_rights_compare(void *l, void *r) { char *str1 = l; char *str2 = r; return (strcasecmp(str1, str2)); } static int group_compare(void *l, void *r) { char *name = l; struct bgroup *gr = r; return (strcasecmp(name, gr->name)); } static int buddy_hash_remove(struct pork_acct *acct, const char *screen_name) { struct buddy_pref *pref = acct->buddy_pref; char buddy[NUSER_LEN]; u_int32_t hash; acct->proto->normalize(buddy, screen_name, sizeof(buddy)); hash = string_hash(buddy, pref->buddy_hash.order); return (hash_remove(&pref->buddy_hash, buddy, hash)); } int buddy_remove(struct pork_acct *acct, const char *screen_name, int send) { struct buddy *buddy; dlist_t *list_node; char nname[NUSER_LEN]; if (acct->proto->buddy_remove == NULL) return (-1); acct->proto->normalize(nname, screen_name, sizeof(nname)); buddy = buddy_find(acct, nname); if (buddy == NULL) return (-1); list_node = dlist_find(buddy->group->member_list, buddy->nname, buddy_hash_compare); if (list_node == NULL) { debug("buddy list node is NULL"); return (-1); } if (buddy->status != STATUS_OFFLINE) buddy_offline(acct, buddy); if (send) acct->proto->buddy_remove(acct, buddy); buddy->group->member_list = dlist_remove(buddy->group->member_list, list_node); buddy->group->num_members--; acct->buddy_pref->num_buddies--; return (buddy_hash_remove(acct, buddy->name)); } /* ** Add the buddy whose screen name is "screen_name" to the specified ** group. */ struct buddy *buddy_add(struct pork_acct *acct, const char *screen_name, struct bgroup *group, int send) { struct buddy *buddy; char nname[NUSER_LEN]; struct buddy_pref *pref = acct->buddy_pref; if (acct->proto->buddy_add == NULL) return (NULL); acct->proto->normalize(nname, screen_name, sizeof(nname)); if (buddy_find(acct, nname) != NULL) return (NULL); buddy = xcalloc(1, sizeof(*buddy)); buddy->name = xstrdup(screen_name); buddy->nname = xstrdup(nname); buddy->group = group; buddy->refnum = group->high_refnum++; pref->num_buddies++; group->num_members++; group->member_list = dlist_add_tail(group->member_list, buddy); hash_add(&pref->buddy_hash, buddy, string_hash(buddy->nname, pref->buddy_hash.order)); if (send) acct->proto->buddy_add(acct, buddy); return (buddy); } struct bgroup *group_find(struct pork_acct *acct, char *group_name) { dlist_t *node; struct buddy_pref *pref = acct->buddy_pref; node = dlist_find(pref->group_list, group_name, group_compare); if (node == NULL) return (NULL); return (node->data); } struct bgroup *group_add(struct pork_acct *acct, char *group_name) { struct bgroup *group; struct buddy_pref *pref = acct->buddy_pref; group = group_find(acct, group_name); if (group != NULL) return (group); group = xcalloc(1, sizeof(*group)); group->name = xstrdup(group_name); group->refnum = pref->next_group_refnum++; pref->group_list = dlist_add_tail(pref->group_list, group); blist_add_group(acct->blist, group); return (group); } int group_remove(struct pork_acct *acct, char *group_name, int send) { struct bgroup *group; dlist_t *memb_list; dlist_t *node; struct buddy_pref *pref = acct->buddy_pref; node = dlist_find(pref->group_list, group_name, group_compare); if (node == NULL) return (-1); group = node->data; memb_list = group->member_list; while (memb_list != NULL) { dlist_t *next = memb_list->next; struct buddy *buddy = memb_list->data; buddy_remove(acct, buddy->name, send); memb_list = next; } pref->group_list = dlist_remove(pref->group_list, node); blist_del_group(acct->blist, group); return (0); } struct buddy *buddy_find(struct pork_acct *acct, const char *screen_name) { dlist_t *node; char buddy[NUSER_LEN]; u_int32_t hash; struct buddy_pref *pref = acct->buddy_pref; if (pref == NULL) return (NULL); acct->proto->normalize(buddy, screen_name, sizeof(buddy)); hash = string_hash(buddy, pref->buddy_hash.order); node = hash_find(&pref->buddy_hash, buddy, hash); if (node != NULL) return (node->data); return (NULL); } int buddy_alias(struct pork_acct *acct, struct buddy *buddy, char *alias, int send) { if (!strcmp(buddy->name, alias)) return (0); if (acct->proto->buddy_alias == NULL) return (-1); free(buddy->name); buddy->name = xstrdup(alias); blist_update_label(acct->blist, buddy->blist_line); if (send) return (acct->proto->buddy_alias(acct, buddy)); return (0); } char *buddy_name(struct pork_acct *acct, char *name) { struct buddy *buddy; buddy = buddy_find(acct, name); if (buddy != NULL) return (buddy->name); return (name); } int buddy_clear_block(struct pork_acct *acct) { struct buddy_pref *pref = acct->buddy_pref; dlist_t *cur = pref->block_list; if (acct->proto->buddy_unblock == NULL) return (-1); while (cur != NULL) { dlist_t *next = cur->next; acct->proto->buddy_unblock(acct, cur->data); free(cur->data); free(cur); cur = next; } pref->block_list = NULL; return (0); } int buddy_clear_permit(struct pork_acct *acct) { struct buddy_pref *pref = acct->buddy_pref; dlist_t *cur = pref->permit_list; if (acct->proto->buddy_remove_permit == NULL) return (-1); while (cur != NULL) { dlist_t *next = cur->next; acct->proto->buddy_remove_permit(acct, cur->data); free(cur->data); free(cur); cur = next; } pref->permit_list = NULL; return (0); } int buddy_init(struct pork_acct *acct) { struct buddy_pref *pref; if (acct->buddy_pref != NULL) return (-1); pref = xcalloc(1, sizeof(*pref)); acct->buddy_pref = pref; hash_init(&pref->buddy_hash, 5, buddy_hash_compare, buddy_hash_cleanup); return (0); } void buddy_destroy(struct pork_acct *acct) { struct buddy_pref *pref = acct->buddy_pref; if (pref != NULL) { hash_destroy(&pref->buddy_hash); dlist_destroy(pref->group_list, NULL, group_cleanup); dlist_destroy(pref->permit_list, NULL, generic_cleanup); dlist_destroy(pref->block_list, NULL, generic_cleanup); pref->group_list = NULL; pref->permit_list = NULL; pref->block_list = NULL; acct->buddy_pref = NULL; free(pref); } } int buddy_update( struct pork_acct *acct, struct buddy *buddy, void *data) { int ret; if (acct->proto->buddy_update == NULL) return (-1); ret = acct->proto->buddy_update(acct, buddy, data); blist_update_label(acct->blist, buddy->blist_line); return (ret); } void buddy_online( struct pork_acct *acct, struct buddy *buddy, void *data) { buddy->last_seen = time(NULL); buddy->group->num_online++; buddy_update(acct, buddy, data); blist_add(acct->blist, buddy); } void buddy_offline(struct pork_acct *acct, struct buddy *buddy) { buddy->last_seen = time(NULL); buddy->status = STATUS_OFFLINE; buddy->signon_time = 0; buddy->idle_time = 0; buddy->warn_level = 0; buddy->group->num_online--; blist_del(acct->blist, buddy); } void buddy_offline_all(struct pork_acct *acct) { struct buddy_pref *pref = acct->buddy_pref; dlist_t *gcur; gcur = pref->group_list; while (gcur != NULL) { struct bgroup *gr = gcur->data; dlist_t *bcur = gr->member_list; while (bcur != NULL) { struct buddy *buddy = bcur->data; if (buddy->status != STATUS_OFFLINE) buddy_offline(acct, bcur->data); bcur = bcur->next; } gcur = gcur->next; } } int buddy_add_block(struct pork_acct *acct, char *screen_name, int send) { dlist_t *node; char nname[NUSER_LEN]; struct buddy_pref *pref = acct->buddy_pref; if (acct->proto->buddy_block == NULL) return (-1); acct->proto->normalize(nname, screen_name, sizeof(nname)); node = dlist_find(pref->block_list, nname, buddy_rights_compare); if (node != NULL) return (-1); pref->block_list = dlist_add_tail(pref->block_list, xstrdup(nname)); if (send) return (acct->proto->buddy_block(acct, nname)); return (0); } int buddy_remove_block(struct pork_acct *acct, char *screen_name, int send) { dlist_t *node; char nname[NUSER_LEN]; struct buddy_pref *pref = acct->buddy_pref; int ret = 0; if (acct->proto->buddy_unblock == NULL) return (-1); acct->proto->normalize(nname, screen_name, sizeof(nname)); node = dlist_find(pref->block_list, nname, buddy_rights_compare); if (node == NULL) return (-1); if (send) ret = acct->proto->buddy_unblock(acct, nname); free(node->data); pref->block_list = dlist_remove(pref->block_list, node); return (ret); } int buddy_add_permit(struct pork_acct *acct, char *screen_name, int send) { dlist_t *node; char nname[NUSER_LEN]; struct buddy_pref *pref = acct->buddy_pref; int ret = 0; if (acct->proto->buddy_permit == NULL) return (-1); acct->proto->normalize(nname, screen_name, sizeof(nname)); node = dlist_find(pref->permit_list, nname, buddy_rights_compare); if (node != NULL) return (-1); if (send) ret = acct->proto->buddy_permit(acct, nname); pref->permit_list = dlist_add_tail(pref->permit_list, xstrdup(nname)); return (ret); } int buddy_remove_permit(struct pork_acct *acct, char *screen_name, int send) { dlist_t *node; char nname[NUSER_LEN]; struct buddy_pref *pref = acct->buddy_pref; int ret = 0; if (acct->proto->buddy_remove_permit == NULL) return (-1); acct->proto->normalize(nname, screen_name, sizeof(nname)); node = dlist_find(pref->permit_list, nname, buddy_rights_compare); if (node == NULL) return (-1); if (send) ret = acct->proto->buddy_remove_permit(acct, nname); free(node->data); pref->permit_list = dlist_remove(pref->permit_list, node); return (ret); } void buddy_update_idle(struct pork_acct *acct) { struct buddy_pref *pref = acct->buddy_pref; dlist_t *gcur; gcur = pref->group_list; while (gcur != NULL) { struct bgroup *gr = gcur->data; dlist_t *bcur = gr->member_list; while (bcur != NULL) { struct buddy *buddy = bcur->data; if (buddy->idle_time > 0) { buddy->idle_time++; blist_update_label(acct->blist, buddy->blist_line); } bcur = bcur->next; } gcur = gcur->next; } } int buddy_went_offline(struct pork_acct *acct, char *user) { struct buddy *buddy; char *name = user; int notify = 0; buddy = buddy_find(acct, user); if (buddy != NULL) { /* ** This happens with AIM sometimes. I don't know why. */ if (buddy->status == STATUS_OFFLINE) return (0); if (buddy->notify) notify = 1; name = buddy->name; buddy_offline(acct, buddy); } if (event_generate(acct->events, EVENT_BUDDY_SIGNOFF, user, acct->refnum)) return (1); if (opt_get_bool(OPT_SHOW_BUDDY_SIGNOFF)) { struct imwindow *win; win = imwindow_find(acct, user); if (win != NULL) { win->typing = 0; screen_win_msg(win, 1, 1, 0, MSG_TYPE_SIGNOFF, "%s has signed off", name); } else if (notify) { screen_win_msg(screen.status_win, 1, 1, 0, MSG_TYPE_SIGNOFF, "%s has signed off", name); } } return (0); } int buddy_came_online(struct pork_acct *acct, char *user, void *data) { struct buddy *buddy; char *name = user; int notify = 0; buddy = buddy_find(acct, user); if (buddy != NULL) { if (buddy->notify) notify = 1; name = buddy->name; buddy_online(acct, buddy, data); } if (event_generate(acct->events, EVENT_BUDDY_SIGNON, user, acct->refnum)) return (1); if (opt_get_bool(OPT_SHOW_BUDDY_SIGNOFF)) { struct imwindow *win; win = imwindow_find(acct, user); if (win != NULL) { screen_win_msg(win, 1, 1, 0, MSG_TYPE_SIGNON, "%s has signed on", name); } else if (notify) { screen_win_msg(screen.status_win, 1, 1, 0, MSG_TYPE_SIGNON, "%s has signed on", name); } } return (0); } int buddy_went_idle(struct pork_acct *acct, char *user, u_int32_t seconds) { if (event_generate(acct->events, EVENT_BUDDY_IDLE, user, seconds, acct->refnum)) { return (1); } if (opt_get_bool(OPT_SHOW_BUDDY_IDLE)) { struct imwindow *win; char *name = user; int notify = 0; struct buddy *buddy; buddy = buddy_find(acct, user); if (buddy != NULL) { name = buddy->name; if (buddy->notify) notify = 1; } win = imwindow_find(acct, user); if (win != NULL) screen_win_msg(win, 1, 1, 0, MSG_TYPE_IDLE, "%s is now idle", name); else if (notify) { screen_win_msg(screen.status_win, 1, 1, 0, MSG_TYPE_IDLE, "%s is now idle", name); } } return (0); } int buddy_went_unidle(struct pork_acct *acct, char *user) { if (event_generate(acct->events, EVENT_BUDDY_UNIDLE, user, acct->refnum)) return (1); if (opt_get_bool(OPT_SHOW_BUDDY_IDLE)) { struct imwindow *win; char *name = user; int notify = 0; struct buddy *buddy; buddy = buddy_find(acct, user); if (buddy != NULL) { name = buddy->name; if (buddy->notify) notify = 1; } win = imwindow_find(acct, user); if (win != NULL) { screen_win_msg(win, 1, 1, 0, MSG_TYPE_UNIDLE, "%s is no longer idle", name); } else if (notify) { screen_win_msg(screen.status_win, 1, 1, 0, MSG_TYPE_UNIDLE, "%s is no longer idle", name); } } return (0); } int buddy_went_away(struct pork_acct *acct, char *user) { if (event_generate(acct->events, EVENT_BUDDY_AWAY, user, acct->refnum)) return (1); if (opt_get_bool(OPT_SHOW_BUDDY_AWAY)) { struct imwindow *win; char *name = user; int notify = 0; struct buddy *buddy; buddy = buddy_find(acct, user); if (buddy != NULL) { name = buddy->name; if (buddy->notify) notify = 1; } win = imwindow_find(acct, user); if (win != NULL) { screen_win_msg(win, 1, 1, 0, MSG_TYPE_AWAY, "%s is now away", name); } else if (notify) { screen_win_msg(screen.status_win, 1, 1, 0, MSG_TYPE_AWAY, "%s is no longer away", name); } } return (0); } int buddy_went_unaway(struct pork_acct *acct, char *user) { if (event_generate(acct->events, EVENT_BUDDY_BACK, user, acct->refnum)) return (1); if (opt_get_bool(OPT_SHOW_BUDDY_AWAY)) { struct imwindow *win; char *name = user; int notify = 0; struct buddy *buddy; buddy = buddy_find(acct, user); if (buddy != NULL) { name = buddy->name; if (buddy->notify) notify = 1; } win = imwindow_find(acct, user); if (win != NULL) { screen_win_msg(win, 1, 1, 0, MSG_TYPE_BACK, "%s is no longer away", name); } else if (notify) { screen_win_msg(screen.status_win, 1, 1, 0, MSG_TYPE_BACK, "%s is no longer away", name); } } return (0); } pork-0.99.8.1/src/pork_buddy.h0000644000175000017500000000561710234217325016011 0ustar ryanryan00000000000000/* ** pork_buddy.h - Buddy list / permit / deny management. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_BUDDY_H #define __PORK_BUDDY_H enum { STATUS_OFFLINE, STATUS_ACTIVE, STATUS_IDLE, STATUS_AWAY }; struct pork_acct; struct buddy_pref { dlist_t *group_list; dlist_t *permit_list; dlist_t *block_list; u_int32_t next_group_refnum; u_int16_t privacy_mode; u_int32_t num_buddies; hash_t buddy_hash; }; struct bgroup { char *name; u_int32_t refnum; u_int32_t num_online; u_int32_t num_members; u_int32_t high_refnum; dlist_t *member_list; dlist_t *blist_line; }; struct buddy { char *name; char *nname; char *userhost; struct bgroup *group; u_int32_t refnum; u_int32_t signon_time; u_int32_t idle_time; u_int32_t warn_level; u_int32_t status:2; u_int32_t notify:1; u_int32_t ignore:1; u_int32_t type:6; u_int32_t last_seen; dlist_t *blist_line; }; int buddy_update( struct pork_acct *acct, struct buddy *buddy, void *data); void buddy_online( struct pork_acct *acct, struct buddy *buddy, void *data); void buddy_offline(struct pork_acct *acct, struct buddy *buddy); void buddy_offline_all(struct pork_acct *acct); char *buddy_name(struct pork_acct *acct, char *buddy); int buddy_alias(struct pork_acct *acct, struct buddy *buddy, char *alias, int send); struct bgroup *group_find(struct pork_acct *acct, char *group_name); struct buddy *buddy_find(struct pork_acct *acct, const char *screen_name); void buddy_update_idle(struct pork_acct *acct); struct buddy *buddy_add(struct pork_acct *acct, const char *screen_name, struct bgroup *group, int send); int buddy_init(struct pork_acct *acct); void buddy_destroy(struct pork_acct *acct); struct bgroup *group_add(struct pork_acct *acct, char *group_name); int group_remove(struct pork_acct *acct, char *group_name, int send); int buddy_remove(struct pork_acct *acct, const char *screen_name, int send); int buddy_add_block(struct pork_acct *acct, char *screen_name, int send); int buddy_remove_block(struct pork_acct *acct, char *screen_name, int send); int buddy_add_permit(struct pork_acct *acct, char *screen_name, int send); int buddy_remove_permit(struct pork_acct *acct, char *screen_name, int send); int buddy_clear_block(struct pork_acct *acct); int buddy_clear_permit(struct pork_acct *acct); int buddy_came_online(struct pork_acct *acct, char *user, void *data); int buddy_went_offline(struct pork_acct *acct, char *user); int buddy_went_idle(struct pork_acct *acct, char *user, u_int32_t seconds); int buddy_went_unidle(struct pork_acct *acct, char *user); int buddy_went_away(struct pork_acct *acct, char *user); int buddy_went_unaway(struct pork_acct *acct, char *user); #endif pork-0.99.8.1/src/pork_io.c0000644000175000017500000001145410236222245015277 0ustar ryanryan00000000000000/* ** pork_io.c - I/O handler. ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static dlist_t *io_list; static int pork_io_find_cb(void *l, void *r) { struct io_source *io = (struct io_source *) r; return (!(l == io->key)); } static void pork_io_destroy_cb(void *param __notused, void *data) { free(data); } static void pork_io_remove(dlist_t *node) { pork_io_destroy_cb(NULL, node->data); io_list = dlist_remove(io_list, node); } int pork_io_init(void) { io_list = NULL; return (0); } void pork_io_destroy(void) { dlist_destroy(io_list, NULL, pork_io_destroy_cb); io_list = NULL; } int pork_io_add(int fd, u_int32_t cond, void *data, void *key, void (*callback)(int fd, u_int32_t cond, void *data)) { dlist_t *node; struct io_source *io; /* ** If there's already an entry for this key, delete it ** and replace it with the new one. */ node = dlist_find(io_list, key, pork_io_find_cb); if (node != NULL) pork_io_remove(node); io = xcalloc(1, sizeof(*io)); io->fd = fd; io->cond = cond; io->data = data; io->key = key; io->callback = callback; io_list = dlist_add_head(io_list, io); return (0); } int pork_io_del(void *key) { dlist_t *node; struct io_source *io; node = dlist_find(io_list, key, pork_io_find_cb); if (node == NULL) return (-1); io = node->data; io->fd = -2; io->callback = NULL; return (0); } int pork_io_dead(void *key) { dlist_t *node; node = dlist_find(io_list, key, pork_io_find_cb); if (node == NULL) return (-1); ((struct io_source *) node->data)->fd = -1; return (0); } int pork_io_set_cond(void *key, u_int32_t new_cond) { dlist_t *node; node = dlist_find(io_list, key, pork_io_find_cb); if (node == NULL) return (-1); ((struct io_source *) node->data)->cond = new_cond; return (0); } int pork_io_add_cond(void *key, u_int32_t new_cond) { dlist_t *node; node = dlist_find(io_list, key, pork_io_find_cb); if (node == NULL) return (-1); ((struct io_source *) node->data)->cond |= new_cond; return (0); } int pork_io_del_cond(void *key, u_int32_t new_cond) { dlist_t *node; node = dlist_find(io_list, key, pork_io_find_cb); if (node == NULL) return (-1); ((struct io_source *) node->data)->cond &= ~new_cond; return (0); } static int pork_io_find_dead_fds(dlist_t *io_list) { dlist_t *cur = io_list; int bad_fd = 0; while (cur != NULL) { struct io_source *io = cur->data; dlist_t *next = cur->next; if (io->fd < 0 || sock_is_error(io->fd)) { debug("fd %d is dead", io->fd); if (io->callback != NULL) io->callback(io->fd, IO_COND_DEAD, io->data); pork_io_remove(cur); bad_fd++; } cur = next; } return (bad_fd); } int pork_io_run(void) { fd_set rfds; fd_set wfds; fd_set xfds; int max_fd = -1; int ret; struct timeval tv = { 0, 600000 }; dlist_t *cur; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); cur = io_list; while (cur != NULL) { struct io_source *io = cur->data; dlist_t *next = cur->next; if (io->fd >= 0) { if (io->cond & IO_COND_ALWAYS && io->callback != NULL) io->callback(io->fd, IO_COND_ALWAYS, io->data); if (io->cond & IO_COND_READ) FD_SET(io->fd, &rfds); if (io->cond & IO_COND_WRITE) FD_SET(io->fd, &wfds); if (io->cond & IO_COND_EXCEPTION) FD_SET(io->fd, &xfds); if (io->fd > max_fd) max_fd = io->fd; } else { if (io->callback != NULL) io->callback(io->fd, IO_COND_DEAD, io->data); pork_io_remove(cur); } cur = next; } if (max_fd < 0) return (-1); /* ** If there's a bad fd in the set better find it, otherwise ** we're going to get into an infinite loop. */ ret = select(max_fd + 1, &rfds, &wfds, &xfds, &tv); if (ret < 1) { if (ret == -1 && errno == EBADF) pork_io_find_dead_fds(io_list); return (ret); } cur = io_list; while (cur != NULL) { struct io_source *io = cur->data; dlist_t *next = cur->next; if (io->fd >= 0) { u_int32_t cond = 0; if ((io->cond & IO_COND_READ) && FD_ISSET(io->fd, &rfds)) cond |= IO_COND_READ; if ((io->cond & IO_COND_WRITE) && FD_ISSET(io->fd, &wfds)) cond |= IO_COND_WRITE; if ((io->cond & IO_COND_EXCEPTION) && FD_ISSET(io->fd, &xfds)) cond |= IO_COND_EXCEPTION; if (cond != 0 && io->callback != NULL) io->callback(io->fd, cond, io->data); } cur = next; } return (ret); } pork-0.99.8.1/src/pork_io.h0000644000175000017500000000210410234217325015275 0ustar ryanryan00000000000000/* ** pork_io.h - I/O handler. ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_IO_H #define __PORK_IO_H #define IO_COND_READ 0x01 #define IO_COND_WRITE 0x02 #define IO_COND_EXCEPTION 0x04 #define IO_COND_DEAD 0x08 #define IO_COND_ALWAYS 0x10 #define IO_COND_RW (IO_COND_READ | IO_COND_WRITE) struct io_source { int fd; u_int32_t cond; void *data; void *key; void (*callback)(int fd, u_int32_t condition, void *data); }; int pork_io_init(void); void pork_io_destroy(void); int pork_io_del(void *key); int pork_io_run(void); int pork_io_dead(void *key); int pork_io_add_cond(void *key, u_int32_t new_cond); int pork_io_del_cond(void *key, u_int32_t new_cond); int pork_io_set_cond(void *key, u_int32_t new_cond); int pork_io_add(int fd, u_int32_t cond, void *data, void *key, void (*callback)(int fd, u_int32_t condition, void *data)); #endif pork-0.99.8.1/src/pork_proto.c0000644000175000017500000000423110234217325016027 0ustar ryanryan00000000000000/* ** pork_proto.c ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include static struct pork_proto *proto_table[PROTO_MAX + 1]; extern int irc_proto_init(struct pork_proto *proto); extern int aim_proto_init(struct pork_proto *proto); inline struct pork_proto *proto_get(int protocol) { if (protocol > PROTO_MAX || protocol < -1) return (NULL); return (proto_table[protocol + 1]); } struct pork_proto *proto_get_name(const char *name) { size_t i; for (i = 1 ; i <= PROTO_MAX ; i++) { if (!strcasecmp(name, proto_table[i]->name)) return (proto_table[i]); } return (NULL); } int proto_new( int protocol, const char *name, int (*init_func)(struct pork_proto *)) { struct pork_proto *new_proto; int ret; if (protocol < -1 || protocol > PROTO_MAX || proto_table[protocol + 1] != NULL || init_func == NULL) { return (-1); } new_proto = xcalloc(1, sizeof(*new_proto)); new_proto->protocol = protocol; xstrncpy(new_proto->name, name, sizeof(new_proto->name)); ret = init_func(new_proto); if (ret != 0) { free(new_proto); return (ret); } proto_table[protocol + 1] = new_proto; return (0); } int proto_get_num(const char *name) { size_t i; for (i = 0 ; i <= PROTO_MAX && proto_table[i] != NULL ; i++) { if (!strcasecmp(proto_table[i]->name, name)) return (proto_table[i]->protocol); } return (-1); } void proto_destroy(void) { size_t i; for (i = 0 ; i <= PROTO_MAX ; i++) free(proto_table[i]); } static int proto_init_null(struct pork_proto *proto) { proto->normalize = xstrncpy; return (0); } int proto_init(void) { proto_new(PROTO_NULL, "NULL", proto_init_null); proto_new(PROTO_AIM, "AIM", aim_proto_init); #ifdef IRC_SUPPORT proto_new(PROTO_IRC, "IRC", irc_proto_init); #endif return (0); } pork-0.99.8.1/src/pork_proto.h0000644000175000017500000001121010234217325016027 0ustar ryanryan00000000000000/* ** pork_proto.h ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_PROTO_H #define __PORK_PROTO_H struct pork_acct; struct imwindow; struct file_transfer; struct chatroom; struct chat_user; struct buddy; enum { PROTO_NULL = -1, PROTO_AIM, PROTO_IRC, PROTO_MAX, }; struct pork_proto { int protocol; char name[32]; struct command *cmd; size_t num_cmds; int (*init)(struct pork_acct *); int (*free)(struct pork_acct *); int (*read_config)(struct pork_acct *); int (*write_config)(struct pork_acct *); int (*update)(struct pork_acct *); int (*normalize)(char *dest, const char *str, size_t len); int (*user_compare)(const char *u1, const char *u2); char *(*filter_text)(char *); char *(*filter_text_out)(char *); int (*connect)(struct pork_acct *, char *); int (*connect_abort)(struct pork_acct *acct); int (*reconnect)(struct pork_acct *, char *); int (*disconnected)(struct pork_acct *); int (*signoff)(struct pork_acct *acct, char *reason); int (*buddy_block)(struct pork_acct *, char *); int (*buddy_permit)(struct pork_acct *, char *); int (*buddy_unblock)(struct pork_acct *, char *); int (*buddy_remove_permit)(struct pork_acct *, char *); int (*buddy_add)(struct pork_acct *, struct buddy *); int (*buddy_alias)(struct pork_acct *, struct buddy *); int (*buddy_remove)(struct pork_acct *, struct buddy *); int (*buddy_update)(struct pork_acct *, struct buddy *, void *); struct chatroom *(*chat_find)(struct pork_acct *, char *); int (*is_chat)(struct pork_acct *acct, char *str); int (*chat_free)(struct pork_acct *, void *chat_data); int (*chat_ignore)(struct pork_acct *, struct chatroom *, char *user); int (*chat_unignore)(struct pork_acct *, struct chatroom *, char *user); int (*chat_join)(struct pork_acct *, char *name, char *args); int (*chat_rejoin)(struct pork_acct *, struct chatroom *); int (*chat_leave)(struct pork_acct *, struct chatroom *); int (*chat_invite)(struct pork_acct *, struct chatroom *, char *, char *); int (*chat_kick)(struct pork_acct *, struct chatroom *, char *user, char *); int (*chat_ban)(struct pork_acct *, struct chatroom *, char *user); int (*chat_name)(const char *name, char *buf, size_t len, char *, size_t); int (*chat_send)(struct pork_acct *, struct chatroom *chat, char *, char *); int (*chat_action)(struct pork_acct *, struct chatroom *, char *, char *msg); int (*chat_send_notice)(struct pork_acct *, struct chatroom *, char *, char *); int (*chat_user_free)(struct pork_acct *acct, struct chat_user *); int (*chat_users)(struct pork_acct *, struct chatroom *chat); int (*chat_who)(struct pork_acct *, struct chatroom *chat); int (*chat_set_topic)(struct pork_acct *, struct chatroom *chat, char *topic); int (*file_send)(struct file_transfer *xfer); int (*file_accept)(struct file_transfer *xfer); int (*file_abort)(struct file_transfer *xfer); int (*file_recv_data)(struct file_transfer *xfer, char *buf, size_t len); int (*file_send_data)(struct file_transfer *xfer, char *buf, size_t len); int (*file_recv_complete)(struct file_transfer *xfer); int (*file_send_complete)(struct file_transfer *xfer); int (*set_report_idle)(struct pork_acct *, int); int (*set_idle_time)(struct pork_acct *, u_int32_t); int (*set_privacy_mode)(struct pork_acct *, int); int (*warn)(struct pork_acct *, char *); int (*warn_anon)(struct pork_acct *, char *); int (*send_action)(struct pork_acct *, char *target, char *msg); int (*send_msg)(struct pork_acct *, char *target, char *msg); int (*send_notice)(struct pork_acct *, char *target, char *msg); int (*send_msg_auto)(struct pork_acct *, char *target, char *msg); int (*set_back)(struct pork_acct *); int (*set_away)(struct pork_acct *, char *); int (*get_away_msg)(struct pork_acct *, char *); int (*set_profile)(struct pork_acct *, char *); int (*get_profile)(struct pork_acct *, char *); int (*whowas)(struct pork_acct *, char *); int (*quote)(struct pork_acct *acct, char *str); int (*mode)(struct pork_acct *, char *); int (*who)(struct pork_acct *, char *str); int (*ping)(struct pork_acct *, char *str); int (*ctcp)(struct pork_acct *, char *dest, char *str); int (*keepalive)(struct pork_acct *); int (*change_nick)(struct pork_acct *acct, char *nick); }; int proto_init(void); int proto_get_num(const char *name); int proto_new(int proto, const char *name, int (*init)(struct pork_proto *)); void proto_destroy(void); inline struct pork_proto *proto_get(int protocol); struct pork_proto *proto_get_name(const char *name); #endif pork-0.99.8.1/src/pork_buddy_list.c0000644000175000017500000002170110234217325017027 0ustar ryanryan00000000000000/* ** pork_buddy_list.c - Buddy list screen widget. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void blist_cell_destroy_cb(void *d) { struct slist_cell *cell = d; if (cell->type == TYPE_LIST_CELL) { struct bgroup *group = cell->data; group->blist_line = NULL; } else { struct buddy *buddy = cell->data; buddy->blist_line = NULL; } } static void blist_make_buddy_label(struct buddy *buddy, chtype *ch, size_t len) { char buf[1024]; char *string = buf; if (fill_format_str(OPT_FORMAT_BLIST, buf, sizeof(buf), buddy) == -1) string = "ERROR"; format_apply_justification(buf, ch, len); } static void blist_make_group_label(struct bgroup *group, chtype *ch, size_t len) { char buf[1024]; char *string = buf; if (fill_format_str(OPT_FORMAT_BLIST_GROUP, buf, sizeof(buf), group) == -1) string = "ERROR"; format_apply_justification(buf, ch, len); } void blist_update_label(struct blist *blist, dlist_t *node) { struct slist_cell *cell; if (blist == NULL || node == NULL) return; cell = node->data; if (cell->type == TYPE_FLAT_CELL) { struct buddy *buddy = cell->data; blist_make_buddy_label(buddy, cell->label, blist->label_len); } else { struct bgroup *group = cell->data; blist_make_group_label(group, cell->label, blist->label_len); } if (cell->line >= 0) { if (node == blist->slist.cursor) blist_draw_cursor(blist, 1); else blist_draw_line(blist, cell); } } int blist_init(struct pork_acct *acct) { int cols = DEFAULT_BLIST_WIDTH; struct blist *blist; dlist_t *cur; int ret; if (acct == NULL || acct->blist != NULL) return (-1); blist = xcalloc(1, sizeof(*blist)); ret = slist_init(&blist->slist, screen.rows - STATUS_ROWS, cols, screen.cols - cols, 0); if (ret != 0) { free(blist); return (-1); } slist_cell_free_cb(&blist->slist, blist_cell_destroy_cb); blist->label_len = SLIST_LAST_COL(&blist->slist) + 1; /* Add the buddy groups to the buddy list */ cur = acct->buddy_pref->group_list; while (cur != NULL) { struct bgroup *group = cur->data; dlist_t *node = blist_add_group(blist, group); if (node != NULL) group->blist_line = node; cur = cur->next; } blist_draw(blist); acct->blist = blist; return (0); } dlist_t *blist_add_group(struct blist *blist, struct bgroup *group) { struct slist_cell *cell; dlist_t *ret; if (blist == NULL) return (NULL); cell = xcalloc(1, sizeof(*cell)); cell->type = TYPE_LIST_CELL; cell->parent = NULL; cell->children = NULL; cell->collapsed = 0; cell->refnum = group->refnum; cell->label = xmalloc(sizeof(chtype) * blist->label_len); cell->data = group; blist_make_group_label(group, cell->label, blist->label_len); ret = slist_add(&blist->slist, cell); if (ret == NULL) return (NULL); group->blist_line = ret; blist_draw(blist); return (ret); } dlist_t *blist_add(struct blist *blist, struct buddy *buddy) { struct slist_cell *cell; dlist_t *ret; dlist_t *node; if (blist == NULL) return (NULL); cell = xcalloc(1, sizeof(*cell)); cell->type = TYPE_FLAT_CELL; cell->parent = buddy->group->blist_line; cell->refnum = buddy->refnum; cell->label = xmalloc(sizeof(chtype) * blist->label_len); cell->data = buddy; blist_make_buddy_label(buddy, cell->label, blist->label_len); ret = slist_add(&blist->slist, cell); if (ret == NULL) return (NULL); node = buddy->group->blist_line; cell = node->data; buddy->blist_line = ret; blist_make_group_label(buddy->group, cell->label, blist->label_len); blist_draw(blist); return (ret); } void blist_del(struct blist *blist, struct buddy *buddy) { dlist_t *node; struct slist_cell *cell; if (blist == NULL) return; node = buddy->blist_line; if (node == NULL) return; cell = node->data; if (cell == NULL) return; buddy->blist_line = NULL; slist_del(&blist->slist, cell); node = buddy->group->blist_line; cell = node->data; blist_make_group_label(buddy->group, cell->label, blist->label_len); blist_draw(blist); } void blist_del_group(struct blist *blist, struct bgroup *group) { dlist_t *node; struct slist_cell *cell; if (blist == NULL) return; node = group->blist_line; if (node == NULL) return; cell = node->data; if (cell == NULL) return; group->blist_line = NULL; slist_del(&blist->slist, cell); blist_draw(blist); } void blist_collapse_group(struct blist *blist, struct bgroup *group) { dlist_t *node; struct slist_cell *cell; node = group->blist_line; if (node == NULL) return; cell = node->data; if (cell == NULL) return; if (!cell->collapsed) { if (slist_collapse_list_cell(&blist->slist, group->blist_line) != 0) return; } else { dlist_t *cur = group->member_list; cell->collapsed = 0; while (cur != NULL) { struct buddy *buddy = cur->data; if (buddy->status != STATUS_OFFLINE) blist_add(blist, buddy); cur = cur->next; } } blist_make_group_label(group, cell->label, blist->label_len); blist_draw(blist); } int blist_cursor_up(struct blist *blist) { int ret; if (blist == NULL) return (-1); blist_draw_cursor(blist, 0); ret = slist_cursor_up(&blist->slist); blist_draw_cursor(blist, 1); return (ret); } int blist_cursor_down(struct blist *blist) { int ret; if (blist == NULL) return (-1); blist_draw_cursor(blist, 0); ret = slist_cursor_down(&blist->slist); blist_draw_cursor(blist, 1); return (ret); } int blist_cursor_start(struct blist *blist) { int ret; if (blist == NULL) return (-1); blist_draw_cursor(blist, 0); ret = slist_cursor_start(&blist->slist); blist_draw_cursor(blist, 1); return (ret); } int blist_cursor_end(struct blist *blist) { int ret; if (blist == NULL) return (-1); blist_draw_cursor(blist, 0); ret = slist_cursor_end(&blist->slist); blist_draw_cursor(blist, 1); return (ret); } int blist_cursor_pgdown(struct blist *blist) { int ret; if (blist == NULL) return (-1); blist_draw_cursor(blist, 0); ret = slist_cursor_pgdown(&blist->slist); blist_draw_cursor(blist, 1); return (ret); } int blist_cursor_pgup(struct blist *blist) { int ret; if (blist == NULL) return (-1); blist_draw_cursor(blist, 0); ret = slist_cursor_pgup(&blist->slist); blist_draw_cursor(blist, 1); return (ret); } inline struct slist_cell *blist_get_cursor(struct blist *blist) { if (blist == NULL) return (NULL); return (slist_get_cursor(&blist->slist)); } int blist_resize( struct blist *blist, u_int32_t rows, u_int32_t cols, u_int32_t screen_cols) { int ret; int needs_update = 0; if (blist == NULL) return (0); if (blist->slist.cols != cols) needs_update = 1; ret = slist_resize(&blist->slist, rows, cols, screen_cols); if (ret != 0) return (-1); blist->label_len = SLIST_LAST_COL(&blist->slist) + 1; if (needs_update) blist_changed_width(blist); return (0); } inline void blist_destroy(struct blist *blist) { if (blist == NULL) return; slist_destroy(&blist->slist); memset(blist, 0, sizeof(*blist)); } inline void blist_draw(struct blist *blist) { slist_draw(&blist->slist); blist_draw_cursor(blist, 1); } inline int blist_refresh(struct blist *blist) { return (slist_refresh(&blist->slist)); } void blist_draw_border(struct blist *blist, int border_state) { attr_t border_attr; if (border_state == 0) border_attr = opt_get_color(OPT_COLOR_BLIST_NOFOCUS); else border_attr = opt_get_color(OPT_COLOR_BLIST_FOCUS); slist_clear_bot(&blist->slist); wattrset(blist->slist.win, border_attr); box(blist->slist.win, ACS_VLINE, ACS_HLINE); wattrset(blist->slist.win, 0); } inline void blist_draw_cursor(struct blist *blist, int status) { attr_t curs_attr = 0; if (status) curs_attr = opt_get_color(OPT_COLOR_BLIST_SELECTOR); slist_draw_cursor(&blist->slist, curs_attr); } inline void blist_draw_line(struct blist *blist, struct slist_cell *cell) { slist_draw_line(&blist->slist, cell); } void blist_changed_format(struct blist *blist) { dlist_t *cur; cur = blist->slist.cells; while (cur != NULL) { blist_update_label(blist, cur); cur = slist_node_next(cur); } } void blist_changed_width(struct blist *blist) { dlist_t *cur; cur = blist->slist.cells; while (cur != NULL) { struct slist_cell *cell = cur->data; free(cell->label); cell->label = xmalloc(sizeof(chtype) * blist->label_len); blist_update_label(blist, cur); cur = slist_node_next(cur); } } pork-0.99.8.1/src/pork_buddy_list.h0000644000175000017500000000347210234217325017041 0ustar ryanryan00000000000000/* ** pork_buddy_list.h - Buddy list screen widget. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_BUDDY_LIST_H #define __PORK_BUDDY_LIST_H #define DEFAULT_BLIST_WIDTH 28 struct pork_acct; struct buddy; struct bgroup; #include struct blist { struct slist slist; size_t label_len; }; int blist_init(struct pork_acct *acct); void blist_update_label(struct blist *blist, dlist_t *node); dlist_t *blist_add_group(struct blist *blist, struct bgroup *group); dlist_t *blist_add(struct blist *blist, struct buddy *buddy); void blist_del(struct blist *blist, struct buddy *buddy); void blist_del_group(struct blist *blist, struct bgroup *group); void blist_collapse_group(struct blist *blist, struct bgroup *group); int blist_cursor_up(struct blist *blist); int blist_cursor_down(struct blist *blist); int blist_cursor_start(struct blist *blist); int blist_cursor_end(struct blist *blist); int blist_cursor_pgdown(struct blist *blist); int blist_cursor_pgup(struct blist *blist); inline struct slist_cell *blist_get_cursor(struct blist *blist); inline int blist_resize( struct blist *blist, u_int32_t rows, u_int32_t cols, u_int32_t screen_cols); inline void blist_destroy(struct blist *blist); inline void blist_draw(struct blist *blist); inline void blist_draw_cursor(struct blist *blist, int status); inline void blist_draw_line(struct blist *blist, struct slist_cell *cell); inline int blist_refresh(struct blist *blist); void blist_draw_border(struct blist *blist, int border_state); void blist_changed_format(struct blist *blist); void blist_changed_width(struct blist *blist); #endif pork-0.99.8.1/src/pork_format.c0000644000175000017500000007233310234217325016164 0ustar ryanryan00000000000000/* ** pork_format.c - helper functions for formatting text. ** Copyright (C) 2002-2004 Amber Adams ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static int format_status_timestamp( char opt, char *buf, size_t len, va_list ap __notused) { time_t cur_time; struct tm *tm; int ret = 0; cur_time = time(NULL); tm = localtime(&cur_time); if (tm == NULL) { debug("localtime: %s", strerror(errno)); return (-1); } switch (opt) { /* Hours, 24-hour format */ case 'H': ret = snprintf(buf, len, "%02d", tm->tm_hour); break; /* Hours, 12-hour format */ case 'h': { u_int32_t time_12hour; if (tm->tm_hour == 0) time_12hour = 12; else { time_12hour = tm->tm_hour; if (time_12hour > 12) time_12hour -= 12; } ret = snprintf(buf, len, "%02d", time_12hour); break; } /* Minutes */ case 'M': case 'm': ret = snprintf(buf, len, "%02d", tm->tm_min); break; /* Seconds */ case 'S': case 's': ret = snprintf(buf, len, "%02d", tm->tm_sec); break; /* AM or PM */ case 'Z': case 'z': ret = xstrncpy(buf, (tm->tm_hour >= 12 ? "pm" : "am"), len); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_status_activity( char opt, char *buf, size_t len, va_list ap __notused) { switch (opt) { /* Activity display */ case 'A': case 'a': { dlist_t *cur = screen.window_list; size_t n = 0; do { struct imwindow *imwindow = cur->data; if (imwindow->swindow.activity && !imwindow->ignore_activity && !imwindow->swindow.visible) { int ret = snprintf(&buf[n], len - n, "%u,", imwindow->refnum); if (ret < 0 || (size_t) ret >= len - n) return (-1); n += ret; } cur = cur->next; } while (cur != screen.window_list); if (n > 0) buf[n - 1] = '\0'; else return (1); break; } default: return (-1); } return (0); } static int format_status_typing(char opt, char *buf, size_t len, va_list ap) { int ret = 0; struct imwindow *imwindow = va_arg(ap, struct imwindow *); switch (opt) { /* Typing status */ case 'Y': if (imwindow->typing) { char *str; if (imwindow->typing == 1) str = opt_get_str(OPT_TEXT_TYPING_PAUSED); else str = opt_get_str(OPT_TEXT_TYPING); if (xstrncpy(buf, str, len) == -1) ret = -1; } else return (1); break; default: return (-1); } return (ret); } static int format_status_held(char opt, char *buf, size_t len, va_list ap) { struct imwindow *imwindow = va_arg(ap, struct imwindow *); int ret = 0; if (imwindow->swindow.held == 0) return (1); switch (opt) { /* Held indicator */ case 'H': ret = snprintf(buf, len, "%02d", imwindow->swindow.held); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_status_idle(char opt, char *buf, size_t len, va_list ap) { struct pork_acct *acct = va_arg(ap, struct pork_acct *); int hide_if_zero = va_arg(ap, int); int ret = 0; switch (opt) { /* Idle time */ case 'I': own: if (acct->idle_time == 0 && hide_if_zero) return (1); ret = time_to_str(acct->idle_time, buf, len); break; /* ** If the current window is a chat window, $i will display the ** idle time of the user we're talking to. */ case 'i': { struct imwindow *win = cur_window(); if (win->type == WIN_TYPE_PRIVMSG) { struct buddy *buddy; buddy = buddy_find(acct, win->target); if (buddy == NULL || (buddy->idle_time == 0 && hide_if_zero)) return (1); ret = time_to_str(buddy->idle_time, buf, len); break; } goto own; } default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_status(char opt, char *buf, size_t len, va_list ap) { struct imwindow *imwindow = va_arg(ap, struct imwindow *); struct pork_acct *acct = va_arg(ap, struct pork_acct *); int ret = 0; switch (opt) { /* Disconnect / reconnect status */ case 'D': if (acct->reconnecting) ret = xstrncpy(buf, "reconnecting", len); else if (acct->disconnected) ret = xstrncpy(buf, "disconnected", len); else ret = xstrncpy(buf, "connected", len); break; /* Screen name */ case 'n': case 'N': ret = xstrncpy(buf, acct->username, len); break; /* Remote server */ case 'S': case 's': if (acct->server != NULL) ret = xstrncpy(buf, acct->server, len); break; /* Remote port */ case 'P': case 'p': if (acct->fport != NULL) ret = xstrncpy(buf, acct->fport, len); break; /* Window name */ case 'z': case 'Z': ret = xstrncpy(buf, imwindow->name, len); break; /* Chat room, if inactive */ case 'c': case 'C': if (imwindow->type == WIN_TYPE_CHAT && (imwindow->data == NULL || !acct->connected)) { ret = xstrncpy(buf, opt_get_str(OPT_TEXT_NO_ROOM), len); } break; /* Chat mode, if applicable; M includes arguments, m doesn't. */ case 'M': case 'm': if (imwindow->type == WIN_TYPE_CHAT && imwindow->data != NULL) { struct chatroom *chat = imwindow->data; ret = xstrncpy(buf, chat->mode, len); if (opt == 'm') { char *p; p = strchr(buf, ' '); if (p != NULL) *p = '\0'; } } break; /* Chat status, if applicable */ case '@': if (imwindow->type == WIN_TYPE_CHAT && imwindow->data != NULL) { struct chatroom *chat = imwindow->data; struct chat_user *user; user = chat_find_user(acct, chat, acct->username); if (user == NULL) break; if (user->status & CHAT_STATUS_OP) ret = xstrncpy(buf, "@", len); else if (user->status & CHAT_STATUS_HALFOP) ret = xstrncpy(buf, "%%", len); else if (user->status & CHAT_STATUS_VOICE) ret = xstrncpy(buf, "+", len); } break; /* User status */ case '!': if (acct->disconnected) { if (acct->reconnecting) ret = xstrncpy(buf, "reconnecting", len); else ret = xstrncpy(buf, "disconnected", len); } else if (acct->connected) { if (acct->away_msg != NULL) ret = xstrncpy(buf, "away", len); else ret = xstrncpy(buf, "online", len); } else ret = xstrncpy(buf, "not connected", len); break; /* Protocol */ case '?': ret = xstrncpy(buf, acct->proto->name, len); break; /* User mode */ case 'u': case 'U': ret = xstrncpy(buf, acct->umode, len); break; /* Timestamp */ case 't': case 'T': ret = fill_format_str(OPT_FORMAT_STATUS_TIMESTAMP, buf, len); break; /* Activity */ case 'a': case 'A': ret = fill_format_str(OPT_FORMAT_STATUS_ACTIVITY, buf, len); break; /* Typing */ case 'y': case 'Y': ret = fill_format_str(OPT_FORMAT_STATUS_TYPING, buf, len, imwindow); break; /* Held Messages */ case 'h': case 'H': ret = fill_format_str(OPT_FORMAT_STATUS_HELD, buf, len, imwindow); break; /* Idle Time */ case 'i': case 'I': ret = fill_format_str(OPT_FORMAT_STATUS_IDLE, buf, len, acct, isupper(opt)); break; /* Warn Level */ case 'w': case 'W': ret = fill_format_str(OPT_FORMAT_STATUS_WARN, buf, len, acct, isupper(opt)); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_status_warn(char opt, char *buf, size_t len, va_list ap) { struct pork_acct *acct= va_arg(ap, struct pork_acct *); int hide_if_zero = va_arg(ap, int); int ret = 0; switch (opt) { /* Warn level */ case 'W': own: if (acct->warn_level == 0 && hide_if_zero) return (1); ret = snprintf(buf, len, "%02d", acct->warn_level); break; case 'w': { struct imwindow *win = cur_window(); if (win->type == WIN_TYPE_PRIVMSG) { struct buddy *buddy; buddy = buddy_find(acct, win->target); if (buddy == NULL || (buddy->warn_level == 0 && hide_if_zero)) return (1); ret = snprintf(buf, len, "%02d", buddy->warn_level); break; } goto own; } default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_msg_send(char opt, char *buf, size_t len, va_list ap) { struct pork_acct *acct = va_arg(ap, struct pork_acct *); char *dest = va_arg(ap, char *); char *msg = va_arg(ap, char *); int ret = 0; switch (opt) { /* Timestamp */ case 'T': ret = fill_format_str(OPT_FORMAT_TIMESTAMP, buf, len); break; /* Screen name of sender */ case 'n': case 'N': ret = xstrncpy(buf, acct->username, len); break; /* Screen name / alias of the receiver */ case 'R': if (dest != NULL) ret = xstrncpy(buf, buddy_name(acct, dest), len); break; case 'r': if (dest != NULL) ret = xstrncpy(buf, dest, len); break; /* Message text */ case 'M': if (msg != NULL) { msg = acct->proto->filter_text(msg); ret = xstrncpy(buf, msg, len); free(msg); } break; case 'm': if (msg != NULL) ret = xstrncpy(buf, msg, len); break; case 'H': if (acct->userhost != NULL) { char *host = acct->proto->filter_text(acct->userhost); ret = xstrncpy(buf, host, len); free(host); } break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_msg_recv(char opt, char *buf, size_t len, va_list ap) { struct pork_acct *acct = va_arg(ap, struct pork_acct *); char *dest = va_arg(ap, char *); char *sender = va_arg(ap, char *); char *sender_userhost = va_arg(ap, char *); char *msg = va_arg(ap, char *); int ret = 0; switch (opt) { /* Timestamp */ case 'T': ret = fill_format_str(OPT_FORMAT_TIMESTAMP, buf, len); break; /* Screen name of sender */ case 'n': if (sender != NULL) ret = xstrncpy(buf, sender, len); break; /* Screen name / alias of sender */ case 'N': if (sender != NULL) ret = xstrncpy(buf, buddy_name(acct, sender), len); break; /* Screen name / alias of the receiver */ case 'R': if (dest != NULL) ret = xstrncpy(buf, buddy_name(acct, dest), len); break; case 'r': if (dest != NULL) ret = xstrncpy(buf, dest, len); break; /* Message text */ case 'm': case 'M': if (msg != NULL) { msg = acct->proto->filter_text(msg); ret = xstrncpy(buf, msg, len); free(msg); } break; case 'H': if (acct->userhost != NULL) { char *host = acct->proto->filter_text(acct->userhost); ret = xstrncpy(buf, host, len); free(host); } break; case 'h': if (sender_userhost != NULL) { char *host = acct->proto->filter_text(sender_userhost); ret = xstrncpy(buf, host, len); free(host); } break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_chat_send(char opt, char *buf, size_t len, va_list ap) { struct pork_acct *acct = va_arg(ap, struct pork_acct *); struct chatroom *chat = va_arg(ap, struct chatroom *); char *dest = va_arg(ap, char *); char *msg = va_arg(ap, char *); int ret = 0; switch (opt) { /* Timestamp */ case 'T': ret = fill_format_str(OPT_FORMAT_TIMESTAMP, buf, len); break; /* Message source */ case 'n': case 'N': ret = xstrncpy(buf, acct->username, len); break; /* Message destination */ case 'C': if (chat != NULL) ret = xstrncpy(buf, chat->title_quoted, len); break; case 'c': if (dest != NULL) { dest = acct->proto->filter_text(dest); ret = xstrncpy(buf, dest, len); free(dest); } break; /* Message text */ case 'm': case 'M': if (msg != NULL) { msg = acct->proto->filter_text(msg); ret = xstrncpy(buf, msg, len); free(msg); } break; case 'H': if (acct->userhost != NULL) { char *host = acct->proto->filter_text(acct->userhost); ret = xstrncpy(buf, host, len); free(host); } break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_chat_recv(char opt, char *buf, size_t len, va_list ap) { struct pork_acct *acct = va_arg(ap, struct pork_acct *); struct chatroom *chat = va_arg(ap, struct chatroom *); char *dest = va_arg(ap, char *); char *src = va_arg(ap, char *); char *src_uhost = va_arg(ap, char *); char *msg = va_arg(ap, char *); int ret = 0; switch (opt) { /* Timestamp */ case 'T': ret = fill_format_str(OPT_FORMAT_TIMESTAMP, buf, len); break; /* Message source */ case 'N': if (src != NULL) ret = xstrncpy(buf, buddy_name(acct, src), len); break; case 'n': if (src != NULL) ret = xstrncpy(buf, src, len); break; /* Message destination */ case 'C': if (chat != NULL) ret = xstrncpy(buf, chat->title_quoted, len); break; case 'c': if (dest != NULL) { dest = acct->proto->filter_text(dest); ret = xstrncpy(buf, dest, len); free(dest); } break; /* Message text */ case 'M': case 'm': if (msg != NULL) { msg = acct->proto->filter_text(msg); ret = xstrncpy(buf, msg, len); free(msg); } break; case 'H': if (acct->userhost != NULL) { char *host = acct->proto->filter_text(acct->userhost); ret = xstrncpy(buf, host, len); free(host); } break; case 'h': if (src_uhost != NULL) { src_uhost = acct->proto->filter_text(src_uhost); ret = xstrncpy(buf, src_uhost, len); free(src_uhost); } break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_chat_info(char opt, char *buf, size_t len, va_list ap) { struct pork_acct *acct = va_arg(ap, struct pork_acct *); struct chatroom *chat = va_arg(ap, struct chatroom *); char *chat_nameq = va_arg(ap, char *); char *src = va_arg(ap, char *); char *dst = va_arg(ap, char *); char *msg = va_arg(ap, char *); int ret = 0; switch (opt) { /* Timestamp */ case 'T': ret = fill_format_str(OPT_FORMAT_TIMESTAMP, buf, len); break; /* Screen name of user who the action originated from */ case 'n': case 'N': ret = xstrncpy(buf, buddy_name(acct, src), len); break; /* Destination, if applicable */ case 'D': case 'd': if (dst != NULL) { dst = acct->proto->filter_text(dst); ret = xstrncpy(buf, dst, len); free(dst); } break; /* Chat name (quoted) */ case 'r': case 'R': ret = xstrncpy(buf, chat_nameq, len); break; /* Chat name (full, quoted) */ case 'U': case 'u': if (chat != NULL) ret = xstrncpy(buf, chat->title_full_quoted, len); /* Source's userhost (if available) */ case 'H': if (acct != NULL && chat != NULL && src != NULL) { struct chat_user *chat_user; chat_user = chat_find_user(acct, chat, src); if (chat_user != NULL && chat_user->host != NULL) { char *host = acct->proto->filter_text(chat_user->host); ret = xstrncpy(buf, host, len); free(host); } } break; /* Dest's userhost (if available) */ case 'h': if (acct != NULL && chat != NULL && dst != NULL) { struct chat_user *chat_user; chat_user = chat_find_user(acct, chat, dst); if (chat_user != NULL && chat_user->host != NULL) { char *host = acct->proto->filter_text(chat_user->host); ret = xstrncpy(buf, host, len); free(host); } } break; case 'm': case 'M': if (msg != NULL) { msg = acct->proto->filter_text(msg); ret = xstrncpy(buf, msg, len); free(msg); } break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_warning(char opt, char *buf, size_t len, va_list ap) { char *you = va_arg(ap, char *); char *warner = va_arg(ap, char *); u_int16_t warn_level = va_arg(ap, unsigned int); int ret = 0; switch (opt) { /* Timestamp */ case 'T': ret = fill_format_str(OPT_FORMAT_TIMESTAMP, buf, len); break; case 'n': case 'N': ret = xstrncpy(buf, you, len); break; case 'u': case 'U': ret = xstrncpy(buf, warner, len); break; case 'w': case 'W': ret = snprintf(buf, len, "%u", warn_level); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_blist_idle(char opt, char *buf, size_t len, va_list ap) { struct buddy *buddy = va_arg(ap, struct buddy *); int ret = 0; switch (opt) { case 'I': ret = time_to_str(buddy->idle_time, buf, len); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_blist_warn(char opt, char *buf, size_t len, va_list ap) { struct buddy *buddy = va_arg(ap, struct buddy *); int ret = 0; switch (opt) { case 'W': ret = snprintf(buf, len, "%u", buddy->warn_level); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_blist_buddy_label(char opt, char *buf, size_t len, va_list ap) { struct buddy *buddy = va_arg(ap, struct buddy *); int ret = 0; switch (opt) { case 'B': case 'b': { char *status_text; if (buddy->status == STATUS_ACTIVE) status_text = opt_get_str(OPT_TEXT_BUDDY_ACTIVE); else if (buddy->status == STATUS_AWAY) status_text = opt_get_str(OPT_TEXT_BUDDY_AWAY); else if (buddy->status == STATUS_IDLE) status_text = opt_get_str(OPT_TEXT_BUDDY_IDLE); else status_text = "%p?%x"; ret = xstrncpy(buf, status_text, len); break; } case 'N': case 'n': ret = xstrncpy(buf, buddy->name, len); break; case 'I': ret = fill_format_str(OPT_FORMAT_BLIST_IDLE, buf, len, buddy); break; case 'i': if (buddy->idle_time > 0) ret = fill_format_str(OPT_FORMAT_BLIST_IDLE, buf, len, buddy); break; case 'W': ret = fill_format_str(OPT_FORMAT_BLIST_WARN, buf, len, buddy); break; case 'w': if (buddy->warn_level > 0) ret = fill_format_str(OPT_FORMAT_BLIST_WARN, buf, len, buddy); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_blist_group_label(char opt, char *buf, size_t len, va_list ap) { struct bgroup *group = va_arg(ap, struct bgroup *); dlist_t *node = group->blist_line; int ret = 0; switch (opt) { case 'E': { char *expand_str; if (node != NULL) { struct slist_cell *cell = node->data; if (cell != NULL && cell->collapsed) { expand_str = opt_get_str(OPT_TEXT_BLIST_GROUP_COLLAPSED); } else { expand_str = opt_get_str(OPT_TEXT_BLIST_GROUP_EXPANDED); } } else { expand_str = opt_get_str(OPT_TEXT_BLIST_GROUP_COLLAPSED); } ret = xstrncpy(buf, expand_str, len); break; } case 'N': case 'n': ret = xstrncpy(buf, group->name, len); break; case 'T': case 't': ret = snprintf(buf, len, "%u", group->num_members); break; case 'O': case 'o': ret = snprintf(buf, len, "%u", group->num_online); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_file_transfer(char opt, char *buf, size_t len, va_list ap) { struct file_transfer *xfer = va_arg(ap, struct file_transfer *); struct pork_acct *acct = xfer->acct; int ret = 0; switch (opt) { /* Timestamp */ case 'T': ret = fill_format_str(OPT_FORMAT_TIMESTAMP, buf, len); break; /* Starting offset */ case 'O': ret = snprintf(buf, len, "%lld", xfer->start_offset); break; /* File transfer reference number */ case 'I': ret = snprintf(buf, len, "%u", xfer->refnum); break; /* Actual file name */ case 'N': ret = xstrncpy(buf, xfer->fname_local, len); break; /* Original (requested) file name */ case 'n': ret = xstrncpy(buf, xfer->fname_orig, len); break; /* Local IP address */ case 'L': ret = xstrncpy(buf, xfer->laddr_ip, len); break; /* Local hostname */ case 'l': ret = xstrncpy(buf, transfer_get_local_hostname(xfer), len); break; /* Remote IP address */ case 'F': ret = xstrncpy(buf, xfer->faddr_ip, len); break; /* Remote hostname */ case 'f': ret = xstrncpy(buf, transfer_get_remote_hostname(xfer), len); break; /* Local port */ case 'P': ret = snprintf(buf, len, "%d", xfer->lport); break; /* Remote port */ case 'p': ret = snprintf(buf, len, "%d", xfer->fport); break; /* Average transfer rate */ case 'R': ret = snprintf(buf, len, "%.04f", transfer_avg_speed(xfer)); break; /* File size */ case 'S': ret = snprintf(buf, len, "%lld", xfer->file_len - xfer->start_offset); break; /* Number of bytes sent */ case 's': ret = snprintf(buf, len, "%lld", xfer->bytes_sent); break; /* Time elapsed since the start of the transfer in seconds */ case 't': ret = snprintf(buf, len, "%.04f", transfer_time_elapsed(xfer)); break; /* Local user */ case 'U': ret = xstrncpy(buf, acct->username, len); break; /* Remote user */ case 'u': ret = xstrncpy(buf, xfer->peer_username, len); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int format_whois(char opt, char *buf, size_t len, va_list ap) { char *user = va_arg(ap, char *); u_int32_t warn_level = va_arg(ap, unsigned long int); u_int32_t idle_time = va_arg(ap, unsigned long int); u_int32_t online_since = va_arg(ap, unsigned long int); u_int32_t member_since = va_arg(ap, unsigned long int); char *info = va_arg(ap, char *); int ret = 0; switch (opt) { /* Timestamp */ case 'T': ret = fill_format_str(OPT_FORMAT_TIMESTAMP, buf, len); break; /* Name */ case 'N': case 'n': ret = xstrncpy(buf, user, len); break; /* Online since */ case 'S': case 's': ret = date_to_str(online_since, buf, len); break; /* Idle time */ case 'I': case 'i': ret = time_to_str(idle_time, buf, len); break; /* Member since */ case 'D': case 'd': ret = date_to_str(member_since, buf, len); break; /* Warn level */ case 'W': case 'w': ret = snprintf(buf, len, "%u", warn_level); break; /* Profile or away message */ case 'P': case 'A': if (info != NULL) { char *p = strchr(info, '\n'); if (p != NULL) ret = snprintf(buf, len, "\n%s", info); else ret = xstrncpy(buf, info, len); } break; /* ** Same as above, but don't prepend a newline if the profile or away ** msg contains one. */ case 'p': case 'a': ret = xstrncpy(buf, info, len); break; default: return (-1); } if (ret < 0 || (size_t) ret >= len) return (-1); return (0); } static int (*const format_handler[])(char, char *, size_t, va_list) = { format_msg_recv, /* OPT_FORMAT_ACTION_RECV */ format_msg_recv, /* OPT_FORMAT_ACTION_RECV_STATUS */ format_msg_send, /* OPT_FORMAT_ACTION_SEND */ format_msg_send, /* OPT_FORMAT_ACTION_SEND_STATUS */ format_blist_buddy_label, /* OPT_FORMAT_BLIST */ format_blist_group_label, /* OPT_FORMAT_BLIST_GROUP */ format_blist_idle, /* OPT_FORMAT_BLIST_IDLE */ format_blist_warn, /* OPT_FORMAT_BLIST_WARN */ format_chat_info, /* OPT_FORMAT_CHAT_CREATE */ format_chat_info, /* OPT_FORMAT_CHAT_IGNORE */ format_chat_info, /* OPT_FORMAT_CHAT_INVITE */ format_chat_info, /* OPT_FORMAT_CHAT_JOIN */ format_chat_info, /* OPT_FORMAT_CHAT_KICK */ format_chat_info, /* OPT_FORMAT_CHAT_LEAVE */ format_chat_info, /* OPT_FORMAT_CHAT_MODE */ format_chat_info, /* OPT_FORMAT_CHAT_NICK */ format_chat_info, /* OPT_FORMAT_CHAT_QUIT */ format_chat_recv, /* OPT_FORMAT_CHAT_RECV */ format_chat_recv, /* OPT_FORMAT_CHAT_RECV_ACTION */ format_chat_recv, /* OPT_FORMAT_CHAT_RECV_NOTICE */ format_chat_send, /* OPT_FORMAT_CHAT_SEND */ format_chat_send, /* OPT_FORMAT_CHAT_SEND_ACTION */ format_chat_send, /* OPT_FORMAT_CHAT_SEND_NOTICE */ format_chat_info, /* OPT_FORMAT_CHAT_TOPIC */ format_chat_info, /* OPT_FORMAT_CHAT_UNIGNORE */ format_file_transfer, /* OPT_FORMAT_FILE_CANCEL_LOCAL */ format_file_transfer, /* OPT_FORMAT_FILE_CANCEL_REMOTE */ format_file_transfer, /* OPT_FORMAT_FILE_LOST */ format_file_transfer, /* OPT_FORMAT_FILE_RECV_ACCEPT */ format_file_transfer, /* OPT_FORMAT_FILE_RECV_ASK */ format_file_transfer, /* OPT_FORMAT_FILE_RECV_COMPLETE */ format_file_transfer, /* OPT_FORMAT_FILE_RECV_RESUME */ format_file_transfer, /* OPT_FORMAT_FILE_SEND_ACCEPT */ format_file_transfer, /* OPT_FORMAT_FILE_SEND_ASK */ format_file_transfer, /* OPT_FORMAT_FILE_SEND_COMPLETE */ format_file_transfer, /* OPT_FORMAT_FILE_SEND_RESUME */ format_msg_recv, /* OPT_FORMAT_IM_RECV */ format_msg_recv, /* OPT_FORMAT_IM_RECV_AUTO */ format_msg_recv, /* OPT_FORMAT_IM_RECV_STATUS */ format_msg_send, /* OPT_FORMAT_IM_SEND */ format_msg_send, /* OPT_FORMAT_IM_SEND_AUTO */ format_msg_send, /* OPT_FORMAT_IM_SEND_STATUS */ format_msg_recv, /* OPT_FORMAT_NOTICE_RECV */ format_msg_recv, /* OPT_FORMAT_NOTICE_RECV_STATUS */ format_msg_send, /* OPT_FORMAT_NOTICE_SEND */ format_msg_send, /* OPT_FORMAT_NOTICE_SEND_STATUS */ format_status, /* OPT_FORMAT_STATUS */ format_status_activity, /* OPT_FORMAT_STATUS_ACTIVITY */ format_status, /* OPT_FORMAT_STATUS_CHAT */ format_status_held, /* OPT_FORMAT_STATUS_HELD */ format_status_idle, /* OPT_FORMAT_STATUS_IDLE */ format_status_timestamp, /* OPT_FORMAT_STATUS_TIMESTAMP */ format_status_typing, /* OPT_FORMAT_STATUS_TYPING */ format_status_warn, /* OPT_FORMAT_STATUS_WARN */ format_status_timestamp, /* OPT_FORMAT_TIMESTAMP */ format_warning, /* OPT_FORMAT_WARN */ format_whois, /* OPT_FORMAT_WHOIS_AWAY */ format_whois, /* OPT_FORMAT_WHOIS_IDLE */ format_whois, /* OPT_FORMAT_WHOIS_MEMBER */ format_whois, /* OPT_FORMAT_WHOIS_NAME */ format_whois, /* OPT_FORMAT_WHOIS_SIGNON */ format_whois, /* OPT_FORMAT_WHOIS_USERINFO */ format_whois, /* OPT_FORMAT_WHOIS_WARNLEVEL */ }; /* ** Do all appropriate '$' substitutions in format strings, except for ** $>, which must be handled after everything else. */ int fill_format_str(int type, char *buf, size_t len, ...) { va_list ap; char *format; size_t i = 0; int (*handler)(char, char *, size_t, va_list); format = opt_get_str(type); if (format == NULL) { debug("unknown format str: %d", type); return (-1); } --len; handler = format_handler[type - OPT_FORMAT_OFFSET]; while (*format != '\0' && i < len) { if (*format == FORMAT_VARIABLE) { char result[len + 1]; int ret_code; format++; result[0] = '\0'; va_start(ap, len); ret_code = handler(*format, result, sizeof(result), ap); va_end(ap); if (ret_code == 0) { /* ** The subsitution was successful. */ int ret; ret = xstrncpy(&buf[i], result, len - i); if (ret == -1) break; i += ret; } else if (ret_code == 1) { /* ** We should suppress the whole string. */ *buf = '\0'; break; } else { /* ** Unknown variable -- treat ** their FORMAT_VARIABLE as a literal. */ if (i > len - 2) break; buf[i++] = FORMAT_VARIABLE; buf[i++] = *format; } } else buf[i++] = *format; format++; } buf[i] = '\0'; return (i); } void format_apply_justification(char *buf, chtype *ch, size_t len) { char *p = buf; char *left = NULL; char *right = NULL; size_t len_left; chtype fill_char; while ((p = strchr(p, '$')) != NULL) { if (p[1] == '>') { left = buf; *p = '\0'; right = &p[2]; break; } p++; } len_left = plaintext_to_cstr(ch, len, buf, NULL); fill_char = ch[len_left - 1]; chtype_set(fill_char, ' '); /* ** If there's right-justified text, paste it on. */ if (right != NULL) { chtype ch_right[len]; size_t len_right; size_t diff; size_t i; size_t j; plaintext_to_cstr(ch_right, len, right, NULL); len_right = cstrlen(ch_right); /* ** If the right side won't fit, paste as much ** as possible, leaving at least one cell of whitespace. */ if (len_left + len_right >= len - 1) { int new_rlen; new_rlen = len_right - ((len_left + 1 + len_right) - (len - 1)); if (new_rlen < 0) len_right = 0; else len_right = new_rlen; } diff = len_left + (--len - (len_left + len_right)); i = len_left; while (i < diff) ch[i++] = fill_char; j = 0; while (i < len && j < len_right && ch_right[j] != 0) ch[i++] = ch_right[j++]; ch[i] = 0; } else if (len_left < len - 1) { /* ** If there's no right-justified text, pad out the ** string to its maximum length with blank characters (spaces) ** having the color/highlighting attributes of the last character ** in the string. */ size_t i = len_left; --len; while (i < len) ch[i++] = fill_char; ch[i] = 0; } } pork-0.99.8.1/src/pork_format.h0000644000175000017500000000077610234217325016173 0ustar ryanryan00000000000000/* ** pork_format.h - parsing format strings. ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_FORMAT_H #define __PORK_FORMAT_H #define FORMAT_VARIABLE '$' int fill_format_str(int type, char *buf, size_t len, ...); void format_apply_justification(char *buf, chtype *ch, size_t len); #endif pork-0.99.8.1/src/pork_color.c0000644000175000017500000001257410234217325016013 0ustar ryanryan00000000000000/* ** pork_color.c - color functions. ** Copyright (C) 2002-2004 Amber Adams ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include static inline int color_get_code(char code); static inline int color_get_highlighting(char code); /* ** Initialize the colors that we're going to be using. */ void color_init(void) { int i; int n = 1; int can_use_default; start_color(); can_use_default = use_default_colors(); for (i = 0 ; i < 8 ; i++) { int bgcolor = i; int j; if (bgcolor == COLOR_BLACK && can_use_default == OK) bgcolor = -1; for (j = 0 ; j < 8 ; j++) { if (n < COLOR_PAIRS) init_pair(n++, j, bgcolor); } } } /* ** Takes a color code string and makes it into attributes which are stored ** where attr points. Returns the length of the color code that was read, ** if one was read successfully. Returns -1 if an invalid color code was ** encountered. ** ** The basic form of the color code is [,], where ** foreground and background are one of the following: ** ** d = black D = bold black ** r = red R = bold red ** g = green G = bold green ** y = yellow Y = bold yellow ** b = blue B = bold blue ** m = magenta M = bold magenta ** c = cyan C = bold cyan ** w = white W = bold white ** ** In addition, the following codes are also available: ** x = clear all attributes ** ** Highlighting modes: ** 1 = bold 2 = reverse 3 = underline ** 4 = blink 5 = standout 6 = dim ** ** Highlighting modes, unlike colors, cascade. For example, %b%1%2 is ** bold and reverse blue; %1%2%b is just blue. ** ** Highlighting modes can be removed with %-. For example, ** %1this%-1 is a test will display test as bold and the rest of the ** text non-bold. */ int color_parse_code(const char *code, attr_t *attr) { int fgcol; int bgcol = 0; int ret = 1; attr_t new_attr = 0; if (*code == 'x') { *attr = 0; return (ret); } if (isdigit(*code)) { int highlighting; highlighting = color_get_highlighting(*code); if (highlighting == -1) return (-1); *attr |= highlighting; return (ret); } if (*code == '-' && isdigit(code[1])) { int highlighting; highlighting = color_get_highlighting(code[1]); if (highlighting == -1) return (-1); *attr &= ~highlighting; return (2); } fgcol = color_get_code(*code); if (fgcol == -1) return (-1); if (isupper(*code)) new_attr |= A_BOLD; if (code[1] == ',') { bgcol = color_get_code(code[2]); if (bgcol == -1) bgcol = 0; else { /* ** If a black background is specifically requested, ** force it by swapping the foreground and background colors ** and setting the reverse highlighting attribute. */ if (tolower(code[2]) == 'd') { bgcol = fgcol; fgcol = 0; new_attr |= A_REVERSE; } ret = 3; } } new_attr |= COLOR_PAIR((bgcol * 8 + fgcol) + 1); *attr = new_attr; return (ret); } static inline int color_get_code(char code) { static const char codes[] = { 4, 6, 0, -1, -1, 2, -1, -1, -1, -1, -1, 5, -1, -1, 5, -1, 1, -1, -1, -1, -1, 7, -1, 3 }; code = tolower(code); if (code < 'b' || code > 'y') return (-1); return ((int) codes[code - 'b']); } static inline int color_get_highlighting(char code) { static const int colors[] = { A_BOLD, A_REVERSE, A_UNDERLINE, A_BLINK, A_STANDOUT, A_DIM }; if (code < '1' || code > '6') return (-1); return (colors[code - '1']); } int color_get_str(attr_t attr, char *buf, size_t len) { int num; int fgcol; int bgcol; char c; int ret; int i = 0; static const char color_codes[] = "drgybmcw"; num = PAIR_NUMBER(attr) - 1; fgcol = num % 8; bgcol = num / 8; c = color_codes[fgcol]; if (attr & A_BOLD) c = toupper(c); ret = snprintf(&buf[i], len - i, "%%%c", c); if (ret < 0 || (size_t) ret >= len - i) return (-1); i += ret; if (bgcol != 0) { ret = snprintf(&buf[i], len - i, ",%c", color_codes[bgcol]); if (ret < 0 || (size_t) ret >= len - i) return (-1); i += ret; } if (attr & A_REVERSE) { ret = snprintf(&buf[i], len - i, "%%2"); if (ret < 0 || (size_t) ret >= len - i) return (-1); i += ret; } if (attr & A_UNDERLINE) { ret = snprintf(&buf[i], len - i, "%%3"); if (ret < 0 || (size_t) ret >= len - i) return (-1); i += ret; } if (attr & A_BLINK) { ret = snprintf(&buf[i], len - i, "%%4"); if (ret < 0 || (size_t) ret >= len - i) return (-1); i += ret; } if (attr & A_STANDOUT) { ret = snprintf(&buf[i], len - i, "%%5"); if (ret < 0 || (size_t) ret >= len - i) return (-1); i += ret; } if (attr & A_DIM) { ret = snprintf(&buf[i], len - i, "%%6"); if (ret < 0 || (size_t) ret >= len - i) return (-1); i += ret; } return (0); } char *color_quote_codes(const char *str) { size_t len; size_t i = 0; char *p; if (strchr(str, '%') == NULL) return (xstrdup(str)); len = (strlen(str) * 3) / 2; p = xmalloc(len); --len; while (*str != '\0' && i < len) { if (*str == '%') { p[i++] = '%'; if (i >= len) break; } p[i++] = *str++; } p[i] = '\0'; return (p); } pork-0.99.8.1/src/pork_color.h0000644000175000017500000000107610234217325016013 0ustar ryanryan00000000000000/* ** pork_color.h - color functions. ** Copyright (C) 2002-2004 Amber Adams ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_COLOR_H #define __PORK_COLOR_H void color_init(void); int color_parse_code(const char *code, attr_t *attr); int color_get_str(attr_t attr, char *buf, size_t len); char *color_quote_codes(const char *str); #endif pork-0.99.8.1/src/missing/0000755000175000017500000000000010236222746015143 5ustar ryanryan00000000000000pork-0.99.8.1/src/missing/pork_missing.h0000644000175000017500000000354110234301511020005 0ustar ryanryan00000000000000/* ** pork_missing.h ** Copyright (C) 2003-2004 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_MISSING_H #define __PORK_MISSING_H #ifndef HAVE_STRSEP char *strsep(char **str, char *delim); #endif #ifndef HAVE_VSNPRINTF int vsnprintf(char *str, size_t n, char *fmt, va_list ap); #endif #ifndef HAVE_SNPRINTF int snprintf(char *str, size_t n, char const *fmt, ...); #endif #ifndef HAVE_INET_NTOP const char *inet_ntop(int af, const void *src, char *dst, size_t len); #endif #ifndef EAI_NODATA # define EAI_NODATA 1 # define EAI_MEMORY 2 #endif #ifndef AI_PASSIVE # define AI_PASSIVE 1 # define AI_CANONNAME 2 #endif #ifndef NI_NUMERICHOST # define NI_NUMERICHOST 2 # define NI_NAMEREQD 4 # define NI_NUMERICSERV 8 #endif #if !defined HAVE_STRUCT_ADDRINFO || !defined HAVE_GETNAMEINFO struct sockaddr; #endif #ifndef HAVE_STRUCT_ADDRINFO struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; char *ai_canonname; struct sockaddr *ai_addr; struct addrinfo *ai_next; }; #endif #ifndef HAVE_GETADDRINFO int getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res); #endif #ifndef HAVE_GAI_STRERROR char *gai_strerror(int ecode); #endif #ifndef HAVE_FREEADDRINFO void freeaddrinfo(struct addrinfo *ai); #endif #ifndef HAVE_GETNAMEINFO int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags); #endif #ifndef HAVE_VASPRINTF int vasprintf(char **result, const char *format, va_list args); #endif #ifndef NI_MAXSERV # define NI_MAXSERV 32 #endif #ifndef NI_MAXHOST # define NI_MAXHOST 1025 #endif #endif pork-0.99.8.1/src/missing/vasprintf.c0000644000175000017500000000530710234302551017317 0ustar ryanryan00000000000000/* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. Copyright (C) 1994 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Libiberty 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #ifndef HAVE_VASPRINTF #include #include #include #include #include static int int_vasprintf(char **result, char *format, va_list args) { char *p = format; /* ** Add one to make sure that it is never zero, which might cause malloc ** to return NULL. */ int total_width = strlen(format) + 1; va_list ap; memcpy(&ap, args, sizeof(va_list)); while (*p != '\0') { if (*p++ == '%') { while (strchr("-+ #0", *p)) ++p; if (*p == '*') { ++p; total_width += abs(va_arg(ap, int)); } else total_width += strtoul(p, &p, 10); if (*p == '.') { ++p; if (*p == '*') { ++p; total_width += abs(va_arg(ap, int)); } else total_width += strtoul(p, &p, 10); } while (strchr("hlL", *p)) ++p; /* ** Should be big enough for any format ** specifier except %s and floats. */ total_width += 30; switch (*p) { case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': case 'c': (void) va_arg(ap, int); break; case 'f': case 'e': case 'E': case 'g': case 'G': (void) va_arg(ap, double); /* ** Since an ieee double can have an exponent of 307, ** we'll make the buffer wide enough to cover ** the gross case. */ total_width += 307; break; case 's': total_width += strlen(va_arg(ap, char *)); break; case 'p': case 'n': (void) va_arg(ap, char *); break; } } } *result = malloc(total_width); if (*result != NULL) return (vsprintf(*result, format, args)); else return (0); } int vasprintf(char **strp, const char *fmt, va_list ap) { return (int_vasprintf(strp, (char *) fmt, ap)); } #endif pork-0.99.8.1/src/missing/getopt.c0000644000175000017500000002506710234217327016620 0ustar ryanryan00000000000000/* ** Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 ** Free Software Foundation, Inc. ** This file is part of the GNU C Library. ** ** The GNU C Library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** The GNU C Library 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 ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with the GNU C Library; if not, write to the Free ** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ** 02111-1307 USA. ** ** Code cleanup Copyright (C) 2001-2004 Ryan McCabe */ #include #ifndef HAVE_GETOPT_LONG #include #include #include #include char *optarg; int optind = 1; int __getopt_initialized; static char *nextchar; int opterr = 1; int optopt = '?'; static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; static char *posixly_correct; static char *my_index(const char *str, int chr) { while (*str) { if (*str == chr) return ((char *) str); str++; } return (0); } static int first_nonopt; static int last_nonopt; #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') static void exchange(char **argv) { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { int len = middle - bottom; int i; for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } top -= len; } else { int len = top - middle; int i; for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } bottom += len; } } first_nonopt += (optind - last_nonopt); last_nonopt = optind; } static const char *_getopt_initialize( int argc, char *const *argv, const char *optstring) { (void) argc; (void) argv; first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv("POSIXLY_CORRECT"); if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; return (optstring); } int _getopt_internal( int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only) { int print_errors = opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return (-1); optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; optstring = _getopt_initialize(argc, argv, optstring); __getopt_initialized = 1; } if (nextchar == NULL || *nextchar == '\0') { if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { if (first_nonopt != last_nonopt && last_nonopt != optind) exchange((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } if (optind != argc && !strcmp(argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } if (optind == argc) { if (first_nonopt != last_nonopt) optind = first_nonopt; return (-1); } if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return (-1); optarg = argv[optind++]; return (1); } nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) ; for (p = longopts, option_index = 0; p->name; p++, option_index++) { if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen(p->name)) { pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) { ambig = 1; } } } if (ambig && !exact) { if (print_errors) { fprintf(stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[optind]); } nextchar += strlen(nextchar); optind++; optopt = 0; return ('?'); } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { if (argv[optind - 1][1] == '-') { fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); } else { fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[optind - 1][0], pfound->name); } } nextchar += strlen(nextchar); optopt = pfound->val; return ('?'); } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { fprintf(stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); } nextchar += strlen(nextchar); optopt = pfound->val; return (optstring[0] == ':' ? ':' : '?'); } } nextchar += strlen(nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return (0); } return (pfound->val); } if (!long_only || argv[optind][1] == '-' || my_index(optstring, *nextchar) == NULL) { if (print_errors) { if (argv[optind][1] == '-') { fprintf(stderr, "%s: unrecognized option `--%s'\n", argv[0], nextchar); } else { fprintf(stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar); } } nextchar = (char *) ""; optind++; optopt = 0; return ('?'); } } { char c = *nextchar++; char *temp = my_index(optstring, c); if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (print_errors) { if (posixly_correct) { fprintf(stderr, "%s: illegal option -- %c\n", argv[0], c); } else { fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c); } } optopt = c; return ('?'); } if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; if (*nextchar != '\0') { optarg = nextchar; optind++; } else if (optind == argc) { if (print_errors) { fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return (c); } else optarg = argv[optind++]; for (nextchar = nameend = optarg ; *nameend && *nameend != '=' ; nameend++) { ; } for (p = longopts, option_index = 0 ; p->name; p++, option_index++) { if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen(p->name)) { pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { pfound = p; indfound = option_index; } else ambig = 1; } } if (ambig && !exact) { if (print_errors) { fprintf(stderr, "%s: option `-W %s' is ambiguous\n", argv[0], argv[optind]); } nextchar += strlen(nextchar); optind++; return ('?'); } if (pfound != NULL) { option_index = indfound; if (*nameend) { if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { fprintf(stderr, "%s option `-W %s' doesn't allow an argument\n", argv[0], pfound->name); } nextchar += strlen(nextchar); return ('?'); } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { fprintf(stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); } nextchar += strlen(nextchar); return (optstring[0] == ':' ? ':' : '?'); } } nextchar += strlen(nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return (0); } return (pfound->val); } nextchar = NULL; return ('W'); } if (temp[1] == ':') { if (temp[2] == ':') { if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { if (*nextchar != '\0') { optarg = nextchar; optind++; } else if (optind == argc) { if (print_errors) { fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else optarg = argv[optind++]; nextchar = NULL; } } return (c); } } int getopt(int argc, char *const *argv, const char *optstring) { return (_getopt_internal(argc, argv, optstring, NULL, NULL, 0)); } int getopt_long(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return (_getopt_internal(argc, argv, options, long_options, opt_index, 0)); } int getopt_long_only( int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return (_getopt_internal(argc, argv, options, long_options, opt_index, 1)); } #endif pork-0.99.8.1/src/missing/Makefile.am0000644000175000017500000000042610234301511017163 0ustar ryanryan00000000000000INCLUDES = -I../../src AM_CFLAGS = $(DEBUG_CFLAGS) $(PERL_CFLAGS) noinst_LIBRARIES = libmissing.a libmissing_a_SOURCES = \ inet_ntop.c \ ipv6_missing.c \ getopt.c \ snprintf.c \ strsep.c \ vasprintf.c noinst_HEADERS = \ getopt_missing.h \ pork_missing.h pork-0.99.8.1/src/missing/Makefile.in0000644000175000017500000003122110236222653017204 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SOURCES = $(libmissing_a_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = src/missing DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libmissing_a_AR = $(AR) $(ARFLAGS) libmissing_a_LIBADD = am_libmissing_a_OBJECTS = inet_ntop.$(OBJEXT) ipv6_missing.$(OBJEXT) \ getopt.$(OBJEXT) snprintf.$(OBJEXT) strsep.$(OBJEXT) \ vasprintf.$(OBJEXT) libmissing_a_OBJECTS = $(am_libmissing_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/inet_ntop.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ipv6_missing.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/snprintf.Po ./$(DEPDIR)/strsep.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/vasprintf.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libmissing_a_SOURCES) DIST_SOURCES = $(libmissing_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ INCLUDES = -I../../src AM_CFLAGS = $(DEBUG_CFLAGS) $(PERL_CFLAGS) noinst_LIBRARIES = libmissing.a libmissing_a_SOURCES = \ inet_ntop.c \ ipv6_missing.c \ getopt.c \ snprintf.c \ strsep.c \ vasprintf.c noinst_HEADERS = \ getopt_missing.h \ pork_missing.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/missing/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/missing/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmissing.a: $(libmissing_a_OBJECTS) $(libmissing_a_DEPENDENCIES) -rm -f libmissing.a $(libmissing_a_AR) libmissing.a $(libmissing_a_OBJECTS) $(libmissing_a_LIBADD) $(RANLIB) libmissing.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_ntop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipv6_missing.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strsep.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/src/missing/inet_ntop.c0000644000175000017500000000123410234217327017303 0ustar ryanryan00000000000000#include #ifndef HAVE_INET_NTOP #include #include #include #include #include #include #include #include #ifndef INET_ADDRSTRLEN # define INET_ADDRSTRLEN 16 #endif /* ** This is an IPv4 only inet_ntop(3) replacement function. */ const char *inet_ntop(int af, const void *src, char *dst, size_t len) { const char *tmp = src; if (af != AF_INET) { errno = EAFNOSUPPORT; return (NULL); } if (len < INET_ADDRSTRLEN) { errno = ENOSPC; return (NULL); } snprintf(dst, len, "%u.%u.%u.%u", tmp[0], tmp[1], tmp[2], tmp[3]); return (dst); } #endif pork-0.99.8.1/src/missing/strsep.c0000644000175000017500000000333410234217327016627 0ustar ryanryan00000000000000/* Copyright (C) 1992, 93, 96, 97, 98, 99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include #ifndef HAVE_STRSEP #include #include char *strsep(char **stringp, const char *delim) { char *begin, *end; begin = *stringp; if (begin == NULL) return NULL; /* A frequent case is when the delimiter string contains only one character. Here we don't need to call the expensive `strpbrk' function and instead work using `strchr'. */ if (delim[0] == '\0' || delim[1] == '\0') { char ch = delim[0]; if (ch == '\0') end = NULL; else { if (*begin == ch) end = begin; else if (*begin == '\0') end = NULL; else end = strchr(begin + 1, ch); } } else /* Find the end of the token. */ end = strpbrk(begin, delim); if (end) { /* Terminate the token and set *STRINGP past NUL character. */ *end++ = '\0'; *stringp = end; } else /* No more delimiters; this is the last token. */ *stringp = NULL; return begin; } #endif pork-0.99.8.1/src/missing/getopt_missing.h0000644000175000017500000000364010234217327020347 0ustar ryanryan00000000000000/* ** getopt_missing.h - Declarations for getopt. ** ** Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. ** This file is part of the GNU C Library. ** ** The GNU C Library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** The GNU C Library 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 ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with the GNU C Library; if not, write to the Free ** Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ** 02111-1307 USA. ** ** Cleanup Copyright (C) 2001-2004 Ryan McCabe */ #ifndef _GETOPT_MISSING_H #define _GETOPT_MISSING_H # ifndef HAVE_GETOPT_LONG extern char *optarg; extern int optind; extern int opterr; extern int optopt; struct option { const char *name; int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 int getopt(int ___argc, char *const *___argv, const char *__shortopts); int getopt_long(int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind); int getopt_long_only( int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind); int _getopt_internal( int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); # endif #endif pork-0.99.8.1/src/missing/snprintf.c0000644000175000017500000000775010234217330017152 0ustar ryanryan00000000000000/* * Revision 12: http://theos.com/~deraadt/snprintf.c * * Copyright (c) 1997 Theo de Raadt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) #include #include #include #include #include #include #include #if __STDC__ #include #include #else #include #endif #include #ifndef roundup #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) #endif static int pgsize; static char *curobj; static sigjmp_buf bail; #define EXTRABYTES 2 /* XXX: why 2? you don't want to know */ #ifndef HAVE_GETPAGESIZE int getpagesize() { #ifdef EXEC_PAGESIZE return EXEC_PAGESIZE; #else /* !EXEC_PAGESIZE */ # ifdef NBPG # ifndef CLSIZE # define CLSIZE 1 # endif /* No CLSIZE */ return NBPG * CLSIZE; # else /* !NBPG */ return NBPC; # endif /* NBPG */ #endif /* EXEC_PAGESIZE */ } #endif /* HAVE_GETPAGESIZE */ static char * msetup(str, n) char *str; size_t n; { char *e; if (n == 0) return NULL; if (pgsize == 0) pgsize = getpagesize(); curobj = (char *)malloc(n + EXTRABYTES + pgsize * 2); if (curobj == NULL) return NULL; e = curobj + n + EXTRABYTES; e = (char *)roundup((unsigned long)e, pgsize); if (mprotect(e, pgsize, PROT_NONE) == -1) { free(curobj); curobj = NULL; return NULL; } e = e - n - EXTRABYTES; *e = '\0'; return (e); (void) str; } static void mcatch() { siglongjmp(bail, 1); } static void mcleanup(str, n, p) char *str; size_t n; char *p; { strncpy(str, p, n-1); str[n-1] = '\0'; if (mprotect((caddr_t)(p + n + EXTRABYTES), pgsize, PROT_READ|PROT_WRITE|PROT_EXEC) == -1) mprotect((caddr_t)(p + n + EXTRABYTES), pgsize, PROT_READ|PROT_WRITE); free(curobj); } #if !defined(HAVE_VSNPRINTF) int vsnprintf(str, n, fmt, ap) char *str; size_t n; char *fmt; va_list ap; { struct sigaction osa, nsa; char *p; int ret = n + 1; /* if we bail, indicated we overflowed */ memset(&nsa, 0, sizeof nsa); nsa.sa_handler = mcatch; sigemptyset(&nsa.sa_mask); p = msetup(str, n); if (p == NULL) { *str = '\0'; return 0; } if (sigsetjmp(bail, 1) == 0) { if (sigaction(SIGSEGV, &nsa, &osa) == -1) { mcleanup(str, n, p); return (0); } ret = vsprintf(p, fmt, ap); } mcleanup(str, n, p); (void) sigaction(SIGSEGV, &osa, NULL); return (ret); } #endif /* !defined(HAVE_VSNPRINTF) */ #if !defined(HAVE_SNPRINTF) int #if __STDC__ snprintf(char *str, size_t n, char const *fmt, ...) #else snprintf(str, n, fmt, va_alist) char *str; size_t n; char *fmt; va_dcl #endif { va_list ap; #if __STDC__ va_start(ap, fmt); #else va_start(ap); #endif return (vsnprintf(str, n, fmt, ap)); va_end(ap); } #endif /* !defined(HAVE_SNPRINTF) */ #endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */ pork-0.99.8.1/src/missing/ipv6_missing.c0000644000175000017500000001002510234217330017711 0ustar ryanryan00000000000000/* ** ipv6.c - Compatibility functions. ** ** This file includes getaddrinfo(), freeaddrinfo() and gai_strerror(). ** These funtions are defined in rfc2133. ** ** But these functions are not implemented correctly. The minimum subset ** is implemented for ssh use only. For exapmle, this routine assumes ** that ai_family is AF_INET. Don't use it for another purpose. ** ** This code was taken from OpenSSH. It is distributed ** under a two-term BSD license. ** ** Modifications are Copyright (C) 2001-2004 Ryan McCabe */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef HAVE_GAI_STRERROR char *gai_strerror(int ecode) { switch (ecode) { case EAI_NODATA: return ("no address associated with hostname."); case EAI_MEMORY: return ("memory allocation failure."); default: return ("unknown error."); } } #endif #ifndef HAVE_FREEADDRINFO void freeaddrinfo(struct addrinfo *ai) { while (ai != NULL) { struct addrinfo *next = ai->ai_next; free(ai); ai = next; } } #endif #ifndef HAVE_GETADDRINFO static struct addrinfo *malloc_ai(int port, in_addr_t addr) { struct addrinfo *ai; ai = malloc(sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); if (ai == NULL) return (NULL); memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); ai->ai_addr = (struct sockaddr *) (ai + 1); ai->ai_addrlen = sizeof(struct sockaddr_in); ai->ai_addr->sa_family = ai->ai_family = AF_INET; ((struct sockaddr_in *) (ai)->ai_addr)->sin_port = port; ((struct sockaddr_in *) (ai)->ai_addr)->sin_addr.s_addr = addr; return (ai); } int getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res) { struct addrinfo *cur, *prev = NULL; struct hostent *hp; struct in_addr in; int i, port; if (servname) port = htons(atoi(servname)); else port = 0; if (hints != NULL && hints->ai_flags & AI_PASSIVE) { *res = malloc_ai(port, htonl(0x00000000)); if (*res != NULL) return (0); else return (EAI_MEMORY); } if (hostname == NULL) { *res = malloc_ai(port, htonl(0x7f000001)); if (*res != NULL) return (0); else return (EAI_MEMORY); } if (inet_aton(hostname, &in) != 0) { *res = malloc_ai(port, in.s_addr); if (*res != NULL) return (0); else return (EAI_MEMORY); } hp = gethostbyname(hostname); if (hp != NULL && hp->h_name != NULL && hp->h_name[0] != 0 && hp->h_addr_list[0] != NULL) { for (i = 0 ; hp->h_addr_list[i] ; i++) { cur = malloc_ai(port, ((struct in_addr *) hp->h_addr_list[i])->s_addr); if (cur == NULL) { if (*res != NULL) freeaddrinfo(*res); return (EAI_MEMORY); } if (prev != NULL) prev->ai_next = cur; else *res = cur; prev = cur; } return (0); } return (EAI_NODATA); } #endif #ifndef HAVE_GETNAMEINFO int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) { struct sockaddr_in *sin4 = (struct sockaddr_in *) sa; struct hostent *hp; char tmpserv[16]; (void) salen; if (serv != NULL) { snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin4->sin_port)); if (strlen(tmpserv) >= servlen) return (EAI_MEMORY); else strcpy(serv, tmpserv); } if (host != NULL) { if (flags & NI_NUMERICHOST) { if (strlen(inet_ntoa(sin4->sin_addr)) >= hostlen) return (EAI_MEMORY); strcpy(host, inet_ntoa(sin4->sin_addr)); return (0); } else { hp = gethostbyaddr((char *) &sin4->sin_addr, sizeof(struct in_addr), AF_INET); if (hp == NULL) return (EAI_NODATA); if (strlen(hp->h_name) >= hostlen) return (EAI_MEMORY); strcpy(host, hp->h_name); return (0); } } return (0); } #endif pork-0.99.8.1/src/pork_swindow.c0000644000175000017500000005305310234301511016353 0ustar ryanryan00000000000000/* ** pork_swindow.c - an ncurses scrolling window widget ** Copyright (C) 2002-2005 Ryan McCabe ** ** I've tried to keep this code independent from the rest of the program ** so that it might be useful outside of this particular program. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void swindow_scroll(struct swindow *swindow, int n); static int swindow_print_msg_wr(struct swindow *swindow, struct imsg *imsg, u_int32_t y, u_int32_t x, u_int32_t firstline, u_int32_t lastline) { u_int32_t len = imsg->len; chtype *ch = imsg->text; u_int32_t lines = 0; u_int32_t lines_printed = 0; chtype *end = &ch[len - 1]; int add = 0; chtype cont_char = (chtype) swindow->wordwrap_char; if (swindow->cols == 1) cont_char = 0; while (*ch != 0) { chtype *p; p = &ch[swindow->cols - 1 - add]; if (p >= end) { ++lines; if (lines <= lastline) { mvwputstr(swindow->win, y + lines_printed, add, ch); ++lines_printed; } break; } if (chtype_get(p[0]) != ' ' && chtype_get(p[1]) != ' ') { chtype *temp = p; do { temp--; if (temp <= ch) goto out; } while (chtype_get(*temp) != ' '); p = temp; } out: ++lines; if (lines >= firstline) { if (lines > lastline) break; mvwputnstr(swindow->win, y + lines_printed, add, ch, p - ch + 1); ++lines_printed; } if (cont_char != 0) { mvwaddch(swindow->win, y + lines_printed, 0, cont_char); add = 1; } ch = &p[1]; } return (lines_printed); } static int swindow_print_msg( struct swindow *swindow, struct imsg *imsg, u_int32_t y, u_int32_t x, u_int32_t firstline, u_int32_t lastline) { chtype *msg; if (swindow->wordwrap) return (swindow_print_msg_wr(swindow, imsg, y, x, firstline, lastline)); if (lastline < firstline) return (-1); msg = imsg_partial(swindow, imsg, firstline); mvwputnstr(swindow->win, y, x, msg, min(swindow->rows * swindow->cols, (lastline - firstline + 1) * swindow->cols)); return (0); } /* ** Initialize a new window. */ int swindow_init( struct swindow *swindow, WINDOW *win, u_int32_t rows, u_int32_t cols, pref_val_t *wopt) { set_default_win_opts(win); memset(swindow, 0, sizeof(*swindow)); swindow->win = win; swindow->cols = cols; swindow->rows = rows; swindow->bottom_blank = rows; swindow->visible = 0; swindow->dirty = 1; swindow->scrollbuf_max = wopt_get_int(wopt, WOPT_SCROLLBUF_LEN); swindow->scroll_on_input = wopt_get_bool(wopt, WOPT_SCROLL_ON_INPUT); swindow->scroll_on_output = wopt_get_bool(wopt, WOPT_SCROLL_ON_OUTPUT); swindow->timestamp = wopt_get_bool(wopt, WOPT_TIMESTAMP); swindow->wordwrap = wopt_get_bool(wopt, WOPT_WORDWRAP); swindow->wordwrap_char = wopt_get_char(wopt, WOPT_WORDWRAP_CHAR); swindow->logged = wopt_get_bool(wopt, WOPT_LOG); swindow->logfile = wopt_get_str(wopt, WOPT_LOGFILE); swindow->activity_type = wopt_get_int(wopt, WOPT_ACTIVITY_TYPES); swindow->log_type = wopt_get_int(wopt, WOPT_LOG_TYPES); if (swindow->scrollbuf_max < rows) swindow->scrollbuf_max = rows; if (swindow->logged) swindow_set_log(swindow); return (0); } /* ** We don't want the window scrolling when something is written to ** (max_col - 1, max_rows - 1), so scrolling is turned off by default. ** When we need to scroll the window, enable it, scroll the window, then ** disable it. */ static inline void swindow_scroll(struct swindow *swindow, int n) { scrollok(swindow->win, TRUE); wscrl(swindow->win, n); scrollok(swindow->win, FALSE); swindow->dirty = 1; } /* ** Prune the scroll buffer so that the number of total ** messages is not greater than swindow->scrollbuf_max. */ void swindow_prune(struct swindow *swindow) { int num = swindow->scrollbuf_len - swindow->scrollbuf_max; dlist_t *cur = swindow->scrollbuf_end; u_int32_t serial_top; u_int32_t serial_bot; serial_top = ((struct imsg *) swindow->scrollbuf_top->data)->serial; serial_bot = ((struct imsg *) swindow->scrollbuf_bot->data)->serial; while (cur != NULL && num > 0) { struct imsg *imsg = cur->data; dlist_t *next = cur->prev; /* Don't prune anything that's still on the screen */ if (imsg->serial >= serial_top && imsg->serial <= serial_bot) break; swindow->scrollbuf_lines -= imsg->lines; swindow->scrollbuf_len--; num--; free(imsg->text); free(imsg); dlist_remove(swindow->scrollbuf, cur); cur = next; } swindow->scrollbuf_end = cur; } /* ** Adjust the swindow->scrollbuf_top pointer so that it's pointing to ** the line that's "n" lines up from the current top of the screen. */ static void swindow_adjust_top(struct swindow *swindow, u_int32_t n) { dlist_t *cur = swindow->scrollbuf_top; while (1) { struct imsg *imsg = cur->data; u_int32_t visible_lines = imsg->lines; if (swindow->top_hidden != 0) { visible_lines -= swindow->top_hidden; swindow->top_hidden = 0; } if (visible_lines == n) { swindow->top_hidden = 0; cur = cur->prev; break; } if (visible_lines > n) { swindow->top_hidden = imsg->lines - (visible_lines - n); break; } n -= visible_lines; cur = cur->prev; } swindow->scrollbuf_top = cur; } /* ** Recalculate the number of lines for each message. ** ** This should be called when the window is resized ** and when timestamps are turned on or off. */ static void swindow_recalculate(struct swindow *swindow, u_int32_t old_rows, u_int32_t old_cols) { dlist_t *cur = swindow->scrollbuf; u_int32_t total_lines = 0; struct imsg *imsg_top; u_int32_t old_top; if (swindow->scrollbuf_top == NULL) { swindow->bottom_blank = swindow->rows; return; } imsg_top = swindow->scrollbuf_top->data; old_top = imsg_top->lines; while (cur != NULL) { struct imsg *imsg = cur->data; imsg->lines = imsg_lines(swindow, imsg); total_lines += imsg->lines; cur = cur->next; } swindow->scrollbuf_lines = total_lines; /* ** If the number of rows needed to display the top line has ** changed, the number of hidden rows for the top message ** has to be adjusted. ** ** The goal is for the line that was on the top of the display ** before the resize to stay there. */ if (swindow->top_hidden != 0 && imsg_top->lines != old_top) swindow->top_hidden = (old_cols * swindow->top_hidden) / swindow->cols; } /* ** Called when the dimensions of the window have changed. */ void swindow_resize(struct swindow *swindow, u_int32_t new_row, u_int32_t new_col) { u_int32_t old_rows = swindow->rows; u_int32_t old_cols = swindow->cols; int ret; /* ** This seems to be necessary to prevent some funny stuff ** from happening. */ wclear(swindow->win); wnoutrefresh(swindow->win); ret = wresize(swindow->win, new_row, new_col); if (ret == -1) debug("wresize: %d (%u,%u)", ret, new_row, new_col); swindow->rows = new_row; swindow->cols = new_col; if (swindow->scrollbuf_max < swindow->rows) swindow->scrollbuf_max = swindow->rows; swindow_recalculate(swindow, old_rows, old_cols); swindow_redraw(swindow); } inline int swindow_refresh(struct swindow *swindow) { if (swindow->visible && swindow->dirty) { wnoutrefresh(swindow->win); swindow->dirty = 0; return (1); } return (0); } /* ** Redraw the window keeping the line that's currently ** at the top of the screen in place. */ void swindow_redraw(struct swindow *swindow) { dlist_t *cur = swindow->scrollbuf_top; u_int32_t curs_pos = 0; if (cur == NULL) return; /* ** If part of the top message is scrolled off ** the top, print the visible part and advance ** the pointer to the next message. */ if (swindow->top_hidden != 0) { struct imsg *imsg = cur->data; curs_pos += imsg->lines - swindow->top_hidden; if (curs_pos > swindow->rows) { swindow->bottom_blank = 0; swindow->bottom_hidden = curs_pos - swindow->rows; swindow->scrollbuf_bot = cur; swindow_print_msg(swindow, imsg, 0, 0, swindow->top_hidden + 1, curs_pos + swindow->rows); } else swindow_print_msg(swindow, imsg, 0, 0, swindow->top_hidden + 1, -1); cur = cur->prev; } while (cur != NULL && curs_pos < swindow->rows) { struct imsg *imsg = cur->data; if (curs_pos + imsg->lines > swindow->rows) { swindow->scrollbuf_bot = cur; swindow->bottom_blank = 0; swindow->bottom_hidden = imsg->lines - (swindow->rows - curs_pos); swindow_print_msg(swindow, imsg, curs_pos, 0, 1, swindow->rows - curs_pos); break; } swindow_print_msg(swindow, imsg, curs_pos, 0, 1, -1); curs_pos += imsg->lines; if (cur->prev == NULL) { swindow->scrollbuf_bot = cur; swindow->bottom_blank = swindow->rows - curs_pos; swindow->bottom_hidden = 0; swindow->held = 0; } else if (curs_pos == swindow->rows) { swindow->scrollbuf_bot = cur; swindow->bottom_hidden = 0; swindow->bottom_blank = 0; } cur = cur->prev; } swindow->dirty = 1; } /* ** It's the caller's responsibility to make sure there's nothing ** funny in the message that's being added -- things like tabs ** and other control/non-printing characters will mess up the ** display. */ int swindow_add(struct swindow *swindow, struct imsg *imsg, u_int32_t msgtype) { u_int32_t msg_line_start = 1; dlist_t *old_head = swindow->scrollbuf; int y_pos; /* ** If the window is scrolled up, and the scroll on ** output flag is set, scroll to the bottom of the ** window before doing anything else. */ if ((swindow->scrollbuf_bot != swindow->scrollbuf || swindow->bottom_hidden != 0) && swindow->scroll_on_output) { swindow_scroll_to_end(swindow); } if (swindow->logged && (swindow->log_type & msgtype)) { struct iovec wvec[2]; char *plaintext; plaintext = cstr_to_plaintext(imsg->text, imsg->len); wvec[0].iov_base = plaintext; wvec[0].iov_len = imsg->len; wvec[1].iov_base = "\n"; wvec[1].iov_len = 1; if (writev(swindow->log_fd, wvec, 2) != (int) imsg->len + 1) { screen_err_msg("Error writing logfile: %s", strerror(errno)); } free(plaintext); } swindow->scrollbuf = dlist_add_head(swindow->scrollbuf, imsg); swindow->scrollbuf_len++; swindow->scrollbuf_lines += imsg->lines; /* ** If this is the first message in the window, save a pointer ** to it for use with the scrolling routines. */ if (old_head == NULL) { swindow->scrollbuf_end = swindow->scrollbuf; swindow->scrollbuf_top = swindow->scrollbuf; } /* ** If the window is scrolled back, but the scroll ** on output flag is not set, there's nothing left ** to do here. */ if (old_head != swindow->scrollbuf_bot) { swindow->held += imsg->lines; if (swindow->activity_type & msgtype) swindow->activity = 1; return (0); } /* ** The window is scrolling normally (i.e. the user has not scrolled up). ** Set the current position to the new head of the list ** (the element containing the message we just added). */ swindow->scrollbuf_bot = swindow->scrollbuf; if (imsg->lines <= swindow->bottom_blank) { y_pos = swindow->rows - swindow->bottom_blank; swindow->bottom_blank -= imsg->lines; } else { u_int32_t evict = imsg->lines - swindow->bottom_blank; swindow->bottom_blank = 0; swindow_adjust_top(swindow, evict); /* ** The message could require more rows than the ** screen has. In this case, print as much of the ** message as possible such that the end of the message ** is on the last row. */ y_pos = swindow->rows - imsg->lines; if (y_pos < 0) { y_pos = 0; msg_line_start = imsg->lines - swindow->rows + 1; } swindow_scroll(swindow, evict); } swindow_print_msg(swindow, imsg, y_pos, 0, msg_line_start, -1); swindow->dirty = 1; if (!swindow->visible && (swindow->activity_type & msgtype)) swindow->activity = 1; /* ** If there's a maximum scroll buffer length, enforce it. */ if (swindow->scrollbuf_len > swindow->scrollbuf_max) swindow_prune(swindow); return (0); } /* Called when a message sent by a user is written to a window. */ inline int swindow_input(struct swindow *swindow) { /* ** If the window is scrolled up, and the scroll on ** input flag is set, scroll to the bottom of the ** window before doing anything else. */ if ((swindow->scrollbuf_bot != swindow->scrollbuf || swindow->bottom_hidden != 0) && swindow->scroll_on_input) { swindow_scroll_to_end(swindow); } return (0); } /* ** Scroll to the end of the scroll buffer (the bottom line). */ void swindow_scroll_to_end(struct swindow *swindow) { dlist_t *cur; u_int32_t lines = 0; if (swindow->scrollbuf == NULL) return; /* Avoid a redraw if it's already at the bottom */ if (swindow->scrollbuf_bot == swindow->scrollbuf && swindow->bottom_hidden == 0) { return; } cur = swindow->scrollbuf; do { struct imsg *imsg = cur->data; lines += imsg->lines; if (lines >= swindow->rows) { swindow->scrollbuf_top = cur; swindow->top_hidden = lines - swindow->rows; break; } if (cur->next == NULL) { swindow->scrollbuf_top = cur; swindow->top_hidden = 0; break; } cur = cur->next; } while (1); swindow->held = 0; wclear(swindow->win); swindow_redraw(swindow); } /* ** Scroll to the beginning of the scroll buffer (the top line). */ void swindow_scroll_to_start(struct swindow *swindow) { if (swindow->scrollbuf == NULL) return; /* Avoid a redraw if it's already at the top */ if (swindow->scrollbuf_top == swindow->scrollbuf_end && swindow->top_hidden == 0) { return; } swindow->top_hidden = 0; swindow->scrollbuf_top = swindow->scrollbuf_end; wclear(swindow->win); swindow_redraw(swindow); } static u_int32_t swindow_scroll_down_by(struct swindow *swindow, u_int32_t lines) { u_int32_t i; /* ** Adjust the pointer to the top line on the screen. */ for (i = 0 ; i < lines ; i++) { struct imsg *imsg; if (swindow->scrollbuf_bot->prev == NULL && swindow->bottom_hidden == 0) { swindow->held = 0; break; } imsg = swindow->scrollbuf_top->data; if (++swindow->top_hidden == imsg->lines) { swindow->top_hidden = 0; if (swindow->scrollbuf_top->prev == NULL) return (1); swindow->scrollbuf_top = swindow->scrollbuf_top->prev; } if (swindow->bottom_hidden > 0) swindow->bottom_hidden--; else { swindow->scrollbuf_bot = swindow->scrollbuf_bot->prev; imsg = swindow->scrollbuf_bot->data; swindow->bottom_hidden = imsg->lines - 1; } } return (i); } static u_int32_t swindow_scroll_up_by(struct swindow *swindow, u_int32_t lines) { dlist_t *cur; if (swindow->top_hidden == 0 && swindow->scrollbuf_top->next == NULL) return (0); if (swindow->top_hidden >= lines) { swindow->top_hidden -= lines; return (1); } lines -= swindow->top_hidden; swindow->top_hidden = 0; cur = swindow->scrollbuf_top->next; while (lines > 0 && cur != NULL) { struct imsg *msg = cur->data; if (msg->lines >= lines) { swindow->scrollbuf_top = cur; swindow->top_hidden = msg->lines - lines; return (1); } lines -= msg->lines; cur = cur->next; } if (lines > 0) swindow->scrollbuf_top = swindow->scrollbuf_end; return (1); } int swindow_scroll_by(struct swindow *swindow, int lines) { /* Can't scroll if there are less (or equal to) lines than rows */ if (swindow->scrollbuf_lines > swindow->rows) { int ret; if (lines < 0) ret = swindow_scroll_up_by(swindow, -lines); else ret = swindow_scroll_down_by(swindow, lines); if (ret > 0) { wclear(swindow->win); swindow_redraw(swindow); swindow_refresh(swindow); /* If the window's visible, a delay is not acceptable. */ if (swindow->visible) screen_doupdate(); return (1); } } return (0); } /* ** Print all messages in the buffer for this window that match ** the specified regular expression. */ int swindow_print_matching( struct swindow *swindow, const char *regex, u_int32_t options) { int cflags = REG_EXTENDED; regex_t preg; dlist_t *cur; dlist_t *match_list = NULL; if (regex == NULL) return (-1); if (options & SWINDOW_FIND_ICASE) cflags |= REG_ICASE; if (options & SWINDOW_FIND_BASIC) cflags &= ~REG_EXTENDED; if (regcomp(&preg, regex, cflags) != 0) return (-1); for (cur = swindow->scrollbuf ; cur != NULL ; cur = cur->next) { struct imsg *imsg = cur->data; char *buf; buf = cstr_to_plaintext(imsg->text, imsg->len); if (buf != NULL) { if (regexec(&preg, buf, 0, NULL, 0) == 0) match_list = dlist_add_head(match_list, imsg); free(buf); } } regfree(&preg); /* ** Better to compile a list of matches and print them after scanning ** the whole buffer. If we started scanning at the oldest message and ** printed matches as we traversed the scrollbuffer list, bad interactions ** with swindow_prune() could occur. */ cur = match_list; while (cur != NULL) { dlist_t *next = cur->next; swindow_add(swindow, imsg_copy(swindow, cur->data), MSG_TYPE_LASTLOG); free(cur); cur = next; } return (0); } /* ** Turn timestamping on or off, depending on the value of "value" */ inline void swindow_set_timestamp(struct swindow *swindow, u_int32_t value) { swindow->timestamp = value; } inline void swindow_set_wordwrap(struct swindow *swindow, u_int32_t value) { /* ** Allow for updating after the continued char changed but the ** wordwrap enabled setting didn't. */ swindow->wordwrap = value; swindow_recalculate(swindow, swindow->rows, swindow->cols); wclear(swindow->win); swindow_redraw(swindow); } /* ** dump everything in the window to the specified file. */ int swindow_dump_buffer(struct swindow *swindow, char *file) { int fd; dlist_t *cur; struct iovec wvec[2]; if (swindow->scrollbuf_end == NULL) return (-1); fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0600); if (fd == -1) return (-1); wvec[1].iov_base = "\n"; wvec[1].iov_len = 1; for (cur = swindow->scrollbuf_end ; cur != NULL ; cur = cur->prev) { struct imsg *imsg = cur->data; wvec[0].iov_base = cstr_to_plaintext(imsg->text, imsg->len); wvec[0].iov_len = imsg->len; if (writev(fd, wvec, 2) != (int) imsg->len + 1) { screen_err_msg("Error writing buffer to %s: %s", file, strerror(errno)); } free(wvec[0].iov_base); } close(fd); return (0); } /* ** Set the window to log to "logfile" */ void swindow_set_logfile(struct swindow *swindow, char *logfile) { swindow->logfile = logfile; /* ** If the window is currently being logged, close ** the log having the old filename, and open a new ** one. */ if (swindow->logged) { swindow_end_log(swindow); swindow_set_log(swindow); } } /* ** Turn logging for this window on, and open the logfile for writing. */ int swindow_set_log(struct swindow *swindow) { int fd; time_t cur_time; struct tm *tm; char timebuf[128]; u_int32_t len; if (swindow->logfile == NULL) { screen_err_msg("No logfile has been specified for this window"); return (-1); } fd = open(swindow->logfile, O_CREAT | O_APPEND | O_WRONLY, 0600); if (fd == -1) { swindow->logged = 0; screen_err_msg("Unable to open %s for writing: %s", swindow->logfile, strerror(errno)); return (-1); } cur_time = time(NULL); tm = localtime(&cur_time); len = strftime(timebuf, sizeof(timebuf), "\n---------- Log started on %a %b %d %T %Z %Y ----------\n\n", tm); write(fd, timebuf, len); swindow->log_fd = fd; swindow->logged = 1; return (0); } /* ** End the log for this window. */ void swindow_end_log(struct swindow *swindow) { time_t cur_time; struct tm *tm; char timebuf[128]; u_int32_t len; if (swindow->log_fd == -1) return; cur_time = time(NULL); tm = localtime(&cur_time); len = strftime(timebuf, sizeof(timebuf), "\n---------- Log ended on %a %b %d %T %Z %Y ----------\n\n", tm); write(swindow->log_fd, timebuf, len); close(swindow->log_fd); swindow->logged = 0; } /* ** Clear the window. This amounts to filling the screen with one ** screen full of blank lines. The window can be scrolled up to ** view text that was in the window before it was cleared. When the ** window is scrolled back down, the blank lines that were inserted ** will go away. */ void swindow_clear(struct swindow *swindow) { struct imsg *imsg; if (swindow->scrollbuf == NULL) return; imsg = swindow->scrollbuf->data; swindow->scrollbuf_top = swindow->scrollbuf; swindow->scrollbuf_bot = swindow->scrollbuf; swindow->top_hidden = imsg->lines; swindow->bottom_hidden = 0; swindow->held = 0; swindow->bottom_blank = swindow->rows; swindow->dirty = 1; wclear(swindow->win); } /* ** Cleanup function for use with dlist_destroy() */ static void swindow_free(void *param __notused, void *data) { struct imsg *imsg = data; free(imsg->text); free(imsg); } /* ** Remove all the messages from the scroll buffer and clear ** the screen. */ void swindow_erase(struct swindow *swindow) { dlist_destroy(swindow->scrollbuf, NULL, swindow_free); swindow->scrollbuf = NULL; swindow->scrollbuf_top = NULL; swindow->scrollbuf_bot = NULL; swindow->scrollbuf_end = NULL; swindow->top_hidden = 0; swindow->bottom_hidden = 0; swindow->scrollbuf_len = 0; swindow->scrollbuf_lines = 0; swindow->held = 0; swindow->serial = 0; swindow->activity = 0; swindow->bottom_blank = swindow->rows; swindow->dirty = 1; wclear(swindow->win); } int swindow_destroy(struct swindow *swindow) { if (swindow->logged) swindow_end_log(swindow); dlist_destroy(swindow->scrollbuf, NULL, swindow_free); delwin(swindow->win); return (0); } pork-0.99.8.1/src/pork_swindow.h0000644000175000017500000000520710234217326016370 0ustar ryanryan00000000000000/* ** pork_swindow.h - an ncurses scrolling window widget ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_SWINDOW_H #define __PORK_SWINDOW_H #define SWINDOW_FIND_ICASE 0x01 #define SWINDOW_FIND_BASIC 0x02 struct imsg; struct swindow { WINDOW *win; u_int32_t serial; u_int32_t rows; u_int32_t cols; u_int32_t scrollbuf_max; u_int32_t scrollbuf_len; u_int32_t scrollbuf_lines; u_int32_t held; u_int32_t bottom_blank; /* ** How many lines of the message that's currently ** at the top or bottom of the screen aren't ** currently being displayed on screen. */ u_int32_t top_hidden; u_int32_t bottom_hidden; /* pointers to the head and tail of the message list */ dlist_t *scrollbuf; dlist_t *scrollbuf_end; /* pointers to the top and bottom lines currently displayed */ dlist_t *scrollbuf_top; dlist_t *scrollbuf_bot; /* window-specific preferences */ u_int32_t activity_type; u_int32_t log_type; char *logfile; int log_fd; char wordwrap_char; u_int32_t visible:1; u_int32_t dirty:1; u_int32_t activity:1; u_int32_t beep_on_output:1; u_int32_t scroll_on_input:1; u_int32_t scroll_on_output:1; u_int32_t timestamp:1; u_int32_t logged:1; u_int32_t wordwrap:1; }; int swindow_init( struct swindow *swindow, WINDOW *win, u_int32_t rows, u_int32_t cols, pref_val_t *wopt); int swindow_destroy(struct swindow *swindow); int swindow_add(struct swindow *swindow, struct imsg *imsg, u_int32_t type); int swindow_input(struct swindow *swindow); void swindow_redraw(struct swindow *swindow); void swindow_clear(struct swindow *swindow); void swindow_erase(struct swindow *swindow); inline int swindow_refresh(struct swindow *swindow); void swindow_resize(struct swindow *swindow, u_int32_t new_row, u_int32_t new_col); int swindow_print_matching( struct swindow *swindow, const char *regex, u_int32_t options); int swindow_dump_buffer(struct swindow *swindow, char *file); int swindow_set_log(struct swindow *swindow); void swindow_end_log(struct swindow *swindow); void swindow_set_logfile(struct swindow *swindow, char *logfile); void swindow_set_timestamp(struct swindow *swindow, u_int32_t value); void swindow_set_wordwrap(struct swindow *swindow, u_int32_t value); void swindow_prune(struct swindow *swindow); void swindow_scroll_to_end(struct swindow *swindow); void swindow_scroll_to_start(struct swindow *swindow); int swindow_scroll_by(struct swindow *swindow, int lines); #endif pork-0.99.8.1/src/Makefile.am0000644000175000017500000000353010234217326015523 0ustar ryanryan00000000000000SUBDIRS = missing protocols bin_PROGRAMS = pork if IRC_SUPPORT irc_lib = protocols/irc/libirc.a endif AM_CFLAGS = -funsigned-char -Imissing -Wall -Iprotocols -fPIC AM_CFLAGS += -DHELP_PATH=\"$(pkgdatadir)/help\" -DSYSTEM_PORKRC=\"$(pkgdatadir)/porkrc\" AM_CFLAGS += $(PERL_CFLAGS) $(DEBUG_CFLAGS) pork_LDADD = missing/libmissing.a protocols/aim/libaim.a $(irc_lib) -lncurses $(PERL_LIBS) $(DEBUG_LIBS) if COMPILE_PERL pork_perl = pork_perl.c pork_perl_xs = pork_perl_xs.c else pork_perl = pork_perl_stub.c endif noinst_HEADERS = \ pork.h \ pork_acct.h \ pork_alias.h \ pork_bind.h \ pork_buddy.h \ pork_buddy_list.h \ pork_chat.h \ pork_color.h \ pork_command.h \ pork_command_defs.h \ pork_conf.h \ pork_cstr.h \ pork_events.h \ pork_format.h \ pork_help.h \ pork_html.h \ pork_imwindow.h \ pork_imsg.h \ pork_inet.h \ pork_input.h \ pork_io.h \ pork_list.h \ pork_misc.h \ pork_msg.h \ pork_opt.h \ pork_perl.h \ pork_perl_xs.h \ pork_proto.h \ pork_queue.h \ pork_screen.h \ pork_screen_io.h \ pork_set.h \ pork_set_defaults.h \ pork_slist.h \ pork_status.h \ pork_swindow.h \ pork_timer.h \ pork_transfer.h \ pork_util.h pork_SOURCES = \ pork.c \ pork_acct.c \ pork_alias.c \ pork_bind.c \ pork_buddy.c \ pork_buddy_list.c \ pork_chat.c \ pork_color.c \ pork_command.c \ pork_conf.c \ pork_cstr.c \ pork_events.c \ pork_format.c \ pork_help.c \ pork_html.c \ pork_imwindow.c \ pork_imsg.c \ pork_inet.c \ pork_input.c \ pork_io.c \ pork_list.c \ pork_misc.c \ pork_msg.c \ pork_opt.c \ $(pork_perl) \ $(pork_perl_xs) \ pork_proto.c \ pork_queue.c \ pork_screen.c \ pork_screen_io.c \ pork_slist.c \ pork_set.c \ pork_status.c \ pork_swindow.c \ pork_timer.c \ pork_transfer.c \ pork_util.c pork-0.99.8.1/src/Makefile.in0000644000175000017500000005716610236222653015553 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SOURCES = $(pork_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ bin_PROGRAMS = pork$(EXEEXT) subdir = src DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am__pork_SOURCES_DIST = pork.c pork_acct.c pork_alias.c pork_bind.c \ pork_buddy.c pork_buddy_list.c pork_chat.c pork_color.c \ pork_command.c pork_conf.c pork_cstr.c pork_events.c \ pork_format.c pork_help.c pork_html.c pork_imwindow.c \ pork_imsg.c pork_inet.c pork_input.c pork_io.c pork_list.c \ pork_misc.c pork_msg.c pork_opt.c pork_perl_stub.c pork_perl.c \ pork_perl_xs.c pork_proto.c pork_queue.c pork_screen.c \ pork_screen_io.c pork_slist.c pork_set.c pork_status.c \ pork_swindow.c pork_timer.c pork_transfer.c pork_util.c @COMPILE_PERL_FALSE@am__objects_1 = pork_perl_stub.$(OBJEXT) @COMPILE_PERL_TRUE@am__objects_1 = pork_perl.$(OBJEXT) @COMPILE_PERL_TRUE@am__objects_2 = pork_perl_xs.$(OBJEXT) am_pork_OBJECTS = pork.$(OBJEXT) pork_acct.$(OBJEXT) \ pork_alias.$(OBJEXT) pork_bind.$(OBJEXT) pork_buddy.$(OBJEXT) \ pork_buddy_list.$(OBJEXT) pork_chat.$(OBJEXT) \ pork_color.$(OBJEXT) pork_command.$(OBJEXT) \ pork_conf.$(OBJEXT) pork_cstr.$(OBJEXT) pork_events.$(OBJEXT) \ pork_format.$(OBJEXT) pork_help.$(OBJEXT) pork_html.$(OBJEXT) \ pork_imwindow.$(OBJEXT) pork_imsg.$(OBJEXT) \ pork_inet.$(OBJEXT) pork_input.$(OBJEXT) pork_io.$(OBJEXT) \ pork_list.$(OBJEXT) pork_misc.$(OBJEXT) pork_msg.$(OBJEXT) \ pork_opt.$(OBJEXT) $(am__objects_1) $(am__objects_2) \ pork_proto.$(OBJEXT) pork_queue.$(OBJEXT) \ pork_screen.$(OBJEXT) pork_screen_io.$(OBJEXT) \ pork_slist.$(OBJEXT) pork_set.$(OBJEXT) pork_status.$(OBJEXT) \ pork_swindow.$(OBJEXT) pork_timer.$(OBJEXT) \ pork_transfer.$(OBJEXT) pork_util.$(OBJEXT) pork_OBJECTS = $(am_pork_OBJECTS) @IRC_SUPPORT_TRUE@am__DEPENDENCIES_1 = protocols/irc/libirc.a am__DEPENDENCIES_2 = pork_DEPENDENCIES = missing/libmissing.a protocols/aim/libaim.a \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_2) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/pork.Po ./$(DEPDIR)/pork_acct.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_alias.Po ./$(DEPDIR)/pork_bind.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_buddy.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_buddy_list.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_chat.Po ./$(DEPDIR)/pork_color.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_command.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_conf.Po ./$(DEPDIR)/pork_cstr.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_events.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_format.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_help.Po ./$(DEPDIR)/pork_html.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_imsg.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_imwindow.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_inet.Po ./$(DEPDIR)/pork_input.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_io.Po ./$(DEPDIR)/pork_list.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_misc.Po ./$(DEPDIR)/pork_msg.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_opt.Po ./$(DEPDIR)/pork_perl.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_perl_stub.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_perl_xs.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_proto.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_queue.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_screen.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_screen_io.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_set.Po ./$(DEPDIR)/pork_slist.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_status.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_swindow.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_timer.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_transfer.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_util.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(pork_SOURCES) DIST_SOURCES = $(am__pork_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = missing protocols @IRC_SUPPORT_TRUE@irc_lib = protocols/irc/libirc.a AM_CFLAGS = -funsigned-char -Imissing -Wall -Iprotocols -fPIC -DHELP_PATH=\"$(pkgdatadir)/help\" -DSYSTEM_PORKRC=\"$(pkgdatadir)/porkrc\" $(PERL_CFLAGS) $(DEBUG_CFLAGS) pork_LDADD = missing/libmissing.a protocols/aim/libaim.a $(irc_lib) -lncurses $(PERL_LIBS) $(DEBUG_LIBS) @COMPILE_PERL_FALSE@pork_perl = pork_perl_stub.c @COMPILE_PERL_TRUE@pork_perl = pork_perl.c @COMPILE_PERL_TRUE@pork_perl_xs = pork_perl_xs.c noinst_HEADERS = \ pork.h \ pork_acct.h \ pork_alias.h \ pork_bind.h \ pork_buddy.h \ pork_buddy_list.h \ pork_chat.h \ pork_color.h \ pork_command.h \ pork_command_defs.h \ pork_conf.h \ pork_cstr.h \ pork_events.h \ pork_format.h \ pork_help.h \ pork_html.h \ pork_imwindow.h \ pork_imsg.h \ pork_inet.h \ pork_input.h \ pork_io.h \ pork_list.h \ pork_misc.h \ pork_msg.h \ pork_opt.h \ pork_perl.h \ pork_perl_xs.h \ pork_proto.h \ pork_queue.h \ pork_screen.h \ pork_screen_io.h \ pork_set.h \ pork_set_defaults.h \ pork_slist.h \ pork_status.h \ pork_swindow.h \ pork_timer.h \ pork_transfer.h \ pork_util.h pork_SOURCES = \ pork.c \ pork_acct.c \ pork_alias.c \ pork_bind.c \ pork_buddy.c \ pork_buddy_list.c \ pork_chat.c \ pork_color.c \ pork_command.c \ pork_conf.c \ pork_cstr.c \ pork_events.c \ pork_format.c \ pork_help.c \ pork_html.c \ pork_imwindow.c \ pork_imsg.c \ pork_inet.c \ pork_input.c \ pork_io.c \ pork_list.c \ pork_misc.c \ pork_msg.c \ pork_opt.c \ $(pork_perl) \ $(pork_perl_xs) \ pork_proto.c \ pork_queue.c \ pork_screen.c \ pork_screen_io.c \ pork_slist.c \ pork_set.c \ pork_status.c \ pork_swindow.c \ pork_timer.c \ pork_transfer.c \ pork_util.c all: all-recursive .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) pork$(EXEEXT): $(pork_OBJECTS) $(pork_DEPENDENCIES) @rm -f pork$(EXEEXT) $(LINK) $(pork_LDFLAGS) $(pork_OBJECTS) $(pork_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_acct.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_alias.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_bind.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_buddy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_buddy_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_chat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_color.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_command.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_conf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_cstr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_events.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_format.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_html.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_imsg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_imwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_inet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_input.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_misc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_msg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_opt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_perl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_perl_stub.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_perl_xs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_proto.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_queue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_screen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_screen_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_set.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_slist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_status.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_swindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_timer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_transfer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_util.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="../$(top_distdir)" \ distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-binPROGRAMS install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-binPROGRAMS clean-generic clean-recursive ctags \ ctags-recursive distclean distclean-compile distclean-generic \ distclean-recursive distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/src/pork_screen.c0000644000175000017500000002713010234217326016147 0ustar ryanryan00000000000000/* ** pork_screen.c - screen management. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* ** Find the window having the specified refnum, and return ** a pointer to the node that holds it. ** ** This depends on the list being sorted. */ static dlist_t *screen_find_refnum(u_int32_t refnum) { dlist_t *cur = screen.window_list; do { struct imwindow *imwindow = cur->data; if (imwindow->refnum == refnum) return (cur); if (imwindow->refnum > refnum) break; cur = cur->next; } while (cur != screen.window_list); return (NULL); } /* ** Yes, this is pretty slow and stupid, but it'd be pretty ** unusual (i think) to have even 10 windows open at any one time. ** ** It's also only called when creating a new window. */ static inline u_int32_t screen_get_new_refnum(void) { u_int32_t i; for (i = 1 ; i < 0xffffffff ; i++) { if (screen_find_refnum(i) == NULL) return (i); } return (0); } static void screen_window_list_add(dlist_t *new_node) { struct imwindow *imwindow = new_node->data; /* ** The window list is a sorted circular doubly linked list. ** The window_list pointer points to the window having the lowest ** refnum. */ if (screen.window_list == NULL) { new_node->prev = new_node; new_node->next = new_node; screen.window_list = new_node; } else { dlist_t *cur = screen.window_list; do { struct imwindow *imw = cur->data; if (imwindow->refnum < imw->refnum) { if (cur == screen.window_list) screen.window_list = new_node; break; } cur = cur->next; } while (cur != screen.window_list); new_node->next = cur; new_node->prev = cur->prev; new_node->next->prev = new_node; new_node->prev->next = new_node; } } static void screen_window_list_remove(dlist_t *node) { dlist_t *save = node; if (node == screen.window_list) screen.window_list = node->next; if (node == screen.window_list) screen.window_list = NULL; save->prev->next = node->next; save->next->prev = node->prev; } /* ** Create the program's status window. This window will have the buddy ** list visible in it by default. */ int screen_init(u_int32_t rows, u_int32_t cols) { struct imwindow *imwindow; struct pork_acct *acct; memset(&screen, 0, sizeof(screen)); screen.rows = rows; screen.cols = cols; bind_init(&screen.binds); input_init(&screen.input, cols); if (status_init() == -1) return (-1); acct = pork_acct_init(opt_get_str(OPT_TEXT_NO_NAME), PROTO_NULL); if (acct == NULL) return (-1); acct->refnum = -1UL; pork_acct_add(acct); screen.null_acct = acct; pork_io_add(STDIN_FILENO, IO_COND_READ, &screen, &screen, keyboard_input); rows = max(1, (int) rows - STATUS_ROWS); imwindow = imwindow_new(rows, cols, 1, WIN_TYPE_STATUS, acct, "status"); if (imwindow == NULL) return (-1); wopt_set(imwindow, WOPT_SHOW_BLIST, "1"); screen_add_window(imwindow); screen.status_win = imwindow; return (0); } void screen_destroy(void) { dlist_t *cur = screen.window_list; do { dlist_t *next = cur->next; imwindow_destroy(cur->data); free(cur); cur = next; } while (cur != screen.window_list); opt_destroy(); input_destroy(&screen.input); bind_destroy(&screen.binds); hash_destroy(&screen.alias_hash); event_destroy(&screen.events); delwin(screen.status_bar); wclear(curscr); } void screen_add_window(struct imwindow *imwindow) { dlist_t *new_node = xmalloc(sizeof(*new_node)); new_node->data = imwindow; screen_window_list_add(new_node); /* ** If this is the first window, make it current. */ if (screen.cur_window == NULL) screen_window_swap(new_node); } /* ** Change the refnum on the currently visible window. */ int screen_renumber(struct imwindow *imwindow, u_int32_t refnum) { dlist_t *node; u_int32_t old_refnum = imwindow->refnum; node = screen_find_refnum(old_refnum); if (node == NULL) return (-1); screen_window_list_remove(node); imwindow->refnum = refnum; /* ** If there's more than one window, check to ** make sure that no other window's refnum ** is equal to the refnum we just set for 'imwindow'. ** If it is, give it 'imwindow's' old refnum. */ if (node != node->next || node->next != node->prev) { dlist_t *temp = screen_find_refnum(refnum); if (temp != NULL) { struct imwindow *imw; screen_window_list_remove(temp); imw = temp->data; imw->refnum = old_refnum; screen_window_list_add(temp); screen_win_msg(imw, 0, 1, 1, MSG_TYPE_CMD_OUTPUT, "This is now window %%W%u", old_refnum); } } screen_window_list_add(node); screen_cmd_output("This is now window %%W%u", imwindow->refnum); return (0); } void screen_resize(u_int32_t rows, u_int32_t cols) { dlist_t *cur; int ret; resize_terminal(rows, cols); screen.rows = rows; screen.cols = cols; for (cur = screen.acct_list ; cur != NULL ; cur = cur->next) { struct pork_acct *acct = cur->data; if (acct->blist != NULL) { blist_resize(acct->blist, max(1, (int) rows - STATUS_ROWS), acct->blist->slist.cols, cols); } } cur = screen.window_list; do { struct imwindow *imwindow = cur->data; u_int32_t im_cols = cols; if (imwindow->blist_visible) { u_int32_t blist_cols = imwindow->owner->blist->slist.cols; if (blist_cols >= cols) { imwindow->blist_visible = 0; imwindow->active_binds = &screen.binds.main; } else im_cols -= blist_cols; } imwindow_resize(imwindow, max(1, (int) rows - STATUS_ROWS), im_cols); input_resize(imwindow->input, cols); cur = cur->next; } while (screen.window_list != cur); ret = mvwin(screen.status_bar, max(0, (int) rows - STATUS_ROWS), 0); if (ret == -1) { delwin(screen.status_bar); status_init(); } } int screen_blist_width(struct blist *blist, u_int32_t new_width) { dlist_t *cur; if (new_width < 3 || new_width >= screen.cols) return (-1); if (blist == NULL) return (-1); cur = screen.window_list; do { struct imwindow *imwindow = cur->data; if (imwindow->owner != NULL && imwindow->owner->blist == blist && imwindow->blist_visible) { imwindow_resize(imwindow, imwindow->swindow.rows, imwindow->swindow.cols + blist->slist.cols - new_width); } cur = cur->next; } while (cur != screen.window_list); blist_resize(blist, blist->slist.rows, new_width, screen.cols); return (0); } void screen_window_swap(dlist_t *new_cur) { struct imwindow *imwindow = NULL; u_int32_t last_own_input = 0; u_int32_t cur_own_input; struct pork_acct *acct; if (screen.cur_window != NULL) { imwindow = cur_window(); last_own_input = wopt_get_bool(imwindow->opts, WOPT_PRIVATE_INPUT); imwindow->swindow.activity = 0; imwindow->swindow.visible = 0; } screen.cur_window = new_cur; imwindow = cur_window(); imwindow->swindow.visible = 1; imwindow->swindow.activity = 0; cur_own_input = wopt_get_bool(imwindow->opts, WOPT_PRIVATE_INPUT); /* ** If the current window and the one that we're going to switch ** to don't share an input buffer, history, etc, the input ** line must be refreshed. Force a redraw. */ if (cur_own_input || last_own_input) { imwindow->input->dirty = 1; screen_draw_input(); } status_draw(imwindow->owner); acct = imwindow->owner; /* ** To force ncurses to redraw it on the physical screen. */ redrawwin(imwindow->swindow.win); imwindow->swindow.dirty = 1; imwindow_blist_draw(imwindow); } inline int screen_goto_window(u_int32_t refnum) { dlist_t *cur = screen_find_refnum(refnum); if (cur == NULL) return (-1); screen_window_swap(cur); return (0); } void screen_refresh(void) { struct imwindow *imwindow = cur_window(); wclear(curscr); wnoutrefresh(curscr); wclear(imwindow->swindow.win); wnoutrefresh(imwindow->swindow.win); swindow_redraw(&imwindow->swindow); imwindow_blist_draw(imwindow); status_draw(imwindow->owner); imwindow_refresh(imwindow); imwindow->input->dirty = 1; screen_draw_input(); screen_doupdate(); } struct imwindow *screen_new_window( struct pork_acct *acct, char *target, char *name) { u_int32_t refnum = screen_get_new_refnum(); struct imwindow *imwindow; u_int32_t rows; rows = max(1, (int) screen.rows - STATUS_ROWS); imwindow = imwindow_new(rows, screen.cols, refnum, WIN_TYPE_PRIVMSG, acct, target); if (imwindow == NULL) return (NULL); if (name != NULL) imwindow_rename(imwindow, name); screen_add_window(imwindow); status_draw(imwindow->owner); return (imwindow); } struct imwindow *screen_new_chat_window(struct pork_acct *acct, char *name) { u_int32_t refnum = screen_get_new_refnum(); struct imwindow *imwindow; u_int32_t rows; rows = max(1, (int) screen.rows - STATUS_ROWS); imwindow = imwindow_new(rows, screen.cols, refnum, WIN_TYPE_CHAT, acct, name); if (imwindow == NULL) return (NULL); imwindow->data = NULL; screen_add_window(imwindow); status_draw(imwindow->owner); return (imwindow); } int screen_get_query_window(struct pork_acct *acct, char *name, struct imwindow **winr) { struct imwindow *win; int new = 0; win = imwindow_find(acct, name); if (win == NULL || win->type != WIN_TYPE_PRIVMSG) { if (opt_get_bool(OPT_DUMP_MSGS_TO_STATUS)) win = screen.status_win; else { win = screen_new_window(acct, name, buddy_name(acct, name)); new++; } } *winr = win; return (new); } /* ** When we really want a query window. */ int screen_make_query_window(struct pork_acct *acct, char *name, struct imwindow **winr) { struct imwindow *win; int new = 0; win = imwindow_find(acct, name); if (win == NULL || win->type != WIN_TYPE_PRIVMSG) { win = screen_new_window(acct, name, buddy_name(acct, name)); new++; } *winr = win; return (new); } void screen_cycle_fwd(void) { dlist_t *cur = screen.cur_window; struct imwindow *win; do { cur = cur->next; win = cur->data; } while (win->skip && cur != screen.cur_window); screen_window_swap(cur); } void screen_cycle_bak(void) { dlist_t *cur = screen.cur_window; struct imwindow *win; do { cur = cur->prev; win = cur->data; } while (win->skip && cur != screen.cur_window); screen_window_swap(cur); } void screen_bind_all_unbound(struct pork_acct *acct) { dlist_t *node; node = screen.window_list; do { struct imwindow *imwindow = node->data; if (imwindow->owner == screen.null_acct) { imwindow_bind_acct(imwindow, acct->refnum); if (!imwindow->blist_visible) { if (wopt_get_bool(imwindow->opts, WOPT_SHOW_BLIST)) wopt_set(imwindow, WOPT_SHOW_BLIST, "1"); } } node = node->next; } while (node != screen.window_list); } int screen_close_window(struct imwindow *imwindow) { dlist_t *node = screen_find_refnum(imwindow->refnum); if (node == NULL) return (-1); /* ** The status window can't be closed. */ if (imwindow->type == WIN_TYPE_STATUS) return (-1); if (imwindow->type == WIN_TYPE_CHAT && imwindow->data != NULL) { struct chatroom *chat = imwindow->data; chat_leave(imwindow->owner, chat->title, 0); } if (imwindow->swindow.visible) screen_cycle_fwd(); screen_window_list_remove(node); imwindow_destroy(imwindow); free(node); return (0); } pork-0.99.8.1/src/pork_screen.h0000644000175000017500000000330610234217326016153 0ustar ryanryan00000000000000/* ** pork_screen.h - screen management. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_SCREEN_H #define __PORK_SCREEN_H extern struct screen screen; enum { FOCUS_MSG, FOCUS_BUDDY }; struct blist; struct imwindow; struct pork_acct; #include #include #include struct screen { u_int32_t rows; u_int32_t cols; dlist_t *cur_window; dlist_t *window_list; dlist_t *timer_list; dlist_t *transfer_list; struct imwindow *status_win; dlist_t *acct_list; WINDOW *status_bar; u_int32_t quiet:1; struct pork_acct *null_acct; struct input input; struct binds binds; hash_t alias_hash; struct event events; }; #define cur_window() ((struct imwindow *) (screen.cur_window->data)) int screen_init(u_int32_t rows, u_int32_t cols); void screen_destroy(void); int screen_renumber(struct imwindow *imwindow, u_int32_t refnum); void screen_add_window(struct imwindow *imwindow); void screen_resize(u_int32_t rows, u_int32_t cols); int screen_blist_width(struct blist *blist, u_int32_t new_width); void screen_window_swap(dlist_t *new_cur); int screen_goto_window(u_int32_t refnum); void screen_refresh(void); void screen_bind_all_unbound(struct pork_acct *acct); struct imwindow *screen_new_window(struct pork_acct *o, char *dest, char *name); struct imwindow *screen_new_chat_window(struct pork_acct *acct, char *name); int screen_close_window(struct imwindow *imwindow); void screen_cycle_fwd(void); void screen_cycle_bak(void); void screen_doupdate(void); #endif pork-0.99.8.1/src/pork_queue.c0000644000175000017500000000401310234217326016007 0ustar ryanryan00000000000000/* ** pork_queue.c - Generic queues ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include pork_queue_t *queue_new(u_int32_t max_entries) { pork_queue_t *q = xcalloc(1, sizeof(*q)); q->max = max_entries; return (q); } int queue_putback_head(pork_queue_t *q, void *data) { dlist_t *new_node; if (q->max > 0 && q->entries >= q->max) return (-1); new_node = xcalloc(1, sizeof(*new_node)); new_node->data = data; if (q->entries == 0) { new_node->prev = NULL; new_node->next = NULL; q->head = new_node; q->tail = new_node; } else { new_node->prev = NULL; new_node->next = q->head; q->head->prev = new_node; q->head = new_node; } q->entries++; return (0); } int queue_add(pork_queue_t *q, void *data) { dlist_t *new_node; if (q->max > 0 && q->entries >= q->max) return (-1); new_node = xcalloc(1, sizeof(*new_node)); new_node->data = data; new_node->next = NULL; if (q->entries == 0) { new_node->prev = NULL; q->head = new_node; q->tail = new_node; } else { new_node->prev = q->tail; q->tail->next = new_node; q->tail = new_node; } q->entries++; return (0); } void *queue_get(pork_queue_t *q) { void *ret; if (q->entries == 0) return (NULL); q->entries--; ret = q->head->data; if (q->head == q->tail) { free(q->head); q->head = NULL; q->tail = NULL; } else { dlist_t *old_head = q->head; old_head->next->prev = NULL; q->head = old_head->next; free(old_head); } return (ret); } void queue_destroy(pork_queue_t *q, void (*cleanup)(void *)) { dlist_t *cur = q->head; while (cur != NULL) { dlist_t *next = cur->next; if (cleanup != NULL) cleanup(cur->data); free(cur); cur = next; } } pork-0.99.8.1/src/pork_queue.h0000644000175000017500000000125510234217326016021 0ustar ryanryan00000000000000/* ** pork_queue.h - Generic queues ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_QUEUE_H #define __PORK_QUEUE_H typedef struct { dlist_t *head; dlist_t *tail; u_int32_t entries; u_int32_t max; } pork_queue_t; pork_queue_t *queue_new(u_int32_t max_entries); int queue_add(pork_queue_t *q, void *data); int queue_putback_head(pork_queue_t *q, void *data); void *queue_get(pork_queue_t *q); void queue_destroy(pork_queue_t *q, void (*cleanup)(void *)); #endif pork-0.99.8.1/src/pork_set_defaults.h0000644000175000017500000001633010234217326017357 0ustar ryanryan00000000000000/* ** pork_set_defaults.h - /SET command implementation. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_SET_DEFAULTS_H #define __PORK_SET_DEFAULTS_H /* ** Default values for the global options. */ #define DEFAULT_ACTIVITY_TYPES 0xffffffff #define DEFAULT_AUTO_RECONNECT 1 #define DEFAULT_AUTO_REJOIN 1 #define DEFAULT_AUTOSEND_AWAY 0 #define DEFAULT_BANNER "*** " #define DEFAULT_BEEP 0 #define DEFAULT_BEEP_MAX 3 #define DEFAULT_BEEP_ON_OUTPUT 0 #define DEFAULT_CMDCHARS '/' #define DEFAULT_COLOR_BLIST_FOCUS 0x200400 #define DEFAULT_COLOR_BLIST_NOFOCUS 0x200500 #define DEFAULT_COLOR_BLIST_SELECTOR 0x202400 #define DEFAULT_CONNECT_TIMEOUT 180 #define DEFAULT_DOWNLOAD_DIR "" #define DEFAULT_DUMP_MSGS_TO_STATUS 0 #define DEFAULT_FORMAT_ACTION_RECV "[$T] %c* %W$N%x $M" #define DEFAULT_FORMAT_ACTION_RECV_STATUS "[$T] %C>%c* %W$N%D(%C$h%D)%x $M" #define DEFAULT_FORMAT_ACTION_SEND "[$T] %c* %W$N%x $M" #define DEFAULT_FORMAT_ACTION_SEND_STATUS "[$T] %D-> %m$R %c* %W$N%x $M" #define DEFAULT_FORMAT_BLIST " $B $N$>$i" #define DEFAULT_FORMAT_BLIST_GROUP "($E) $N ($O/$T)" #define DEFAULT_FORMAT_BLIST_IDLE "%B$I" #define DEFAULT_FORMAT_BLIST_WARN "$W%%" #define DEFAULT_FORMAT_CHAT_CREATE "[$T] %W$N%x has %Gcreated %c$R %D(%x$U%D)" #define DEFAULT_FORMAT_CHAT_IGNORE "[$T] %W$N%x has %Gignored%x $D in %c$R" #define DEFAULT_FORMAT_CHAT_INVITE "[$T] %W$N%x has %Ginvited%x $D to %c$R%x %D(%x$M%D)" #define DEFAULT_FORMAT_CHAT_JOIN "[%YJ%D/%x$T%D/%C$N%D/%c$H%x]" #define DEFAULT_FORMAT_CHAT_KICK "[%RL%D/%r$D%D/%c$N%D/%c$M%x]" #define DEFAULT_FORMAT_CHAT_LEAVE "[%rL%D/%x$T%D/%c$N%D/%c$H%x]" #define DEFAULT_FORMAT_CHAT_MODE "[%MM%D/%m$T%D/%W$N%D/%C$M%x]" #define DEFAULT_FORMAT_CHAT_NICK "[%YN%D/%x$T%D/%m$N%W ->%M $D%x]" #define DEFAULT_FORMAT_CHAT_QUIT "[%BQ%D/%x$T%D/%B$N%D/%b$H%D/%x$M%x]" #define DEFAULT_FORMAT_CHAT_RECV "[$T] %b<%x$N%b>%x $M" #define DEFAULT_FORMAT_CHAT_RECV_ACTION "[$T] %c* %W$N%x $M" #define DEFAULT_FORMAT_CHAT_RECV_NOTICE "[$T] %D-%B$N%Y:%b$C%D-%x $M" #define DEFAULT_FORMAT_CHAT_SEND "[$T] $C%m>%x $M" #define DEFAULT_FORMAT_CHAT_SEND_ACTION "[$T] %c* %W$N%x $M" #define DEFAULT_FORMAT_CHAT_SEND_NOTICE "[$T] %D-> -%c$N%Y:%b$C%D-%x $M" #define DEFAULT_FORMAT_CHAT_TOPIC "[%GT%D/%g$T%D/%W$N%D/%x$M%x]" #define DEFAULT_FORMAT_CHAT_UNIGNORE "%W$N%x has %Gunignored%x $D in %c$R" #define DEFAULT_FORMAT_FILE_CANCEL_LOCAL "[$T] $U has canceled file transfer $I with $u for $N. $s bytes were sent" #define DEFAULT_FORMAT_FILE_CANCEL_REMOTE "[$T] $u has canceled file transfer $I with $U for $N. $s bytes were sent" #define DEFAULT_FORMAT_FILE_LOST "[$T] File transfer $I with $u for $N has been lost. $s bytes were sent" #define DEFAULT_FORMAT_FILE_RECV_ACCEPT "[$T] $U has accepted $N from $u. Beginning transfer" #define DEFAULT_FORMAT_FILE_RECV_ASK "[$T] $u [$F:$p] offered $N ($S bytes) to $U. Type /file get $I to accept it" #define DEFAULT_FORMAT_FILE_RECV_COMPLETE "[$T] Transfer $I has completed successfully: $N ($s bytes) was received by $U from $u in $t seconds ($R KB/s)" #define DEFAULT_FORMAT_FILE_RECV_RESUME "[$T] $U has accepted $N from $u, resuming at byte $O" #define DEFAULT_FORMAT_FILE_SEND_ACCEPT "[$T] $u [$F:$p] has accepted $N from $U. Beginning transfer" #define DEFAULT_FORMAT_FILE_SEND_ASK "[$T] Sent request to send $N ($S bytes) from $u to $U, waiting for reply" #define DEFAULT_FORMAT_FILE_SEND_COMPLETE "[$T] Transfer $I has completed successfully: $N ($s bytes) was sent by $U to $u in $T seconds ($R KB/s)" #define DEFAULT_FORMAT_FILE_SEND_RESUME "[$T] $u [$F:$p] has accepted $N from $U, resuming at byte $O" #define DEFAULT_FORMAT_IM_RECV "[$T] %m<%x$N%m>%x $M" #define DEFAULT_FORMAT_IM_RECV_AUTO "[$T] %Ca%cuto%D-%Cr%cesponse%x from %W$N%D:%x $M" #define DEFAULT_FORMAT_IM_RECV_STATUS "[$T] %D*%M$N%D(%m$h%D)*%x $M" #define DEFAULT_FORMAT_IM_SEND "[$T] %c>%x $M" #define DEFAULT_FORMAT_IM_SEND_AUTO "[$T] %Ca%cuto%D-%Cr%cesponse%x to %W$R%D:%x $M" #define DEFAULT_FORMAT_IM_SEND_STATUS "[$T] %D->*%m$R%D*%x $M" #define DEFAULT_FORMAT_NOTICE_RECV "[$T] %D-%B$N%D-%x $M" #define DEFAULT_FORMAT_NOTICE_RECV_STATUS "[$T] %D-%B$N%D(%c$h%D)-%x $M" #define DEFAULT_FORMAT_NOTICE_SEND "[$T] %D-> -%c$R%D-%x $M" #define DEFAULT_FORMAT_NOTICE_SEND_STATUS "[$T] %D-> -%c$R%D-%x $M" #define DEFAULT_FORMAT_STATUS "%d,w$T$n [$z$c]$A$Y$H $>$I$W%d,w$S [$!]" #define DEFAULT_FORMAT_STATUS_ACTIVITY " %w,d{$A}%d,w" #define DEFAULT_FORMAT_STATUS_CHAT "%d,w$T$@$n (+$u) [$z$c (+$M)]$A$Y$H $>$I$W%d,w$S [$!]" #define DEFAULT_FORMAT_STATUS_HELD " <%g,w$H%d,w>" #define DEFAULT_FORMAT_STATUS_IDLE "%d,w (%D,widle: $i%d,w)" #define DEFAULT_FORMAT_STATUS_TIMESTAMP "[$H:$M] " #define DEFAULT_FORMAT_STATUS_TYPING " (%b,w$Y%d,w)" #define DEFAULT_FORMAT_STATUS_WARN "%d,w [%r,w$w%%%d,w]" #define DEFAULT_FORMAT_TIMESTAMP "$H:$M" #define DEFAULT_FORMAT_WARN "[$T] %R$N%r has been warned by %R$U%r.%x Warning level is now %W$W%%" #define DEFAULT_FORMAT_WHOIS_AWAY "%D-%Ca%cway message%W:%x $A" #define DEFAULT_FORMAT_WHOIS_IDLE "%D-%p-%P--%Ci%cdle time%W:%x $i" #define DEFAULT_FORMAT_WHOIS_MEMBER "%D-%Cm%cember since%W:%x $d" #define DEFAULT_FORMAT_WHOIS_NAME "%D-%p-%P---%Cu%csername%W:%x $N" #define DEFAULT_FORMAT_WHOIS_SIGNON "%D-%Co%cnline since%W:%x $s" #define DEFAULT_FORMAT_WHOIS_USERINFO "%D-%p-%P--%Cu%cser info%W:%x $P" #define DEFAULT_FORMAT_WHOIS_WARNLEVEL "%D-%p-%P-%Cw%carn level%W:%x $W%%" #define DEFAULT_HISTORY_LEN 400 #define DEFAULT_IDLE_AFTER 10 #define DEFAULT_LOG 0 #define DEFAULT_LOG_TYPES 0xffffffff #define DEFAULT_LOGIN_ON_STARTUP 1 #define DEFAULT_OUTGOING_MSG_FONT "" #define DEFAULT_OUTGOING_MSG_FONT_BGCOLOR "#ffffff" #define DEFAULT_OUTGOING_MSG_FONT_FGCOLOR "#000000" #define DEFAULT_OUTGOING_MSG_FONT_SIZE "" #define DEFAULT_PORK_DIR NULL #define DEFAULT_PRIVATE_INPUT 0 #define DEFAULT_PROMPT "%Mp%mork%w>%x " #define DEFAULT_RECONNECT_INTERVAL 15 #define DEFAULT_RECONNECT_MAX_INTERVAL 600 #define DEFAULT_RECONNECT_TRIES 10 #define DEFAULT_RECURSIVE_EVENTS 0 #define DEFAULT_REPORT_IDLE 1 #define DEFAULT_SAVE_PASSWD 0 #define DEFAULT_SCROLL_ON_INPUT 1 #define DEFAULT_SCROLL_ON_OUTPUT 0 #define DEFAULT_SCROLLBUF_LEN 5000 #define DEFAULT_SEND_REMOVES_AWAY 1 #define DEFAULT_SHOW_BLIST 0 #define DEFAULT_SHOW_BUDDY_AWAY 1 #define DEFAULT_SHOW_BUDDY_IDLE 0 #define DEFAULT_SHOW_BUDDY_SIGNOFF 1 #define DEFAULT_TEXT_BLIST_GROUP_EXPANDED "%B+%x" #define DEFAULT_TEXT_BLIST_GROUP_COLLAPSED "%R-%x" #define DEFAULT_TEXT_BUDDY_ACTIVE "%G*%x" #define DEFAULT_TEXT_BUDDY_AWAY "%r*%x" #define DEFAULT_TEXT_BUDDY_IDLE "%Y*%x" #define DEFAULT_TEXT_NO_NAME "" #define DEFAULT_TEXT_NO_ROOM ":(not joined)" #define DEFAULT_TEXT_TYPING "Typing" #define DEFAULT_TEXT_TYPING_PAUSED "Typing [paused]" #define DEFAULT_TEXT_WARN_ANONYMOUS "%D<%ranonymous%D>%x" #define DEFAULT_TIMESTAMP 1 #define DEFAULT_TRANSFER_PORT_MAX 15000 #define DEFAULT_TRANSFER_PORT_MIN 10000 #define DEFAULT_WORDWRAP 1 #define DEFAULT_WORDWRAP_CHAR ' ' #endif pork-0.99.8.1/src/pork.c0000644000175000017500000001370010234217326014606 0ustar ryanryan00000000000000/* ** pork.c - main function. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_TERMIOS_H # include #elif defined HAVE_SYS_TERMIOS_H # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct screen screen; /* ** The fallback for when no binding for a key exists. ** Insert the key into the input buffer. */ static void binding_insert(int key) { struct imwindow *imwindow = cur_window(); if (key > 0 && key <= 0xff) input_insert(imwindow->input, key); } static inline void binding_run(struct binding *binding) { /* ** Yeah, this is kind of a hack, but it makes things ** more pleasant (i.e. you don't see status messages ** about new settings and things like that if the command ** was run from a key binding (other than hitting enter on ** the command line). */ if (binding->key != '\n') { int quiet = screen_set_quiet(1); run_mcommand(binding->binding); screen_set_quiet(quiet); } else run_mcommand(binding->binding); } static void resize_display(void) { struct winsize size; if (ioctl(1, TIOCGWINSZ, &size) != 0) { debug("ioctl: %s", strerror(errno)); pork_exit(-1, NULL, "Fatal error getting screen size\n"); } screen_resize(size.ws_row, size.ws_col); screen_refresh(); } static void sigwinch_handler(int sig __notused) { pork_io_add_cond(&screen, IO_COND_ALWAYS); } static void generic_signal_handler(int sig) { pork_exit(sig, NULL, "Caught signal %d. Exiting\n", sig); } void keyboard_input(int fd __notused, u_int32_t cond, void *data __notused) { struct imwindow *imwindow = cur_window(); struct pork_acct *acct = imwindow->owner; int key; /* ** This will be the case only after the program receives SIGWINCH. ** The screen can't be resized from inside a signal handler.. */ if (cond == IO_COND_ALWAYS) { pork_io_del_cond(&screen, IO_COND_ALWAYS); resize_display(); return; } key = wgetinput(screen.status_bar); if (key == -1) return; time(&acct->last_input); bind_exec(imwindow->active_binds, key); if (acct->connected && acct->marked_idle && opt_get_bool(OPT_REPORT_IDLE)) { if (acct->proto->set_idle_time != NULL) acct->proto->set_idle_time(acct, 0); acct->marked_idle = 0; screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_UNIDLE, "%s is no longer marked idle", acct->username); } } int main(int argc, char **argv) { struct passwd *pw; char buf[PATH_MAX]; struct imwindow *imwindow; int ret; time_t timer_last_run; time_t status_last_update = 0; pw = getpwuid(getuid()); if (pw == NULL) { fprintf(stderr, "Fatal: Can't get your user info.\n"); exit(-1); } snprintf(buf, sizeof(buf), "%s/.pork", pw->pw_dir); opt_set(OPT_PORK_DIR, buf); if (get_options(argc, argv) != 0) { fprintf(stderr, "Fatal: Error getting options.\n"); exit(-1); } if (initialize_environment() != 0) { fprintf(stderr, "Fatal: Error initializing the terminal.\n"); exit(-1); } proto_init(); color_init(); pork_io_init(); perl_init(); if (screen_init(LINES, COLS) == -1) pork_exit(-1, NULL, "Fatal: Error initializing the terminal.\n"); signal(SIGWINCH, sigwinch_handler); signal(SIGTERM, generic_signal_handler); signal(SIGQUIT, generic_signal_handler); signal(SIGHUP, generic_signal_handler); signal(SIGPIPE, SIG_IGN); wmove(screen.status_bar, STATUS_ROWS - 1, 0); imwindow = cur_window(); bind_init(&screen.binds); bind_set_handlers(&screen.binds.main, binding_run, binding_insert); bind_set_handlers(&screen.binds.blist, binding_run, NULL); alias_init(&screen.alias_hash); event_init(&screen.events); screen_set_quiet(1); ret = read_global_config(); screen_set_quiet(0); if (ret != 0) screen_err_msg("Error reading the global configuration."); status_draw(screen.null_acct); screen_draw_input(); screen_doupdate(); time(&timer_last_run); while (1) { time_t time_now; int dirty = 0; pork_io_run(); pork_acct_update(); /* ** Run the timers at most once per second. */ time(&time_now); if (timer_last_run < time_now) { timer_last_run = time_now; timer_run(&screen.timer_list); pork_acct_reconnect_all(); } imwindow = cur_window(); dirty = imwindow_refresh(imwindow); /* ** Draw the status bar at most once per second. */ time(&time_now); if (status_last_update < time_now) { status_last_update = time_now; status_draw(imwindow->owner); dirty++; } dirty += screen_draw_input(); if (dirty) screen_doupdate(); } pork_exit(0, NULL, NULL); } /* ** Sign off all acounts and exit. If a message ** is given, print it to the screen. */ void pork_exit(int status, char *msg, char *fmt, ...) { event_generate(cur_window()->owner->events, EVENT_UNLOAD); pork_acct_del_all(msg); screen_destroy(); perl_destroy(); pork_io_destroy(); proto_destroy(); wclear(stdscr); wrefresh(stdscr); delwin(stdscr); endwin(); if (fmt != NULL) { va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); } exit(status); } pork-0.99.8.1/src/pork.h0000644000175000017500000000164210234217326014615 0ustar ryanryan00000000000000/* ** pork.h - pork main include file. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_H #define __PORK_H #ifdef HAVE___ATTRIBUTE__ #define __used __attribute__((used)) #define __notused __attribute__((unused)) #define __format(x) __attribute__((format x )) #else #define __used #define __notused #define __format(x) #endif #ifdef ENABLE_DEBUGGING # define debug(format, args...) do { fprintf(stderr, "[%s:%u:%s] DEBUG: " format "\n", __FILE__, __LINE__, __FUNCTION__, ##args); } while (0) #else # define debug(format, args...) do { } while (0) #endif void pork_exit(int status, char *msg, char *fmt, ...) __format((printf, 3, 4)); void keyboard_input(int fd, u_int32_t condition, void *data); #endif pork-0.99.8.1/src/pork_events.c0000644000175000017500000001676710234217326016212 0ustar ryanryan00000000000000/* ** pork_events.c - event handler functions. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static u_int32_t next_refnum; static struct event_info events_info[] = { { "BUDDY_AWAY", "Si", 0 }, { "BUDDY_BACK", "Si", 0 }, { "BUDDY_IDLE", "Sii", 0 }, { "BUDDY_SIGNOFF", "Si", 0 }, { "BUDDY_SIGNON", "Si", 0 }, { "BUDDY_UNIDLE", "Si", 0 }, { "QUIT", "S", 0 }, { "RECV_ACTION", "SSSsi", 0 }, { "RECV_AWAYMSG", "Siiiisi", 0 }, { "RECV_CHAT_ACTION", "SSSSsi", 0 }, { "RECV_CHAT_INVITE", "SSSsi", 0 }, { "RECV_CHAT_JOIN", "SSSi", 0 }, { "RECV_CHAT_KICK", "SSSsi", 0 }, { "RECV_CHAT_LEAVE", "SSi", 0 }, { "RECV_CHAT_MSG", "SSSSsi", 0 }, { "RECV_CHAT_MODE", "SSsi", 0 }, { "RECV_CHAT_NOTICE", "SSSSsi", 0 }, { "RECV_CHAT_QUIT", "SSsi", 0 }, { "RECV_CHAT_TOPIC", "SSsi", 0 }, { "RECV_IM", "SSSisi", 0 }, { "RECV_NOTICE", "SSSsi", 0 }, { "RECV_PROFILE", "Siiiisi", 0 }, { "RECV_RAW", "SSi", 0 }, { "RECV_SEARCH_RESULT", "SSi", 0 }, { "RECV_WARN", "Sii", 0 }, { "SEND_ACTION", "Ssi", 0 }, { "SEND_AWAY", "si", 0 }, { "SEND_CHAT_ACTION", "Ssi", 0 }, { "SEND_CHAT_INVITE", "SSsi", 0 }, { "SEND_CHAT_JOIN", "Si", 0 }, { "SEND_CHAT_KICK", "SSsi", 0 }, { "SEND_CHAT_LEAVE", "Si", 0 }, { "SEND_CHAT_MSG", "Ssi", 0 }, { "SEND_CHAT_NOTICE", "Ssi", 0 }, { "SEND_CHAT_TOPIC", "Ssi", 0 }, { "SEND_IDLE", "ii", 0 }, { "SEND_IM", "Ssi", 0 }, { "SEND_NOTICE", "Ssi", 0 }, { "SEND_LINE", "si", 0 }, { "SEND_PROFILE", "si", 0 }, { "SEND_WARN", "Sii", 0 }, { "SIGNOFF", "i", 0 }, { "SIGNON", "i", 0 }, { "UNLOAD", "", 0 }, }; static int event_compare(const void *l, const void *r) { const char *key = (char *) l; struct event_info *info = (struct event_info *) r; return (strcasecmp(key, info->name)); } static int event_find_refnum_cb(void *l, void *r) { u_int32_t refnum = POINTER_TO_UINT(l); struct event_entry *event = (struct event_entry *) r; return (refnum - event->refnum); } static int event_find(const char *name) { struct event_info *info; u_int32_t offset; info = bsearch(name, events_info, array_elem(events_info), sizeof(struct event_info), event_compare); if (info == NULL) return (-1); offset = (long) info - (long) &events_info[0]; return (offset / sizeof(struct event_info)); } void event_init(struct event *events) { memset(events, 0, sizeof(*events)); } static void event_destroy_cb(void *param __notused, void *data) { struct event_entry *event = (struct event_entry *) data; free(event->command); } inline void event_purge(struct event *events) { event_destroy(events); event_init(events); } void event_destroy(struct event *events) { u_int32_t i; for (i = 0 ; i < MAX_EVENT_TYPE ; i++) { dlist_destroy(events->e[i], NULL, event_destroy_cb); events->e[i] = NULL; } } static void event_print_type(struct event *events, u_int32_t type) { dlist_t *cur = events->e[type]; if (cur == NULL) { screen_win_msg(cur_window(), 0, 1, 1, MSG_TYPE_CMD_OUTPUT, "No %s events", events_info[type].name); return; } do { struct event_entry *event = cur->data; screen_win_msg(cur_window(), 0, 1, 1, MSG_TYPE_CMD_OUTPUT, "[refnum %u] EVENT %s: %s", event->refnum, events_info[type].name, event->command); cur = cur->next; } while (cur != NULL); } void event_list(struct event *events, const char *event_type) { u_int32_t i; if (event_type != NULL) { int event; event = event_find(event_type); if (event == -1) { screen_err_msg("No such event: %s", event_type); return; } event_print_type(events, event); return; } for (i = 0 ; i < MAX_EVENT_TYPE ; i++) event_print_type(events, i); } int event_add( struct event *events, const char *event_type, const char *args, u_int32_t *event_refnum) { int event; int quiet = 0; struct event_entry *new_event; if (*event_type == '^') { quiet = 1; event_type++; } event = event_find(event_type); if (event == -1) return (-1); new_event = xcalloc(1, sizeof(*new_event)); new_event->command = xstrdup(args); new_event->quiet = quiet; new_event->refnum = next_refnum++; events->e[event] = dlist_add_tail(events->e[event], new_event); *event_refnum = new_event->refnum; return (0); } int event_del_refnum(struct event *events, u_int32_t refnum) { u_int32_t i; for (i = 0 ; i < MAX_EVENT_TYPE ; i++) { dlist_t *cur; cur = dlist_find(events->e[i], UINT_TO_POINTER(refnum), event_find_refnum_cb); if (cur != NULL) { struct event_entry *event = cur->data; events->e[i] = dlist_remove(events->e[i], cur); free(event->command); free(event); return (0); } } return (-1); } int event_del_type(struct event *events, const char *type, const char *func) { int event = event_find(type); dlist_t *cur; if (event == -1) return (-1); if (func == NULL) { dlist_destroy(events->e[event], NULL, event_destroy_cb); events->e[event] = NULL; return (0); } cur = events->e[event]; while (cur != NULL) { struct event_entry *entry = cur->data; if (!strcasecmp(entry->command, func)) { events->e[event] = dlist_remove(events->e[event], cur); free(entry->command); free(entry); return (0); } } return (-1); } static int event_should_generate(u_int32_t event_num) { int recursive_events = opt_get_bool(OPT_RECURSIVE_EVENTS); if (events_info[event_num].inside > 0 && !recursive_events) return (0); return (1); } int event_generate(struct event *events, u_int32_t event_num, ...) { dlist_t *cur; /* ** Event handlers can delete and add other event ** handlers, so after one handler runs, we have no idea ** what the list of event handlers for the event type that was ** just handled looks like. We need some way to figure out ** which handlers in the list have and have not already run. ** This could get out of control if the list of handlers for ** some event type got big, but that should never happen. */ cur = events->e[event_num]; while (cur != NULL) { struct event_entry *event = cur->data; event->has_run = 0; cur = cur->next; } cur = events->e[event_num]; while (cur != NULL) { int ret = 0; va_list data; struct event_entry *event = cur->data; int old_quiet = 0; int quiet = event->quiet; if (event->has_run) { cur = cur->next; continue; } if (quiet) old_quiet = screen_set_quiet(1); va_start(data, event_num); event->has_run = 1; if (event_should_generate(event_num)) { events_info[event_num].inside++; ret = execute_perl_va(event->command, events_info[event_num].fmt, data); events_info[event_num].inside--; } va_end(data); if (quiet) screen_set_quiet(old_quiet); if (ret != 0) return (ret); /* ** The event handler that just ran could have removed ** any other event handlers for this type. It could ** have added new handlers to the head of the list. We start over. */ cur = events->e[event_num]; } return (0); } pork-0.99.8.1/src/pork_events.h0000644000175000017500000000373710234217326016210 0ustar ryanryan00000000000000/* ** pork_events.h - event handler functions. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_EVENTS_H #define __PORK_EVENTS_H enum { EVENT_BUDDY_AWAY, EVENT_BUDDY_BACK, EVENT_BUDDY_IDLE, EVENT_BUDDY_SIGNOFF, EVENT_BUDDY_SIGNON, EVENT_BUDDY_UNIDLE, EVENT_QUIT, EVENT_RECV_ACTION, EVENT_RECV_AWAYMSG, EVENT_RECV_CHAT_ACTION, EVENT_RECV_CHAT_INVITE, EVENT_RECV_CHAT_JOIN, EVENT_RECV_CHAT_KICK, EVENT_RECV_CHAT_LEAVE, EVENT_RECV_CHAT_MSG, EVENT_RECV_CHAT_MODE, EVENT_RECV_CHAT_NOTICE, EVENT_RECV_CHAT_QUIT, EVENT_RECV_CHAT_TOPIC, EVENT_RECV_IM, EVENT_RECV_NOTICE, EVENT_RECV_PROFILE, EVENT_RECV_RAW, EVENT_RECV_SEARCH_RESULT, EVENT_RECV_WARN, EVENT_SEND_ACTION, EVENT_SEND_AWAY, EVENT_SEND_CHAT_ACTION, EVENT_SEND_CHAT_INVITE, EVENT_SEND_CHAT_JOIN, EVENT_SEND_CHAT_KICK, EVENT_SEND_CHAT_LEAVE, EVENT_SEND_CHAT_MSG, EVENT_SEND_CHAT_NOTICE, EVENT_SEND_CHAT_TOPIC, EVENT_SEND_IDLE, EVENT_SEND_IM, EVENT_SEND_LINE, EVENT_SEND_NOTICE, EVENT_SEND_PROFILE, EVENT_SEND_WARN, EVENT_SIGNOFF, EVENT_SIGNON, EVENT_UNLOAD, MAX_EVENT_TYPE }; struct event_info { char *name; char *fmt; int inside; }; struct event { dlist_t *e[MAX_EVENT_TYPE]; }; struct event_entry { char *command; u_int32_t refnum; u_int32_t quiet:1; u_int32_t has_run:1; }; int event_add( struct event *events, const char *event_type, const char *args, u_int32_t *refnum); void event_list(struct event *events, const char *event_type); int event_generate(struct event *events, u_int32_t event_num, ...); int event_del_refnum(struct event *events, u_int32_t refnum); int event_del_type(struct event *events, const char *type, const char *func); void event_init(struct event *events); void event_destroy(struct event *events); void event_purge(struct event *events); #endif pork-0.99.8.1/src/pork_slist.c0000644000175000017500000003542710234217326016036 0ustar ryanryan00000000000000/* ** pork_slist.c - an ncurses scrolling list widget ** Copyright (C) 2002-2005 Ryan McCabe ** ** This widget is more akin to what GUI development toolkits call ** 'trees' than to a list, I think. ** ** This could be improved and made more useful for other purposes ** (it's fine for what this program needs right now) by supporting ** "hidden" nodes, so that nodes don't have to be deleted from the list ** in order to not be displayed. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include static int slist_find_cb(void *l, void *r) { return (l != r); } static void slist_destroy_cleanup(void *param, void *data) { struct slist *slist = param; struct slist_cell *cell = data; dlist_destroy(cell->children, slist, slist_destroy_cleanup); free(cell->label); if (slist->cell_free_cb != NULL) slist->cell_free_cb(cell); free(cell); } static dlist_t *slist_node_prev(dlist_t *node) { struct slist_cell *cell; if (node->prev != NULL) { struct slist_cell *prev_cell = node->prev->data; dlist_t *cur = prev_cell->children; /* ** The the node immediately before a node that follows ** a node with children is the last of those children. */ while (cur != NULL) { dlist_t *next = cur->next; if (next == NULL) return (cur); cur = next; } return (node->prev); } cell = node->data; return (cell->parent); } dlist_t *slist_node_next(dlist_t *node) { struct slist_cell *cell = node->data; if (cell->children != NULL) return (cell->children); if (node->next != NULL) return (node->next); if (cell->parent != NULL) return (cell->parent->next); return (NULL); } static void slist_scroll_screen_up(struct slist *slist) { struct slist_cell *cell; scrollok(slist->win, TRUE); wscrl(slist->win, -1); scrollok(slist->win, FALSE); if (slist->has_border) { cell = slist->bot->data; if (cell->line != SLIST_LAST_ROW(slist)) { wmove(slist->win, SLIST_LAST_ROW(slist) + slist->has_border, 0); wclrtoeol(slist->win); } } cell = slist->top->data; wmove(slist->win, cell->line, 1); wclrtoeol(slist->win); mvwputstr(slist->win, cell->line, SLIST_FIRST_COL(slist), cell->label); slist->dirty = 1; } static void slist_scroll_screen_down(struct slist *slist) { struct slist_cell *cell; scrollok(slist->win, TRUE); wscrl(slist->win, 1); scrollok(slist->win, FALSE); cell = slist->bot->data; wmove(slist->win, cell->line, 1); wclrtoeol(slist->win); mvwputstr(slist->win, cell->line, SLIST_FIRST_COL(slist), cell->label); slist->dirty = 1; } int slist_init( struct slist *slist, u_int32_t rows, u_int32_t cols, u_int32_t xpos, u_int32_t ypos) { WINDOW *win; win = newwin(rows, cols, ypos, xpos); if (win == NULL) return (-1); set_default_win_opts(win); memset(slist, 0, sizeof(*slist)); slist->win = win; slist->rows = rows; slist->cols = cols; slist->has_border = 1; return (0); } void slist_cell_free_cb(struct slist *slist, void (*cell_free_cb)(void *)) { slist->cell_free_cb = cell_free_cb; } void slist_destroy(struct slist *slist) { dlist_destroy(slist->cells, slist, slist_destroy_cleanup); delwin(slist->win); memset(slist, 0, sizeof(*slist)); } int slist_renumber(struct slist *slist, dlist_t *start_cell, int cur_line) { dlist_t *cur = start_cell; if (cur == NULL) return (-1); while (1) { struct slist_cell *cell = cur->data; dlist_t *last; if (cur_line > SLIST_LAST_ROW(slist)) { slist->bot = slist_node_prev(cur); cur_line = -1; } cell->line = cur_line; if (cur_line >= 0) cur_line++; last = cur; cur = slist_node_next(cur); if (cur == NULL) { if (cur_line > 0) slist->bot = last; break; } } return (cur_line); } int slist_resize( struct slist *slist, u_int32_t rows, u_int32_t cols, u_int32_t screen_cols) { struct slist_cell *cell; slist->rows = rows; slist->cols = cols; wresize(slist->win, slist->rows, slist->cols); mvwin(slist->win, 0, screen_cols - slist->cols); wmove(slist->win, 0, 0); wclrtobot(slist->win); slist_renumber(slist, slist->top, 0 + slist->has_border); slist_draw(slist); if (slist->cursor != NULL) { cell = slist->cursor->data; if (cell->line == -1) slist->cursor = slist->bot; else if (cell->line == -2) slist->cursor = slist->top; } else { /* ** This should only happen if the list is ** completely empty. */ slist->cursor = slist->top; } slist->dirty = 1; return (0); } int slist_cursor_up(struct slist *slist) { dlist_t *cursor; struct slist_cell *cell; if (slist->cursor == NULL) return (-1); cursor = slist_node_prev(slist->cursor); if (cursor == NULL) return (-1); slist->cursor = cursor; cell = cursor->data; if (cell->line < 0) { struct slist_cell *bot_cell = slist->bot->data; slist->top = slist_node_prev(slist->top); if (bot_cell->line == SLIST_LAST_ROW(slist)) bot_cell->line = -1; slist_renumber(slist, slist->top, 0 + slist->has_border); slist_scroll_screen_up(slist); } slist->dirty = 1; return (0); } int slist_cursor_down(struct slist *slist) { dlist_t *cursor; struct slist_cell *cell; if (slist->cursor == NULL) return (-1); cursor = slist_node_next(slist->cursor); if (cursor == NULL) return (-1); cell = cursor->data; /* ** The top line scrolls off the top. */ if (cell->line < 0) { struct slist_cell *top_cell = slist->top->data; top_cell->line = -2; slist->top = slist_node_next(slist->top); slist_renumber(slist, slist->top, 0 + slist->has_border); slist_scroll_screen_down(slist); } slist->cursor = cursor; slist->dirty = 1; return (0); } int slist_cursor_start(struct slist *slist) { int ret; int scrolled = 0; if (slist == NULL) return (-1); while ((ret = slist_cursor_up(slist)) == 0) scrolled++; return (scrolled); } int slist_cursor_end(struct slist *slist) { int ret; int scrolled = 0; if (slist == NULL) return (-1); while ((ret = slist_cursor_down(slist)) == 0) scrolled++; return (scrolled); } int slist_cursor_pgdown(struct slist *slist) { int ret; int lines = slist->rows - (slist->has_border * 2); int scrolled = 0; if (slist == NULL) return (-1); while (lines-- > 0 && (ret = slist_cursor_down(slist)) == 0) scrolled++; return (scrolled); } int slist_cursor_pgup(struct slist *slist) { int ret; int lines = slist->rows - (slist->has_border * 2); int scrolled = 0; if (slist == NULL) return (-1); while (lines-- > 0 && (ret = slist_cursor_up(slist)) == 0) scrolled++; return (scrolled); } dlist_t *slist_find(dlist_t *start, void *data) { dlist_t *cur = start; while (cur != NULL) { if (cur->data == data) return (cur); cur = slist_node_next(cur); } return (NULL); } inline struct slist_cell *slist_get_cursor(struct slist *slist) { if (slist->cursor == NULL) return (NULL); return (slist->cursor->data); } dlist_t *slist_add(struct slist *slist, struct slist_cell *cell) { int next_line; dlist_t *cur; dlist_t **head; dlist_t **start_renumber; if (cell == NULL) return (NULL); if (cell->parent == NULL) { head = &slist->cells; next_line = SLIST_FIRST_ROW(slist); start_renumber = head; } else { struct slist_cell *parent_cell = cell->parent->data; if (parent_cell->type != TYPE_LIST_CELL) return (NULL); if (parent_cell->collapsed) return (NULL); head = &parent_cell->children; next_line = parent_cell->line; if (parent_cell->line >= 0) next_line++; start_renumber = head; } cur = *head; if (cur == NULL) { dlist_t *old_head = *head; cell->line = next_line; *head = dlist_add_head(*head, cell); if (slist->top == old_head) { slist->top = *head; start_renumber = head; } } else { struct slist_cell *last_cell = cur->data; dlist_t *old_head = *head; if (last_cell->refnum > cell->refnum) { cell->line = last_cell->line; *head = dlist_add_head(*head, cell); if (slist->top == old_head) { slist->top = *head; start_renumber = head; } } else { dlist_t *temp; dlist_t *child; do { struct slist_cell *cur_cell; dlist_t *next = cur->next; if (next == NULL) break; cur_cell = next->data; if (cur_cell->refnum > cell->refnum) break; cur = next; } while (1); *head = dlist_add_after(*head, cur, cell); temp = cur->next; start_renumber = &temp; last_cell = cur->data; /* ** We're adding this new node, call it B, after an old ** node, call it A. If A holds a list cell, then B's line ** number will be one more than that of the last child of B. */ child = last_cell->children; if (child != NULL) { dlist_t *last = NULL; while (child != temp) { last = child; child = slist_node_next(child); } if (last != NULL) last_cell = last->data; } cell->line = last_cell->line; if (cell->line >= 0) cell->line++; } } if (cell->line > SLIST_LAST_ROW(slist)) cell->line = -1; cur = *start_renumber; if (slist->top == NULL) slist->top = slist->cells; if (cell->line >= 0) { if (slist->cursor == NULL) slist->cursor = cur; slist_renumber(slist, *start_renumber, cell->line); } if (slist->cursor == NULL) slist->cursor = slist->top; /* ** If the node to be added is off the screen at the top, scroll ** everything up. */ if (cell->line == -2) { slist->top = slist_node_prev(slist->top); slist_renumber(slist, slist->top, 0 + slist->has_border); slist_scroll_screen_up(slist); } if (slist->cursor != NULL) { struct slist_cell *cur_cell = slist->cursor->data; if (cur_cell->line == -1) slist->cursor = slist->bot; else if (cur_cell->line == -2) slist->cursor = slist->top; } return (cur); } static void slist_del_cell_cb(void *param, void *data) { struct slist *slist = param; struct slist_cell *cell = data; free(cell->label); if (slist->cell_free_cb != NULL) slist->cell_free_cb(cell); free(cell); } void slist_del_children(struct slist *slist, dlist_t *node) { dlist_t *cur; struct slist_cell *cell; if (node == NULL) return; cell = node->data; cur = cell->children; while (cur != NULL) { struct slist_cell *cur_cell = cur->data; if (cur_cell->children != NULL) slist_del_children(slist, cur); if (slist->cursor == cur) slist->cursor = node; if (slist->top == cur) slist->top = node; if (slist->bot == cur) slist->bot = node; cur = cur->next; } dlist_destroy(cell->children, slist, slist_del_cell_cb); cell->collapsed = 1; cell->children = NULL; } int slist_collapse_list_cell(struct slist *slist, dlist_t *node) { struct slist_cell *cell; if (node == NULL || node->data == NULL) return (-1); cell = node->data; if (cell->type != TYPE_LIST_CELL || cell->collapsed) return (-1); slist_del_children(slist, node); slist_renumber(slist, slist->top, 0 + slist->has_border); return (0); } struct slist_cell *slist_del(struct slist *slist, struct slist_cell *cell) { dlist_t *cur; dlist_t **head; if (cell == NULL) return (NULL); if (cell->parent == NULL) head = &slist->cells; else { struct slist_cell *parent_cell = cell->parent->data; if (parent_cell->type != TYPE_LIST_CELL) return (NULL); if (parent_cell->collapsed) return (NULL); head = &parent_cell->children; } cur = dlist_find(*head, cell, slist_find_cb); if (cur == NULL) return (NULL); if (cell->children != NULL) slist_del_children(slist, cur); if (slist->top == cur) { slist->top = slist_node_next(cur); if (slist->top == NULL) slist->top = slist_node_prev(cur); } if (slist->cursor == cur) { slist->cursor = slist_node_next(cur); if (slist->cursor == NULL) slist->cursor = slist_node_prev(cur); } /* ** If the node to be deleted is off the screen at the top, scroll ** everything down. */ if (cell->line == -2) { dlist_t *new_top; new_top = slist_node_next(slist->top); if (new_top != NULL) { dlist_t *old_top = slist->top; struct slist_cell *top_cell = slist->top->data; top_cell->line = -2; slist->top = new_top; if (slist->cursor == old_top) slist->cursor = slist->top; slist_scroll_screen_down(slist); } } *head = dlist_remove(*head, cur); slist_del_cell_cb(slist, cell); if (slist->top != NULL) slist_renumber(slist, slist->top, 0 + slist->has_border); if (slist->cursor != NULL) { cell = slist->cursor->data; if (cell->line == -1) slist->cursor = slist->bot; else if (cell->line == -2) slist->cursor = slist->top; } else slist->cursor = slist->top; return (0); } void slist_draw_line(struct slist *slist, struct slist_cell *cell) { int ret; if (cell->line < 0) return; wmove(slist->win, cell->line, SLIST_FIRST_COL(slist)); ret = mvwputnstr(slist->win, cell->line, slist->has_border, cell->label, SLIST_LAST_COL(slist) - SLIST_FIRST_COL(slist) + 1); /* ** Pad it out with spaces. */ while (++ret <= SLIST_LAST_COL(slist)) waddch(slist->win, ' '); slist->dirty = 1; } void slist_draw_cursor(struct slist *slist, attr_t curs_attr) { int i; struct slist_cell *cell; if (slist == NULL || slist->cursor == NULL || slist->cursor->data == NULL) return; cell = slist->cursor->data; if (cell->line < 0) return; wmove(slist->win, cell->line, SLIST_FIRST_COL(slist)); if (curs_attr) { /* ** I don't call wattron and then wputstr here because ** ncurses' waddch fuction seems to ignore the attributes ** that you just set with wattron if a chtype already has ** color attributes set. */ for (i = 0 ; i <= SLIST_LAST_COL(slist) && cell->label[i] != 0 ; i++) waddch(slist->win, chtype_get(cell->label[i]) | curs_attr); } else { /* ** If no attributes are specified, just use the ones in ** the chtype already. */ for (i = 0 ; i <= SLIST_LAST_COL(slist) && cell->label[i] != 0 ; i++) waddch(slist->win, cell->label[i]); } /* ** Pad it out with spaces. */ while (++i <= SLIST_LAST_COL(slist)) waddch(slist->win, ' ' | curs_attr); slist->dirty = 1; } void slist_draw(struct slist *slist) { dlist_t *cur = slist->top; while (cur != NULL) { struct slist_cell *cell = cur->data; if (cell->line < 0) return; slist_draw_line(slist, cell); cur = slist_node_next(cur); } slist->dirty = 1; } void slist_clear_bot(struct slist *slist) { struct slist_cell *cell; if (slist->bot == NULL) return; cell = slist->bot->data; if (cell == NULL) return; if (cell->line != SLIST_LAST_ROW(slist)) { wmove(slist->win, cell->line + 1, 0); wclrtobot(slist->win); slist->dirty = 1; } } int slist_refresh(struct slist *slist) { if (!slist->dirty) return (0); wnoutrefresh(slist->win); slist->dirty = 0; return (1); } pork-0.99.8.1/src/pork_slist.h0000644000175000017500000000503510234217326016033 0ustar ryanryan00000000000000/* ** pork_slist.h - an ncurses scrolling list widget ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_SLIST_H #define __PORK_SLIST_H #define SLIST_FIRST_ROW(x) (0 + (x)->has_border) #define SLIST_FIRST_COL(x) (0 + (x)->has_border) #define SLIST_LAST_ROW(x) \ ((int) ((x)->rows - (x)->has_border - 1)) #define SLIST_LAST_COL(x) \ ((int) ((x)->cols - (x)->has_border - 1)) #define TYPE_LIST_CELL 0 #define TYPE_FLAT_CELL 1 struct slist_cell { u_int32_t type:1; u_int32_t collapsed:1; u_int32_t refnum; /* ** Line can be -1 meaning off the screen at the bottom, ** -2, meaning off the screen at the top, or a positive ** integer, indicating what physical line it is displayed on. */ int line; chtype *label; dlist_t *parent; dlist_t *children; void *data; }; struct slist { u_int32_t rows; u_int32_t cols; u_int32_t dirty:1; u_int32_t has_border:1; WINDOW *win; dlist_t *cells; dlist_t *cursor; dlist_t *top; dlist_t *bot; void (*cell_free_cb)(void *); }; int slist_init( struct slist *slist, u_int32_t rows, u_int32_t cols, u_int32_t xpos, u_int32_t ypos); void slist_cell_free_cb(struct slist *slist, void (*cell_free_cb)(void *)); int slist_renumber(struct slist *slist, dlist_t *start_cell, int next_line); int slist_resize( struct slist *slist, u_int32_t new_rows, u_int32_t new_cols, u_int32_t screen_cols); int slist_cursor_up(struct slist *slist); int slist_cursor_down(struct slist *slist); int slist_cursor_start(struct slist *slist); int slist_cursor_end(struct slist *slist); int slist_cursor_pgup(struct slist *slist); int slist_cursor_pgdown(struct slist *slist); struct slist_cell *slist_del(struct slist *slist, struct slist_cell *cell); void slist_del_children(struct slist *slist, dlist_t *node); dlist_t *slist_add(struct slist *slist, struct slist_cell *cell); dlist_t *slist_find(dlist_t *start, void *data); int slist_collapse_list_cell(struct slist *slist, dlist_t *node); void slist_destroy(struct slist *slist); void slist_draw(struct slist *slist); void slist_draw_cursor(struct slist *slist, attr_t curs_attr); void slist_draw_line(struct slist *slist, struct slist_cell *cell); void slist_clear_bot(struct slist *slist); int slist_refresh(struct slist *slist); dlist_t *slist_node_next(dlist_t *node); inline struct slist_cell *slist_get_cursor(struct slist *slist); #endif pork-0.99.8.1/src/pork_status.c0000644000175000017500000000331110234217326016206 0ustar ryanryan00000000000000/* ** pork_status.c - status bar implementation. ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern struct screen screen; int status_init(void) { WINDOW *win; win = newwin(STATUS_ROWS, screen.cols, screen.rows - STATUS_ROWS, 0); if (win == NULL) return (-1); set_default_win_opts(win); screen.status_bar = win; return (0); } /* ** Draw the status bar, using the format string OPT_FORMAT_STATUS. This ** parses the format string every time the status bar is redrawn, which ** could waste some cpu time, except that today's computers are sickeningly fast ** and the status bar isn't redrawn all that much anyway. */ void status_draw(struct pork_acct *acct) { char buf[1024]; chtype status_bar[screen.cols + 1]; struct imwindow *win = cur_window(); int type; if (win->type == WIN_TYPE_CHAT) type = OPT_FORMAT_STATUS_CHAT; else type = OPT_FORMAT_STATUS; fill_format_str(type, buf, sizeof(buf), win, acct); format_apply_justification(buf, status_bar, array_elem(status_bar)); mvwputstr(screen.status_bar, 0, 0, status_bar); wnoutrefresh(screen.status_bar); } pork-0.99.8.1/src/pork_status.h0000644000175000017500000000072010234217326016214 0ustar ryanryan00000000000000/* ** pork_status.h - status bar implementation. ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_STATUS_H #define __PORK_STATUS_H #define STATUS_ROWS 2 struct pork_acct; int status_init(void); void status_draw(struct pork_acct *acct); #endif pork-0.99.8.1/src/pork_timer.c0000644000175000017500000000540410234217326016010 0ustar ryanryan00000000000000/* ** pork_timer.c - Timer implementation ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include static u_int32_t last_refnum; static int timer_find_cb(void *l, void *r) { char *str = l; struct timer_entry *timer = r; return (strcmp(str, timer->command)); } static int timer_find_refnum_cb(void *l, void *r) { u_int32_t refnum = POINTER_TO_UINT(l); struct timer_entry *timer = r; return (refnum - timer->refnum); } static void timer_destroy_cb(void *param __notused, void *data) { struct timer_entry *timer = data; free(timer->command); free(timer); } u_int32_t timer_add(dlist_t **timer_list, char *command, time_t interval, u_int32_t times) { struct timer_entry *timer = xcalloc(1, sizeof(*timer)); timer->last_run = time(NULL); timer->command = xstrdup(command); timer->refnum = last_refnum++; timer->interval = interval; timer->times = times; *timer_list = dlist_add_head(*timer_list, timer); return (timer->refnum); } int timer_del(dlist_t **timer_list, char *command) { dlist_t *node; struct timer_entry *timer; node = dlist_find(*timer_list, command, timer_find_cb); if (node == NULL) return (-1); timer = node->data; *timer_list = dlist_remove(*timer_list, node); free(timer->command); free(timer); return (0); } int timer_del_refnum(dlist_t **timer_list, u_int32_t refnum) { dlist_t *node; struct timer_entry *timer; node = dlist_find(*timer_list, UINT_TO_POINTER(refnum), timer_find_refnum_cb); if (node == NULL) return (-1); timer = node->data; *timer_list = dlist_remove(*timer_list, node); free(timer->command); free(timer); return (0); } int timer_run(dlist_t **timer_list) { dlist_t *cur = *timer_list; int triggered = 0; while (cur != NULL) { dlist_t *next = cur->next; struct timer_entry *timer = cur->data; if (timer->last_run + timer->interval <= time(NULL)) { char *command = xstrdup(timer->command); triggered++; run_mcommand(command); free(command); if (timer->times != 1) { time(&timer->last_run); if (timer->times > 1) timer->times--; } else { *timer_list = dlist_remove(*timer_list, cur); free(timer->command); free(timer); } } cur = next; } return (triggered); } inline void timer_destroy(dlist_t **timer_list) { dlist_destroy(*timer_list, NULL, timer_destroy_cb); *timer_list = NULL; } pork-0.99.8.1/src/pork_timer.h0000644000175000017500000000140110234217326016006 0ustar ryanryan00000000000000/* ** pork_timer.h - Timer implementation ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_TIMER_H #define __PORK_TIMER_H struct timer_entry { char *command; u_int32_t refnum; time_t interval; time_t last_run; u_int32_t times; }; int timer_run(dlist_t **timer_list); inline void timer_destroy(dlist_t **timer_list); int timer_del_refnum(dlist_t **timer_list, u_int32_t refnum); int timer_del(dlist_t **timer_list, char *command); u_int32_t timer_add(dlist_t **timer_list, char *command, time_t interval, u_int32_t count); #endif pork-0.99.8.1/src/pork_msg.c0000644000175000017500000002540410234217326015460 0ustar ryanryan00000000000000/* ** pork_msg.c ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int pork_msg_autoreply(struct pork_acct *acct, char *dest, char *msg) { struct imwindow *win; char buf[4096]; int ret; if (acct->proto->send_msg_auto == NULL) return (-1); if (acct->proto->send_msg_auto(acct, dest, msg) == -1) return (-1); screen_get_query_window(acct, dest, &win); ret = fill_format_str(OPT_FORMAT_IM_SEND_AUTO, buf, sizeof(buf), acct, dest, msg); if (ret < 1) return (-1); screen_print_str(win, buf, (size_t) ret, MSG_TYPE_PRIVMSG_SEND); imwindow_send_msg(win); return (0); } int pork_msg_send_auto(struct pork_acct *acct, char *sender) { dlist_t *node; u_int32_t hash_val; int ret = 0; if (acct->away_msg != NULL && acct->proto->send_msg_auto == NULL) return (-1); hash_val = string_hash(sender, acct->autoreply.order); node = hash_find(&acct->autoreply, sender, hash_val); if (node == NULL) { struct autoresp *autoresp; autoresp = xcalloc(1, sizeof(*autoresp)); autoresp->name = xstrdup(sender); autoresp->last = time(NULL); hash_add(&acct->autoreply, autoresp, hash_val); ret = pork_msg_autoreply(acct, sender, acct->away_msg); } else { time_t time_now = time(NULL); struct autoresp *autoresp = node->data; /* ** Only send someone an auto-reply every 10 minutes. ** XXX: maybe this should be a configurable value. */ if (autoresp->last + 600 <= time_now) { autoresp->last = time_now; ret = pork_msg_autoreply(acct, sender, acct->away_msg); } } return (ret); } int pork_recv_msg( struct pork_acct *acct, char *dest, char *sender, char *userhost, char *msg, int autoresp) { struct imwindow *win; screen_get_query_window(acct, sender, &win); win->typing = 0; if (!event_generate(acct->events, EVENT_RECV_IM, sender, userhost, dest, autoresp, msg, acct->refnum)) { int type; char buf[4096]; int ret; if (autoresp) type = OPT_FORMAT_IM_RECV_AUTO; else { if (win == screen.status_win) type = OPT_FORMAT_IM_RECV_STATUS; else type = OPT_FORMAT_IM_RECV; } ret = fill_format_str(type, buf, sizeof(buf), acct, dest, sender, userhost, msg); if (ret < 1) return (-1); screen_print_str(win, buf, (size_t) ret, MSG_TYPE_PRIVMSG_RECV); imwindow_recv_msg(win); if (acct->away_msg != NULL && !autoresp && opt_get_bool(OPT_AUTOSEND_AWAY)) { pork_msg_send_auto(acct, sender); } } return (0); } static void autoresp_destroy_cb(void *param __notused, void *data) { struct autoresp *autoresp = (struct autoresp *) data; free(autoresp->name); free(autoresp); } static int autoresp_compare_cb(void *l, void *r) { char *name = (char *) l; struct autoresp *autoresp = (struct autoresp *) r; return (strcasecmp(name, autoresp->name)); } int pork_set_away(struct pork_acct *acct, char *msg) { if (msg == NULL) return (pork_set_back(acct)); if (event_generate(acct->events, EVENT_SEND_AWAY, msg, acct->refnum)) return (0); if (acct->away_msg != NULL) { free(acct->away_msg); hash_destroy(&acct->autoreply); } acct->away_msg = xstrdup(msg); hash_init(&acct->autoreply, 3, autoresp_compare_cb, autoresp_destroy_cb); if (acct->proto->set_away != NULL) { if (acct->proto->set_away(acct, msg) == -1) { screen_err_msg("An error occurred while setting %s away", acct->username); return (-1); } } screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_AWAY, "%s is now away", acct->username); return (0); } int pork_set_back(struct pork_acct *acct) { if (event_generate(acct->events, EVENT_SEND_AWAY, NULL, acct->refnum)) return (0); if (acct->away_msg == NULL) { screen_err_msg("%s is not away", acct->username); return (-1); } free(acct->away_msg); acct->away_msg = NULL; if (acct->proto->set_back != NULL) { if (acct->proto->set_back(acct) == -1) { screen_err_msg("An error occurred while setting %s unaway", acct->username); return (-1); } } hash_destroy(&acct->autoreply); memset(&acct->autoreply, 0, sizeof(acct->autoreply)); screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_BACK, "%s is no longer away", acct->username); return (0); } int pork_msg_send(struct pork_acct *acct, char *dest, char *msg) { int ret = 0; if (!event_generate(acct->events, EVENT_SEND_IM, dest, msg, acct->refnum)) { if (acct->proto->send_msg != NULL) { ret = acct->proto->send_msg(acct, dest, msg); if (ret == -1) { screen_err_msg("Error: the last message to %s could not be sent", dest); } else { struct imwindow *win; char buf[4096]; int type; int ret; if (acct->away_msg != NULL) { if (opt_get_bool(OPT_SEND_REMOVES_AWAY)) pork_set_back(acct); } if (screen_get_query_window(acct, dest, &win) != 0) screen_goto_window(win->refnum); if (win == screen.status_win) type = OPT_FORMAT_IM_SEND_STATUS; else type = OPT_FORMAT_IM_SEND; ret = fill_format_str(type, buf, sizeof(buf), acct, dest, msg); if (ret < 1) return (-1); screen_print_str(win, buf, (size_t) ret, MSG_TYPE_PRIVMSG_SEND); imwindow_send_msg(win); } } } return (ret); } int pork_set_profile(struct pork_acct *acct, char *profile) { int ret = 0; if (event_generate(acct->events, EVENT_SEND_PROFILE, profile, acct->refnum)) return (1); free(acct->profile); if (profile == NULL) acct->profile = NULL; else acct->profile = xstrdup(profile); if (acct->proto->set_profile != NULL) ret = acct->proto->set_profile(acct, profile); if (ret == 0) { screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_CMD_OUTPUT, "Profile for %s was %s", acct->username, (profile == NULL ? "cleared" : "set")); } return (ret); } int pork_set_idle_time(struct pork_acct *acct, u_int32_t seconds) { char timebuf[32]; if (acct->proto->set_idle_time == NULL) return (-1); if (event_generate(acct->events, EVENT_SEND_IDLE, seconds, acct->refnum)) return (1); acct->proto->set_idle_time(acct, seconds); time_to_str_full(seconds, timebuf, sizeof(timebuf)); screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_CMD_OUTPUT, "%s's idle time set to %s", acct->username, timebuf); return (0); } int pork_send_warn(struct pork_acct *acct, char *user) { int ret = 0; if (acct->proto->warn == NULL) return (-1); if (!event_generate(acct->events, EVENT_SEND_WARN, user, 0, acct->refnum)) { ret = acct->proto->warn(acct, user); if (ret == 0) { struct imwindow *win; win = imwindow_find(acct, user); if (win == NULL) win = cur_window(); screen_win_msg(win, 1, 1, 0, MSG_TYPE_CMD_OUTPUT, "%s has warned %s", acct->username, user); } } return (ret); } int pork_send_warn_anon(struct pork_acct *acct, char *user) { int ret = 0; if (acct->proto->warn_anon == NULL) return (-1); if (!event_generate(acct->events, EVENT_SEND_WARN, user, 1, acct->refnum)) { ret = acct->proto->warn_anon(acct, user); if (ret == 0) { struct imwindow *win; win = imwindow_find(acct, user); if (win == NULL) win = cur_window(); screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%s has warned %s anonymously", acct->username, user); } } return (ret); } int pork_change_nick(struct pork_acct *acct, char *nick) { if (acct->proto->change_nick != NULL) return (acct->proto->change_nick(acct, nick)); return (-1); } int pork_recv_action( struct pork_acct *acct, char *dest, char *sender, char *userhost, char *msg) { if (!event_generate(acct->events, EVENT_RECV_ACTION, sender, userhost, dest, msg, acct->refnum)) { struct imwindow *win; char buf[4096]; int type; int ret; screen_get_query_window(acct, sender, &win); if (win == screen.status_win) type = OPT_FORMAT_ACTION_RECV_STATUS; else type = OPT_FORMAT_ACTION_RECV; ret = fill_format_str(type, buf, sizeof(buf), acct, dest, sender, userhost, msg); if (ret < 1) return (-1); screen_print_str(win, buf, (size_t) ret, MSG_TYPE_PRIVMSG_RECV); imwindow_recv_msg(win); } return (0); } int pork_action_send(struct pork_acct *acct, char *dest, char *msg) { if (acct->proto->send_action == NULL || dest == NULL) return (-1); if (event_generate(acct->events, EVENT_SEND_ACTION, dest, msg, acct->refnum)) { return (0); } if (acct->proto->send_action(acct, dest, msg) != -1) { char buf[4096]; struct imwindow *win; int type; int ret; screen_get_query_window(acct, dest, &win); if (win == screen.status_win) type = OPT_FORMAT_ACTION_SEND_STATUS; else type = OPT_FORMAT_ACTION_SEND; ret = fill_format_str(type, buf, sizeof(buf), acct, dest, msg); if (ret < 1) return (-1); screen_print_str(win, buf, (size_t) ret, MSG_TYPE_PRIVMSG_SEND); imwindow_send_msg(win); } return (0); } int pork_notice_send(struct pork_acct *acct, char *dest, char *msg) { struct imwindow *win; if (acct->proto->send_notice == NULL) return (-1); win = imwindow_find(acct, dest); if (win == NULL) win = cur_window(); if (!event_generate(acct->events, EVENT_SEND_NOTICE, dest, msg, acct->refnum)) { char buf[4096]; int type; int ret; if (win == screen.status_win) type = OPT_FORMAT_NOTICE_SEND_STATUS; else type = OPT_FORMAT_NOTICE_SEND; ret = fill_format_str(type, buf, sizeof(buf), acct, dest, msg); if (ret < 1) return (-1); screen_print_str(win, buf, (size_t) ret, MSG_TYPE_NOTICE_SEND); imwindow_send_msg(win); } return (0); } int pork_recv_notice( struct pork_acct *acct, char *dest, char *sender, char *userhost, char *msg) { struct imwindow *win; int type; win = imwindow_find(acct, sender); if (win == NULL) { win = screen.status_win; type = OPT_FORMAT_NOTICE_RECV_STATUS; } else type = OPT_FORMAT_NOTICE_RECV; if (!event_generate(acct->events, EVENT_RECV_NOTICE, sender, userhost, dest, msg, acct->refnum)) { char buf[4096]; int ret; ret = fill_format_str(type, buf, sizeof(buf), acct, dest, sender, userhost, msg); if (ret < 1) return (-1); screen_print_str(win, buf, (size_t) ret, MSG_TYPE_NOTICE_RECV); imwindow_recv_msg(win); } return (0); } int pork_signoff(struct pork_acct *acct, char *msg) { if (acct->proto->signoff != NULL) return (acct->proto->signoff(acct, msg)); return (0); } pork-0.99.8.1/src/pork_msg.h0000644000175000017500000000300010234217326015451 0ustar ryanryan00000000000000/* ** pork_msg.h ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_MSG_H #define __PORK_MSG_H struct autoresp { char *name; time_t last; }; int pork_recv_msg( struct pork_acct *acct, char *dest, char *sender, char *userhost, char *msg, int arply); int pork_recv_notice( struct pork_acct *acct, char *dest, char *src, char *userhost, char *msg); int pork_recv_action( struct pork_acct *acct, char *dest, char *src, char *userhost, char *msg); int pork_msg_autoreply(struct pork_acct *acct, char *dest, char *msg); int pork_msg_send_auto(struct pork_acct *acct, char *sender); int pork_set_away(struct pork_acct *acct, char *msg); int pork_set_back(struct pork_acct *acct); int pork_msg_send(struct pork_acct *acct, char *dest, char *msg); int pork_set_profile(struct pork_acct *acct, char *profile); int pork_set_idle_time(struct pork_acct *acct, u_int32_t seconds); int pork_send_warn(struct pork_acct *acct, char *user); int pork_send_warn_anon(struct pork_acct *acct, char *user); int pork_change_nick(struct pork_acct *acct, char *nick); int pork_notice_send(struct pork_acct *acct, char *dest, char *msg); int pork_action_send(struct pork_acct *acct, char *dest, char *msg); int pork_signoff(struct pork_acct *acct, char *msg); #endif pork-0.99.8.1/src/pork_opt.c0000644000175000017500000000445510234217326015477 0ustar ryanryan00000000000000/* ** pork_opt.c - Command-line argument handler. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #ifndef HAVE_GETOPT_LONG # include #else # include #endif #include #include #include #include #define OPTSTRING "vH:p:h" static u_int32_t flags; static void print_help_text(void); struct sockaddr_storage local_addr; in_port_t local_port; static const struct option longopts[] = { { "host", required_argument, 0, 'H' }, { "port", required_argument, 0, 'p' }, { "version", no_argument, 0, 'v' }, { "help", no_argument, 0, 'h' }, { NULL, 0, NULL, 0 }, }; int get_options(int argc, char *const argv[]) { int opt; while ((opt = getopt_long(argc, argv, OPTSTRING, longopts, NULL)) != EOF) { switch (opt) { case 'H': if (get_addr(optarg, &local_addr) != 0) { fprintf(stderr, "Error: Invalid local address: %s\n", optarg); return (-1); } flags |= USE_ADDR; break; case 'p': if (get_port(optarg, &local_port) != 0) { fprintf(stderr, "Error: Invalid local port: %s\n", optarg); return (-1); } local_port = htons(local_port); flags |= USE_PORT; break; case 'h': print_help_text(); exit(0); break; case 'v': printf("%s version %s (%s)\n", PACKAGE, VERSION, PACKAGE_EXTRAVERSION); printf("Written by %s <%s>\n", PACKAGE_AUTHOR, PACKAGE_BUGREPORT); printf("%s\n", PACKAGE_WEBSITE); exit(0); break; } } return (0); } int opt_is_set(u_int32_t opt) { return ((flags & opt) != 0); } static void print_help_text(void) { const char usage[] = "Usage: pork [options]\n" "-H or --host Use the local address specified for outgoing connections\n" "-p or --port Use the local port specified for the main connection\n" "-h or --help Display this help text\n" "-v or --version Display version information and exit\n"; printf("%s", usage); } pork-0.99.8.1/src/pork_opt.h0000644000175000017500000000074410234217326015501 0ustar ryanryan00000000000000/* ** pork_opt.h - Command-line argument handler. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_OPT_H #define __PORK_OPT_H int get_options(int argc, char *const argv[]); int opt_is_set(u_int32_t opt); #define USE_ADDR (1 << 1) #define USE_PORT (1 << 2) #endif pork-0.99.8.1/src/pork_set.c0000644000175000017500000007402510234217326015470 0ustar ryanryan00000000000000/* ** pork_set.c - /SET command implementation. ** Copyright (C) 2002-2005 Ryan McCabe ** Copyright (C) 2002-2004 Amber Adams ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern struct screen screen; static int wopt_set_bool(struct imwindow *imwindow, u_int32_t opt, char *args); static int wopt_set_int(struct imwindow *imwindow, u_int32_t opt, char *args); static int wopt_set_str(struct imwindow *imwindow, u_int32_t opt, char *args); static int wopt_set_char( struct imwindow *imwindow, u_int32_t opt, char *args) __notused; static void opt_changed_prompt(void); static void scrollbuf_len_update(void); static void wopt_changed_histlen(struct imwindow *imwindow); static void wopt_changed_log(struct imwindow *imwindow); static void wopt_changed_logfile(struct imwindow *imwindow); static void wopt_changed_priv_input(struct imwindow *imwindow); static void wopt_changed_scrollbuf_len(struct imwindow *imwindow); static void wopt_changed_scroll_on_output(struct imwindow *imwindow); static void wopt_changed_scroll_on_input(struct imwindow *imwindow); static void wopt_changed_show_blist(struct imwindow *imwindow); static void wopt_changed_timestamp(struct imwindow *imwindow); static void wopt_changed_wordwrap(struct imwindow *imwindow); /* ** Name: The name of the option ** Type: The type of the option (boolean, string, int, char, color) ** Dynamic: When the option changes, does the current value need to ** be freed before the new one is set (i.e. was it ** dynamically allocated?). ** Set func: The function used to set the value of the option. ** Change func: The function to be called when the value of the option changes. ** Default: The default value of the option. */ struct global_pref global_pref[] = { { "ACTIVITY_TYPES", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_ACTIVITY_TYPES) },{ "AUTO_RECONNECT", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_AUTO_RECONNECT) },{ "AUTO_REJOIN", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_AUTO_REJOIN) },{ "AUTOSEND_AWAY", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_AUTOSEND_AWAY) },{ "BANNER", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_BANNER) },{ "BEEP", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_BEEP) },{ "BEEP_MAX", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_BEEP_MAX) },{ "BEEP_ON_OUTPUT", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_BEEP_ON_OUTPUT) },{ "CMDCHARS", OPT_CHAR, 0, opt_set_char, NULL, SET_CHAR(DEFAULT_CMDCHARS), },{ "COLOR_BLIST_FOCUS", OPT_COLOR, 0, opt_set_color, pork_acct_update_blist_color, SET_INT(DEFAULT_COLOR_BLIST_FOCUS), },{ "COLOR_BLIST_NOFOCUS", OPT_COLOR, 0, opt_set_color, pork_acct_update_blist_color, SET_INT(DEFAULT_COLOR_BLIST_NOFOCUS), },{ "COLOR_BLIST_SELECTOR", OPT_COLOR, 0, opt_set_color, pork_acct_update_blist_color, SET_INT(DEFAULT_COLOR_BLIST_SELECTOR), },{ "CONNECT_TIMEOUT", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_CONNECT_TIMEOUT) },{ "DOWNLOAD_DIR", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_DOWNLOAD_DIR), },{ "DUMP_MSGS_TO_STATUS", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_DUMP_MSGS_TO_STATUS), },{ "FORMAT_ACTION_RECV", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_ACTION_RECV), },{ "FORMAT_ACTION_RECV_STATUS", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_ACTION_RECV_STATUS), },{ "FORMAT_ACTION_SEND", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_ACTION_SEND), },{ "FORMAT_ACTION_SEND_STATUS", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_ACTION_SEND_STATUS), },{ "FORMAT_BLIST", OPT_FORMAT, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_FORMAT_BLIST), },{ "FORMAT_BLIST_GROUP", OPT_FORMAT, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_FORMAT_BLIST_GROUP), },{ "FORMAT_BLIST_IDLE", OPT_FORMAT, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_FORMAT_BLIST_IDLE), },{ "FORMAT_BLIST_WARN", OPT_FORMAT, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_FORMAT_BLIST_WARN), },{ "FORMAT_CHAT_CREATE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_CREATE), },{ "FORMAT_CHAT_IGNORE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_IGNORE), },{ "FORMAT_CHAT_INVITE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_INVITE), },{ "FORMAT_CHAT_JOIN", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_JOIN), },{ "FORMAT_CHAT_KICK", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_KICK), },{ "FORMAT_CHAT_LEAVE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_LEAVE), },{ "FORMAT_CHAT_MODE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_MODE), },{ "FORMAT_CHAT_NICK", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_NICK), },{ "FORMAT_CHAT_QUIT", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_QUIT), },{ "FORMAT_CHAT_RECV", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_RECV), },{ "FORMAT_CHAT_RECV_ACTION", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_RECV_ACTION), },{ "FORMAT_CHAT_RECV_NOTICE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_RECV_NOTICE), },{ "FORMAT_CHAT_SEND", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_SEND), },{ "FORMAT_CHAT_SEND_ACTION", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_SEND_ACTION), },{ "FORMAT_CHAT_SEND_NOTICE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_SEND_NOTICE), },{ "FORMAT_CHAT_TOPIC", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_TOPIC), },{ "FORMAT_CHAT_UNIGNORE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_CHAT_UNIGNORE), },{ "FORMAT_FILE_CANCEL_LOCAL", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_CANCEL_LOCAL), },{ "FORMAT_FILE_CANCEL_REMOTE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_CANCEL_REMOTE), },{ "FORMAT_FILE_LOST", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_LOST), },{ "FORMAT_FILE_RECV_ACCEPT", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_RECV_ACCEPT), },{ "FORMAT_FILE_RECV_ASK", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_RECV_ASK), },{ "FORMAT_FILE_RECV_COMPLETE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_RECV_COMPLETE), },{ "FORMAT_FILE_RECV_RESUME", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_RECV_RESUME), },{ "FORMAT_FILE_SEND_ACCEPT", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_SEND_ACCEPT), },{ "FORMAT_FILE_SEND_ASK", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_SEND_ASK), },{ "FORMAT_FILE_SEND_COMPLETE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_SEND_COMPLETE), },{ "FORMAT_FILE_SEND_RESUME", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_FILE_SEND_RESUME), },{ "FORMAT_IM_RECV", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_IM_RECV), },{ "FORMAT_IM_RECV_AUTO", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_IM_RECV_AUTO), },{ "FORMAT_IM_RECV_STATUS", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_IM_RECV_STATUS), },{ "FORMAT_IM_SEND", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_IM_SEND), },{ "FORMAT_IM_SEND_AUTO", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_IM_SEND_AUTO), },{ "FORMAT_IM_SEND_STATUS", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_IM_SEND_STATUS), },{ "FORMAT_NOTICE_RECV", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_NOTICE_RECV), },{ "FORMAT_NOTICE_RECV_STATUS", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_NOTICE_RECV_STATUS), },{ "FORMAT_NOTICE_SEND", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_NOTICE_SEND), },{ "FORMAT_NOTICE_SEND_STATUS", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_NOTICE_SEND_STATUS), },{ "FORMAT_STATUS", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_STATUS), },{ "FORMAT_STATUS_ACTIVITY", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_STATUS_ACTIVITY), },{ "FORMAT_STATUS_CHAT", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_STATUS_CHAT), },{ "FORMAT_STATUS_HELD", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_STATUS_HELD), },{ "FORMAT_STATUS_IDLE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_STATUS_IDLE), },{ "FORMAT_STATUS_TIMESTAMP", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_STATUS_TIMESTAMP), },{ "FORMAT_STATUS_TYPING", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_STATUS_TYPING), },{ "FORMAT_STATUS_WARN", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_STATUS_WARN), },{ "FORMAT_TIMESTAMP", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_TIMESTAMP), },{ "FORMAT_WARN", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_WARN), },{ "FORMAT_WHOIS_AWAY", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_WHOIS_AWAY), },{ "FORMAT_WHOIS_IDLE", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_WHOIS_IDLE), },{ "FORMAT_WHOIS_MEMBER", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_WHOIS_MEMBER), },{ "FORMAT_WHOIS_NAME", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_WHOIS_NAME), },{ "FORMAT_WHOIS_SIGNON", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_WHOIS_SIGNON), },{ "FORMAT_WHOIS_USERINFO", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_WHOIS_USERINFO), },{ "FORMAT_WHOIS_WARNLEVEL", OPT_FORMAT, 0, opt_set_format, NULL, SET_STR(DEFAULT_FORMAT_WHOIS_WARNLEVEL), },{ "HISTORY_LEN", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_HISTORY_LEN), },{ "IDLE_AFTER", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_IDLE_AFTER), },{ "LOG", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_LOG), },{ "LOG_TYPES", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_LOG_TYPES) },{ "LOGIN_ON_STARTUP", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_LOGIN_ON_STARTUP), },{ "OUTGOING_MSG_FONT", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_OUTGOING_MSG_FONT), },{ "OUTGOING_MSG_FONT_BGCOLOR", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_OUTGOING_MSG_FONT_BGCOLOR), },{ "OUTGOING_MSG_FONT_FGCOLOR", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_OUTGOING_MSG_FONT_FGCOLOR), },{ "OUTGOING_MSG_FONT_SIZE", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_OUTGOING_MSG_FONT_SIZE), },{ "PORK_DIR", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_PORK_DIR), },{ "PRIVATE_INPUT", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_PRIVATE_INPUT), },{ "PROMPT", OPT_FORMAT, 0, opt_set_format, opt_changed_prompt, SET_STR(DEFAULT_PROMPT), },{ "RECONNECT_INTERVAL", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_RECONNECT_INTERVAL), },{ "RECONNECT_MAX_INTERVAL", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_RECONNECT_MAX_INTERVAL), },{ "RECONNECT_TRIES", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_RECONNECT_TRIES), },{ "RECURSIVE_EVENTS", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_RECURSIVE_EVENTS), },{ "REPORT_IDLE", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_REPORT_IDLE), },{ "SAVE_PASSWD", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_SAVE_PASSWD), },{ "SCROLL_ON_INPUT", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_SCROLL_ON_INPUT), },{ "SCROLL_ON_OUTPUT", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_SCROLL_ON_OUTPUT), },{ "SCROLLBUF_LEN", OPT_INT, 0, opt_set_int, scrollbuf_len_update, SET_INT(DEFAULT_SCROLLBUF_LEN), },{ "SEND_REMOVES_AWAY", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_SEND_REMOVES_AWAY), },{ "SHOW_BLIST", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_SHOW_BLIST), },{ "SHOW_BUDDY_AWAY", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_SHOW_BUDDY_AWAY), },{ "SHOW_BUDDY_IDLE", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_SHOW_BUDDY_IDLE), },{ "SHOW_BUDDY_SIGNOFF", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_SHOW_BUDDY_SIGNOFF), },{ "TEXT_BLIST_GROUP_COLLAPSED", OPT_STR, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_TEXT_BLIST_GROUP_COLLAPSED), },{ "TEXT_BLIST_GROUP_EXPANDED", OPT_STR, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_TEXT_BLIST_GROUP_EXPANDED), },{ "TEXT_BUDDY_ACTIVE", OPT_STR, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_TEXT_BUDDY_ACTIVE), },{ "TEXT_BUDDY_AWAY", OPT_STR, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_TEXT_BUDDY_AWAY), },{ "TEXT_BUDDY_IDLE", OPT_STR, 0, opt_set_format, pork_acct_update_blist_format, SET_STR(DEFAULT_TEXT_BUDDY_IDLE), },{ "TEXT_NO_NAME", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_TEXT_NO_NAME), },{ "TEXT_NO_ROOM", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_TEXT_NO_ROOM), },{ "TEXT_TYPING", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_TEXT_TYPING), },{ "TEXT_TYPING_PAUSED", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_TEXT_TYPING_PAUSED), },{ "TEXT_WARN_ANONYMOUS", OPT_STR, 0, opt_set_str, NULL, SET_STR(DEFAULT_TEXT_WARN_ANONYMOUS), },{ "TIMESTAMP", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_TIMESTAMP), },{ "TRANSFER_PORT_MAX", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_TRANSFER_PORT_MAX), },{ "TRANSFER_PORT_MIN", OPT_INT, 0, opt_set_int, NULL, SET_INT(DEFAULT_TRANSFER_PORT_MIN), },{ "WORDWRAP", OPT_BOOL, 0, opt_set_bool, NULL, SET_BOOL(DEFAULT_WORDWRAP), },{ "WORDWRAP_CHAR", OPT_CHAR, 0, opt_set_char, NULL, SET_CHAR(DEFAULT_WORDWRAP_CHAR), } }; /* ** Name: The name of the window specific option. ** Type: The type of the option (boolean, string, int, char) ** Set func: The function used to set the option. ** Change func: The function to be called when the option changes. */ static struct window_var window_var[] = { { "ACTIVITY_TYPES", OPT_INT, wopt_set_int, NULL },{ "BEEP_ON_OUTPUT", OPT_BOOL, wopt_set_bool, NULL },{ "HISTORY_LEN", OPT_INT, wopt_set_int, wopt_changed_histlen },{ "LOG", OPT_BOOL, wopt_set_bool, wopt_changed_log },{ "LOG_TYPES", OPT_INT, wopt_set_int, NULL },{ "LOGFILE", OPT_STR, wopt_set_str, wopt_changed_logfile },{ "PRIVATE_INPUT", OPT_BOOL, wopt_set_bool, wopt_changed_priv_input },{ "SCROLL_ON_INPUT", OPT_BOOL, wopt_set_bool, wopt_changed_scroll_on_input },{ "SCROLL_ON_OUTPUT", OPT_BOOL, wopt_set_bool, wopt_changed_scroll_on_output },{ "SCROLLBUF_LEN", OPT_INT, wopt_set_int, wopt_changed_scrollbuf_len },{ "SHOW_BLIST", OPT_BOOL, wopt_set_bool, wopt_changed_show_blist },{ "TIMESTAMP", OPT_BOOL, wopt_set_bool, wopt_changed_timestamp },{ "WORDWRAP", OPT_BOOL, wopt_set_bool, wopt_changed_wordwrap },{ "WORDWRAP_CHAR", OPT_CHAR, wopt_set_char, wopt_changed_wordwrap }, }; /* ** Print out the value of the specified option. */ void wopt_print_var(struct imwindow *imwindow, int i, const char *text) { switch (window_var[i].type) { case OPT_BOOL: screen_nocolor_msg("%s %s %s", window_var[i].name, text, (imwindow->opts[i].b ? "TRUE" : "FALSE")); break; case OPT_STR: if (imwindow->opts[i].s != NULL && imwindow->opts[i].s[0] != '\0') { screen_nocolor_msg("%s %s \"%s\"", window_var[i].name, text, imwindow->opts[i].s); } else screen_nocolor_msg("%s is ", window_var[i].name); break; case OPT_INT: screen_nocolor_msg("%s %s %d", window_var[i].name, text, imwindow->opts[i].i); break; case OPT_CHAR: if (isprint(imwindow->opts[i].c)) { screen_nocolor_msg("%s %s '%c'", window_var[i].name, text, imwindow->opts[i].c); } else { screen_nocolor_msg("%s %s 0x%x", window_var[i].name, text, imwindow->opts[i].c); } break; } } int opt_get_val(const char *opt_name, char *buf, size_t len) { int i = opt_find(opt_name); if (i == -1) return (-1); switch (global_pref[i].type) { case OPT_BOOL: snprintf(buf, len, "%d", global_pref[i].val.b); break; case OPT_STR: if (global_pref[i].val.s == NULL) return (-1); xstrncpy(buf, global_pref[i].val.s, len); break; case OPT_INT: snprintf(buf, len, "%d", global_pref[i].val.i); break; case OPT_CHAR: snprintf(buf, len, "%c", global_pref[i].val.c); break; case OPT_COLOR: color_get_str(global_pref[i].val.i, buf, len); break; } return (0); } int wopt_get_val( struct imwindow *imwindow, const char *opt_name, char *buf, size_t len) { int i; i = wopt_find(opt_name); if (i == -1) return (-1); switch (window_var[i].type) { case OPT_BOOL: snprintf(buf, len, "%d", imwindow->opts[i].b); break; case OPT_STR: if (imwindow->opts[i].s == NULL) return (-1); xstrncpy(buf, imwindow->opts[i].s, len); break; case OPT_INT: snprintf(buf, len, "%d", imwindow->opts[i].i); break; case OPT_CHAR: snprintf(buf, len, "%c", imwindow->opts[i].c); break; } return (0); } /* ** Print the values of all the window-specific options. */ void wopt_print(struct imwindow *imwindow) { size_t i; for (i = 0 ; i < array_elem(window_var) ; i++) wopt_print_var(imwindow, i, "is set to"); } /* ** Print value the specified global option. */ void opt_print_var(int i, const char *text) { switch (global_pref[i].type) { case OPT_BOOL: screen_nocolor_msg("%s %s %s", global_pref[i].name, text, (global_pref[i].val.b ? "TRUE" : "FALSE")); break; case OPT_STR: if (global_pref[i].val.s != NULL && global_pref[i].val.s[0] != '\0') { screen_nocolor_msg("%s %s \"%s\"", global_pref[i].name, text, global_pref[i].val.s); } else screen_nocolor_msg("%s is ", global_pref[i].name); break; case OPT_INT: screen_nocolor_msg("%s %s %d", global_pref[i].name, text, global_pref[i].val.i); break; case OPT_CHAR: if (isprint(global_pref[i].val.c)) { screen_nocolor_msg("%s %s '%c'", global_pref[i].name, text, global_pref[i].val.c); } else { screen_nocolor_msg("%s %s 0x%x", global_pref[i].name, text, global_pref[i].val.c); } break; case OPT_COLOR: { char buf[128]; color_get_str(global_pref[i].val.i, buf, sizeof(buf)); screen_nocolor_msg("%s %s %s", global_pref[i].name, text, buf); break; } } } static void scrollbuf_len_update(void) { u_int32_t scrollbuf_len; scrollbuf_len = opt_get_int(OPT_SCROLLBUF_LEN); if (scrollbuf_len < cur_window()->swindow.rows) global_pref[OPT_SCROLLBUF_LEN].val.i = cur_window()->swindow.rows; } /* ** Print the values of all the global variables. */ void opt_print(void) { size_t i; for (i = 0 ; i < array_elem(global_pref) ; i++) opt_print_var(i, "is set to"); } void opt_write(FILE *fp) { size_t i; for (i = 0 ; i < array_elem(global_pref) ; i++) { switch (global_pref[i].type) { case OPT_BOOL: fprintf(fp, "set %s %s\n", global_pref[i].name, (global_pref[i].val.b ? "TRUE" : "FALSE")); break; case OPT_STR: if (global_pref[i].val.s != NULL && global_pref[i].val.s[0] != '\0') { fprintf(fp, "set %s %s\n", global_pref[i].name, global_pref[i].val.s); } break; case OPT_INT: fprintf(fp, "set %s %d\n", global_pref[i].name, global_pref[i].val.i); break; case OPT_CHAR: if (isprint(global_pref[i].val.c)) { fprintf(fp, "set %s %c\n", global_pref[i].name, global_pref[i].val.c); } else { fprintf(fp, "set %s 0x%x\n", global_pref[i].name, global_pref[i].val.c); } break; case OPT_COLOR: { char buf[128]; color_get_str(global_pref[i].val.i, buf, sizeof(buf)); fprintf(fp, "set %s %s\n", global_pref[i].name, buf); break; } } } } static int opt_compare(const void *l, const void *r) { const char *str = l; const struct global_pref *gvar = r; return (strcasecmp(str, gvar->name)); } static int wopt_compare(const void *l, const void *r) { const char *str = l; const struct window_var *wvar = r; return (strcasecmp(str, wvar->name)); } /* ** Find the position of the global option named "name" ** in the global option table. */ int opt_find(const char *name) { struct global_pref *gvar; u_int32_t offset; gvar = bsearch(name, global_pref, array_elem(global_pref), sizeof(struct global_pref), opt_compare); if (gvar == NULL) return (-1); offset = (long) gvar - (long) &global_pref[0]; return (offset / sizeof(struct global_pref)); } /* ** Same as above, only for window-specific options. */ int wopt_find(const char *name) { struct window_var *wvar; u_int32_t offset; wvar = bsearch(name, window_var, array_elem(window_var), sizeof(struct window_var), wopt_compare); if (wvar == NULL) return (-1); offset = (long) wvar - (long) &window_var[0]; return (offset / sizeof(struct window_var)); } static void opt_changed_prompt(void) { input_set_prompt(&screen.input, opt_get_str(OPT_PROMPT)); } static void wopt_changed_histlen(struct imwindow *imwindow) { u_int32_t new_len; new_len = wopt_get_int(imwindow->opts, WOPT_HISTORY_LEN); imwindow->input->history_len = new_len; input_history_prune(imwindow->input); } static void wopt_changed_log(struct imwindow *imwindow) { u_int32_t new_val; new_val = wopt_get_bool(imwindow->opts, WOPT_LOG); if (new_val != imwindow->swindow.logged) { if (new_val == 0) swindow_end_log(&imwindow->swindow); else { if (swindow_set_log(&imwindow->swindow) == -1) imwindow->opts[WOPT_LOG].b = 0; } } } static void wopt_changed_logfile(struct imwindow *imwindow) { swindow_set_logfile(&imwindow->swindow, wopt_get_str(imwindow->opts, WOPT_LOGFILE)); } static void wopt_changed_priv_input(struct imwindow *imwindow) { u_int32_t new_val; new_val = wopt_get_bool(imwindow->opts, WOPT_PRIVATE_INPUT); imwindow_set_priv_input(imwindow, new_val); } static void wopt_changed_scrollbuf_len(struct imwindow *imwindow) { u_int32_t new_len; new_len = wopt_get_int(imwindow->opts, WOPT_SCROLLBUF_LEN); if (new_len < imwindow->swindow.rows) { imwindow->opts[WOPT_SCROLLBUF_LEN].i = imwindow->swindow.rows; imwindow->swindow.scrollbuf_max = imwindow->swindow.rows; } else imwindow->swindow.scrollbuf_max = new_len; swindow_prune(&imwindow->swindow); } static void wopt_changed_scroll_on_output(struct imwindow *imwindow) { u_int32_t new_val; new_val = wopt_get_bool(imwindow->opts, WOPT_SCROLL_ON_OUTPUT); imwindow->swindow.scroll_on_output = new_val; } static void wopt_changed_scroll_on_input(struct imwindow *imwindow) { u_int32_t new_val; new_val = wopt_get_bool(imwindow->opts, WOPT_SCROLL_ON_INPUT); imwindow->swindow.scroll_on_input = new_val; } static void wopt_changed_show_blist(struct imwindow *imwindow) { u_int32_t new_val; struct pork_acct *acct; acct = imwindow->owner; if (acct->blist == NULL) return; new_val = wopt_get_bool(imwindow->opts, WOPT_SHOW_BLIST); if (new_val == imwindow->blist_visible) return; if (new_val) imwindow_blist_show(imwindow); else imwindow_blist_hide(imwindow); } static void wopt_changed_timestamp(struct imwindow *imwindow) { swindow_set_timestamp(&imwindow->swindow, wopt_get_bool(imwindow->opts, WOPT_TIMESTAMP)); } static void wopt_changed_wordwrap(struct imwindow *imwindow) { swindow_set_wordwrap(&imwindow->swindow, wopt_get_bool(imwindow->opts, WOPT_WORDWRAP)); } void wopt_init(struct imwindow *imwindow, const char *target) { char nnick[NUSER_LEN]; char buf[NUSER_LEN + 256]; char *pork_dir; char *p; pref_val_t *wopt = imwindow->opts; memset(wopt, 0, sizeof(pref_val_t) * WOPT_NUM_OPTS); wopt[WOPT_ACTIVITY_TYPES].i = opt_get_int(OPT_ACTIVITY_TYPES); wopt[WOPT_BEEP_ON_OUTPUT].b = opt_get_bool(OPT_BEEP_ON_OUTPUT); wopt[WOPT_HISTORY_LEN].i = opt_get_int(OPT_HISTORY_LEN); wopt[WOPT_LOG].b = opt_get_bool(OPT_LOG); wopt[WOPT_LOG_TYPES].i = opt_get_int(OPT_LOG_TYPES); wopt[WOPT_PRIVATE_INPUT].b = opt_get_bool(OPT_PRIVATE_INPUT); wopt[WOPT_SCROLL_ON_INPUT].b = opt_get_bool(OPT_SCROLL_ON_INPUT); wopt[WOPT_SCROLL_ON_OUTPUT].b = opt_get_bool(OPT_SCROLL_ON_OUTPUT); wopt[WOPT_SCROLLBUF_LEN].i = opt_get_int(OPT_SCROLLBUF_LEN); wopt[WOPT_SHOW_BLIST].b = opt_get_bool(OPT_SHOW_BLIST); wopt[WOPT_TIMESTAMP].b = opt_get_bool(OPT_TIMESTAMP); wopt[WOPT_WORDWRAP].b = opt_get_bool(OPT_WORDWRAP); wopt[WOPT_WORDWRAP_CHAR].c = opt_get_char(OPT_WORDWRAP_CHAR); normalize(nnick, target, sizeof(nnick)); while ((p = strchr(nnick, '/')) != NULL) *p = '_'; pork_dir = opt_get_str(OPT_PORK_DIR); snprintf(buf, sizeof(buf), "%s/%s/logs/%s.log", pork_dir, imwindow->owner->username, nnick); wopt[WOPT_LOGFILE].s = xstrdup(buf); } /* ** The values a boolean variable can accept are TRUE, FALSE and TOGGLE. ** TRUE is 1, FALSE is 0. TOGGLE flips the current value of the variable. */ static int opt_tristate(char *args) { if (args == NULL) return (-1); if (!strcasecmp(args, "ON") || !strcasecmp(args, "TRUE") || !strcasecmp(args, "1")) { return (1); } if (!strcasecmp(args, "OFF") || !strcasecmp(args, "FALSE") || !strcasecmp(args, "0")) { return (0); } if (!strcasecmp(args, "TOGGLE")) return (2); return (-1); } int opt_set_bool(u_int32_t opt, char *args) { int val = opt_tristate(args); if (val == -1) return (-1); if (val != 2) global_pref[opt].val.b = val; else global_pref[opt].val.b = !global_pref[opt].val.b; if (global_pref[opt].updated != NULL) global_pref[opt].updated(); return (0); } int opt_set_char(u_int32_t opt, char *args) { if (args == NULL || *args == '\0') return (-1); if (!strncasecmp(args, "0x", 2)) { u_int32_t temp; if (str_to_uint(args, &temp) == -1 || temp > 0xff) global_pref[opt].val.c = *args; else global_pref[opt].val.c = temp; } else global_pref[opt].val.c = *args; if (global_pref[opt].updated != NULL) global_pref[opt].updated(); return (0); } int opt_set_int(u_int32_t opt, char *args) { u_int32_t num; if (args == NULL) return (-1); if (str_to_uint(args, &num) != 0) return (-1); global_pref[opt].val.i = num; if (global_pref[opt].updated != NULL) global_pref[opt].updated(); return (0); } int opt_set_str(u_int32_t opt, char *args) { if (global_pref[opt].dynamic == 1) free(global_pref[opt].val.s); if (args != NULL) { global_pref[opt].val.s = xstrdup(args); global_pref[opt].dynamic = 1; } else { global_pref[opt].val.s = NULL; global_pref[opt].dynamic = 0; } if (global_pref[opt].updated != NULL) global_pref[opt].updated(); return (0); } int opt_set_color(u_int32_t opt, char *args) { attr_t attr = 0; if (*args != '%') { if (color_parse_code(args, &attr) == -1) return (-1); } else { char buf[32]; chtype ch[4]; snprintf(buf, sizeof(buf), "%s ", args); if (plaintext_to_cstr(ch, array_elem(ch), buf, NULL) != 1) return (-1); attr = ch[0] & A_ATTRIBUTES; } global_pref[opt].val.i = attr; if (global_pref[opt].updated != NULL) global_pref[opt].updated(); return (0); } int opt_set(u_int32_t opt, char *args) { struct global_pref *var = &global_pref[opt]; return (var->set(opt, args)); } static int wopt_set_bool(struct imwindow *imwindow, u_int32_t opt, char *args) { int val = opt_tristate(args); if (val == -1) return (-1); if (val != 2) imwindow->opts[opt].b = val; else imwindow->opts[opt].b = !imwindow->opts[opt].b; if (window_var[opt].updated != NULL) window_var[opt].updated(imwindow); return (0); } static int wopt_set_char(struct imwindow *imwindow, u_int32_t opt, char *args) { if (args == NULL || *args == '\0') return (-1); if (!strncasecmp(args, "0x", 2)) { u_int32_t temp; if (str_to_uint(args, &temp) == -1 || temp > 0xff) imwindow->opts[opt].c = *args; else imwindow->opts[opt].c = temp; } else imwindow->opts[opt].c = *args; if (window_var[opt].updated != NULL) window_var[opt].updated(imwindow); return (0); } static int wopt_set_int(struct imwindow *imwindow, u_int32_t opt, char *args) { u_int32_t num; if (args == NULL) return (-1); if (str_to_uint(args, &num) != 0) return (-1); imwindow->opts[opt].i = num; if (window_var[opt].updated != NULL) window_var[opt].updated(imwindow); return (0); } static int wopt_set_str(struct imwindow *imwindow, u_int32_t opt, char *args) { free(imwindow->opts[opt].s); if (args != NULL) imwindow->opts[opt].s = xstrdup(args); else imwindow->opts[opt].s = NULL; if (window_var[opt].updated != NULL) window_var[opt].updated(imwindow); return (0); } inline int wopt_set(struct imwindow *imwindow, u_int32_t opt, char *args) { struct window_var *var = &window_var[opt]; return (var->set(imwindow, opt, args)); } void opt_destroy(void) { size_t i; for (i = 0 ; i < array_elem(global_pref) ; i++) { if (global_pref[i].dynamic) free(global_pref[i].val.s); } } void wopt_destroy(struct imwindow *imwindow) { free(imwindow->opts[WOPT_LOGFILE].s); } pork-0.99.8.1/src/pork_set.h0000644000175000017500000001354610234217326015476 0ustar ryanryan00000000000000/* ** pork_set.h - /SET command implementation. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_SET_H #define __PORK_SET_H #define opt_set_format opt_set_str enum { OPT_INT = 0, OPT_CHAR = 1, OPT_STR = 2, OPT_FORMAT = 2, OPT_BOOL = 3, OPT_COLOR = 4 }; /* ** Global options. */ enum { OPT_ACTIVITY_TYPES = 0, OPT_AUTO_RECONNECT, OPT_AUTO_REJOIN, OPT_AUTOSEND_AWAY, OPT_BANNER, OPT_BEEP, OPT_BEEP_MAX, OPT_BEEP_ON_OUTPUT, OPT_CMDCHARS, OPT_COLOR_BLIST_FOCUS, OPT_COLOR_BLIST_NOFOCUS, OPT_COLOR_BLIST_SELECTOR, OPT_CONNECT_TIMEOUT, OPT_DOWNLOAD_DIR, OPT_DUMP_MSGS_TO_STATUS, OPT_FORMAT_ACTION_RECV, OPT_FORMAT_ACTION_RECV_STATUS, OPT_FORMAT_ACTION_SEND, OPT_FORMAT_ACTION_SEND_STATUS, OPT_FORMAT_BLIST, OPT_FORMAT_BLIST_GROUP, OPT_FORMAT_BLIST_IDLE, OPT_FORMAT_BLIST_WARN, OPT_FORMAT_CHAT_CREATE, OPT_FORMAT_CHAT_IGNORE, OPT_FORMAT_CHAT_INVITE, OPT_FORMAT_CHAT_JOIN, OPT_FORMAT_CHAT_KICK, OPT_FORMAT_CHAT_LEAVE, OPT_FORMAT_CHAT_MODE, OPT_FORMAT_CHAT_NICK, OPT_FORMAT_CHAT_QUIT, OPT_FORMAT_CHAT_RECV, OPT_FORMAT_CHAT_RECV_ACTION, OPT_FORMAT_CHAT_RECV_NOTICE, OPT_FORMAT_CHAT_SEND, OPT_FORMAT_CHAT_SEND_ACTION, OPT_FORMAT_CHAT_SEND_NOTICE, OPT_FORMAT_CHAT_TOPIC, OPT_FORMAT_CHAT_UNIGNORE, OPT_FORMAT_FILE_CANCEL_LOCAL, OPT_FORMAT_FILE_CANCEL_REMOTE, OPT_FORMAT_FILE_LOST, OPT_FORMAT_FILE_RECV_ACCEPT, OPT_FORMAT_FILE_RECV_ASK, OPT_FORMAT_FILE_RECV_COMPLETE, OPT_FORMAT_FILE_RECV_RESUME, OPT_FORMAT_FILE_SEND_ACCEPT, OPT_FORMAT_FILE_SEND_ASK, OPT_FORMAT_FILE_SEND_COMPLETE, OPT_FORMAT_FILE_SEND_RESUME, OPT_FORMAT_IM_RECV, OPT_FORMAT_IM_RECV_AUTO, OPT_FORMAT_IM_RECV_STATUS, OPT_FORMAT_IM_SEND, OPT_FORMAT_IM_SEND_AUTO, OPT_FORMAT_IM_SEND_STATUS, OPT_FORMAT_NOTICE_RECV, OPT_FORMAT_NOTICE_RECV_STATUS, OPT_FORMAT_NOTICE_SEND, OPT_FORMAT_NOTICE_SEND_STATUS, OPT_FORMAT_STATUS, OPT_FORMAT_STATUS_ACTIVITY, OPT_FORMAT_STATUS_CHAT, OPT_FORMAT_STATUS_HELD, OPT_FORMAT_STATUS_IDLE, OPT_FORMAT_STATUS_TIMESTAMP, OPT_FORMAT_STATUS_TYPING, OPT_FORMAT_STATUS_WARN, OPT_FORMAT_TIMESTAMP, OPT_FORMAT_WARN, OPT_FORMAT_WHOIS_AWAY, OPT_FORMAT_WHOIS_IDLE, OPT_FORMAT_WHOIS_MEMBER, OPT_FORMAT_WHOIS_NAME, OPT_FORMAT_WHOIS_SIGNON, OPT_FORMAT_WHOIS_USERINFO, OPT_FORMAT_WHOIS_WARNLEVEL, OPT_HISTORY_LEN, OPT_IDLE_AFTER, OPT_LOG, OPT_LOG_TYPES, OPT_LOGIN_ON_STARTUP, OPT_OUTGOING_MSG_FONT, OPT_OUTGOING_MSG_FONT_BGCOLOR, OPT_OUTGOING_MSG_FONT_FGCOLOR, OPT_OUTGOING_MSG_FONT_SIZE, OPT_PORK_DIR, OPT_PRIVATE_INPUT, OPT_PROMPT, OPT_RECONNECT_INTERVAL, OPT_RECONNECT_MAX_INTERVAL, OPT_RECONNECT_TRIES, OPT_RECURSIVE_EVENTS, OPT_REPORT_IDLE, OPT_SAVE_PASSWD, OPT_SCROLL_ON_INPUT, OPT_SCROLL_ON_OUTPUT, OPT_SCROLLBUF_LEN, OPT_SEND_REMOVES_AWAY, OPT_SHOW_BLIST, OPT_SHOW_BUDDY_AWAY, OPT_SHOW_BUDDY_IDLE, OPT_SHOW_BUDDY_SIGNOFF, OPT_TEXT_BLIST_GROUP_COLLAPSED, OPT_TEXT_BLIST_GROUP_EXPANDED, OPT_TEXT_BUDDY_ACTIVE, OPT_TEXT_BUDDY_AWAY, OPT_TEXT_BUDDY_IDLE, OPT_TEXT_NO_NAME, OPT_TEXT_NO_ROOM, OPT_TEXT_TYPING, OPT_TEXT_TYPING_PAUSED, OPT_TEXT_WARN_ANONYMOUS, OPT_TIMESTAMP, OPT_TRANSFER_PORT_MAX, OPT_TRANSFER_PORT_MIN, OPT_WORDWRAP, OPT_WORDWRAP_CHAR, OPT_NUM_OPTS }; #define OPT_FORMAT_OFFSET OPT_FORMAT_ACTION_RECV /* ** Per-window options. */ enum { WOPT_ACTIVITY_TYPES = 0, WOPT_BEEP_ON_OUTPUT, WOPT_HISTORY_LEN, WOPT_LOG, WOPT_LOG_TYPES, WOPT_LOGFILE, WOPT_PRIVATE_INPUT, WOPT_SCROLL_ON_INPUT, WOPT_SCROLL_ON_OUTPUT, WOPT_SCROLLBUF_LEN, WOPT_SHOW_BLIST, WOPT_TIMESTAMP, WOPT_WORDWRAP, WOPT_WORDWRAP_CHAR, WOPT_NUM_OPTS, }; struct imwindow; typedef union { u_int32_t i; u_int32_t b; char c; char *s; } pref_val_t; struct global_pref { char *name; u_int32_t type:31; u_int32_t dynamic:1; int (*set)(u_int32_t, char *); void (*updated)(void); pref_val_t val; }; struct window_var { char *name; u_int32_t type; int (*set)(struct imwindow *, u_int32_t, char *); void (*updated)(struct imwindow *); }; extern struct global_pref global_pref[OPT_NUM_OPTS]; int opt_set_bool(u_int32_t opt, char *args); int opt_set_char(u_int32_t opt, char *args); int opt_set_int(u_int32_t opt, char *args); int opt_set_str(u_int32_t opt, char *args); int opt_set_color(u_int32_t opt, char *args); #define SET_STR(x) { .s = (x) } #define SET_INT(x) { .i = (x) } #define SET_CHAR(x) { .c = (x) } #define SET_BOOL(x) { .b = (x) } void opt_destroy(void); void wopt_init(struct imwindow *imwindow, const char *target); void wopt_destroy(struct imwindow *imwindow); void wopt_print_var(struct imwindow *win, int var, const char *text); void wopt_print(struct imwindow *win); void opt_print_var(int var, const char *text); void opt_print(void); void opt_write(FILE *fp); int opt_set(u_int32_t opt, char *args); int wopt_set(struct imwindow *imwindow, u_int32_t opt, char *args); int opt_find(const char *name); int wopt_find(const char *name); int opt_get_val(const char *opt_name, char *buf, size_t len); int wopt_get_val( struct imwindow *imwindow, const char *opt_name, char *buf, size_t len); /* ** These used to be inline functions until I discovered ** how positively stupid GCC is. GCC refused to inline ** the functions regardless of which one of the 9 or 10 ** possible ways to tell it "inline this" I used. */ #define opt_get_int(opt) (global_pref[(opt)].val.i) #define opt_get_color(opt) (global_pref[(opt)].val.i) #define opt_get_bool(opt) (global_pref[(opt)].val.b) #define opt_get_char(opt) (global_pref[(opt)].val.c) #define opt_get_str(opt) (global_pref[(opt)].val.s) #define wopt_get_int(wopt, opt) ((wopt)[(opt)].i) #define wopt_get_str(wopt, opt) ((wopt)[(opt)].s) #define wopt_get_char(wopt, opt) ((wopt)[(opt)].c) #define wopt_get_bool(wopt, opt) ((wopt)[(opt)].b) #include "pork_set_defaults.h" #endif pork-0.99.8.1/src/pork_perl_stub.c0000644000175000017500000000161010234217326016662 0ustar ryanryan00000000000000/* ** pork_perl_stub.c - Perl scripting support (stubs) ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include /* ** Stubs for when Perl support isn't enabled. */ int perl_init(void) { return (0); } int perl_destroy(void) { return (0); } int execute_perl(char *function __notused, char **args __notused) { return (0); } int execute_perl_va(char *function __notused, const char *fmt __notused, va_list ap __notused) { return (0); } int perl_load_file(char *filename __notused) { return (-1); } pork-0.99.8.1/src/pork_imwindow.c0000644000175000017500000002470710234217326016534 0ustar ryanryan00000000000000/* ** pork_imwindow.c - interface for manipulating conversation/chat/info windows. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern struct screen screen; struct imwindow *imwindow_new( u_int32_t rows, u_int32_t cols, u_int32_t refnum, u_int32_t type, struct pork_acct *owner, char *target) { WINDOW *swin; struct imwindow *imwindow; struct input *input; char nname[NUSER_LEN]; swin = newwin(rows, cols, 0, 0); if (swin == NULL) { debug("Unable to create %ux%u window", rows, cols); return (NULL); } owner->proto->normalize(nname, target, sizeof(nname)); imwindow = xcalloc(1, sizeof(*imwindow)); imwindow->refnum = refnum; imwindow->type = type; imwindow->target = xstrdup(nname); imwindow->name = color_quote_codes(target); imwindow->active_binds = &screen.binds.main; imwindow->owner = owner; imwindow->owner->ref_count++; wopt_init(imwindow, target); swindow_init(&imwindow->swindow, swin, rows, cols, imwindow->opts); /* ** Use a separate input handler. */ if (wopt_get_bool(imwindow->opts, WOPT_PRIVATE_INPUT)) { input = xmalloc(sizeof(*input)); input_init(input, cols); } else input = &screen.input; imwindow->input = input; if (wopt_get_bool(imwindow->opts, WOPT_SHOW_BLIST)) { if (owner->blist != NULL) imwindow_blist_show(imwindow); } return (imwindow); } inline void imwindow_rename(struct imwindow *imwindow, char *new_name) { free(imwindow->name); imwindow->name = color_quote_codes(new_name); } inline void imwindow_resize(struct imwindow *imwindow, u_int32_t rows, u_int32_t cols) { swindow_resize(&imwindow->swindow, rows, cols); swindow_scroll_to_start(&imwindow->swindow); swindow_scroll_to_end(&imwindow->swindow); } int imwindow_set_priv_input(struct imwindow *imwindow, int val) { int old_val; old_val = !(imwindow->input == &screen.input); if (old_val == val) return (-1); /* ** Give this imwindow its own input buffer and history. */ if (val == 1) { struct input *input = xmalloc(sizeof(*input)); input_init(input, imwindow->swindow.cols); imwindow->input = input; } else { /* ** Destroy this imwindow's private input, and set its input ** to the global input. */ input_destroy(imwindow->input); free(imwindow->input); imwindow->input = &screen.input; } return (0); } inline int imwindow_blist_refresh(struct imwindow *imwindow) { struct pork_acct *owner = imwindow->owner; if (!imwindow->blist_visible) return (0); if (!owner->blist->slist.dirty) return (0); blist_draw_border(owner->blist, imwindow->input_focus); blist_refresh(owner->blist); return (1); } inline int imwindow_refresh(struct imwindow *imwindow) { int was_dirty_win; int was_dirty_blist; was_dirty_win = swindow_refresh(&imwindow->swindow); was_dirty_blist = imwindow_blist_refresh(imwindow); return (was_dirty_win || was_dirty_blist); } void imwindow_blist_show(struct imwindow *imwindow) { u_int32_t new_width; if (imwindow->owner->blist == NULL) return; if (imwindow->blist_visible) return; imwindow->blist_visible = 1; imwindow->owner->blist->slist.dirty = 1; new_width = imwindow->swindow.cols - imwindow->owner->blist->slist.cols; imwindow_resize(imwindow, imwindow->swindow.rows, new_width); } void imwindow_buffer_find(struct imwindow *imwindow, char *str, u_int32_t opt) { screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_LASTLOG, "Matching lines:"); swindow_print_matching(&imwindow->swindow, str, opt); screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_LASTLOG, "End of matches"); } void imwindow_blist_hide(struct imwindow *imwindow) { u_int32_t new_width; if (!imwindow->blist_visible) return; imwindow->blist_visible = 0; if (imwindow->owner->blist != NULL) { imwindow->owner->blist->slist.dirty = 1; new_width = imwindow->swindow.cols + imwindow->owner->blist->slist.cols; } else new_width = screen.cols; imwindow->input_focus = BINDS_MAIN; imwindow->active_binds = &screen.binds.main; imwindow_resize(imwindow, imwindow->swindow.rows, new_width); } void imwindow_blist_toggle(struct imwindow *imwindow) { if (!imwindow->blist_visible) imwindow_blist_show(imwindow); else imwindow_blist_hide(imwindow); } void imwindow_blist_draw(struct imwindow *imwindow) { struct blist *blist = imwindow->owner->blist; if (blist == NULL || !imwindow->blist_visible) return; blist_draw(imwindow->owner->blist); } void imwindow_destroy(struct imwindow *imwindow) { swindow_destroy(&imwindow->swindow); if (wopt_get_bool(imwindow->opts, WOPT_PRIVATE_INPUT)) { input_destroy(imwindow->input); free(imwindow->input); } if (imwindow->owner != NULL) imwindow->owner->ref_count--; wopt_destroy(imwindow); free(imwindow->name); free(imwindow->target); free(imwindow); } void imwindow_switch_focus(struct imwindow *imwindow) { if (!imwindow->blist_visible) return; if (imwindow->input_focus == BINDS_MAIN) { imwindow->input_focus = BINDS_BUDDY; imwindow->active_binds = &screen.binds.blist; } else { imwindow->input_focus = BINDS_MAIN; imwindow->active_binds = &screen.binds.main; } } struct imwindow *imwindow_find(struct pork_acct *owner, const char *target) { dlist_t *list_start = screen.window_list; dlist_t *cur = list_start; char nname[NUSER_LEN]; owner->proto->normalize(nname, target, sizeof(nname)); do { struct imwindow *imwindow = cur->data; if (imwindow->owner == owner && imwindow->type == WIN_TYPE_PRIVMSG && !strcasecmp(imwindow->target, nname)) { return (imwindow); } cur = cur->next; } while (cur != list_start); return (NULL); } struct imwindow *imwindow_find_chat_target( struct pork_acct *owner, const char *target) { dlist_t *list_start = screen.window_list; dlist_t *cur = list_start; char nname[NUSER_LEN]; owner->proto->normalize(nname, target, sizeof(nname)); do { struct imwindow *imwindow = cur->data; if (imwindow->owner == owner && imwindow->type == WIN_TYPE_CHAT && !strcasecmp(imwindow->target, nname)) { return (imwindow); } cur = cur->next; } while (cur != list_start); return (NULL); } struct imwindow *imwindow_find_name(struct pork_acct *owner, const char *name) { dlist_t *list_start = screen.window_list; dlist_t *cur = list_start; do { struct imwindow *imwindow = cur->data; if (imwindow->owner == owner && !strcasecmp(imwindow->name, name)) return (imwindow); cur = cur->next; } while (cur != list_start); return (NULL); } struct imwindow *imwindow_find_refnum(u_int32_t refnum) { dlist_t *cur = screen.window_list; do { struct imwindow *imwindow = cur->data; if (imwindow->refnum == refnum) return (imwindow); cur = cur->next; } while (cur != screen.window_list); return (NULL); } inline void imwindow_send_msg(struct imwindow *win) { swindow_input(&win->swindow); } inline void imwindow_recv_msg(struct imwindow *win) { if (wopt_get_bool(win->opts, WOPT_BEEP_ON_OUTPUT)) beep(); } /* ** Bind the account whose reference number is "refnum" to the window ** "imwindow". */ int imwindow_bind_acct(struct imwindow *imwindow, u_int32_t refnum) { struct pork_acct *owner; struct pork_acct *old_acct = imwindow->owner; if (imwindow->type == WIN_TYPE_CHAT && imwindow->owner != screen.null_acct) { return (-1); } owner = pork_acct_get_data(refnum); if (owner == NULL) return (-1); if (old_acct != owner) { imwindow->owner->ref_count--; imwindow->owner = owner; imwindow->owner->ref_count++; if (imwindow->blist_visible) { if (imwindow->owner->blist == NULL) imwindow_blist_hide(imwindow); else { imwindow_blist_draw(imwindow); imwindow_blist_refresh(imwindow); } } } return (0); } inline int imwindow_dump_buffer(struct imwindow *imwindow, char *file) { return (swindow_dump_buffer(&imwindow->swindow, file)); } /* ** Binds the next account in this window. */ int imwindow_bind_next_acct(struct imwindow *imwindow) { u_int32_t next_refnum; if (pork_acct_next_refnum(imwindow->owner->refnum, &next_refnum) == -1) return (-1); return (imwindow_bind_acct(imwindow, next_refnum)); } inline void imwindow_scroll_up(struct imwindow *imwindow) { swindow_scroll_by(&imwindow->swindow, -1); } inline void imwindow_scroll_down(struct imwindow *imwindow) { swindow_scroll_by(&imwindow->swindow, 1); } inline void imwindow_scroll_by(struct imwindow *imwindow, int lines) { swindow_scroll_by(&imwindow->swindow, lines); } inline void imwindow_scroll_page_up(struct imwindow *imwindow) { swindow_scroll_by(&imwindow->swindow, -imwindow->swindow.rows); } inline void imwindow_scroll_page_down(struct imwindow *imwindow) { swindow_scroll_by(&imwindow->swindow, imwindow->swindow.rows); } inline void imwindow_scroll_start(struct imwindow *imwindow) { swindow_scroll_to_start(&imwindow->swindow); } inline void imwindow_scroll_end(struct imwindow *imwindow) { swindow_scroll_to_end(&imwindow->swindow); } inline void imwindow_clear(struct imwindow *imwindow) { swindow_clear(&imwindow->swindow); } inline void imwindow_erase(struct imwindow *imwindow) { swindow_erase(&imwindow->swindow); } inline int imwindow_ignore(struct imwindow *imwindow) { int ret = imwindow->ignore_activity; imwindow->ignore_activity = 1; return (ret); } inline int imwindow_unignore(struct imwindow *imwindow) { int ret = imwindow->ignore_activity; imwindow->ignore_activity = 0; return (ret); } inline int imwindow_skip(struct imwindow *imwindow) { int ret = imwindow->skip; imwindow->skip = 1; return (ret); } inline int imwindow_unskip(struct imwindow *imwindow) { int ret = imwindow->skip; imwindow->skip = 0; return (ret); } inline int imwindow_add(struct imwindow *imwindow, struct imsg *imsg, u_int32_t type) { return (swindow_add(&imwindow->swindow, imsg, type)); } pork-0.99.8.1/src/pork_imwindow.h0000644000175000017500000000641510234217326016535 0ustar ryanryan00000000000000/* ** pork_imwindow.h - interface for manipulating conversation/chat/info windows. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_IMWINDOW_H #define __PORK_IMWINDOW_H #define IMWINDOW(x) ((struct imwindow *) (x)) struct pork_acct; struct imsg; #include #include enum { WIN_TYPE_STATUS, WIN_TYPE_PRIVMSG, WIN_TYPE_CHAT }; struct imwindow { struct swindow swindow; struct input *input; struct pork_acct *owner; struct key_binds *active_binds; char *target; char *name; void *data; u_int32_t refnum; u_int32_t type:2; u_int32_t typing:2; u_int32_t blist_visible:1; u_int32_t input_focus:1; u_int32_t ignore_activity:1; u_int32_t skip:1; pref_val_t opts[WOPT_NUM_OPTS]; }; struct imwindow *imwindow_new( u_int32_t rows, u_int32_t cols, u_int32_t refnum, u_int32_t type, struct pork_acct *owner, char *target); void imwindow_resize( struct imwindow *imwindow, u_int32_t rows, u_int32_t cols); int imwindow_set_priv_input(struct imwindow *imwindow, int val); int imwindow_blist_refresh(struct imwindow *imwindow); void imwindow_blist_show(struct imwindow *imwindow); void imwindow_blist_hide(struct imwindow *imwindow); void imwindow_blist_toggle(struct imwindow *imwindow); void imwindow_blist_draw(struct imwindow *imwindow); void imwindow_send_msg(struct imwindow *win); void imwindow_recv_msg(struct imwindow *win); int imwindow_bind_acct(struct imwindow *imwindow, u_int32_t refnum); int imwindow_bind_next_acct(struct imwindow *imwindow); int imwindow_refresh(struct imwindow *imwindow); void imwindow_destroy(struct imwindow *imwindow); void imwindow_switch_focus(struct imwindow *imwindow); void imwindow_buffer_find(struct imwindow *imwindow, char *str, u_int32_t opt); struct imwindow *imwindow_find_refnum(u_int32_t refnum); struct imwindow *imwindow_find(struct pork_acct *owner, const char *target); struct imwindow *imwindow_find_name(struct pork_acct *owner, const char *name); struct imwindow *imwindow_find_chat_target( struct pork_acct *owner, const char *target); inline int imwindow_add(struct imwindow *imwindow, struct imsg *imsg, u_int32_t type); inline int imwindow_ignore(struct imwindow *imwindow); inline int imwindow_unignore(struct imwindow *imwindow); inline int imwindow_skip(struct imwindow *imwindow); inline int imwindow_unskip(struct imwindow *imwindow); inline int imwindow_dump_buffer(struct imwindow *imwindow, char *file); inline void imwindow_rename(struct imwindow *imwindow, char *new_name); inline void imwindow_scroll_up(struct imwindow *imwindow); inline void imwindow_scroll_down(struct imwindow *imwindow); inline void imwindow_scroll_by(struct imwindow *imwindow, int lines); inline void imwindow_scroll_page_up(struct imwindow *imwindow); inline void imwindow_scroll_page_down(struct imwindow *imwindow); inline void imwindow_scroll_start(struct imwindow *imwindow); inline void imwindow_scroll_end(struct imwindow *imwindow); inline void imwindow_clear(struct imwindow *imwindow); inline void imwindow_erase(struct imwindow *imwindow); #endif pork-0.99.8.1/src/pork_acct.c0000644000175000017500000002635610234217327015614 0ustar ryanryan00000000000000/* ** pork_acct.c - account management. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern struct sockaddr_storage local_addr; extern in_port_t local_port; static int pork_acct_find_helper(void *l, void *r) { u_int32_t refnum = POINTER_TO_UINT(l); struct pork_acct *acct = r; return (refnum - acct->refnum); } /* ** Free everything that needs freeing. */ static void pork_acct_free(struct pork_acct *acct) { /* XXX - really? */ if (acct->proto->write_config != NULL) acct->proto->write_config(acct); if (acct->proto->free != NULL) acct->proto->free(acct); if (acct->blist != NULL) { blist_destroy(acct->blist); free(acct->blist); } buddy_destroy(acct); hash_destroy(&acct->autoreply); free_str_wipe(acct->passwd); free(acct->away_msg); free(acct->username); free(acct->profile); free(acct->server); free(acct->fport); free(acct); } inline dlist_t *pork_acct_find(u_int32_t refnum) { dlist_t *ret; ret = dlist_find(screen.acct_list, UINT_TO_POINTER(refnum), pork_acct_find_helper); return (ret); } struct pork_acct *pork_acct_find_name(const char *name, int protocol) { dlist_t *cur = screen.acct_list; while (cur != NULL) { struct pork_acct *acct = cur->data; if (acct->proto->protocol == protocol && !strcasecmp(name, acct->username)) { return (cur->data); } cur = cur->next; } return (NULL); } inline struct pork_acct *pork_acct_get_data(u_int32_t refnum) { dlist_t *node; node = pork_acct_find(refnum); if (node == NULL || node->data == NULL) return (NULL); return (node->data); } int pork_acct_add(struct pork_acct *acct) { screen.acct_list = dlist_add_head(screen.acct_list, acct); return (0); } int pork_acct_del_refnum(u_int32_t refnum, char *reason) { dlist_t *node; node = pork_acct_find(refnum); if (node == NULL) return (-1); pork_acct_del(node, reason); return (0); } void pork_acct_del(dlist_t *node, char *reason) { struct pork_acct *acct = node->data; dlist_t *cur; pork_signoff(acct, reason); chat_leave_all(acct); screen.acct_list = dlist_remove(screen.acct_list, node); cur = screen.window_list; if (cur != NULL) { do { struct imwindow *win = cur->data; if (win->owner == acct) { if (win->blist_visible) imwindow_blist_hide(win); win->owner->ref_count--; if (win->owner == screen.null_acct) win->owner = NULL; else { win->owner = screen.null_acct; win->owner->ref_count++; } } cur = cur->next; } while (cur != screen.window_list); } /* This must always be the case. */ if (acct->ref_count == 0) pork_acct_free(acct); else { debug("ref count for %s is not 0 [%u]", acct->username, acct->ref_count); } } int pork_acct_next_refnum(u_int32_t cur_refnum, u_int32_t *next) { dlist_t *cur; struct pork_acct *acct = NULL; cur = pork_acct_find(cur_refnum); if (cur == NULL) { debug("current refnum %u doesn't exist", cur_refnum); return (-1); } do { if (cur->next == NULL) { if (cur == screen.acct_list) return (-1); cur = screen.acct_list; } else cur = cur->next; acct = cur->data; } while (acct->proto->protocol < 0); *next = acct->refnum; return (0); } void pork_acct_print_list(void) { dlist_t *cur = screen.acct_list; screen_cmd_output("REFNUM\tUSERNAME\t\tPROTOCOL\tSERVER\t\t\t\t\t\tSTATUS"); for (cur = screen.acct_list ; cur != NULL ; cur = cur->next) { char buf[128]; struct pork_acct *acct = cur->data; u_int32_t max_reconnect_tries = 0; char server_buf[512]; if (acct->proto->protocol < 0) continue; if (!acct->connected) max_reconnect_tries = opt_get_int(OPT_RECONNECT_TRIES); if (acct->reconnecting) { snprintf(buf, sizeof(buf), "reconnecting (attempt %u/%u)", acct->reconnect_tries, max_reconnect_tries); } else if (acct->disconnected) { snprintf(buf, sizeof(buf), "disconnected: reconnect attempt %u/%u in %ld seconds", acct->reconnect_tries + 1, max_reconnect_tries, max(0, acct->reconnect_next_try - time(NULL))); } else xstrncpy(buf, "connected", sizeof(buf)); if (acct->server != NULL) { if (acct->fport != NULL) { snprintf(server_buf, sizeof(server_buf), "%s:%s", acct->server, acct->fport); } else xstrncpy(server_buf, acct->server, sizeof(server_buf)); } else { server_buf[0] = '\0'; } screen_cmd_output("%u\t\t%s\t\t\t%s\t\t\t%s\t\t\t%s", acct->refnum, acct->username, acct->proto->name, server_buf, buf); } } void pork_acct_del_all(char *reason) { dlist_t *cur = screen.acct_list; while (cur != NULL) { dlist_t *next = cur->next; pork_acct_del(cur, reason); cur = next; } } void pork_acct_update_blist_color(void) { dlist_t *cur = screen.acct_list; while (cur != NULL) { struct pork_acct *acct = cur->data; if (acct->blist != NULL) blist_draw(acct->blist); cur = cur->next; } } int pork_acct_connect(const char *user, char *args, int protocol) { struct pork_acct *acct; if (user == NULL) return (-1); acct = pork_acct_init(user, protocol); if (acct == NULL) { screen_err_msg("%s is already connected", user); return (-1); } pork_acct_add(acct); if (!acct->can_connect || acct->proto->connect == NULL) { screen_err_msg("You must specify a screen name before connecting"); pork_acct_del_refnum(acct->refnum, NULL); return (-1); } screen_bind_all_unbound(acct); if (acct->proto->connect(acct, args) == -1) { screen_err_msg("Unable to login as %s", acct->username); pork_acct_del_refnum(acct->refnum, NULL); return (-1); } return (0); } void pork_acct_update_blist_format(void) { dlist_t *cur = screen.acct_list; while (cur != NULL) { struct pork_acct *acct = cur->data; if (acct->blist != NULL) blist_changed_format(acct->blist); cur = cur->next; } } inline void pork_acct_update(void) { dlist_t *cur = screen.acct_list; for (cur = screen.acct_list ; cur != NULL ; cur = cur->next) { struct pork_acct *acct = cur->data; time_t time_now = time(NULL); if (acct->proto->update != NULL) { if (acct->proto->update(acct) == -1) continue; } if (acct->proto->set_idle_time != NULL && acct->report_idle && !acct->marked_idle && opt_get_bool(OPT_REPORT_IDLE)) { time_t time_diff = time_now - acct->last_input; int idle_after = opt_get_int(OPT_IDLE_AFTER); if (idle_after > 0 && time_diff >= 60 * idle_after) { screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_IDLE, "Setting %s idle after %d minutes of inactivity", acct->username, (int) time_diff / 60); acct->proto->set_idle_time(acct, time_diff); } } } } static inline u_int32_t pork_acct_get_new_refnum(void) { u_int32_t i; for (i = 0 ; i < 0xffffffff ; i++) { if (pork_acct_find(i) == NULL) return (i); } return (0); } /* ** Initialize an account for the specified user. */ struct pork_acct *pork_acct_init(const char *user, int protocol) { struct pork_acct *acct; acct = xcalloc(1, sizeof(*acct)); acct->username = xstrdup(user); acct->events = &screen.events; acct->proto = proto_get(protocol); if (protocol < 0) return (acct); if (buddy_init(acct) == -1) goto out_fail; if (acct->proto->init != NULL && acct->proto->init(acct) == -1) goto out_fail2; if (acct->proto->read_config != NULL && acct->proto->read_config(acct) == -1) { goto out_fail2; } acct->can_connect = 1; acct->refnum = pork_acct_get_new_refnum(); memcpy(&acct->laddr, &local_addr, sizeof(acct->laddr)); acct->lport = local_port; if (acct->proto->buddy_add != NULL) blist_init(acct); time(&acct->last_input); return (acct); out_fail: buddy_destroy(acct); out_fail2: free(acct->username); free(acct); return (NULL); } void pork_acct_connected(struct pork_acct *acct) { acct->successful_connect = 1; acct->connected = 1; if (acct->reconnecting) chat_rejoin_all(acct); acct->disconnected = 0; acct->reconnecting = 0; acct->reconnect_tries = 0; if (!event_generate(acct->events, EVENT_SIGNON, acct->refnum)) { screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_SIGNON, "Logged in as %s successfully", acct->username); } } static int pork_acct_reconnect(struct pork_acct *acct) { if (acct->proto->reconnect == NULL || acct->connected || !acct->disconnected || acct->reconnecting) { debug("%p %u %u %u", acct->proto->reconnect, acct->connected, !acct->disconnected, acct->reconnecting); return (-1); } acct->reconnect_tries++; acct->reconnecting = 1; screen_err_msg("Automatically reconnecting account %s (attempt %u)", acct->username, acct->reconnect_tries); return (acct->proto->reconnect(acct, NULL)); } static int pork_acct_connect_fail(struct pork_acct *acct) { u_int32_t max_reconnect_tries; u_int32_t connect_interval; u_int32_t connect_interval_max; max_reconnect_tries = opt_get_int(OPT_RECONNECT_TRIES); connect_interval = opt_get_int(OPT_RECONNECT_INTERVAL); connect_interval_max = opt_get_int(OPT_RECONNECT_MAX_INTERVAL); acct->connected = 0; acct->reconnecting = 0; acct->disconnected = 1; if (acct->reconnect_tries >= max_reconnect_tries) { screen_err_msg("Failed to reconnect %s after %u tries. Giving up.", acct->username, max_reconnect_tries); pork_acct_del_refnum(acct->refnum, NULL); return (-1); } acct->reconnect_next_try = time(NULL) + min(acct->reconnect_tries * connect_interval, connect_interval_max); return (0); } int pork_acct_disconnected(struct pork_acct *acct) { if (!acct->successful_connect || !opt_get_bool(OPT_AUTO_RECONNECT) || event_generate(acct->events, EVENT_SIGNOFF, acct->refnum)) { pork_acct_del_refnum(acct->refnum, NULL); return (0); } if (!acct->connected) return (pork_acct_connect_fail(acct)); screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_SIGNOFF, "%s has been disconnected", acct->username); acct->connected = 0; acct->reconnecting = 0; acct->reconnect_tries = 0; acct->disconnected = 1; acct->reconnect_next_try = time(NULL); if (acct->proto->disconnected != NULL) acct->proto->disconnected(acct); return (pork_acct_reconnect(acct)); } void pork_acct_reconnect_all(void) { dlist_t *cur; time_t now = time(NULL); int timeout = opt_get_int(OPT_CONNECT_TIMEOUT); cur = screen.acct_list; while (cur != NULL) { struct pork_acct *acct = cur->data; dlist_t *next = cur->next; if (acct->disconnected && !acct->reconnecting && acct->reconnect_next_try < now) { pork_acct_reconnect(acct); } else if ( acct->reconnecting && acct->reconnect_next_try + timeout < now) { screen_err_msg( "Attempt %u to reconnect %s timed out after %u seconds", acct->reconnect_tries, acct->username, timeout); acct->proto->connect_abort(acct); pork_acct_connect_fail(acct); } cur = next; } } int pork_acct_save(struct pork_acct *acct) { return (0); } pork-0.99.8.1/src/pork_acct.h0000644000175000017500000000442610234217327015613 0ustar ryanryan00000000000000/* ** pork_acct.h - account management. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_ACCT_H #define __PORK_ACCT_H #include #include #include #include struct buddy_pref; struct blist; struct events; struct pork_proto; struct pork_acct { char *username; char *passwd; char *profile; char *userhost; char *away_msg; char umode[64]; time_t last_input; struct timeval last_flush; u_int16_t warn_level; u_int16_t idle_time; u_int16_t report_idle:1; u_int16_t marked_idle:1; u_int16_t can_connect:1; /* presently connected */ u_int16_t connected:1; /* ever successfully connected */ u_int16_t successful_connect:1; /* presently disconnected */ u_int16_t disconnected:1; /* presently in the process of reconnecting */ u_int16_t reconnecting:1; u_int32_t reconnect_tries; time_t reconnect_next_try; u_int32_t ref_count; u_int32_t refnum; struct buddy_pref *buddy_pref; struct blist *blist; dlist_t *chat_list; dlist_t *transfer_list; hash_t autoreply; char *fport; char *server; in_port_t lport; struct sockaddr_storage laddr; struct event *events; struct pork_proto *proto; void *data; }; int pork_acct_add(struct pork_acct *acct); int pork_acct_del_refnum(u_int32_t refnum, char *reason); void pork_acct_del(dlist_t *node, char *reason); void pork_acct_del_all(char *reason); inline dlist_t *pork_acct_find(u_int32_t refnum); inline struct pork_acct *pork_acct_get_data(u_int32_t refnum); inline void pork_acct_update(void); int pork_acct_disconnected(struct pork_acct *acct); void pork_acct_update_blist_format(void); void pork_acct_update_blist_color(void); void pork_acct_print_list(void); void pork_acct_reconnect_all(void); void pork_acct_connected(struct pork_acct *acct); int pork_acct_connect(const char *user, char *args, int protocol); int pork_acct_next_refnum(u_int32_t cur_refnum, u_int32_t *next); struct pork_acct *pork_acct_find_name(const char *name, int protocol); struct pork_acct *pork_acct_init(const char *user, int protocol); int pork_acct_save(struct pork_acct *acct); #endif pork-0.99.8.1/src/pork_bind.c0000644000175000017500000001600610234217327015605 0ustar ryanryan00000000000000/* ** pork_bind.c - interface to key bindings ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* ** Names for some non-alphanumeric characters. */ static const struct keyval { char *name; int key; } keyval[] = { { "BACKSPACE", KEY_BACKSPACE }, { "BREAK", KEY_BREAK }, { "DELETE", KEY_DC }, { "DOWN_ARROW", KEY_DOWN }, { "END", KEY_END }, { "ENTER", KEY_ENTER }, { "F1", KEY_F(1) }, { "F2", KEY_F(2) }, { "F3", KEY_F(3) }, { "F4", KEY_F(4) }, { "F5", KEY_F(5) }, { "F6", KEY_F(6) }, { "F7", KEY_F(7) }, { "F8", KEY_F(8) }, { "F9", KEY_F(9) }, { "F10", KEY_F(10) }, { "F11", KEY_F(11) }, { "F12", KEY_F(12) }, { "HOME", KEY_HOME }, { "INSERT", KEY_IC }, { "LEFT_ARROW", KEY_LEFT }, { "PAGE_DOWN", KEY_NPAGE }, { "PAGE_UP", KEY_PPAGE }, { "RETURN", '\n' }, { "RIGHT_ARROW", KEY_RIGHT }, { "SPACE", ' ' }, { "SUSPEND", KEY_SUSPEND }, { "TAB", '\t' }, { "UP_ARROW", KEY_UP }, }; static int bind_compare(void *l, void *r) { int key = POINTER_TO_INT(l); struct binding *binding = r; return (key - binding->key); } static int key_compare(const void *l, const void *r) { const char *str = l; const struct keyval *kv = r; return (strcasecmp(str, kv->name)); } static void bind_hash_remove(void *param __notused, void *data) { struct binding *binding = data; free(binding->binding); free(binding); } /* ** If a binding is found for the key "key", execute ** the bind_set->success() function, passing it ** the binding. ** ** If no binding is found for "key", execute ** the bind_set->failure() function, passing it ** the key for which no binding was found. */ int bind_exec(struct key_binds *bind_set, int key) { struct binding *binding; binding = bind_find(bind_set, key); if (binding == NULL) { if (bind_set->failure != NULL) bind_set->failure(key); } else { if (bind_set->success != NULL) bind_set->success(binding); } return (0); } /* ** Remove the binding for key "key" if it exists. */ inline int bind_remove(struct key_binds *bind_set, int key) { int ret; ret = hash_remove(&bind_set->hash, INT_TO_POINTER(key), int_hash(key, bind_set->hash.order)); return (ret); } /* ** Execute the command "command" when key "key" is pressed. */ void bind_add(struct key_binds *bind_set, int key, char *command) { u_int32_t hash = int_hash(key, bind_set->hash.order); struct binding *binding = xmalloc(sizeof(*binding)); bind_remove(bind_set, key); binding->key = key; binding->binding = xstrdup(command); hash_add(&bind_set->hash, binding, hash); } /* ** Set some default bindings. This only ** sets the most essential bindings. The rest ** are read from the system-wide porkrc file. */ static void bind_add_default(struct binds *binds) { bind_add(&binds->main, '\n', "input send"); bind_add(&binds->main, 127, "input backspace"); bind_add(&binds->main, KEY_BACKSPACE, "input backspace"); } /* ** Initialize the bind hash. */ inline int bind_init(struct binds *binds) { memset(binds, 0, sizeof(*binds)); if (hash_init(&binds->main.hash, 5, bind_compare, bind_hash_remove) != 0) return (-1); if (hash_init(&binds->blist.hash, 3, bind_compare, bind_hash_remove) != 0) return (-1); bind_add_default(binds); return (0); } inline void bind_destroy(struct binds *binds) { hash_destroy(&binds->main.hash); hash_destroy(&binds->blist.hash); } inline void bind_set_handlers( struct key_binds *bind_set, void (*success)(struct binding *binding), void (*failure)(int key)) { bind_set->success = success; bind_set->failure = failure; } /* ** Find the binding for the key, "key" */ struct binding *bind_find(struct key_binds *bind_set, int key) { dlist_t *node; u_int32_t hash = int_hash(key, bind_set->hash.order); node = hash_find(&bind_set->hash, INT_TO_POINTER(key), hash); if (node != NULL) return (node->data); return (NULL); } /* ** Translate a key's name to its character code. ** (i.e. ^A -> 0x01) ** ** This is messy. ** ** Basically ^X == ^x, META-^X == META-^x, META-X != META-x, X != x. */ int bind_get_keycode(char *keystr) { struct keyval *kv; int key; kv = bsearch(keystr, keyval, array_elem(keyval), sizeof(struct keyval), key_compare); if (kv != NULL) return (kv->key); if (!strncasecmp(keystr, "0x", 2)) { char *end; int val = strtol(keystr, &end, 16); if (*end != '\0') return (-1); return (val); } if (!strncasecmp(keystr, "META", 4)) { int meta_num = 1; keystr += 4; if (keystr[0] == '-') keystr++; else if (isdigit(keystr[0])) { char meta_str[128]; char *p; if (xstrncpy(meta_str, keystr, sizeof(meta_str)) == -1) return (-1); p = strchr(meta_str, '-'); if (p == NULL) return (-1); *p++ = '\0'; if (str_to_uint(meta_str, &meta_num) == -1 || meta_num > 15) return (-1); keystr = p; } else return (-1); kv = bsearch(keystr, keyval, array_elem(keyval), sizeof(struct keyval), key_compare); if (kv != NULL) return (META_KEY(kv->key, meta_num)); if (keystr[0] == '^' && keystr[1] != '\0' && keystr[2] == '\0') key = META_KEY(CTRL_KEY(toupper(keystr[1])), meta_num); else if (keystr[0] != '\0' && keystr[1] == '\0') key = META_KEY(keystr[0], meta_num); else if (!strncasecmp(keystr, "0x", 2)) { char *end; int val = strtol(keystr, &end, 16); if (*end != '\0') key = -1; else key = META_KEY(val, meta_num); } else key = -1; return (key); } if (keystr[0] == '^' && keystr[1] != '\0' && keystr[2] == '\0') return (CTRL_KEY(toupper(keystr[1]))); if (keystr[1] == '\0') return (keystr[0]); return (-1); } /* ** Given a key code, fill in "result" with its name. ** This is used when listing the current bindings. */ void bind_get_keyname(int key, char *result, size_t len) { u_int32_t i; char buf[32]; int meta_num; result[0] = '\0'; meta_num = META_NUM(key); if (meta_num != 0) { if (meta_num > 1) snprintf(result, len, "META%d-", meta_num); else xstrncpy(result, "META-", len); key &= ~META_MASK; } for (i = 0 ; i < array_elem(keyval) ; i++) { if (key == keyval[i].key) { xstrncat(result, keyval[i].name, len); return; } } if (key <= 0xff && iscntrl(key)) { char ctrl_key = key + 'A' - 1; if (isprint(ctrl_key)) { if (isalpha(ctrl_key)) ctrl_key = toupper(ctrl_key); snprintf(buf, sizeof(buf), "^%c", ctrl_key); } else snprintf(buf, sizeof(buf), "0x%02x", key); } else if (key <= 0xff && isprint(key)) snprintf(buf, sizeof(buf), "%c", key); else snprintf(buf, sizeof(buf), "0x%02x", key); xstrncat(result, buf, len); } pork-0.99.8.1/src/pork_bind.h0000644000175000017500000000217510234217327015614 0ustar ryanryan00000000000000/* ** pork_bind.h - interface to key bindings ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_BIND_H #define __PORK_BIND_H enum { BINDS_MAIN, BINDS_BUDDY }; struct binding { int key; char *binding; }; struct key_binds { hash_t hash; void (*success)(struct binding *binding); void (*failure)(int key); }; struct binds { struct key_binds main; struct key_binds blist; }; int bind_init(struct binds *binds); inline void bind_destroy(struct binds *binds); int bind_remove(struct key_binds *bind_set, int c); int bind_exec(struct key_binds *bind_set, int c); struct binding *bind_find(struct key_binds *bind_set, int c); void bind_add(struct key_binds *bind_set, int c, char *command); void bind_set_handlers( struct key_binds *bind_set, void (*success)(struct binding *binding), void (*failure)(int key)); int bind_get_keycode(char *keystr); void bind_get_keyname(int key, char *result, size_t len); #endif pork-0.99.8.1/src/protocols/0000755000175000017500000000000010236222746015516 5ustar ryanryan00000000000000pork-0.99.8.1/src/protocols/aim/0000755000175000017500000000000010236223230016251 5ustar ryanryan00000000000000pork-0.99.8.1/src/protocols/aim/libfaim/0000755000175000017500000000000010236222655017666 5ustar ryanryan00000000000000pork-0.99.8.1/src/protocols/aim/libfaim/buddylist.c0000644000175000017500000001473610234217330022040 0ustar ryanryan00000000000000/* * Family 0x0003 - Old-style Buddylist Management (non-SSI). * */ #define FAIM_INTERNAL #include #include /* * Subtype 0x0002 - Request rights. * * Request Buddy List rights. * */ faim_export int aim_buddylist_reqrights(aim_session_t *sess, aim_conn_t *conn) { return aim_genericreq_n_snacid(sess, conn, 0x0003, 0x0002); } /* * Subtype 0x0003 - Rights. * */ static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; aim_tlvlist_t *tlvlist; fu16_t maxbuddies = 0, maxwatchers = 0; int ret = 0; /* * TLVs follow */ tlvlist = aim_tlvlist_read(bs); /* * TLV type 0x0001: Maximum number of buddies. */ if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) maxbuddies = aim_tlv_get16(tlvlist, 0x0001, 1); /* * TLV type 0x0002: Maximum number of watchers. * * Watchers are other users who have you on their buddy * list. (This is called the "reverse list" by a certain * other IM protocol.) * */ if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) maxwatchers = aim_tlv_get16(tlvlist, 0x0002, 1); /* * TLV type 0x0003: Unknown. * * ICQ only? */ if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, maxbuddies, maxwatchers); aim_tlvlist_free(&tlvlist); return ret; } /* * Subtype 0x0004 - Add buddy to list. * * Adds a single buddy to your buddy list after login. * XXX This should just be an extension of setbuddylist() * */ faim_export int aim_buddylist_addbuddy(aim_session_t *sess, aim_conn_t *conn, const char *sn) { aim_frame_t *fr; aim_snacid_t snacid; if (!sn || !strlen(sn)) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, sn, strlen(sn)+1); aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid); aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0004 - Add multiple buddies to your buddy list. * * This just builds the "set buddy list" command then queues it. * * buddy_list = "Screen Name One&ScreenNameTwo&"; * * XXX Clean this up. * */ faim_export int aim_buddylist_set(aim_session_t *sess, aim_conn_t *conn, const char *buddy_list) { aim_frame_t *fr; aim_snacid_t snacid; int len = 0; char *localcpy = NULL; char *tmpptr = NULL; if (!buddy_list || !(localcpy = strdup(buddy_list))) return -EINVAL; for (tmpptr = strtok(localcpy, "&"); tmpptr; ) { faimdprintf(sess, 2, "---adding: %s (%d)\n", tmpptr, strlen(tmpptr)); len += 1 + strlen(tmpptr); tmpptr = strtok(NULL, "&"); } if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+len))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid); strncpy(localcpy, buddy_list, strlen(buddy_list) + 1); for (tmpptr = strtok(localcpy, "&"); tmpptr; ) { faimdprintf(sess, 2, "---adding: %s (%d)\n", tmpptr, strlen(tmpptr)); aimbs_put8(&fr->data, strlen(tmpptr)); aimbs_putraw(&fr->data, tmpptr, strlen(tmpptr)); tmpptr = strtok(NULL, "&"); } aim_tx_enqueue(sess, fr); free(localcpy); return 0; } /* * Subtype 0x0005 - Remove buddy from list. * * XXX generalise to support removing multiple buddies (basically, its * the same as setbuddylist() but with a different snac subtype). * */ faim_export int aim_buddylist_removebuddy(aim_session_t *sess, aim_conn_t *conn, const char *sn) { aim_frame_t *fr; aim_snacid_t snacid; if (!sn || !strlen(sn)) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0003, 0x0005, 0x0000, sn, strlen(sn)+1); aim_putsnac(&fr->data, 0x0003, 0x0005, 0x0000, snacid); aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x000b * * XXX Why would we send this? * */ faim_export int aim_buddylist_oncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info) { aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !conn || !info) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0003, 0x000b, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0003, 0x000b, 0x0000, snacid); aim_putuserinfo(&fr->data, info); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x000c * * XXX Why would we send this? * */ faim_export int aim_buddylist_offgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn) { aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !conn || !sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0003, 0x000c, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0003, 0x000c, 0x0000, snacid); aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); aim_tx_enqueue(sess, fr); return 0; } /* * Subtypes 0x000b and 0x000c - Change in buddy status * * Oncoming Buddy notifications contain a subset of the * user information structure. It's close enough to run * through aim_info_extract() however. * * Although the offgoing notification contains no information, * it is still in a format parsable by aim_info_extract(). * */ static int buddychange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_userinfo_t userinfo; aim_rxcallback_t userfunc; aim_info_extract(sess, bs, &userinfo); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, &userinfo); if (snac->subtype == 0x000b) aim_locate_requestuserinfo(sess, userinfo.sn); aim_info_free(&userinfo); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0003) return rights(sess, mod, rx, snac, bs); else if ((snac->subtype == 0x000b) || (snac->subtype == 0x000c)) return buddychange(sess, mod, rx, snac, bs); return 0; } faim_internal int buddylist_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0003; mod->version = 0x0001; mod->toolid = 0x0110; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "buddylist", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/BUGS0000644000175000017500000000062610234217330020345 0ustar ryanryan00000000000000 aim.h ----- - Needs a bit of cleaning info.c ------ - aim_userinfo_s isn't real good. There is no way to tell the client which fields are present and which are zero because they weren't provided. search.c ------------ - Still need aim_usersearch_name() snac.c ---------- - Should implement better SNAC handling rxhandlers.c ---------------- - Need a better solution than sleep() pork-0.99.8.1/src/protocols/aim/libfaim/ft.c0000644000175000017500000006505110234217330020442 0ustar ryanryan00000000000000/* * Oscar File transfer (OFT) and Oscar Direct Connect (ODC). * (ODC is also referred to as DirectIM and IM Image.) * * There are a few static helper functions at the top, then * ODC stuff, then ft stuff. * * I feel like this is a good place to explain OFT, so I'm going to * do just that. Each OFT packet has a header type. I guess this * is pretty similar to the subtype of a SNAC packet. The type * basically tells the other client the meaning of the OFT packet. * There are two distinct types of file transfer, which I usually * call "sendfile" and "getfile." Sendfile is when you send a file * to another AIM user. Getfile is when you share a group of files, * and other users request that you send them the files. * * A typical sendfile file transfer goes like this: * 1) Sender sends a channel 2 ICBM telling the other user that * we want to send them a file. At the same time, we open a * listener socket (this should be done before sending the * ICBM) on some port, and wait for them to connect to us. * The ICBM we sent should contain our IP address and the port * number that we're listening on. * 2) The receiver connects to the sender on the given IP address * and port. After the connection is established, the receiver * sends an ICBM signifying that we are ready and waiting. * 3) The sender sends an OFT PROMPT message over the OFT * connection. * 4) The receiver of the file sends back an exact copy of this * OFT packet, except the cookie is filled in with the cookie * from the ICBM. I think this might be an attempt to verify * that the user that is connected is actually the guy that * we sent the ICBM to. Oh, I've been calling this the ACK. * 5) The sender starts sending raw data across the connection * until the entire file has been sent. * 6) The receiver knows the file is finished because the sender * sent the file size in an earlier OFT packet. So then the * receiver sends the DONE thingy (after filling in the * "received" checksum and size) and closes the connection. */ #define FAIM_INTERNAL #ifdef HAVE_CONFIG_H #include #endif #include #ifndef _WIN32 #include #include #include #include #include /* for aim_odc_initiate */ #include /* for inet_ntoa */ #include /* for UINT_MAX */ #define G_DIR_SEPARATOR '/' #endif #ifdef _WIN32 #include "win32dep.h" #endif /* * I really want to switch all our networking code to using IPv6 only, * but that really isn't a good idea at all. Evan S. of Adium says * OS X sets all connections as "AF_INET6/PF_INET6," even if there is * nothing inherently IPv6 about them. And I feel like Linux kernel * 2.6.5 is doing the same thing. So we REALLY should accept * connections if they're showing up as IPv6. Old OSes (Solaris?) * that might not have full IPv6 support yet will fail if we try * to use PF_INET6 but it isn't defined. --Mark Doliner */ #ifndef PF_INET6 #define PF_INET6 PF_INET #endif struct aim_odc_intdata { fu8_t cookie[8]; char sn[MAXSNLEN+1]; char ip[22]; }; /** * Convert the directory separator from / (0x2f) to ^A (0x01) * * @param name The filename to convert. */ static void aim_oft_dirconvert_tostupid(char *name) { while (name[0]) { if (name[0] == 0x01) name[0] = G_DIR_SEPARATOR; name++; } } /** * Convert the directory separator from ^A (0x01) to / (0x2f) * * @param name The filename to convert. */ static void aim_oft_dirconvert_fromstupid(char *name) { while (name[0]) { if (name[0] == G_DIR_SEPARATOR) name[0] = 0x01; name++; } } /** * Calculate oft checksum of buffer * * Prevcheck should be 0xFFFF0000 when starting a checksum of a file. The * checksum is kind of a rolling checksum thing, so each time you get bytes * of a file you just call this puppy and it updates the checksum. You can * calculate the checksum of an entire file by calling this in a while or a * for loop, or something. * * Thanks to Graham Booker for providing this improved checksum routine, * which is simpler and should be more accurate than Josh Myer's original * code. -- wtm * * This algorithm works every time I have tried it. The other fails * sometimes. So, AOL who thought this up? It has got to be the weirdest * checksum I have ever seen. * * @param buffer Buffer of data to checksum. Man I'd like to buff her... * @param bufsize Size of buffer. * @param prevcheck Previous checksum. */ faim_export fu32_t aim_oft_checksum_chunk(const fu8_t *buffer, int bufferlen, fu32_t prevcheck) { fu32_t check = (prevcheck >> 16) & 0xffff, oldcheck; int i; unsigned short val; for (i=0; i oldcheck) check--; } check = ((check & 0x0000ffff) + (check >> 16)); check = ((check & 0x0000ffff) + (check >> 16)); return check << 16; } faim_export fu32_t aim_oft_checksum_file(char *filename) { FILE *fd; fu32_t checksum = 0xffff0000; if ((fd = fopen(filename, "rb"))) { int bytes; fu8_t buffer[1024]; while ((bytes = fread(buffer, 1, 1024, fd))) checksum = aim_oft_checksum_chunk(buffer, bytes, checksum); fclose(fd); } return checksum; } /** * After establishing a listening socket, this is called to accept a connection. It * clones the conn used by the listener, and passes both of these to a signal handler. * The signal handler should close the listener conn and keep track of the new conn, * since this is what is used for file transfers and what not. * * @param sess The session. * @param cur The conn the incoming connection is on. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_handlerendconnect(aim_session_t *sess, aim_conn_t *cur) { int acceptfd = 0; struct sockaddr addr; socklen_t addrlen = sizeof(addr); int ret = 0; aim_conn_t *newconn; char ip[20]; unsigned short port; if ((acceptfd = accept(cur->fd, &addr, &addrlen)) == -1) return 0; /* not an error */ if ((addr.sa_family != PF_INET) && (addr.sa_family != PF_INET6)) { close(acceptfd); aim_conn_close(cur); return -1; } strncpy(ip, inet_ntoa(((struct sockaddr_in *)&addr)->sin_addr), sizeof(ip)); port = ntohs(((struct sockaddr_in *)&addr)->sin_port); if (!(newconn = aim_cloneconn(sess, cur))) { close(acceptfd); aim_conn_close(cur); return -ENOMEM; } newconn->type = AIM_CONN_TYPE_RENDEZVOUS; newconn->fd = acceptfd; if (newconn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) { aim_rxcallback_t userfunc; struct aim_odc_intdata *priv; priv = (struct aim_odc_intdata *)(newconn->internal = cur->internal); cur->internal = NULL; snprintf(priv->ip, sizeof(priv->ip), "%s:%hu", ip, port); if ((userfunc = aim_callhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED))) ret = userfunc(sess, NULL, newconn, cur); } else if (newconn->subtype == AIM_CONN_SUBTYPE_OFT_GETFILE) { } else if (newconn->subtype == AIM_CONN_SUBTYPE_OFT_SENDFILE) { aim_rxcallback_t userfunc; if ((userfunc = aim_callhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED))) ret = userfunc(sess, NULL, newconn, cur); } else { faimdprintf(sess, 1,"Got a connection on a listener that's not rendezvous. Closing connection.\n"); aim_conn_close(newconn); ret = -1; } return ret; } /** * Send client-to-client typing notification over an established direct connection. * * @param sess The session. * @param conn The already-connected ODC connection. * @param typing If 0x0002, sends a "typing" message, 0x0001 sends "typed," and * 0x0000 sends "stopped." * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_odc_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing) { struct aim_odc_intdata *intdata = (struct aim_odc_intdata *)conn->internal; aim_frame_t *fr; aim_bstream_t *hdrbs; fu8_t *hdr; int hdrlen = 0x44; if (!sess || !conn || (conn->type != AIM_CONN_TYPE_RENDEZVOUS)) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_OFT, 0x0001, 0))) return -ENOMEM; memcpy(fr->hdr.rend.magic, "ODC2", 4); fr->hdr.rend.hdrlen = hdrlen + 8; if (!(hdr = calloc(1, hdrlen))) { aim_frame_destroy(fr); return -ENOMEM; } hdrbs = &(fr->data); aim_bstream_init(hdrbs, hdr, hdrlen); aimbs_put16(hdrbs, 0x0006); aimbs_put16(hdrbs, 0x0000); aimbs_putraw(hdrbs, intdata->cookie, 8); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put32(hdrbs, 0x00000000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); if (typing == 0x0002) aimbs_put16(hdrbs, 0x0002 | 0x0008); else if (typing == 0x0001) aimbs_put16(hdrbs, 0x0002 | 0x0004); else aimbs_put16(hdrbs, 0x0002); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_putraw(hdrbs, sess->sn, strlen(sess->sn)); aim_bstream_setpos(hdrbs, 52); /* bleeehh */ aimbs_put8(hdrbs, 0x00); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put8(hdrbs, 0x00); /* end of hdr */ aim_tx_enqueue(sess, fr); return 0; } /** * Send client-to-client IM over an established direct connection. * Call this just like you would aim_send_im, to send a directim. * * @param sess The session. * @param conn The already-connected ODC connection. * @param msg Null-terminated string to send. * @param len The length of the message to send, including binary data. * @param encoding See the AIM_CHARSET_* defines in aim.h * @param isawaymsg 0 if this is not an auto-response, 1 if it is. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *msg, int len, int encoding, int isawaymsg) { aim_frame_t *fr; aim_bstream_t *hdrbs; struct aim_odc_intdata *intdata = (struct aim_odc_intdata *)conn->internal; int hdrlen = 0x44; fu8_t *hdr; if (!sess || !conn || (conn->type != AIM_CONN_TYPE_RENDEZVOUS) || !msg) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_OFT, 0x01, 0))) return -ENOMEM; memcpy(fr->hdr.rend.magic, "ODC2", 4); fr->hdr.rend.hdrlen = hdrlen + 8; if (!(hdr = calloc(1, hdrlen + len))) { aim_frame_destroy(fr); return -ENOMEM; } hdrbs = &(fr->data); aim_bstream_init(hdrbs, hdr, hdrlen + len); aimbs_put16(hdrbs, 0x0006); aimbs_put16(hdrbs, 0x0000); aimbs_putraw(hdrbs, intdata->cookie, 8); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put32(hdrbs, len); aimbs_put16(hdrbs, encoding); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); /* flags - used for typing notification and to mark if this is an away message */ aimbs_put16(hdrbs, 0x0000 | isawaymsg); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_putraw(hdrbs, sess->sn, strlen(sess->sn)); aim_bstream_setpos(hdrbs, 52); /* bleeehh */ aimbs_put8(hdrbs, 0x00); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x0000); aimbs_put8(hdrbs, 0x00); /* end of hdr2 */ #if 0 /* XXX - this is how you send buddy icon info... */ aimbs_put16(hdrbs, 0x0008); aimbs_put16(hdrbs, 0x000c); aimbs_put16(hdrbs, 0x0000); aimbs_put16(hdrbs, 0x1466); aimbs_put16(hdrbs, 0x0001); aimbs_put16(hdrbs, 0x2e0f); aimbs_put16(hdrbs, 0x393e); aimbs_put16(hdrbs, 0xcac8); #endif aimbs_putraw(hdrbs, msg, len); aim_tx_enqueue(sess, fr); return 0; } /** * Get the screen name of the peer of a direct connection. * * @param conn The ODC connection. * @return The screen name of the dude, or NULL if there was an anomaly. */ faim_export const char *aim_odc_getsn(aim_conn_t *conn) { struct aim_odc_intdata *intdata; if (!conn || !conn->internal) return NULL; if ((conn->type != AIM_CONN_TYPE_RENDEZVOUS) || (conn->subtype != AIM_CONN_SUBTYPE_OFT_DIRECTIM)) return NULL; intdata = (struct aim_odc_intdata *)conn->internal; return intdata->sn; } /** * Get the cookie of a direct connection. * * @param conn The ODC connection. * @return The cookie, an 8 byte unterminated string, or NULL if there was an anomaly. */ faim_export const char *aim_odc_getcookie(aim_conn_t *conn) { struct aim_odc_intdata *intdata; if (!conn || !conn->internal) return NULL; intdata = (struct aim_odc_intdata *)conn->internal; return intdata->cookie; } /** * Find the conn of a direct connection with the given buddy. * * @param sess The session. * @param sn The screen name of the buddy whose direct connection you want to find. * @return The conn for the direct connection with the given buddy, or NULL if no * connection was found. */ faim_export aim_conn_t *aim_odc_getconn(aim_session_t *sess, const char *sn) { aim_conn_t *cur; struct aim_odc_intdata *intdata; if (!sess || !sn || !strlen(sn)) return NULL; for (cur = sess->connlist; cur; cur = cur->next) { if ((cur->type == AIM_CONN_TYPE_RENDEZVOUS) && (cur->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)) { intdata = cur->internal; if (!aim_sncmp(intdata->sn, sn)) return cur; } } return NULL; } /** * For those times when we want to open up the direct connection channel ourselves. * * You'll want to set up some kind of watcher on this socket. * When the state changes, call aim_handlerendconnection with * the connection returned by this. aim_handlerendconnection * will accept the pending connection and stop listening. * * @param sess The session * @param sn The screen name to connect to. * @return The new connection. */ faim_export aim_conn_t *aim_odc_initiate(aim_session_t *sess, const char *sn, int listenfd, const fu8_t *localip, fu16_t port, const fu8_t *mycookie) { aim_conn_t *newconn; aim_msgcookie_t *cookie; struct aim_odc_intdata *priv; fu8_t ck[8]; if (!localip) return NULL; if (mycookie) { memcpy(ck, mycookie, 8); aim_im_sendch2_odcrequest(sess, ck, TRUE, sn, localip, port); } else aim_im_sendch2_odcrequest(sess, ck, FALSE, sn, localip, port); cookie = (aim_msgcookie_t *)calloc(1, sizeof(aim_msgcookie_t)); memcpy(cookie->cookie, ck, 8); cookie->type = AIM_COOKIETYPE_OFTIM; /* this one is for the cookie */ priv = (struct aim_odc_intdata *)calloc(1, sizeof(struct aim_odc_intdata)); memcpy(priv->cookie, ck, 8); strncpy(priv->sn, sn, sizeof(priv->sn)); cookie->data = priv; aim_cachecookie(sess, cookie); /* XXX - switch to aim_cloneconn()? */ if (!(newconn = aim_newconn(sess, AIM_CONN_TYPE_LISTENER, NULL))) { close(listenfd); return NULL; } /* this one is for the conn */ priv = (struct aim_odc_intdata *)calloc(1, sizeof(struct aim_odc_intdata)); memcpy(priv->cookie, ck, 8); strncpy(priv->sn, sn, sizeof(priv->sn)); newconn->fd = listenfd; newconn->subtype = AIM_CONN_SUBTYPE_OFT_DIRECTIM; newconn->internal = priv; newconn->lastactivity = time(NULL); return newconn; } /** * Connect directly to the given buddy for directim. * * This is a wrapper for aim_newconn. * * If addr is NULL, the socket is not created, but the connection is * allocated and setup to connect. * * @param sess The Godly session. * @param sn The screen name we're connecting to. I hope it's a girl... * @param addr Address to connect to. * @return The new connection. */ faim_export aim_conn_t *aim_odc_connect(aim_session_t *sess, const char *sn, const char *addr, const fu8_t *cookie) { aim_conn_t *newconn; struct aim_odc_intdata *intdata; if (!sess || !sn) return NULL; if (!(intdata = calloc(1, sizeof(struct aim_odc_intdata)))) return NULL; memcpy(intdata->cookie, cookie, 8); strncpy(intdata->sn, sn, sizeof(intdata->sn)); if (addr) strncpy(intdata->ip, addr, sizeof(intdata->ip)); /* XXX - verify that non-blocking connects actually work */ if (!(newconn = aim_newconn(sess, AIM_CONN_TYPE_RENDEZVOUS, addr))) { free(intdata); return NULL; } newconn->internal = intdata; newconn->subtype = AIM_CONN_SUBTYPE_OFT_DIRECTIM; return newconn; } /** * Sometimes you just don't know with these kinds of people. * * @param sess The session. * @param conn The ODC connection of the incoming data. * @param frr The frame allocated for the incoming data. * @param bs It stands for "bologna sandwich." * @return Return 0 if no errors, otherwise return the error number. */ static int handlehdr_odc(aim_session_t *sess, aim_conn_t *conn, aim_frame_t *frr, aim_bstream_t *bs) { aim_frame_t fr; int ret = 0; aim_rxcallback_t userfunc; fu32_t payloadlength; fu16_t flags, encoding; char *snptr = NULL; fr.conn = conn; /* AAA - ugly */ aim_bstream_setpos(bs, 20); payloadlength = aimbs_get32(bs); aim_bstream_setpos(bs, 24); encoding = aimbs_get16(bs); aim_bstream_setpos(bs, 30); flags = aimbs_get16(bs); aim_bstream_setpos(bs, 36); /* XXX - create an aimbs_getnullstr function? */ snptr = aimbs_getstr(bs, 32); /* Next 32 bytes contain the sn, padded with null chars */ faimdprintf(sess, 2, "faim: OFT frame: handlehdr_odc: %04x / %04x / %s\n", payloadlength, flags, snptr); if (flags & 0x0008) { if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING))) ret = userfunc(sess, &fr, snptr, 2); } else if (flags & 0x0004) { if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING))) ret = userfunc(sess, &fr, snptr, 1); } else { if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING))) ret = userfunc(sess, &fr, snptr, 0); } if ((payloadlength != 0) && (payloadlength != UINT_MAX)) { char *msg; int recvd = 0; int i, isawaymsg; isawaymsg = flags & 0x0001; if (!(msg = calloc(1, payloadlength+1))) { free(snptr); return -ENOMEM; } while (payloadlength - recvd) { if (payloadlength - recvd >= 1024) i = aim_recv(conn->fd, &msg[recvd], 1024); else i = aim_recv(conn->fd, &msg[recvd], payloadlength - recvd); if (i <= 0) { free(msg); free(snptr); return -1; } recvd = recvd + i; if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER))) ret = userfunc(sess, &fr, snptr, (double)recvd / payloadlength); } if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING))) ret = userfunc(sess, &fr, snptr, msg, payloadlength, encoding, isawaymsg); free(msg); } free(snptr); return ret; } faim_export struct aim_oft_info *aim_oft_createinfo(aim_session_t *sess, const fu8_t *cookie, const char *sn, const char *ip, fu16_t port, fu32_t size, fu32_t modtime, char *filename) { struct aim_oft_info *new; if (!sess) return NULL; if (!(new = (struct aim_oft_info *)calloc(1, sizeof(struct aim_oft_info)))) return NULL; new->sess = sess; if (cookie) memcpy(new->cookie, cookie, 8); if (ip) new->clientip = strdup(ip); if (sn) new->sn = strdup(sn); new->port = port; new->fh.totfiles = 1; new->fh.filesleft = 1; new->fh.totparts = 1; new->fh.partsleft = 1; new->fh.totsize = size; new->fh.size = size; new->fh.modtime = modtime; new->fh.checksum = 0xffff0000; new->fh.rfrcsum = 0xffff0000; new->fh.rfcsum = 0xffff0000; new->fh.recvcsum = 0xffff0000; strncpy(new->fh.idstring, "OFT_Windows ICBMFT V1.1 32", 31); if (filename) { strncpy(new->fh.name, filename, 63); new->fh.name[63] = '\0'; } new->next = sess->oft_info; sess->oft_info = new; return new; } /** * Remove the given oft_info struct from the oft_info linked list, and * then free its memory. * * @param sess The session. * @param oft_info The aim_oft_info struct that we're destroying. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_oft_destroyinfo(struct aim_oft_info *oft_info) { aim_session_t *sess; if (!oft_info || !(sess = oft_info->sess)) return -EINVAL; if (sess->oft_info && (sess->oft_info == oft_info)) { sess->oft_info = sess->oft_info->next; } else { struct aim_oft_info *cur; for (cur=sess->oft_info; (cur->next && (cur->next!=oft_info)); cur=cur->next); if (cur->next) cur->next = cur->next->next; } free(oft_info->sn); free(oft_info->proxyip); free(oft_info->clientip); free(oft_info->verifiedip); free(oft_info); return 0; } /** * Creates a listener socket so the other dude can connect to us. * * You'll want to set up some kind of watcher on this socket. * When the state changes, call aim_handlerendconnection with * the connection returned by this. aim_handlerendconnection * will accept the pending connection and stop listening. * * @param sess The session. * @param oft_info File transfer information associated with this * connection. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_sendfile_listen(aim_session_t *sess, struct aim_oft_info *oft_info, int listenfd) { if (!oft_info) return -EINVAL; if (!(oft_info->conn = aim_newconn(sess, AIM_CONN_TYPE_LISTENER, NULL))) { close(listenfd); return -ENOMEM; } oft_info->conn->fd = listenfd; oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; oft_info->conn->lastactivity = time(NULL); return 0; } /** * Extract an &aim_fileheader_t from the given buffer. * * @param bs The should be from an incoming rendezvous packet. * @return A pointer to new struct on success, or NULL on error. */ static struct aim_fileheader_t *aim_oft_getheader(aim_bstream_t *bs) { struct aim_fileheader_t *fh; if (!(fh = calloc(1, sizeof(struct aim_fileheader_t)))) return NULL; /* The bstream should be positioned after the hdrtype. */ aimbs_getrawbuf(bs, fh->bcookie, 8); fh->encrypt = aimbs_get16(bs); fh->compress = aimbs_get16(bs); fh->totfiles = aimbs_get16(bs); fh->filesleft = aimbs_get16(bs); fh->totparts = aimbs_get16(bs); fh->partsleft = aimbs_get16(bs); fh->totsize = aimbs_get32(bs); fh->size = aimbs_get32(bs); fh->modtime = aimbs_get32(bs); fh->checksum = aimbs_get32(bs); fh->rfrcsum = aimbs_get32(bs); fh->rfsize = aimbs_get32(bs); fh->cretime = aimbs_get32(bs); fh->rfcsum = aimbs_get32(bs); fh->nrecvd = aimbs_get32(bs); fh->recvcsum = aimbs_get32(bs); aimbs_getrawbuf(bs, fh->idstring, 32); fh->flags = aimbs_get8(bs); fh->lnameoffset = aimbs_get8(bs); fh->lsizeoffset = aimbs_get8(bs); aimbs_getrawbuf(bs, fh->dummy, 69); aimbs_getrawbuf(bs, fh->macfileinfo, 16); fh->nencode = aimbs_get16(bs); fh->nlanguage = aimbs_get16(bs); aimbs_getrawbuf(bs, fh->name, 64); /* XXX - filenames longer than 64B */ fh->name[63] = '\0'; return fh; } /** * Fills a buffer with network-order fh data * * @param bs A bstream to fill -- automatically initialized * @param fh A struct aim_fileheader_t to get data from. * @return Return non-zero on error. */ static int aim_oft_buildheader(aim_bstream_t *bs, struct aim_fileheader_t *fh) { fu8_t *hdr; if (!bs || !fh) return -EINVAL; if (!(hdr = (unsigned char *)calloc(1, 0x100 - 8))) return -ENOMEM; aim_bstream_init(bs, hdr, 0x100 - 8); aimbs_putraw(bs, fh->bcookie, 8); aimbs_put16(bs, fh->encrypt); aimbs_put16(bs, fh->compress); aimbs_put16(bs, fh->totfiles); aimbs_put16(bs, fh->filesleft); aimbs_put16(bs, fh->totparts); aimbs_put16(bs, fh->partsleft); aimbs_put32(bs, fh->totsize); aimbs_put32(bs, fh->size); aimbs_put32(bs, fh->modtime); aimbs_put32(bs, fh->checksum); aimbs_put32(bs, fh->rfrcsum); aimbs_put32(bs, fh->rfsize); aimbs_put32(bs, fh->cretime); aimbs_put32(bs, fh->rfcsum); aimbs_put32(bs, fh->nrecvd); aimbs_put32(bs, fh->recvcsum); aimbs_putraw(bs, fh->idstring, 32); aimbs_put8(bs, fh->flags); aimbs_put8(bs, fh->lnameoffset); aimbs_put8(bs, fh->lsizeoffset); aimbs_putraw(bs, fh->dummy, 69); aimbs_putraw(bs, fh->macfileinfo, 16); aimbs_put16(bs, fh->nencode); aimbs_put16(bs, fh->nlanguage); aimbs_putraw(bs, fh->name, 64); /* XXX - filenames longer than 64B */ return 0; } /** * Create an OFT packet based on the given information, and send it on its merry way. * * @param sess The session. * @param type The subtype of the OFT packet we're sending. * @param oft_info The aim_oft_info struct with the connection and OFT * info we're sending. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_oft_sendheader(aim_session_t *sess, fu16_t type, struct aim_oft_info *oft_info) { aim_frame_t *fr; if (!sess || !oft_info || !oft_info->conn || (oft_info->conn->type != AIM_CONN_TYPE_RENDEZVOUS)) return -EINVAL; #if 0 /* * If you are receiving a file, the cookie should be null, if you are sending a * file, the cookie should be the same as the one used in the ICBM negotiation * SNACs. */ fh->lnameoffset = 0x1a; fh->lsizeoffset = 0x10; /* These should be the same as charset and charsubset in ICBMs */ fh->nencode = 0x0000; fh->nlanguage = 0x0000; #endif aim_oft_dirconvert_tostupid(oft_info->fh.name); if (!(fr = aim_tx_new(sess, oft_info->conn, AIM_FRAMETYPE_OFT, type, 0))) return -ENOMEM; if (aim_oft_buildheader(&fr->data, &oft_info->fh) == -1) { aim_frame_destroy(fr); return -ENOMEM; } memcpy(fr->hdr.rend.magic, "OFT2", 4); fr->hdr.rend.hdrlen = aim_bstream_curpos(&fr->data) + 8; aim_tx_enqueue(sess, fr); return 0; } /** * Handle incoming data on a rendezvous connection. This is analogous to the * consumesnac function in rxhandlers.c, and I really think this should probably * be in rxhandlers.c as well, but I haven't finished cleaning everything up yet. * * @param sess The session. * @param fr The frame allocated for the incoming data. * @return Return 0 if the packet was handled correctly, otherwise return the * error number. */ faim_internal int aim_rxdispatch_rendezvous(aim_session_t *sess, aim_frame_t *fr) { aim_conn_t *conn = fr->conn; int ret = 1; if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) { if (fr->hdr.rend.type == 0x0001) ret = handlehdr_odc(sess, conn, fr, &fr->data); else faimdprintf(sess, 0, "faim: ODC directim frame unknown, type is %04x\n", fr->hdr.rend.type); } else { aim_rxcallback_t userfunc; struct aim_fileheader_t *header = aim_oft_getheader(&fr->data); aim_oft_dirconvert_fromstupid(header->name); /* XXX - This should be client-side */ if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_OFT, fr->hdr.rend.type))) ret = userfunc(sess, fr, conn, header->bcookie, header); free(header); } if (ret == -1) aim_conn_close(conn); return ret; } pork-0.99.8.1/src/protocols/aim/libfaim/im.c0000644000175000017500000020452410234217331020437 0ustar ryanryan00000000000000/* * Family 0x0004 - Routines for sending/receiving Instant Messages. * * Note the term ICBM (Inter-Client Basic Message) which blankets * all types of generically routed through-server messages. Within * the ICBM types (family 4), a channel is defined. Each channel * represents a different type of message. Channel 1 is used for * what would commonly be called an "instant message". Channel 2 * is used for negotiating "rendezvous". These transactions end in * something more complex happening, such as a chat invitation, or * a file transfer. Channel 3 is used for chat messages (not in * the same family as these channels). Channel 4 is used for * various ICQ messages. Examples are normal messages, URLs, and * old-style authorization. * * In addition to the channel, every ICBM contains a cookie. For * standard IMs, these are only used for error messages. However, * the more complex rendezvous messages make suitably more complex * use of this field. * * TODO: Split this up into an im.c file an an icbm.c file. It * will be beautiful, you'll see. * * Need to rename all the mpmsg messages to aim_im_bleh. * * Make sure aim_conn_findbygroup is used by all functions. */ #define FAIM_INTERNAL #include #ifdef _WIN32 #include "win32dep.h" #endif /** * Add a standard ICBM header to the given bstream with the given * information. * * @param bs The bstream to write the ICBM header to. * @param c c is for cookie, and cookie is for me. * @param ch The ICBM channel (1 through 4). * @param sn Null-terminated scrizeen nizame. * @return The number of bytes written. It's really not useful. */ static int aim_im_puticbm(aim_bstream_t *bs, const fu8_t *c, fu16_t ch, const char *sn) { aimbs_putraw(bs, c, 8); aimbs_put16(bs, ch); aimbs_put8(bs, strlen(sn)); aimbs_putraw(bs, sn, strlen(sn)); return 8+2+1+strlen(sn); } /* * Takes a msghdr (and a length) and returns a client type * code. Note that this is *only a guess* and has a low likelihood * of actually being accurate. * * Its based on experimental data, with the help of Eric Warmenhoven * who seems to have collected a wide variety of different AIM clients. * * * Heres the current collection: * 0501 0003 0101 0101 01 AOL Mobile Communicator, WinAIM 1.0.414 * 0501 0003 0101 0201 01 WinAIM 2.0.847, 2.1.1187, 3.0.1464, * 4.3.2229, 4.4.2286 * 0501 0004 0101 0102 0101 WinAIM 4.1.2010, libfaim (right here) * 0501 0003 0101 02 WinAIM 5 * 0501 0001 01 iChat x.x, mobile buddies * 0501 0001 0101 01 AOL v6.0, CompuServe 2000 v6.0, any TOC client * 0501 0002 0106 WinICQ 5.45.1.3777.85 * * Note that in this function, only the feature bytes are tested, since * the rest will always be the same. * */ faim_export fu16_t aim_im_fingerprint(const fu8_t *msghdr, int len) { static const struct { fu16_t clientid; int len; fu8_t data[10]; } fingerprints[] = { /* AOL Mobile Communicator, WinAIM 1.0.414 */ { AIM_CLIENTTYPE_MC, 3, {0x01, 0x01, 0x01}}, /* WinAIM 2.0.847, 2.1.1187, 3.0.1464, 4.3.2229, 4.4.2286 */ { AIM_CLIENTTYPE_WINAIM, 3, {0x01, 0x01, 0x02}}, /* WinAIM 4.1.2010, libfaim */ { AIM_CLIENTTYPE_WINAIM41, 4, {0x01, 0x01, 0x01, 0x02}}, /* AOL v6.0, CompuServe 2000 v6.0, any TOC client */ { AIM_CLIENTTYPE_AOL_TOC, 1, {0x01}}, { 0, 0} }; int i; if (!msghdr || (len <= 0)) return AIM_CLIENTTYPE_UNKNOWN; for (i = 0; fingerprints[i].len; i++) { if (fingerprints[i].len != len) continue; if (memcmp(fingerprints[i].data, msghdr, fingerprints[i].len) == 0) return fingerprints[i].clientid; } return AIM_CLIENTTYPE_UNKNOWN; } /** * Subtype 0x0002 - Set ICBM parameters. * * I definitely recommend sending this. If you don't, you'll be stuck * with the rather unreasonable defaults. * */ faim_export int aim_im_setparams(aim_session_t *sess, struct aim_icbmparameters *params) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; if (!params) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+16))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0002, 0x0000, snacid); /* This is read-only (see Parameter Reply). Must be set to zero here. */ aimbs_put16(&fr->data, 0x0000); /* These are all read-write */ aimbs_put32(&fr->data, params->flags); aimbs_put16(&fr->data, params->maxmsglen); aimbs_put16(&fr->data, params->maxsenderwarn); aimbs_put16(&fr->data, params->maxrecverwarn); aimbs_put32(&fr->data, params->minmsginterval); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0004 - Request ICBM parameter information. * */ faim_export int aim_im_reqparams(aim_session_t *sess) { aim_conn_t *conn; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; return aim_genericreq_n_snacid(sess, conn, 0x0004, 0x0004); } /** * Subtype 0x0005 - Receive parameter information. * */ static int aim_im_paraminfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; struct aim_icbmparameters params; params.maxchan = aimbs_get16(bs); params.flags = aimbs_get32(bs); params.maxmsglen = aimbs_get16(bs); params.maxsenderwarn = aimbs_get16(bs); params.maxrecverwarn = aimbs_get16(bs); params.minmsginterval = aimbs_get32(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) return userfunc(sess, rx, ¶ms); return 0; } /** * Subtype 0x0006 - Send an ICBM (instant message). * * * Possible flags: * AIM_IMFLAGS_AWAY -- Marks the message as an autoresponse * AIM_IMFLAGS_ACK -- Requests that the server send an ack * when the message is received (of type 0x0004/0x000c) * AIM_IMFLAGS_OFFLINE--If destination is offline, store it until they are * online (probably ICQ only). * * Generally, you should use the lowest encoding possible to send * your message. If you only use basic punctuation and the generic * Latin alphabet, use ASCII7 (no flags). If you happen to use non-ASCII7 * characters, but they are all clearly defined in ISO-8859-1, then * use that. Keep in mind that not all characters in the PC ASCII8 * character set are defined in the ISO standard. For those cases (most * notably when the (r) symbol is used), you must use the full UNICODE * encoding for your message. In UNICODE mode, _all_ characters must * occupy 16bits, including ones that are not special. (Remember that * the first 128 UNICODE symbols are equivalent to ASCII7, however they * must be prefixed with a zero high order byte.) * * I strongly discourage the use of UNICODE mode, mainly because none * of the clients I use can parse those messages (and besides that, * wchars are difficult and non-portable to handle in most UNIX environments). * If you really need to include special characters, use the HTML UNICODE * entities. These are of the form ߪ where 2026 is the hex * representation of the UNICODE index (in this case, UNICODE * "Horizontal Ellipsis", or 133 in in ASCII8). * * Implementation note: Since this is one of the most-used functions * in all of libfaim, it is written with performance in mind. As such, * it is not as clear as it could be in respect to how this message is * supposed to be layed out. Most obviously, tlvlists should be used * instead of writing out the bytes manually. * * XXX - more precise verification that we never send SNACs larger than 8192 * XXX - check SNAC size for multipart * */ faim_export int aim_im_sendch1_ext(aim_session_t *sess, struct aim_sendimext_args *args) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; fu8_t ck[8]; int i, msgtlvlen; static const fu8_t deffeatures[] = { 0x01, 0x01, 0x01, 0x02 }; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; if (!args) return -EINVAL; if (args->flags & AIM_IMFLAGS_MULTIPART) { if (args->mpmsg->numparts == 0) return -EINVAL; } else { if (!args->msg || (args->msglen <= 0)) return -EINVAL; if (args->msglen >= MAXMSGLEN) return -E2BIG; } /* Painfully calculate the size of the message TLV */ msgtlvlen = 1 + 1; /* 0501 */ if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) msgtlvlen += 2 + args->featureslen; else msgtlvlen += 2 + sizeof(deffeatures); if (args->flags & AIM_IMFLAGS_MULTIPART) { aim_mpmsg_section_t *sec; for (sec = args->mpmsg->parts; sec; sec = sec->next) { msgtlvlen += 2 /* 0101 */ + 2 /* block len */; msgtlvlen += 4 /* charset */ + sec->datalen; } } else { msgtlvlen += 2 /* 0101 */ + 2 /* block len */; msgtlvlen += 4 /* charset */ + args->msglen; } if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, msgtlvlen+128))) return -ENOMEM; /* XXX - should be optional */ snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, args->destsn, strlen(args->destsn)+1); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* * Generate a random message cookie * * We could cache these like we do SNAC IDs. (In fact, it * might be a good idea.) In the message error functions, * the 8byte message cookie is returned as well as the * SNAC ID. * */ for (i = 0; i < 8; i++) ck[i] = (fu8_t)rand(); /* ICBM header */ aim_im_puticbm(&fr->data, ck, 0x0001, args->destsn); /* Message TLV (type 0x0002) */ aimbs_put16(&fr->data, 0x0002); aimbs_put16(&fr->data, msgtlvlen); /* Features TLV (type 0x0501) */ aimbs_put16(&fr->data, 0x0501); if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) { aimbs_put16(&fr->data, args->featureslen); aimbs_putraw(&fr->data, args->features, args->featureslen); } else { aimbs_put16(&fr->data, sizeof(deffeatures)); aimbs_putraw(&fr->data, deffeatures, sizeof(deffeatures)); } if (args->flags & AIM_IMFLAGS_MULTIPART) { aim_mpmsg_section_t *sec; /* Insert each message part in a TLV (type 0x0101) */ for (sec = args->mpmsg->parts; sec; sec = sec->next) { aimbs_put16(&fr->data, 0x0101); aimbs_put16(&fr->data, sec->datalen + 4); aimbs_put16(&fr->data, sec->charset); aimbs_put16(&fr->data, sec->charsubset); aimbs_putraw(&fr->data, sec->data, sec->datalen); } } else { /* Insert message text in a TLV (type 0x0101) */ aimbs_put16(&fr->data, 0x0101); /* Message block length */ aimbs_put16(&fr->data, args->msglen + 0x04); /* Character set */ aimbs_put16(&fr->data, args->charset); aimbs_put16(&fr->data, args->charsubset); /* Message. Not terminated */ aimbs_putraw(&fr->data, args->msg, args->msglen); } /* Set the Autoresponse flag */ if (args->flags & AIM_IMFLAGS_AWAY) { aimbs_put16(&fr->data, 0x0004); aimbs_put16(&fr->data, 0x0000); } else if (args->flags & AIM_IMFLAGS_ACK) { /* Set the Request Acknowledge flag */ aimbs_put16(&fr->data, 0x0003); aimbs_put16(&fr->data, 0x0000); } if (args->flags & AIM_IMFLAGS_OFFLINE) { aimbs_put16(&fr->data, 0x0006); aimbs_put16(&fr->data, 0x0000); } /* * Set the I HAVE A REALLY PURTY ICON flag. * XXX - This should really only be sent on initial * IMs and when you change your icon. */ if (args->flags & AIM_IMFLAGS_HASICON) { aimbs_put16(&fr->data, 0x0008); aimbs_put16(&fr->data, 0x000c); aimbs_put32(&fr->data, args->iconlen); aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, args->iconsum); aimbs_put32(&fr->data, args->iconstamp); } /* * Set the Buddy Icon Requested flag. * XXX - Every time? Surely not... */ if (args->flags & AIM_IMFLAGS_BUDDYREQ) { aimbs_put16(&fr->data, 0x0009); aimbs_put16(&fr->data, 0x0000); } aim_tx_enqueue(sess, fr); /* clean out SNACs over 60sec old */ aim_cleansnacs(sess, 60); return 0; } /* * Simple wrapper for aim_im_sendch1_ext() * * You cannot use aim_send_im if you need the HASICON flag. You must * use aim_im_sendch1_ext directly for that. * * aim_send_im also cannot be used if you require UNICODE messages, because * that requires an explicit message length. Use aim_im_sendch1_ext(). * */ faim_export int aim_im_sendch1(aim_session_t *sess, const char *sn, fu16_t flags, const char *msg) { struct aim_sendimext_args args; args.destsn = sn; args.flags = flags; args.msg = msg; args.msglen = strlen(msg); args.charset = 0x0000; args.charsubset = 0x0000; /* Make these don't get set by accident -- they need aim_im_sendch1_ext */ args.flags &= ~(AIM_IMFLAGS_CUSTOMFEATURES | AIM_IMFLAGS_HASICON | AIM_IMFLAGS_MULTIPART); return aim_im_sendch1_ext(sess, &args); } /* * Subtype 0x0006 - Send a chat invitation. */ faim_export int aim_im_sendch2_chatinvite(aim_session_t *sess, const char *sn, const char *msg, fu16_t exchange, const char *roomname, fu16_t instance) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int i; aim_msgcookie_t *cookie; struct aim_invite_priv *priv; fu8_t ck[8]; aim_tlvlist_t *otl = NULL, *itl = NULL; fu8_t *hdr; int hdrlen; aim_bstream_t hdrbs; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; if (!sn || !msg || !roomname) return -EINVAL; for (i = 0; i < 8; i++) ck[i] = (fu8_t)rand(); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152+strlen(sn)+strlen(roomname)+strlen(msg)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, sn, strlen(sn)+1); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* XXX should be uncached by an unwritten 'invite accept' handler */ if ((priv = malloc(sizeof(struct aim_invite_priv)))) { priv->sn = strdup(sn); priv->roomname = strdup(roomname); priv->exchange = exchange; priv->instance = instance; } if ((cookie = aim_mkcookie(ck, AIM_COOKIETYPE_INVITE, priv))) aim_cachecookie(sess, cookie); else free(priv); /* ICBM Header */ aimbs_putraw(&fr->data, ck, 8); /* Cookie */ aimbs_put16(&fr->data, 0x0002); /* Channel */ aimbs_put8(&fr->data, strlen(sn)); /* Screename length */ aimbs_putraw(&fr->data, sn, strlen(sn)); /* Screenname */ /* * TLV t(0005) * * Everything else is inside this TLV. * * Sigh. AOL was rather inconsistent right here. So we have * to play some minor tricks. Right inside the type 5 is some * raw data, followed by a series of TLVs. * */ hdrlen = 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2; hdr = malloc(hdrlen); aim_bstream_init(&hdrbs, hdr, hdrlen); aimbs_put16(&hdrbs, 0x0000); /* Unknown! */ aimbs_putraw(&hdrbs, ck, sizeof(ck)); /* I think... */ aim_putcap(&hdrbs, AIM_CAPS_CHAT); aim_tlvlist_add_16(&itl, 0x000a, 0x0001); aim_tlvlist_add_noval(&itl, 0x000f); aim_tlvlist_add_raw(&itl, 0x000c, strlen(msg), msg); aim_tlvlist_add_chatroom(&itl, 0x2711, exchange, roomname, instance); aim_tlvlist_write(&hdrbs, &itl); aim_tlvlist_add_raw(&otl, 0x0005, aim_bstream_curpos(&hdrbs), hdr); aim_tlvlist_write(&fr->data, &otl); free(hdr); aim_tlvlist_free(&itl); aim_tlvlist_free(&otl); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0006 - Send your icon to a given user. * * This is also performance sensitive. (If you can believe it...) * */ faim_export int aim_im_sendch2_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; fu8_t ck[8]; int i; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; if (!sn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN)) return -EINVAL; for (i = 0; i < 8; i++) ck[i] = (fu8_t)rand(); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sn)+2+2+2+8+16+2+2+2+2+2+2+2+4+4+4+iconlen+strlen(AIM_ICONIDENT)+2+2))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* ICBM header */ aim_im_puticbm(&fr->data, ck, 0x0002, sn); /* * TLV t(0005) * * Encompasses everything below. */ aimbs_put16(&fr->data, 0x0005); aimbs_put16(&fr->data, 2+8+16+6+4+4+iconlen+4+4+4+strlen(AIM_ICONIDENT)); aimbs_put16(&fr->data, 0x0000); aimbs_putraw(&fr->data, ck, 8); aim_putcap(&fr->data, AIM_CAPS_BUDDYICON); /* TLV t(000a) */ aimbs_put16(&fr->data, 0x000a); aimbs_put16(&fr->data, 0x0002); aimbs_put16(&fr->data, 0x0001); /* TLV t(000f) */ aimbs_put16(&fr->data, 0x000f); aimbs_put16(&fr->data, 0x0000); /* TLV t(2711) */ aimbs_put16(&fr->data, 0x2711); aimbs_put16(&fr->data, 4+4+4+iconlen+strlen(AIM_ICONIDENT)); aimbs_put16(&fr->data, 0x0000); aimbs_put16(&fr->data, iconsum); aimbs_put32(&fr->data, iconlen); aimbs_put32(&fr->data, stamp); aimbs_putraw(&fr->data, icon, iconlen); aimbs_putraw(&fr->data, AIM_ICONIDENT, strlen(AIM_ICONIDENT)); /* TLV t(0003) */ aimbs_put16(&fr->data, 0x0003); aimbs_put16(&fr->data, 0x0000); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0006 - Send a rich text message. * * This only works for ICQ 2001b (thats 2001 not 2000). Better, only * send it to clients advertising the RTF capability. In fact, if you send * it to a client that doesn't support that capability, the server will gladly * bounce it back to you. * * You'd think this would be in icq.c, but, well, I'm trying to stick with * the one-group-per-file scheme as much as possible. This could easily * be an exception, since Rendezvous IMs are external of the Oscar core, * and therefore are undefined. Really I just need to think of a good way to * make an interface similar to what AOL actually uses. But I'm not using COM. * */ faim_export int aim_im_sendch2_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; fu8_t ck[8]; const char rtfcap[] = {"{97B12751-243C-4334-AD22-D6ABF73F1492}"}; /* AIM_CAPS_ICQRTF capability in string form */ int i, servdatalen; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; if (!args || !args->destsn || !args->rtfmsg) return -EINVAL; servdatalen = 2+2+16+2+4+1+2 + 2+2+4+4+4 + 2+4+2+strlen(args->rtfmsg)+1 + 4+4+4+strlen(rtfcap)+1; for (i = 0; i < 8; i++) ck[i] = (fu8_t)rand(); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+128+servdatalen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* ICBM header */ aim_im_puticbm(&fr->data, ck, 0x0002, args->destsn); /* TLV t(0005) - Encompasses everything below. */ aimbs_put16(&fr->data, 0x0005); aimbs_put16(&fr->data, 2+8+16 + 2+2+2 + 2+2 + 2+2+servdatalen); aimbs_put16(&fr->data, 0x0000); aimbs_putraw(&fr->data, ck, 8); aim_putcap(&fr->data, AIM_CAPS_ICQSERVERRELAY); /* t(000a) l(0002) v(0001) */ aimbs_put16(&fr->data, 0x000a); aimbs_put16(&fr->data, 0x0002); aimbs_put16(&fr->data, 0x0001); /* t(000f) l(0000) v() */ aimbs_put16(&fr->data, 0x000f); aimbs_put16(&fr->data, 0x0000); /* Service Data TLV */ aimbs_put16(&fr->data, 0x2711); aimbs_put16(&fr->data, servdatalen); aimbs_putle16(&fr->data, 11 + 16 /* 11 + (sizeof CLSID) */); aimbs_putle16(&fr->data, 9); aim_putcap(&fr->data, AIM_CAPS_EMPTY); aimbs_putle16(&fr->data, 0); aimbs_putle32(&fr->data, 0); aimbs_putle8(&fr->data, 0); aimbs_putle16(&fr->data, 0x03ea); /* trid1 */ aimbs_putle16(&fr->data, 14); aimbs_putle16(&fr->data, 0x03eb); /* trid2 */ aimbs_putle32(&fr->data, 0); aimbs_putle32(&fr->data, 0); aimbs_putle32(&fr->data, 0); aimbs_putle16(&fr->data, 0x0001); aimbs_putle32(&fr->data, 0); aimbs_putle16(&fr->data, strlen(args->rtfmsg)+1); aimbs_putraw(&fr->data, args->rtfmsg, strlen(args->rtfmsg)+1); aimbs_putle32(&fr->data, args->fgcolor); aimbs_putle32(&fr->data, args->bgcolor); aimbs_putle32(&fr->data, strlen(rtfcap)+1); aimbs_putraw(&fr->data, rtfcap, strlen(rtfcap)+1); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0006 - Send an "I want to directly connect to you" message * */ faim_export int aim_im_sendch2_odcrequest(aim_session_t *sess, fu8_t *cookie, fu8_t usecookie, const char *sn, const fu8_t *ip, fu16_t port) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; fu8_t ck[8]; aim_tlvlist_t *tl = NULL, *itl = NULL; int hdrlen, i; fu8_t *hdr; aim_bstream_t hdrbs; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 256+strlen(sn)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* * Generate a random message cookie * * This cookie needs to be alphanumeric and NULL-terminated to be * TOC-compatible. * * XXX - have I mentioned these should be generated in msgcookie.c? * */ if (cookie && usecookie) /* allow user-specified cookie */ memcpy(ck, cookie, 8); else for (i = 0; i < 7; i++) ck[i] = 0x30 + ((fu8_t) rand() % 10); ck[7] = '\0'; if (cookie && !usecookie) memcpy(cookie, ck, 8); /* ICBM header */ aim_im_puticbm(&fr->data, ck, 0x0002, sn); aim_tlvlist_add_noval(&tl, 0x0003); hdrlen = 2+8+16+6+8+6+4; hdr = malloc(hdrlen); aim_bstream_init(&hdrbs, hdr, hdrlen); aimbs_put16(&hdrbs, 0x0000); aimbs_putraw(&hdrbs, ck, 8); aim_putcap(&hdrbs, AIM_CAPS_DIRECTIM); aim_tlvlist_add_16(&itl, 0x000a, 0x0001); aim_tlvlist_add_raw(&itl, 0x0003, 4, ip); aim_tlvlist_add_16(&itl, 0x0005, port); aim_tlvlist_add_noval(&itl, 0x000f); aim_tlvlist_write(&hdrbs, &itl); aim_tlvlist_add_raw(&tl, 0x0005, aim_bstream_curpos(&hdrbs), hdr); aim_tlvlist_write(&fr->data, &tl); free(hdr); aim_tlvlist_free(&itl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0006 - Send an "I want to send you this file" message * */ faim_export int aim_im_sendch2_sendfile_ask(aim_session_t *sess, struct aim_oft_info *oft_info) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl=NULL, *subtl=NULL; int i; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)) || !oft_info) return -EINVAL; /* XXX - Should be like "21CBF95" and null terminated */ for (i = 0; i < 7; i++) oft_info->cookie[i] = 0x30 + ((fu8_t)rand() % 10); oft_info->cookie[7] = '\0'; { /* Create the subTLV chain */ fu8_t *buf; int buflen; aim_bstream_t bs; aim_tlvlist_add_16(&subtl, 0x000a, 0x0001); aim_tlvlist_add_noval(&subtl, 0x000f); /* aim_tlvlist_add_raw(&subtl, 0x000e, 2, "en"); aim_tlvlist_add_raw(&subtl, 0x000d, 8, "us-ascii"); aim_tlvlist_add_raw(&subtl, 0x000c, 24, "Please accept this file."); */ /* XXX - Change oft_info->clientip to an array of 4 bytes */ if (oft_info->clientip) { fu8_t ip[4]; char *nexttoken; int i = 0; nexttoken = strtok(oft_info->clientip, "."); while (nexttoken && i<4) { ip[i] = atoi(nexttoken); nexttoken = strtok(NULL, "."); i++; } aim_tlvlist_add_raw(&subtl, 0x0003, 4, ip); } aim_tlvlist_add_16(&subtl, 0x0005, oft_info->port); /* TLV t(2711) */ buflen = 2+2+4+strlen(oft_info->fh.name)+1; buf = malloc(buflen); aim_bstream_init(&bs, buf, buflen); aimbs_put16(&bs, (oft_info->fh.totfiles > 1) ? 0x0002 : 0x0001); aimbs_put16(&bs, oft_info->fh.totfiles); aimbs_put32(&bs, oft_info->fh.totsize); /* Filename - NULL terminated, for some odd reason */ aimbs_putraw(&bs, oft_info->fh.name, strlen(oft_info->fh.name)); aimbs_put8(&bs, 0x00); aim_tlvlist_add_raw(&subtl, 0x2711, bs.len, bs.data); free(buf); } { /* Create the main TLV chain */ fu8_t *buf; int buflen; aim_bstream_t bs; /* TLV t(0005) - Encompasses everything from above. Gee. */ buflen = 2+8+16+aim_tlvlist_size(&subtl); buf = malloc(buflen); aim_bstream_init(&bs, buf, buflen); aimbs_put16(&bs, AIM_RENDEZVOUS_PROPOSE); aimbs_putraw(&bs, oft_info->cookie, 8); aim_putcap(&bs, AIM_CAPS_SENDFILE); aim_tlvlist_write(&bs, &subtl); aim_tlvlist_free(&subtl); aim_tlvlist_add_raw(&tl, 0x0005, bs.len, bs.data); free(buf); /* TLV t(0003) - Request an ack */ aim_tlvlist_add_noval(&tl, 0x0003); } if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 11+strlen(oft_info->sn) + aim_tlvlist_size(&tl)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, AIM_SNACFLAGS_DESTRUCTOR, oft_info->cookie, sizeof(oft_info->cookie)); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* ICBM header */ aim_im_puticbm(&fr->data, oft_info->cookie, 0x0002, oft_info->sn); /* All that crap from above (the 0x0005 TLV and the 0x0003 TLV) */ aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0006 - Send an "I will accept this file" message? * * @param rendid Capability type (AIM_CAPS_GETFILE or AIM_CAPS_SENDFILE) */ faim_export int aim_im_sendch2_sendfile_accept(aim_session_t *sess, struct aim_oft_info *oft_info) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)) || !oft_info) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 11+strlen(oft_info->sn) + 4+2+8+16))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* ICBM header */ aim_im_puticbm(&fr->data, oft_info->cookie, 0x0002, oft_info->sn); aimbs_put16(&fr->data, 0x0005); aimbs_put16(&fr->data, 0x001a); aimbs_put16(&fr->data, AIM_RENDEZVOUS_ACCEPT); aimbs_putraw(&fr->data, oft_info->cookie, 8); aim_putcap(&fr->data, AIM_CAPS_SENDFILE); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0006 - Send a "cancel this file transfer" message? * */ faim_export int aim_im_sendch2_sendfile_cancel(aim_session_t *sess, struct aim_oft_info *oft_info) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)) || !oft_info) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 11+strlen(oft_info->sn) + 4+2+8+16))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* ICBM header */ aim_im_puticbm(&fr->data, oft_info->cookie, 0x0002, oft_info->sn); aimbs_put16(&fr->data, 0x0005); aimbs_put16(&fr->data, 0x001a); aimbs_put16(&fr->data, AIM_RENDEZVOUS_CANCEL); aimbs_putraw(&fr->data, oft_info->cookie, 8); aim_putcap(&fr->data, AIM_CAPS_SENDFILE); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0006 - Request the status message of the given ICQ user. * * @param sess The oscar session. * @param sn The UIN of the user of whom you wish to request info. * @param type The type of info you wish to request. This should be the current * state of the user, as one of the AIM_ICQ_STATE_* defines. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_im_sendch2_geticqaway(aim_session_t *sess, const char *sn, int type) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int i; fu8_t ck[8]; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)) || !sn) return -EINVAL; for (i = 0; i < 8; i++) ck[i] = (fu8_t)rand(); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sn) + 4+0x5e + 4))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* ICBM header */ aim_im_puticbm(&fr->data, ck, 0x0002, sn); /* TLV t(0005) - Encompasses almost everything below. */ aimbs_put16(&fr->data, 0x0005); /* T */ aimbs_put16(&fr->data, 0x005e); /* L */ { /* V */ aimbs_put16(&fr->data, 0x0000); /* Cookie */ aimbs_putraw(&fr->data, ck, 8); /* Put the 16 byte server relay capability */ aim_putcap(&fr->data, AIM_CAPS_ICQSERVERRELAY); /* TLV t(000a) */ aimbs_put16(&fr->data, 0x000a); aimbs_put16(&fr->data, 0x0002); aimbs_put16(&fr->data, 0x0001); /* TLV t(000f) */ aimbs_put16(&fr->data, 0x000f); aimbs_put16(&fr->data, 0x0000); /* TLV t(2711) */ aimbs_put16(&fr->data, 0x2711); aimbs_put16(&fr->data, 0x0036); { /* V */ aimbs_putle16(&fr->data, 0x001b); /* L */ aimbs_putle16(&fr->data, 0x0008); /* XXX - Protocol version */ aim_putcap(&fr->data, AIM_CAPS_EMPTY); aimbs_putle16(&fr->data, 0x0000); /* Unknown */ aimbs_putle16(&fr->data, 0x0003); /* Client features? */ aimbs_putle16(&fr->data, 0x0000); /* Unknown */ aimbs_putle8(&fr->data, 0x00); /* Unkizown */ aimbs_putle16(&fr->data, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ aimbs_putle16(&fr->data, 0x000e); /* L */ aimbs_putle16(&fr->data, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ aimbs_putle32(&fr->data, 0x00000000); /* Unknown */ /* The type of status message being requested */ if (type & AIM_ICQ_STATE_CHAT) aimbs_putle16(&fr->data, 0x03ec); else if(type & AIM_ICQ_STATE_DND) aimbs_putle16(&fr->data, 0x03eb); else if(type & AIM_ICQ_STATE_OUT) aimbs_putle16(&fr->data, 0x03ea); else if(type & AIM_ICQ_STATE_BUSY) aimbs_putle16(&fr->data, 0x03e9); else if(type & AIM_ICQ_STATE_AWAY) aimbs_putle16(&fr->data, 0x03e8); aimbs_putle16(&fr->data, 0x0000); /* Status? */ aimbs_putle16(&fr->data, 0x0001); /* Priority of this message? */ aimbs_putle16(&fr->data, 0x0001); /* L */ aimbs_putle8(&fr->data, 0x00); /* String of length L */ } /* End TLV t(2711) */ } /* End TLV t(0005) */ /* TLV t(0003) */ aimbs_put16(&fr->data, 0x0003); aimbs_put16(&fr->data, 0x0000); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0006 - Send an ICQ-esque ICBM. * * This can be used to send an ICQ authorization reply (deny or grant). It is the "old way." * The new way is to use SSI. I like the new way a lot better. This seems like such a hack, * mostly because it's in network byte order. Figuring this stuff out sometimes takes a while, * but thats ok, because it gives me time to try to figure out what kind of drugs the AOL people * were taking when they merged the two protocols. * * @param sn The destination screen name. * @param type The type of message. 0x0007 for authorization denied. 0x0008 for authorization granted. * @param message The message you want to send, it should be null terminated. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_im_sendch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int i; char ck[8]; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0002))) return -EINVAL; if (!sn || !type || !message) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+3+strlen(sn)+12+strlen(message)+1+4))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid); /* Cookie */ for (i=0; i<8; i++) ck[i] = (fu8_t)rand(); /* ICBM header */ aim_im_puticbm(&fr->data, ck, 0x0004, sn); /* * TLV t(0005) * * ICQ data (the UIN and the message). */ aimbs_put16(&fr->data, 0x0005); aimbs_put16(&fr->data, 4 + 2+2+strlen(message)+1); /* * Your UIN */ aimbs_putle32(&fr->data, atoi(sess->sn)); /* * TLV t(type) l(strlen(message)+1) v(message+NULL) */ aimbs_putle16(&fr->data, type); aimbs_putle16(&fr->data, strlen(message)+1); aimbs_putraw(&fr->data, message, strlen(message)+1); /* * TLV t(0006) l(0000) v() */ aimbs_put16(&fr->data, 0x0006); aimbs_put16(&fr->data, 0x0000); aim_tx_enqueue(sess, fr); return 0; } /* * XXX - I don't see when this would ever get called... */ static int outgoingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int i, ret = 0; aim_rxcallback_t userfunc; fu8_t cookie[8]; fu16_t channel; aim_tlvlist_t *tlvlist; char *sn; int snlen; fu16_t icbmflags = 0; fu8_t flag1 = 0, flag2 = 0; fu8_t *msg = NULL; aim_tlv_t *msgblock; /* ICBM Cookie. */ for (i = 0; i < 8; i++) cookie[i] = aimbs_get8(bs); /* Channel ID */ channel = aimbs_get16(bs); if (channel != 0x01) { faimdprintf(sess, 0, "icbm: ICBM recieved on unsupported channel. Ignoring. (chan = %04x)\n", channel); return 0; } snlen = aimbs_get8(bs); sn = aimbs_getstr(bs, snlen); tlvlist = aim_tlvlist_read(bs); if (aim_tlv_gettlv(tlvlist, 0x0003, 1)) icbmflags |= AIM_IMFLAGS_ACK; if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) icbmflags |= AIM_IMFLAGS_AWAY; if ((msgblock = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { aim_bstream_t mbs; int featurelen, msglen; aim_bstream_init(&mbs, msgblock->value, msgblock->length); aimbs_get8(&mbs); aimbs_get8(&mbs); for (featurelen = aimbs_get16(&mbs); featurelen; featurelen--) aimbs_get8(&mbs); aimbs_get8(&mbs); aimbs_get8(&mbs); msglen = aimbs_get16(&mbs) - 4; /* final block length */ flag1 = aimbs_get16(&mbs); flag2 = aimbs_get16(&mbs); msg = aimbs_getstr(&mbs, msglen); } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, channel, sn, msg, icbmflags, flag1, flag2); free(sn); aim_tlvlist_free(&tlvlist); return ret; } /* * Ahh, the joys of nearly ridiculous over-engineering. * * Not only do AIM ICBM's support multiple channels. Not only do they * support multiple character sets. But they support multiple character * sets / encodings within the same ICBM. * * These multipart messages allow for complex space savings techniques, which * seem utterly unnecessary by today's standards. In fact, there is only * one client still in popular use that still uses this method: AOL for the * Macintosh, Version 5.0. Obscure, yes, I know. * * In modern (non-"legacy") clients, if the user tries to send a character * that is not ISO-8859-1 or ASCII, the client will send the entire message * as UNICODE, meaning that every character in the message will occupy the * full 16 bit UNICODE field, even if the high order byte would be zero. * Multipart messages prevent this wasted space by allowing the client to * only send the characters in UNICODE that need to be sent that way, and * the rest of the message can be sent in whatever the native character * set is (probably ASCII). * * An important note is that sections will be displayed in the order that * they appear in the ICBM. There is no facility for merging or rearranging * sections at run time. So if you have, say, ASCII then UNICODE then ASCII, * you must supply two ASCII sections with a UNICODE in the middle, and incur * the associated overhead. * * Normally I would have laughed and given a firm 'no' to supporting this * seldom-used feature, but something is attracting me to it. In the future, * it may be possible to abuse this to send mixed-media messages to other * open source clients (like encryption or something) -- see faimtest for * examples of how to do this. * * I would definitely recommend avoiding this feature unless you really * know what you are doing, and/or you have something neat to do with it. * */ faim_export int aim_mpmsg_init(aim_session_t *sess, aim_mpmsg_t *mpm) { memset(mpm, 0, sizeof(aim_mpmsg_t)); return 0; } static int mpmsg_addsection(aim_session_t *sess, aim_mpmsg_t *mpm, fu16_t charset, fu16_t charsubset, fu8_t *data, fu16_t datalen) { aim_mpmsg_section_t *sec; if (!(sec = malloc(sizeof(aim_mpmsg_section_t)))) return -1; sec->charset = charset; sec->charsubset = charsubset; sec->data = data; sec->datalen = datalen; sec->next = NULL; if (!mpm->parts) mpm->parts = sec; else { aim_mpmsg_section_t *cur; for (cur = mpm->parts; cur->next; cur = cur->next) ; cur->next = sec; } mpm->numparts++; return 0; } faim_export int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, fu16_t charset, fu16_t charsubset, const fu8_t *data, fu16_t datalen) { fu8_t *dup; if (!(dup = malloc(datalen))) return -1; memcpy(dup, data, datalen); if (mpmsg_addsection(sess, mpm, charset, charsubset, dup, datalen) == -1) { free(dup); return -1; } return 0; } /* XXX - should provide a way of saying ISO-8859-1 specifically */ faim_export int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii) { fu8_t *dup; if (!(dup = strdup(ascii))) return -1; if (mpmsg_addsection(sess, mpm, 0x0000, 0x0000, dup, strlen(ascii)) == -1) { free(dup); return -1; } return 0; } faim_export int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const fu16_t *unicode, fu16_t unicodelen) { fu8_t *buf; aim_bstream_t bs; int i; if (!(buf = malloc(unicodelen * 2))) return -1; aim_bstream_init(&bs, buf, unicodelen * 2); /* We assume unicode is in /host/ byte order -- convert to network */ for (i = 0; i < unicodelen; i++) aimbs_put16(&bs, unicode[i]); if (mpmsg_addsection(sess, mpm, 0x0002, 0x0000, buf, aim_bstream_curpos(&bs)) == -1) { free(buf); return -1; } return 0; } faim_export void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm) { aim_mpmsg_section_t *cur; for (cur = mpm->parts; cur; ) { aim_mpmsg_section_t *tmp; tmp = cur->next; free(cur->data); free(cur); cur = tmp; } mpm->numparts = 0; mpm->parts = NULL; return; } /* * Start by building the multipart structures, then pick the first * human-readable section and stuff it into args->msg so no one gets * suspicious. * */ static int incomingim_ch1_parsemsgs(aim_session_t *sess, aim_userinfo_t *userinfo, fu8_t *data, int len, struct aim_incomingim_ch1_args *args) { /* Should this be ASCII -> UNICODE -> Custom */ static const fu16_t charsetpri[] = { AIM_CHARSET_ASCII, /* ASCII first */ AIM_CHARSET_CUSTOM, /* then ISO-8859-1 */ AIM_CHARSET_UNICODE, /* UNICODE as last resort */ }; static const int charsetpricount = 3; int i; aim_bstream_t mbs; aim_mpmsg_section_t *sec; aim_bstream_init(&mbs, data, len); while (aim_bstream_empty(&mbs)) { fu16_t msglen, flag1, flag2; fu8_t *msgbuf; aimbs_get8(&mbs); /* 01 */ aimbs_get8(&mbs); /* 01 */ /* Message string length, including character set info. */ msglen = aimbs_get16(&mbs); if (msglen > aim_bstream_empty(&mbs)) { faimdprintf(sess, 0, "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.", userinfo->sn); break; } /* Character set info */ flag1 = aimbs_get16(&mbs); flag2 = aimbs_get16(&mbs); /* Message. */ msglen -= 4; /* * For now, we don't care what the encoding is. Just copy * it into a multipart struct and deal with it later. However, * always pad the ending with a NULL. This makes it easier * to treat ASCII sections as strings. It won't matter for * UNICODE or binary data, as you should never read past * the specified data length, which will not include the pad. * * XXX - There's an API bug here. For sending, the UNICODE is * given in host byte order (aim_mpmsg_addunicode), but here * the received messages are given in network byte order. * */ msgbuf = aimbs_getstr(&mbs, msglen); mpmsg_addsection(sess, &args->mpmsg, flag1, flag2, msgbuf, msglen); } /* while */ args->icbmflags |= AIM_IMFLAGS_MULTIPART; /* always set */ /* * Clients that support multiparts should never use args->msg, as it * will point to an arbitrary section. * * Here, we attempt to provide clients that do not support multipart * messages with something to look at -- hopefully a human-readable * string. But, failing that, a UNICODE message, or nothing at all. * * Which means that even if args->msg is NULL, it does not mean the * message was blank. * */ for (i = 0; i < charsetpricount; i++) { for (sec = args->mpmsg.parts; sec; sec = sec->next) { if (sec->charset != charsetpri[i]) continue; /* Great. We found one. Fill it in. */ args->charset = sec->charset; args->charsubset = sec->charsubset; /* Set up the simple flags */ if (args->charsubset == 0x0000) ; /* standard subencoding? */ else if (args->charsubset == 0x000b) args->icbmflags |= AIM_IMFLAGS_SUBENC_MACINTOSH; else if (args->charsubset == 0xffff) ; /* no subencoding */ args->msg = sec->data; args->msglen = sec->datalen; return 0; } } /* No human-readable sections found. Oh well. */ args->charset = args->charsubset = 0xffff; args->msg = NULL; args->msglen = 0; return 0; } static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, fu16_t channel, aim_userinfo_t *userinfo, aim_bstream_t *bs, fu8_t *cookie) { fu16_t type, length; aim_rxcallback_t userfunc; int ret = 0; struct aim_incomingim_ch1_args args; unsigned int endpos; memset(&args, 0, sizeof(args)); aim_mpmsg_init(sess, &args.mpmsg); /* * This used to be done using tlvchains. For performance reasons, * I've changed it to process the TLVs in-place. This avoids lots * of per-IM memory allocations. */ while (aim_bstream_empty(bs)) { type = aimbs_get16(bs); length = aimbs_get16(bs); if (length > aim_bstream_empty(bs)) { faimdprintf(sess, 0, "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); break; } endpos = aim_bstream_curpos(bs) + length; if (type == 0x0002) { /* Message Block */ /* * This TLV consists of the following: * - 0501 -- Unknown * - Features: Don't know how to interpret these * - 0101 -- Unknown * - Message * */ aimbs_get8(bs); /* 05 */ aimbs_get8(bs); /* 01 */ args.featureslen = aimbs_get16(bs); if (args.featureslen > aim_bstream_empty(bs)) { faimdprintf(sess, 0, "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); break; } if (args.featureslen == 0) { args.features = NULL; } else { args.features = aimbs_getraw(bs, args.featureslen); args.icbmflags |= AIM_IMFLAGS_CUSTOMFEATURES; } /* * The rest of the TLV contains one or more message * blocks... */ incomingim_ch1_parsemsgs(sess, userinfo, bs->data + bs->offset /* XXX evil!!! */, length - 2 - 2 - args.featureslen, &args); } else if (type == 0x0003) { /* Server Ack Requested */ args.icbmflags |= AIM_IMFLAGS_ACK; } else if (type == 0x0004) { /* Message is Auto Response */ args.icbmflags |= AIM_IMFLAGS_AWAY; } else if (type == 0x0006) { /* Message was received offline. */ /* XXX - not sure if this actually gets sent. */ args.icbmflags |= AIM_IMFLAGS_OFFLINE; } else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */ args.iconlen = aimbs_get32(bs); aimbs_get16(bs); /* 0x0001 */ args.iconsum = aimbs_get16(bs); args.iconstamp = aimbs_get32(bs); /* * This looks to be a client bug. MacAIM 4.3 will * send this tag, but with all zero values, in the * first message of a conversation. This makes no * sense whatsoever, so I'm going to say its a bug. * * You really shouldn't advertise a zero-length icon * anyway. * */ if (args.iconlen) args.icbmflags |= AIM_IMFLAGS_HASICON; } else if (type == 0x0009) { args.icbmflags |= AIM_IMFLAGS_BUDDYREQ; } else if (type == 0x000b) { /* Non-direct connect typing notification */ args.icbmflags |= AIM_IMFLAGS_TYPINGNOT; } else if (type == 0x0017) { free(args.extdata); args.extdatalen = length; if (args.extdatalen > aim_bstream_empty(bs)) { faimdprintf(sess, 0, "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->sn); break; } if (args.extdatalen == 0) args.extdata = NULL; else args.extdata = aimbs_getraw(bs, args.extdatalen); } else { faimdprintf(sess, 0, "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length); } /* * This is here to protect ourselves from ourselves. That * is, if something above doesn't completely parse its value * section, or, worse, overparses it, this will set the * stream where it needs to be in order to land on the next * TLV when the loop continues. * */ aim_bstream_setpos(bs, endpos); } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, channel, userinfo, &args); aim_mpmsg_free(sess, &args.mpmsg); free(args.features); free(args.extdata); return ret; } static void incomingim_ch2_buddylist(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) { /* * This goes like this... * * group name length * group name * num of buddies in group * buddy name length * buddy name * buddy name length * buddy name * ... * group name length * group name * num of buddies in group * buddy name length * buddy name * ... * ... */ while (servdata && aim_bstream_empty(servdata)) { fu16_t gnlen, numb; int i; char *gn; gnlen = aimbs_get16(servdata); gn = aimbs_getstr(servdata, gnlen); numb = aimbs_get16(servdata); for (i = 0; i < numb; i++) { fu16_t bnlen; char *bn; bnlen = aimbs_get16(servdata); bn = aimbs_getstr(servdata, bnlen); faimdprintf(sess, 0, "got a buddy list from %s: group %s, buddy %s\n", userinfo->sn, gn, bn); free(bn); } free(gn); } return; } static void incomingim_ch2_buddyicon_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args) { free(args->info.icon.icon); return; } static void incomingim_ch2_buddyicon(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) { if (servdata) { args->info.icon.checksum = aimbs_get32(servdata); args->info.icon.length = aimbs_get32(servdata); args->info.icon.timestamp = aimbs_get32(servdata); args->info.icon.icon = aimbs_getraw(servdata, args->info.icon.length); } args->destructor = (void *)incomingim_ch2_buddyicon_free; return; } static void incomingim_ch2_chat_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args) { /* XXX - aim_chat_roominfo_free() */ free(args->info.chat.roominfo.name); return; } static void incomingim_ch2_chat(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) { /* * Chat room info. */ if (servdata) aim_chat_readroominfo(servdata, &args->info.chat.roominfo); args->destructor = (void *)incomingim_ch2_chat_free; return; } static void incomingim_ch2_icqserverrelay_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args) { free((char *)args->info.rtfmsg.rtfmsg); return; } /* * The relationship between AIM_CAPS_ICQSERVERRELAY and AIM_CAPS_ICQRTF is * kind of odd. This sends the client ICQRTF since that is all that I've seen * SERVERRELAY used for. * * Note that this is all little-endian. Cringe. * */ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) { fu16_t hdrlen, anslen, msglen; hdrlen = aimbs_getle16(servdata); aim_bstream_advance(servdata, hdrlen); hdrlen = aimbs_getle16(servdata); aim_bstream_advance(servdata, hdrlen); args->info.rtfmsg.msgtype = aimbs_getle16(servdata); anslen = aimbs_getle32(servdata); aim_bstream_advance(servdata, anslen); msglen = aimbs_getle16(servdata); args->info.rtfmsg.rtfmsg = aimbs_getstr(servdata, msglen); args->info.rtfmsg.fgcolor = aimbs_getle32(servdata); args->info.rtfmsg.bgcolor = aimbs_getle32(servdata); hdrlen = aimbs_getle32(servdata); aim_bstream_advance(servdata, hdrlen); args->destructor = (void *)incomingim_ch2_icqserverrelay_free; return; } static void incomingim_ch2_sendfile_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args) { free(args->info.sendfile.filename); } static void incomingim_ch2_sendfile(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata) { args->destructor = (void *)incomingim_ch2_sendfile_free; /* Maybe there is a better way to tell what kind of sendfile * this is? Maybe TLV t(000a)? */ if (servdata) { /* Someone is sending us a file */ int flen; /* subtype is one of AIM_OFT_SUBTYPE_* */ args->info.sendfile.subtype = aimbs_get16(servdata); args->info.sendfile.totfiles = aimbs_get16(servdata); args->info.sendfile.totsize = aimbs_get32(servdata); /* * I hope to God I'm right when I guess that there is a * 32 char max filename length for single files. I think * OFT tends to do that. Gotta love inconsistency. I saw * a 26 byte filename? */ /* AAA - create an aimbs_getnullstr function (don't anymore)(maybe) */ /* Use an inelegant way of getting the null-terminated filename, * since there's no easy bstream routine. */ for (flen = 0; aimbs_get8(servdata); flen++); aim_bstream_advance(servdata, -flen -1); args->info.sendfile.filename = aimbs_getstr(servdata, flen); /* There is sometimes more after the null-terminated filename, * but I'm unsure of its format. */ /* I don't believe him. */ } return; } typedef void (*ch2_args_destructor_t)(aim_session_t *sess, struct aim_incomingim_ch2_args *args); static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, fu16_t channel, aim_userinfo_t *userinfo, aim_tlvlist_t *tlvlist, fu8_t *cookie) { aim_rxcallback_t userfunc; aim_tlv_t *block1, *servdatatlv; aim_tlvlist_t *list2; struct aim_incomingim_ch2_args args; aim_bstream_t bbs, sdbs, *sdbsptr = NULL; fu8_t *cookie2; int ret = 0; char proxyip[30] = {""}; char clientip[30] = {""}; char verifiedip[30] = {""}; memset(&args, 0, sizeof(args)); /* * There's another block of TLVs embedded in the type 5 here. */ block1 = aim_tlv_gettlv(tlvlist, 0x0005, 1); aim_bstream_init(&bbs, block1->value, block1->length); /* * First two bytes represent the status of the connection. * * 0 is a request, 1 is a cancel, 2 is an accept */ args.status = aimbs_get16(&bbs); /* * Next comes the cookie. Should match the ICBM cookie. */ cookie2 = aimbs_getraw(&bbs, 8); if (memcmp(cookie, cookie2, 8) != 0) faimdprintf(sess, 0, "rend: warning cookies don't match!\n"); memcpy(args.cookie, cookie2, 8); free(cookie2); /* * The next 16bytes are a capability block so we can * identify what type of rendezvous this is. */ args.reqclass = aim_locate_getcaps(sess, &bbs, 0x10); /* * What follows may be TLVs or nothing, depending on the * purpose of the message. * * Ack packets for instance have nothing more to them. */ list2 = aim_tlvlist_read(&bbs); /* * IP address to proxy the file transfer through. * * XXX - I don't like this. Maybe just read in an int? Or inet_ntoa... */ if (aim_tlv_gettlv(list2, 0x0002, 1)) { aim_tlv_t *iptlv; iptlv = aim_tlv_gettlv(list2, 0x0002, 1); if (iptlv->length == 4) snprintf(proxyip, sizeof(proxyip), "%hhu.%hhu.%hhu.%hhu", iptlv->value[0], iptlv->value[1], iptlv->value[2], iptlv->value[3]); } /* * IP address from the perspective of the client. */ if (aim_tlv_gettlv(list2, 0x0003, 1)) { aim_tlv_t *iptlv; iptlv = aim_tlv_gettlv(list2, 0x0003, 1); if (iptlv->length == 4) snprintf(clientip, sizeof(clientip), "%hhu.%hhu.%hhu.%hhu", iptlv->value[0], iptlv->value[1], iptlv->value[2], iptlv->value[3]); } /* * Verified IP address (from the perspective of Oscar). * * This is added by the server. */ if (aim_tlv_gettlv(list2, 0x0004, 1)) { aim_tlv_t *iptlv; iptlv = aim_tlv_gettlv(list2, 0x0004, 1); if (iptlv->length == 4) snprintf(verifiedip, sizeof(verifiedip), "%hhu.%hhu.%hhu.%hhu", iptlv->value[0], iptlv->value[1], iptlv->value[2], iptlv->value[3]); } /* * Port number for something. */ if (aim_tlv_gettlv(list2, 0x0005, 1)) args.port = aim_tlv_get16(list2, 0x0005, 1); /* * Something to do with ft? -- two bytes * 0x0001 - "I want to send you this file" * 0x0002 - "I will accept this file from you" * 0x0002 - Also used in ICQ Lite Beta 4.0 URLs */ if (aim_tlv_gettlv(list2, 0x000a, 1)) ; /* * Error code. */ if (aim_tlv_gettlv(list2, 0x000b, 1)) args.errorcode = aim_tlv_get16(list2, 0x000b, 1); /* * Invitation message / chat description. */ if (aim_tlv_gettlv(list2, 0x000c, 1)) { args.msg = aim_tlv_getstr(list2, 0x000c, 1); args.msglen = aim_tlv_getlength(list2, 0x000c, 1); } /* * Character set. */ if (aim_tlv_gettlv(list2, 0x000d, 1)) args.encoding = aim_tlv_getstr(list2, 0x000d, 1); /* * Language. */ if (aim_tlv_gettlv(list2, 0x000e, 1)) args.language = aim_tlv_getstr(list2, 0x000e, 1); /* * Unknown -- no value * * Maybe means we should connect directly to transfer the file? * Also used in ICQ Lite Beta 4.0 URLs. Also empty. */ if (aim_tlv_gettlv(list2, 0x000f, 1)) ; /* * Unknown -- no value * * Maybe means we should proxy the file transfer through an AIM server? */ if (aim_tlv_gettlv(list2, 0x0010, 1)) ; if (strlen(proxyip)) args.proxyip = (char *)proxyip; if (strlen(clientip)) args.clientip = (char *)clientip; if (strlen(verifiedip)) args.verifiedip = (char *)verifiedip; /* * This must be present in PROPOSALs, but will probably not * exist in CANCELs and ACCEPTs. Also exists in ICQ Lite * Beta 4.0 URLs (AIM_CAPS_ICQSERVERRELAY). * * Service Data blocks are module-specific in format. */ if ((servdatatlv = aim_tlv_gettlv(list2, 0x2711 /* 10001 */, 1))) { aim_bstream_init(&sdbs, servdatatlv->value, servdatatlv->length); sdbsptr = &sdbs; } /* * The rest of the handling depends on what type it is. * * Not all of them have special handling (yet). */ if (args.reqclass & AIM_CAPS_BUDDYICON) incomingim_ch2_buddyicon(sess, mod, rx, snac, userinfo, &args, sdbsptr); else if (args.reqclass & AIM_CAPS_SENDBUDDYLIST) incomingim_ch2_buddylist(sess, mod, rx, snac, userinfo, &args, sdbsptr); else if (args.reqclass & AIM_CAPS_CHAT) incomingim_ch2_chat(sess, mod, rx, snac, userinfo, &args, sdbsptr); else if (args.reqclass & AIM_CAPS_ICQSERVERRELAY) incomingim_ch2_icqserverrelay(sess, mod, rx, snac, userinfo, &args, sdbsptr); else if (args.reqclass & AIM_CAPS_SENDFILE) incomingim_ch2_sendfile(sess, mod, rx, snac, userinfo, &args, sdbsptr); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, channel, userinfo, &args); if (args.destructor) ((ch2_args_destructor_t)args.destructor)(sess, &args); free((char *)args.msg); free((char *)args.encoding); free((char *)args.language); aim_tlvlist_free(&list2); return ret; } static int incomingim_ch4(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, fu16_t channel, aim_userinfo_t *userinfo, aim_tlvlist_t *tlvlist, fu8_t *cookie) { aim_bstream_t meat; aim_rxcallback_t userfunc; aim_tlv_t *block; struct aim_incomingim_ch4_args args; int ret = 0; /* * Make a bstream for the meaty part. Yum. Meat. */ if (!(block = aim_tlv_gettlv(tlvlist, 0x0005, 1))) return -1; aim_bstream_init(&meat, block->value, block->length); args.uin = aimbs_getle32(&meat); args.type = aimbs_getle8(&meat); args.flags = aimbs_getle8(&meat); args.msglen = aimbs_getle16(&meat); args.msg = aimbs_getraw(&meat, args.msglen); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, channel, userinfo, &args); free(args.msg); return ret; } /* * Subtype 0x0007 * * It can easily be said that parsing ICBMs is THE single * most difficult thing to do in the in AIM protocol. In * fact, I think I just did say that. * * Below is the best damned solution I've come up with * over the past sixteen months of battling with it. This * can parse both away and normal messages from every client * I have access to. Its not fast, its not clean. But it works. * */ static int incomingim(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int i, ret = 0; fu8_t cookie[8]; fu16_t channel; aim_userinfo_t userinfo; memset(&userinfo, 0x00, sizeof(aim_userinfo_t)); /* * Read ICBM Cookie. */ for (i = 0; i < 8; i++) cookie[i] = aimbs_get8(bs); /* * Channel ID. * * Channel 0x0001 is the message channel. It is * used to send basic ICBMs. * * Channel 0x0002 is the Rendezvous channel, which * is where Chat Invitiations and various client-client * connection negotiations come from. * * Channel 0x0003 is used for chat messages. * * Channel 0x0004 is used for ICQ authorization, or * possibly any system notice. * */ channel = aimbs_get16(bs); /* * Extract the standard user info block. * * Note that although this contains TLVs that appear contiguous * with the TLVs read below, they are two different pieces. The * userinfo block contains the number of TLVs that contain user * information, the rest are not even though there is no separation. * You can start reading the message TLVs after aim_info_extract() * parses out the standard userinfo block. * * That also means that TLV types can be duplicated between the * userinfo block and the rest of the message, however there should * never be two TLVs of the same type in one block. * */ aim_info_extract(sess, bs, &userinfo); /* * From here on, its depends on what channel we're on. * * Technically all channels have a TLV list have this, however, * for the common channel 1 case, in-place parsing is used for * performance reasons (less memory allocation). */ if (channel == 1) { ret = incomingim_ch1(sess, mod, rx, snac, channel, &userinfo, bs, cookie); } else if (channel == 2) { aim_tlvlist_t *tlvlist; /* * Read block of TLVs (not including the userinfo data). All * further data is derived from what is parsed here. */ tlvlist = aim_tlvlist_read(bs); ret = incomingim_ch2(sess, mod, rx, snac, channel, &userinfo, tlvlist, cookie); aim_tlvlist_free(&tlvlist); } else if (channel == 4) { aim_tlvlist_t *tlvlist; tlvlist = aim_tlvlist_read(bs); ret = incomingim_ch4(sess, mod, rx, snac, channel, &userinfo, tlvlist, cookie); aim_tlvlist_free(&tlvlist); } else { faimdprintf(sess, 0, "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel); } aim_info_free(&userinfo); return ret; } /* * Subtype 0x0008 - Send a warning to sn. * * Flags: * AIM_WARN_ANON Send as an anonymous (doesn't count as much) * * returns -1 on error (couldn't alloc packet), 0 on success. * */ faim_export int aim_im_warn(aim_session_t *sess, aim_conn_t *conn, const char *sn, fu32_t flags) { aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !conn || !sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, strlen(sn)+13))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0008, 0x0000, sn, strlen(sn)+1); aim_putsnac(&fr->data, 0x0004, 0x0008, 0x0000, snacid); aimbs_put16(&fr->data, (flags & AIM_WARN_ANON) ? 0x0001 : 0x0000); aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); aim_tx_enqueue(sess, fr); return 0; } /* Subtype 0x000a */ static int missedcall(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t channel, nummissed, reason; aim_userinfo_t userinfo; while (aim_bstream_empty(bs)) { channel = aimbs_get16(bs); aim_info_extract(sess, bs, &userinfo); nummissed = aimbs_get16(bs); reason = aimbs_get16(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, channel, &userinfo, nummissed, reason); aim_info_free(&userinfo); } return ret; } /* * Subtype 0x000b * * Possible codes: * AIM_TRANSFER_DENY_NOTSUPPORTED -- "client does not support" * AIM_TRANSFER_DENY_DECLINE -- "client has declined transfer" * AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers" * */ faim_export int aim_im_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, fu16_t code) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+8+2+1+strlen(sender)+6))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x000b, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x000b, 0x0000, snacid); aimbs_putraw(&fr->data, cookie, 8); aimbs_put16(&fr->data, 0x0002); /* channel */ aimbs_put8(&fr->data, strlen(sender)); aimbs_putraw(&fr->data, sender, strlen(sender)); aim_tlvlist_add_16(&tl, 0x0003, code); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x000b - Receive the response from an ICQ status message request. * * This contains the ICQ status message. Go figure. * */ static int clientautoresp(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t channel, reason; char *sn; fu8_t *ck, snlen; ck = aimbs_getraw(bs, 8); channel = aimbs_get16(bs); snlen = aimbs_get8(bs); sn = aimbs_getstr(bs, snlen); reason = aimbs_get16(bs); if (channel == 0x0002) { /* File transfer declined */ aimbs_get16(bs); /* Unknown */ aimbs_get16(bs); /* Unknown */ if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, channel, sn, reason, ck); } else if (channel == 0x0004) { /* ICQ message */ switch (reason) { case 0x0003: { /* ICQ status message. Maybe other stuff too, you never know with these people. */ fu8_t statusmsgtype, *msg; fu16_t len; fu32_t state; len = aimbs_getle16(bs); /* Should be 0x001b */ aim_bstream_advance(bs, len); /* Unknown */ len = aimbs_getle16(bs); /* Should be 0x000e */ aim_bstream_advance(bs, len); /* Unknown */ statusmsgtype = aimbs_getle8(bs); switch (statusmsgtype) { case 0xe8: state = AIM_ICQ_STATE_AWAY; break; case 0xe9: state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; break; case 0xea: state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_OUT; break; case 0xeb: state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY; break; case 0xec: state = AIM_ICQ_STATE_CHAT; break; default: state = 0; break; } aimbs_getle8(bs); /* Unknown - 0x03 Maybe this means this is an auto-reply */ aimbs_getle16(bs); /* Unknown - 0x0000 */ aimbs_getle16(bs); /* Unknown - 0x0000 */ len = aimbs_getle16(bs); msg = aimbs_getraw(bs, len); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, channel, sn, reason, state, msg); free(msg); } break; default: { if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, channel, sn, reason); } break; } /* end switch */ } free(ck); free(sn); return ret; } /* * Subtype 0x000c - Receive an ack after sending an ICBM. * * You have to have send the message with the AIM_IMFLAGS_ACK flag set * (TLV t(0003)). The ack contains the ICBM header of the message you * sent. * */ static int msgack(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; fu16_t ch; fu8_t *ck; char *sn; int ret = 0; ck = aimbs_getraw(bs, 8); ch = aimbs_get16(bs); sn = aimbs_getstr(bs, aimbs_get8(bs)); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, ch, sn); free(sn); free(ck); return ret; } /* * Subtype 0x0014 - Send a mini typing notification (mtn) packet. * * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, * and Gaim 0.60 and newer. * */ faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, const char *sn, fu16_t type2) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0002))) return -EINVAL; if (!sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+11+strlen(sn)+2))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0004, 0x0014, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0004, 0x0014, 0x0000, snacid); /* * 8 days of light * Er, that is to say, 8 bytes of 0's */ aimbs_put16(&fr->data, 0x0000); aimbs_put16(&fr->data, 0x0000); aimbs_put16(&fr->data, 0x0000); aimbs_put16(&fr->data, 0x0000); /* * Type 1 (should be 0x0001 for mtn) */ aimbs_put16(&fr->data, type1); /* * Dest sn */ aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); /* * Type 2 (should be 0x0000, 0x0001, or 0x0002 for mtn) */ aimbs_put16(&fr->data, type2); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0014 - Receive a mini typing notification (mtn) packet. * * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, * and Gaim 0.60 and newer. * */ static int mtn_receive(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; char *sn; fu8_t snlen; fu16_t type1, type2; aim_bstream_advance(bs, 8); /* Unknown - All 0's */ type1 = aimbs_get16(bs); snlen = aimbs_get8(bs); sn = aimbs_getstr(bs, snlen); type2 = aimbs_get16(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, type1, sn, type2); free(sn); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0005) return aim_im_paraminfo(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0006) return outgoingim(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0007) return incomingim(sess, mod, rx, snac, bs); else if (snac->subtype == 0x000a) return missedcall(sess, mod, rx, snac, bs); else if (snac->subtype == 0x000b) return clientautoresp(sess, mod, rx, snac, bs); else if (snac->subtype == 0x000c) return msgack(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0014) return mtn_receive(sess, mod, rx, snac, bs); return 0; } faim_internal int msg_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0004; mod->version = 0x0001; mod->toolid = 0x0110; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "messaging", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/invite.c0000644000175000017500000000201410234217331021316 0ustar ryanryan00000000000000/* * Family 0x0006 - This isn't really ever used by anyone anymore. * * Once upon a time, there used to be a menu item in AIM clients that * said something like "Invite a friend to use AIM..." and then it would * ask for an email address and it would sent a mail to them saying * how perfectly wonderful the AIM service is and why you should use it * and click here if you hate the person who sent this to you and want to * complain and yell at them in a small box with pretty fonts. * * I could've sworn libfaim had this implemented once, a long long time ago, * but I can't find it. * * I'm mainly adding this so that I can keep advertising that we support * group 6, even though we don't. * */ #define FAIM_INTERNAL #include faim_internal int invite_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0006; mod->version = 0x0001; mod->toolid = 0x0110; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "invite", sizeof(mod->name)); mod->snachandler = NULL; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/rxhandlers.c0000644000175000017500000003226410234217331022204 0ustar ryanryan00000000000000/* * rxhandlers.c * * This file contains most all of the incoming packet handlers, along * with aim_rxdispatch(), the Rx dispatcher. Queue/list management is * actually done in aim_rxqueue.c. * */ #define FAIM_INTERNAL #include struct aim_rxcblist_s { fu16_t family; fu16_t type; aim_rxcallback_t handler; fu16_t flags; struct aim_rxcblist_s *next; }; faim_internal aim_module_t *aim__findmodulebygroup(aim_session_t *sess, fu16_t group) { aim_module_t *cur; for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) { if (cur->family == group) return cur; } return NULL; } faim_internal aim_module_t *aim__findmodule(aim_session_t *sess, const char *name) { aim_module_t *cur; for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) { if (strcmp(name, cur->name) == 0) return cur; } return NULL; } faim_internal int aim__registermodule(aim_session_t *sess, int (*modfirst)(aim_session_t *, aim_module_t *)) { aim_module_t *mod; if (!sess || !modfirst) return -1; if (!(mod = malloc(sizeof(aim_module_t)))) return -1; memset(mod, 0, sizeof(aim_module_t)); if (modfirst(sess, mod) == -1) { free(mod); return -1; } if (aim__findmodule(sess, mod->name)) { if (mod->shutdown) mod->shutdown(sess, mod); free(mod); return -1; } mod->next = (aim_module_t *)sess->modlistv; sess->modlistv = mod; faimdprintf(sess, 1, "registered module %s (family 0x%04x, version = 0x%04x, tool 0x%04x, tool version 0x%04x)\n", mod->name, mod->family, mod->version, mod->toolid, mod->toolversion); return 0; } faim_internal void aim__shutdownmodules(aim_session_t *sess) { aim_module_t *cur; for (cur = (aim_module_t *)sess->modlistv; cur; ) { aim_module_t *tmp; tmp = cur->next; if (cur->shutdown) cur->shutdown(sess, cur); free(cur); cur = tmp; } sess->modlistv = NULL; return; } static int consumesnac(aim_session_t *sess, aim_frame_t *rx) { aim_module_t *cur; aim_modsnac_t snac; if (aim_bstream_empty(&rx->data) < 10) return 0; snac.family = aimbs_get16(&rx->data); snac.subtype = aimbs_get16(&rx->data); snac.flags = aimbs_get16(&rx->data); snac.id = aimbs_get32(&rx->data); /* SNAC flags are apparently uniform across all SNACs, so we handle them here */ if (snac.flags & 0x0001) { /* * This means the SNAC will be followed by another SNAC with * related information. We don't need to do anything about * this here. */ } if (snac.flags & 0x8000) { /* * This packet contains the version of the family that this SNAC is * in. You get this when your SSI module is version 2 or higher. * For now we have no need for this, but you could always save * it as a part of aim_modnsac_t, or something. The format is... * 2 byte length of total mini-header (which is 6 bytes), then TLV * of type 0x0001, length 0x0002, value is the 2 byte version * number */ aim_bstream_advance(&rx->data, aimbs_get16(&rx->data)); } for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) { if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && (cur->family != snac.family)) continue; if (cur->snachandler(sess, cur, rx, &snac, &rx->data)) return 1; } return 0; } static int consumenonsnac(aim_session_t *sess, aim_frame_t *rx, fu16_t family, fu16_t subtype) { aim_module_t *cur; aim_modsnac_t snac; snac.family = family; snac.subtype = subtype; snac.flags = snac.id = 0; for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) { if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && (cur->family != snac.family)) continue; if (cur->snachandler(sess, cur, rx, &snac, &rx->data)) return 1; } return 0; } static int negchan_middle(aim_session_t *sess, aim_frame_t *fr) { aim_tlvlist_t *tlvlist; char *msg = NULL; fu16_t code = 0; aim_rxcallback_t userfunc; int ret = 1; if (aim_bstream_empty(&fr->data) == 0) { /* XXX should do something with this */ return 1; } /* Used only by the older login protocol */ /* XXX remove this special case? */ if (fr->conn->type == AIM_CONN_TYPE_AUTH) return consumenonsnac(sess, fr, 0x0017, 0x0003); tlvlist = aim_tlvlist_read(&fr->data); if (aim_tlv_gettlv(tlvlist, 0x0009, 1)) code = aim_tlv_get16(tlvlist, 0x0009, 1); if (aim_tlv_gettlv(tlvlist, 0x000b, 1)) msg = aim_tlv_getstr(tlvlist, 0x000b, 1); if ((userfunc = aim_callhandler(sess, fr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) ret = userfunc(sess, fr, code, msg); aim_tlvlist_free(&tlvlist); free(msg); return ret; } /* * Bleck functions get called when there's no non-bleck functions * around to cleanup the mess... */ faim_internal int bleck(aim_session_t *sess, aim_frame_t *frame, ...) { fu16_t family, subtype; fu16_t maxf, maxs; static const char *channels[6] = { "Invalid (0)", "FLAP Version", "SNAC", "Invalid (3)", "Negotiation", "FLAP NOP" }; static const int maxchannels = 5; /* XXX: this is ugly. and big just for debugging. */ static const char *literals[14][25] = { {"Invalid", NULL }, {"General", "Invalid", "Error", "Client Ready", "Server Ready", "Service Request", "Redirect", "Rate Information Request", "Rate Information", "Rate Information Ack", NULL, "Rate Information Change", "Server Pause", NULL, "Server Resume", "Request Personal User Information", "Personal User Information", "Evil Notification", NULL, "Migration notice", "Message of the Day", "Set Privacy Flags", "Well Known URL", "NOP" }, {"Location", "Invalid", "Error", "Request Rights", "Rights Information", "Set user information", "Request User Information", "User Information", "Watcher Sub Request", "Watcher Notification" }, {"Buddy List Management", "Invalid", "Error", "Request Rights", "Rights Information", "Add Buddy", "Remove Buddy", "Watcher List Query", "Watcher List Response", "Watcher SubRequest", "Watcher Notification", "Reject Notification", "Oncoming Buddy", "Offgoing Buddy" }, {"Messeging", "Invalid", "Error", "Add ICBM Parameter", "Remove ICBM Parameter", "Request Parameter Information", "Parameter Information", "Outgoing Message", "Incoming Message", "Evil Request", "Evil Reply", "Missed Calls", "Message Error", "Host Ack" }, {"Advertisements", "Invalid", "Error", "Request Ad", "Ad Data (GIFs)" }, {"Invitation / Client-to-Client", "Invalid", "Error", "Invite a Friend", "Invitation Ack" }, {"Administrative", "Invalid", "Error", "Information Request", "Information Reply", "Information Change Request", "Information Chat Reply", "Account Confirm Request", "Account Confirm Reply", "Account Delete Request", "Account Delete Reply" }, {"Popups", "Invalid", "Error", "Display Popup" }, {"BOS", "Invalid", "Error", "Request Rights", "Rights Response", "Set group permission mask", "Add permission list entries", "Delete permission list entries", "Add deny list entries", "Delete deny list entries", "Server Error" }, {"User Lookup", "Invalid", "Error", "Search Request", "Search Response" }, {"Stats", "Invalid", "Error", "Set minimum report interval", "Report Events" }, {"Translate", "Invalid", "Error", "Translate Request", "Translate Reply", }, {"Chat Navigation", "Invalid", "Error", "Request rights", "Request Exchange Information", "Request Room Information", "Request Occupant List", "Search for Room", "Outgoing Message", "Incoming Message", "Evil Request", "Evil Reply", "Chat Error", } }; maxf = sizeof(literals) / sizeof(literals[0]); maxs = sizeof(literals[0]) / sizeof(literals[0][0]); if (frame->hdr.flap.channel == 0x02) { family = aimbs_get16(&frame->data); subtype = aimbs_get16(&frame->data); if ((family < maxf) && (subtype+1 < maxs) && (literals[family][subtype] != NULL)) faimdprintf(sess, 0, "bleck: channel %s: null handler for %04x/%04x (%s)\n", channels[frame->hdr.flap.channel], family, subtype, literals[family][subtype+1]); else faimdprintf(sess, 0, "bleck: channel %s: null handler for %04x/%04x (no literal)\n", channels[frame->hdr.flap.channel], family, subtype); } else { if (frame->hdr.flap.channel <= maxchannels) faimdprintf(sess, 0, "bleck: channel %s (0x%02x)\n", channels[frame->hdr.flap.channel], frame->hdr.flap.channel); else faimdprintf(sess, 0, "bleck: unknown channel 0x%02x\n", frame->hdr.flap.channel); } return 1; } faim_export int aim_conn_addhandler(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t type, aim_rxcallback_t newhandler, fu16_t flags) { struct aim_rxcblist_s *newcb; if (!conn) return -1; faimdprintf(sess, 1, "aim_conn_addhandler: adding for %04x/%04x\n", family, type); if (!(newcb = (struct aim_rxcblist_s *)calloc(1, sizeof(struct aim_rxcblist_s)))) return -1; newcb->family = family; newcb->type = type; newcb->flags = flags; newcb->handler = newhandler ? newhandler : bleck; newcb->next = NULL; if (!conn->handlerlist) conn->handlerlist = (void *)newcb; else { struct aim_rxcblist_s *cur; for (cur = (struct aim_rxcblist_s *)conn->handlerlist; cur->next; cur = cur->next) ; cur->next = newcb; } return 0; } faim_export int aim_clearhandlers(aim_conn_t *conn) { struct aim_rxcblist_s *cur; if (!conn) return -1; for (cur = (struct aim_rxcblist_s *)conn->handlerlist; cur; ) { struct aim_rxcblist_s *tmp; tmp = cur->next; free(cur); cur = tmp; } conn->handlerlist = NULL; return 0; } faim_internal aim_rxcallback_t aim_callhandler(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t type) { struct aim_rxcblist_s *cur; if (!conn) return NULL; faimdprintf(sess, 1, "aim_callhandler: calling for %04x/%04x\n", family, type); for (cur = (struct aim_rxcblist_s *)conn->handlerlist; cur; cur = cur->next) { if ((cur->family == family) && (cur->type == type)) return cur->handler; } if (type == AIM_CB_SPECIAL_DEFAULT) { faimdprintf(sess, 1, "aim_callhandler: no default handler for family 0x%04x\n", family); return NULL; /* prevent infinite recursion */ } faimdprintf(sess, 1, "aim_callhandler: no handler for 0x%04x/0x%04x\n", family, type); return aim_callhandler(sess, conn, family, AIM_CB_SPECIAL_DEFAULT); } faim_internal void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src) { struct aim_rxcblist_s *cur; for (cur = (struct aim_rxcblist_s *)src->handlerlist; cur; cur = cur->next) { aim_conn_addhandler(sess, dest, cur->family, cur->type, cur->handler, cur->flags); } return; } faim_internal int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn,fu16_t family, fu16_t type, aim_frame_t *ptr) { aim_rxcallback_t userfunc; if ((userfunc = aim_callhandler(sess, conn, family, type))) return userfunc(sess, ptr); return 1; /* XXX */ } /* * aim_rxdispatch() * * Basically, heres what this should do: * 1) Determine correct packet handler for this packet * 2) Mark the packet handled (so it can be dequeued in purge_queue()) * 3) Send the packet to the packet handler * 4) Go to next packet in the queue and start over * 5) When done, run purge_queue() to purge handled commands * * TODO: Clean up. * TODO: More support for mid-level handlers. * TODO: Allow for NULL handlers. * */ faim_export void aim_rxdispatch(aim_session_t *sess) { int i; aim_frame_t *cur; for (cur = sess->queue_incoming, i = 0; cur; cur = cur->next, i++) { /* * XXX: This is still fairly ugly. */ if (cur->handled) continue; if (cur->hdrtype == AIM_FRAMETYPE_FLAP) { if (cur->hdr.flap.channel == 0x01) { cur->handled = aim_callhandler_noparam(sess, cur->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, cur); /* XXX use consumenonsnac */ continue; } else if (cur->hdr.flap.channel == 0x02) { if ((cur->handled = consumesnac(sess, cur))) continue; } else if (cur->hdr.flap.channel == 0x04) { cur->handled = negchan_middle(sess, cur); continue; } else if (cur->hdr.flap.channel == 0x05) { } } else if (cur->hdrtype == AIM_FRAMETYPE_OFT) { if (cur->conn->type == AIM_CONN_TYPE_RENDEZVOUS) { aim_rxdispatch_rendezvous(sess, cur); cur->handled = 1; continue; } else if (cur->conn->type == AIM_CONN_TYPE_LISTENER) { /* not possible */ faimdprintf(sess, 0, "rxdispatch called on LISTENER connection!\n"); cur->handled = 1; continue; } } if (!cur->handled) { consumenonsnac(sess, cur, 0xffff, 0xffff); /* last chance! */ cur->handled = 1; } } /* * This doesn't have to be called here. It could easily be done * by a separate thread or something. It's an administrative operation, * and can take a while. Though the less you call it the less memory * you'll have :) */ aim_purge_rxqueue(sess); return; } faim_internal int aim_parse_unknown(aim_session_t *sess, aim_frame_t *frame, ...) { int i; faimdprintf(sess, 1, "\nRecieved unknown packet:"); for (i = 0; aim_bstream_empty(&frame->data); i++) { if ((i % 8) == 0) faimdprintf(sess, 1, "\n\t"); faimdprintf(sess, 1, "0x%2x ", aimbs_get8(&frame->data)); } faimdprintf(sess, 1, "\n\n"); return 1; } pork-0.99.8.1/src/protocols/aim/libfaim/txqueue.c0000644000175000017500000002350210234217331021525 0ustar ryanryan00000000000000/* * txqueue.c * * Herein lies all the management routines for the transmit (Tx) queue. * */ #define FAIM_INTERNAL #include #ifndef _WIN32 #include #else #include "win32dep.h" #endif /* * Allocate a new tx frame. * * This is more for looks than anything else. * * Right now, that is. If/when we implement a pool of transmit * frames, this will become the request-an-unused-frame part. * * framing = AIM_FRAMETYPE_OFT/FLAP * chan = channel for FLAP, hdrtype for OFT * */ faim_internal aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, fu8_t framing, fu16_t chan, int datalen) { aim_frame_t *fr; if (!sess || !conn) { faimdprintf(sess, 0, "aim_tx_new: No session or no connection specified!\n"); return NULL; } /* For sanity... */ if ((conn->type == AIM_CONN_TYPE_RENDEZVOUS) || (conn->type == AIM_CONN_TYPE_LISTENER)) { if (framing != AIM_FRAMETYPE_OFT) { faimdprintf(sess, 0, "aim_tx_new: attempted to allocate inappropriate frame type for rendezvous connection\n"); return NULL; } } else { if (framing != AIM_FRAMETYPE_FLAP) { faimdprintf(sess, 0, "aim_tx_new: attempted to allocate inappropriate frame type for FLAP connection\n"); return NULL; } } if (!(fr = (aim_frame_t *)calloc(1, sizeof(aim_frame_t)))) return NULL; fr->conn = conn; fr->hdrtype = framing; if (fr->hdrtype == AIM_FRAMETYPE_FLAP) fr->hdr.flap.channel = chan; else if (fr->hdrtype == AIM_FRAMETYPE_OFT) fr->hdr.rend.type = chan; else faimdprintf(sess, 0, "tx_new: unknown framing\n"); if (datalen > 0) { fu8_t *data; if (!(data = (unsigned char *)malloc(datalen))) { aim_frame_destroy(fr); return NULL; } aim_bstream_init(&fr->data, data, datalen); } return fr; } /* * This increments the tx command count, and returns the seqnum * that should be stamped on the next FLAP packet sent. This is * normally called during the final step of packet preparation * before enqueuement (in aim_tx_enqueue()). */ static flap_seqnum_t aim_get_next_txseqnum(aim_conn_t *conn) { flap_seqnum_t ret; ret = ++conn->seqnum; return ret; } /* * The overall purpose here is to enqueue the passed in command struct * into the outgoing (tx) queue. Basically... * 1) Make a scope-irrelevant copy of the struct * 3) Mark as not-sent-yet * 4) Enqueue the struct into the list * 6) Return * * Note that this is only used when doing queue-based transmitting; * that is, when sess->tx_enqueue is set to &aim_tx_enqueue__queuebased. * */ static int aim_tx_enqueue__queuebased(aim_session_t *sess, aim_frame_t *fr) { if (!fr->conn) { faimdprintf(sess, 1, "aim_tx_enqueue: WARNING: enqueueing packet with no connecetion\n"); fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS); } if (fr->hdrtype == AIM_FRAMETYPE_FLAP) { /* assign seqnum -- XXX should really not assign until hardxmit */ fr->hdr.flap.seqnum = aim_get_next_txseqnum(fr->conn); } fr->handled = 0; /* not sent yet */ /* see overhead note in aim_rxqueue counterpart */ if (!sess->queue_outgoing) sess->queue_outgoing = fr; else { aim_frame_t *cur; for (cur = sess->queue_outgoing; cur->next; cur = cur->next); cur->next = fr; } return 0; } /* * Parallel to aim_tx_enqueue__queuebased, however, this bypasses * the whole queue mess when you want immediate writes to happen. * * Basically the same as its __queuebased couterpart, however * instead of doing a list append, it just calls aim_tx_sendframe() * right here. * */ static int aim_tx_enqueue__immediate(aim_session_t *sess, aim_frame_t *fr) { int ret; if (!fr->conn) { faimdprintf(sess, 1, "aim_tx_enqueue: ERROR: packet has no connection\n"); aim_frame_destroy(fr); return 0; } if (fr->hdrtype == AIM_FRAMETYPE_FLAP) fr->hdr.flap.seqnum = aim_get_next_txseqnum(fr->conn); fr->handled = 0; /* not sent yet */ ret = aim_tx_sendframe(sess, fr); aim_frame_destroy(fr); return ret; } faim_export int aim_tx_setenqueue(aim_session_t *sess, int what, int (*func)(aim_session_t *, aim_frame_t *)) { if (what == AIM_TX_QUEUED) sess->tx_enqueue = &aim_tx_enqueue__queuebased; else if (what == AIM_TX_IMMEDIATE) sess->tx_enqueue = &aim_tx_enqueue__immediate; else if (what == AIM_TX_USER) { if (!func) return -EINVAL; sess->tx_enqueue = func; } else return -EINVAL; /* unknown action */ return 0; } faim_internal int aim_tx_enqueue(aim_session_t *sess, aim_frame_t *fr) { /* * If we want to send on a connection that is in progress, we have to force * them to use the queue based version. Otherwise, use whatever they * want. */ if (fr && fr->conn && (fr->conn->status & AIM_CONN_STATUS_INPROGRESS)) { return aim_tx_enqueue__queuebased(sess, fr); } return (*sess->tx_enqueue)(sess, fr); } static int aim_send(int fd, const void *buf, size_t count) { int left, cur; for (cur = 0, left = count; left; ) { int ret; ret = send(fd, ((unsigned char *)buf)+cur, left, 0); if (ret == -1) return -1; else if (ret == 0) return cur; cur += ret; left -= ret; } return cur; } static int aim_bstream_send(aim_bstream_t *bs, aim_conn_t *conn, size_t count) { int wrote = 0; if (!bs || !conn || (count < 0)) return -EINVAL; /* Make sure we don't send past the end of the bs */ if (count > aim_bstream_empty(bs)) count = aim_bstream_empty(bs); /* truncate to remaining space */ if (count) { /* * I need to rewrite this. "Updating the UI" doesn't make sense. The program is * blocked and the UI can't redraw. We're blocking all of Gaim. We need to set * up an actual txqueue and a GAIM_INPUT_WRITE callback and only write when we * can. Why is this file called txqueue anyway? Lets rename it to txblock. */ if ((conn->type == AIM_CONN_TYPE_RENDEZVOUS) && (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)) { const char *sn = aim_odc_getsn(conn); aim_rxcallback_t userfunc; while (count - wrote > 1024) { int ret; ret = aim_send(conn->fd, bs->data + bs->offset + wrote, 1024); if (ret > 0) wrote += ret; if (ret < 0) return -1; if ((userfunc=aim_callhandler(conn->sessv, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER))) userfunc(conn->sessv, NULL, sn, count-wrote>1024 ? ((double)wrote / count) : 1); } } if (count - wrote) { wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, count - wrote); } } bs->offset += wrote; return wrote; } static int sendframe_flap(aim_session_t *sess, aim_frame_t *fr) { aim_bstream_t bs; fu8_t *bs_raw; int payloadlen, err = 0, bslen; payloadlen = aim_bstream_curpos(&fr->data); if (!(bs_raw = malloc(6 + payloadlen))) return -ENOMEM; aim_bstream_init(&bs, bs_raw, 6 + payloadlen); /* FLAP header */ aimbs_put8(&bs, 0x2a); aimbs_put8(&bs, fr->hdr.flap.channel); aimbs_put16(&bs, fr->hdr.flap.seqnum); aimbs_put16(&bs, payloadlen); /* payload */ aim_bstream_rewind(&fr->data); aimbs_putbs(&bs, &fr->data, payloadlen); bslen = aim_bstream_curpos(&bs); aim_bstream_rewind(&bs); if (aim_bstream_send(&bs, fr->conn, bslen) != bslen) err = -errno; free(bs_raw); /* XXX aim_bstream_free */ fr->handled = 1; fr->conn->lastactivity = time(NULL); return err; } static int sendframe_rendezvous(aim_session_t *sess, aim_frame_t *fr) { aim_bstream_t bs; fu8_t *bs_raw; int payloadlen, err = 0, bslen; payloadlen = aim_bstream_curpos(&fr->data); if (!(bs_raw = malloc(8 + payloadlen))) return -ENOMEM; aim_bstream_init(&bs, bs_raw, 8 + payloadlen); /* Rendezvous header */ aimbs_putraw(&bs, fr->hdr.rend.magic, 4); aimbs_put16(&bs, fr->hdr.rend.hdrlen); aimbs_put16(&bs, fr->hdr.rend.type); /* payload */ aim_bstream_rewind(&fr->data); aimbs_putbs(&bs, &fr->data, payloadlen); bslen = aim_bstream_curpos(&bs); aim_bstream_rewind(&bs); if (aim_bstream_send(&bs, fr->conn, bslen) != bslen) err = -errno; free(bs_raw); /* XXX aim_bstream_free */ fr->handled = 1; fr->conn->lastactivity = time(NULL); return err; } faim_internal int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *fr) { if (fr->hdrtype == AIM_FRAMETYPE_FLAP) return sendframe_flap(sess, fr); else if (fr->hdrtype == AIM_FRAMETYPE_OFT) return sendframe_rendezvous(sess, fr); return -1; } faim_export int aim_tx_flushqueue(aim_session_t *sess) { aim_frame_t *cur; for (cur = sess->queue_outgoing; cur; cur = cur->next) { if (cur->handled) continue; /* already been sent */ if (cur->conn && (cur->conn->status & AIM_CONN_STATUS_INPROGRESS)) continue; /* * And now for the meager attempt to force transmit * latency and avoid missed messages. */ if ((cur->conn->lastactivity + cur->conn->forcedlatency) >= time(NULL)) { /* * XXX should be a break! we don't want to block the * upper layers * * XXX or better, just do this right. * */ sleep((cur->conn->lastactivity + cur->conn->forcedlatency) - time(NULL)); } /* XXX this should call the custom "queuing" function!! */ aim_tx_sendframe(sess, cur); } /* purge sent commands from queue */ aim_tx_purgequeue(sess); return 0; } /* * This is responsible for removing sent commands from the transmit * queue. This is not a required operation, but it of course helps * reduce memory footprint at run time! */ faim_export void aim_tx_purgequeue(aim_session_t *sess) { aim_frame_t *cur, **prev; for (prev = &sess->queue_outgoing; (cur = *prev); ) { if (cur->handled) { *prev = cur->next; aim_frame_destroy(cur); } else prev = &cur->next; } return; } /** * Get rid of packets waiting for tx on a dying conn. For now this * simply marks all packets as sent and lets them disappear without * warning. * * @param sess A session. * @param conn Connection that's dying. */ faim_internal void aim_tx_cleanqueue(aim_session_t *sess, aim_conn_t *conn) { aim_frame_t *cur; for (cur = sess->queue_outgoing; cur; cur = cur->next) { if (cur->conn == conn) cur->handled = 1; } return; } pork-0.99.8.1/src/protocols/aim/libfaim/aim.h0000644000175000017500000013603710234217332020611 0ustar ryanryan00000000000000/* * Main libfaim header. Must be included in client for prototypes/macros. * * "come on, i turned a chick lesbian; i think this is the hackish equivalent" * -- Josh Myer * */ #ifndef __AIM_H__ #define __AIM_H__ #define FAIM_VERSION_MAJOR 0 #define FAIM_VERSION_MINOR 99 #define FAIM_VERSION_MINORMINOR 1 #include #include #include #include #include #include #include #include #include #include #ifndef _WIN32 #include #include #include #include #include #else #include "libc_interface.h" #endif #ifdef __cplusplus extern "C" { #endif /* XXX adjust these based on autoconf-detected platform */ typedef unsigned char fu8_t; typedef unsigned short fu16_t; typedef unsigned int fu32_t; typedef fu32_t aim_snacid_t; typedef fu16_t flap_seqnum_t; #if defined(mach) && defined(__APPLE__) #define gethostbyname(x) gethostbyname2(x, AF_INET) #endif #if defined(_WIN32) && !defined(WIN32_STATIC) /* * For a win32 DLL, we define WIN32_INDLL if this file * is included while compiling the DLL. If its not * defined (its included in a client app), the symbols * will be imported instead of exported. */ #ifdef WIN32_INDLL #define faim_export __declspec(dllexport) #else #define faim_export __declspec(dllimport) #endif /* WIN32_INDLL */ #define faim_internal #else /* * Nothing normally needed for unix... */ #define faim_export #define faim_internal #endif #ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (!FALSE) #endif /* * Current Maximum Length for Screen Names (not including NULL) * * Currently only names up to 16 characters can be registered * however it is apparently legal for them to be larger. */ #define MAXSNLEN 97 /* * Current Maximum Length for Instant Messages * * This was found basically by experiment, but not wholly * accurate experiment. It should not be regarded * as completely correct. But its a decent approximation. * * Note that although we can send this much, its impossible * for WinAIM clients (up through the latest (4.0.1957)) to * send any more than 1kb. Amaze all your windows friends * with utterly oversized instant messages! * * XXX: the real limit is the total SNAC size at 8192. Fix this. * */ #define MAXMSGLEN 7987 /* * Maximum size of a Buddy Icon. */ #define MAXICONLEN 7168 #define AIM_ICONIDENT "AVT1picture.id" /* * Current Maximum Length for Chat Room Messages * * This is actually defined by the protocol to be * dynamic, but I have yet to see due cause to * define it dynamically here. Maybe later. * */ #define MAXCHATMSGLEN 512 /** * Maximum length for the password of an ICQ account */ #define MAXICQPASSLEN 8 #define AIM_MD5_STRING "AOL Instant Messenger (SM)" /* * Client info. Filled in by the client and passed in to * aim_send_login(). The information ends up getting passed to OSCAR * through the initial login command. * */ struct client_info_s { const char *clientstring; fu16_t clientid; fu16_t major; fu16_t minor; fu16_t point; fu16_t build; fu32_t distrib; const char *country; /* two-letter abbrev */ const char *lang; /* two-letter abbrev */ }; /* Needs to be checked */ #define CLIENTINFO_AIM_3_5_1670 { \ "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \ 0x0004, \ 0x0003, 0x0005, \ 0x0000, 0x0686, \ 0x0000002a, \ "us", "en", \ } /* Needs to be checked */ /* Latest winaim without ssi */ #define CLIENTINFO_AIM_4_1_2010 { \ "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \ 0x0004, \ 0x0004, 0x0001, \ 0x0000, 0x07da, \ 0x0000004b, \ "us", "en", \ } /* Needs to be checked */ #define CLIENTINFO_AIM_4_3_2188 { \ "AOL Instant Messenger (SM), version 4.3.2188/WIN32", \ 0x0109, \ 0x0400, 0x0003, \ 0x0000, 0x088c, \ 0x00000086, \ "us", "en", \ } /* Needs to be checked */ #define CLIENTINFO_AIM_4_8_2540 { \ "AOL Instant Messenger (SM), version 4.8.2540/WIN32", \ 0x0109, \ 0x0004, 0x0008, \ 0x0000, 0x09ec, \ 0x000000af, \ "us", "en", \ } /* Needs to be checked */ #define CLIENTINFO_AIM_5_0_2938 { \ "AOL Instant Messenger, version 5.0.2938/WIN32", \ 0x0109, \ 0x0005, 0x0000, \ 0x0000, 0x0b7a, \ 0x00000000, \ "us", "en", \ } #define CLIENTINFO_AIM_5_1_3036 { \ "AOL Instant Messenger, version 5.1.3036/WIN32", \ 0x0109, \ 0x0005, 0x0001, \ 0x0000, 0x0bdc, \ 0x000000d2, \ "us", "en", \ } #define CLIENTINFO_AIM_5_5_3415 { \ "AOL Instant Messenger, version 5.5.3415/WIN32", \ 0x0109, \ 0x0005, 0x0005, \ 0x0000, 0x0057, \ 0x000000ef, \ "us", "en", \ } #define CLIENTINFO_AIM_5_9_3702 { \ "AOL Instant Messenger, version 5.9.3702/WIN32", \ 0x0109, \ 0x0005, 0x0009, \ 0x0000, 0x0e76, \ 0x00000111, \ "us", "en", \ } #define CLIENTINFO_ICHAT_1_0 { \ "Apple iChat", \ 0x311a, \ 0x0001, 0x0000, \ 0x0000, 0x003c, \ 0x000000c6, \ "us", "en", \ } /* Needs to be checked */ #define CLIENTINFO_ICQ_4_65_3281 { \ "ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \ 0x010a, \ 0x0004, 0x0041, \ 0x0001, 0x0cd1, \ 0x00000055, \ "us", "en", \ } /* Needs to be checked */ #define CLIENTINFO_ICQ_5_34_3728 { \ "ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \ 0x010a, \ 0x0005, 0x0022, \ 0x0001, 0x0e8f, \ 0x00000055, \ "us", "en", \ } #define CLIENTINFO_ICQ_5_45_3777 { \ "ICQ Inc. - Product of ICQ (TM).2003a.5.45.1.3777.85", \ 0x010a, \ 0x0005, 0x002d, \ 0x0001, 0x0ec1, \ 0x00000055, \ "us", "en", \ } #define CLIENTINFO_ICQBASIC_14_3_1068 { \ "ICQBasic", \ 0x010a, \ 0x0014, 0x0003, \ 0x0000, 0x042c, \ 0x0000043d, \ "us", "en", \ } #define CLIENTINFO_NETSCAPE_7_0_1 { \ "Netscape 2000 an approved user of AOL Instant Messenger (SM)", \ 0x1d0d, \ 0x0007, 0x0000, \ 0x0001, 0x0000, \ 0x00000058, \ "us", "en", \ } #define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036 #define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_5_45_3777 /* * These could be arbitrary, but its easier to use the actual AIM values */ #define AIM_CONN_TYPE_BOS 0x0002 #define AIM_CONN_TYPE_ADS 0x0005 #define AIM_CONN_TYPE_AUTH 0x0007 #define AIM_CONN_TYPE_CHATNAV 0x000d #define AIM_CONN_TYPE_CHAT 0x000e #define AIM_CONN_TYPE_SEARCH 0x000f #define AIM_CONN_TYPE_ICON 0x0010 #define AIM_CONN_TYPE_EMAIL 0x0018 /* they start getting arbitrary for rendezvous stuff =) */ #define AIM_CONN_TYPE_RENDEZVOUS 0xfffe /* these do not speak FLAP! */ #define AIM_CONN_TYPE_LISTENER 0xffff /* socket waiting for accept() */ /* * Subtypes, we need these for OFT stuff. */ #define AIM_CONN_SUBTYPE_OFT_DIRECTIM 0x0001 #define AIM_CONN_SUBTYPE_OFT_GETFILE 0x0002 #define AIM_CONN_SUBTYPE_OFT_SENDFILE 0x0003 #define AIM_CONN_SUBTYPE_OFT_BUDDYICON 0x0004 #define AIM_CONN_SUBTYPE_OFT_VOICE 0x0005 /* * Status values returned from aim_conn_new(). ORed together. */ #define AIM_CONN_STATUS_READY 0x0001 #define AIM_CONN_STATUS_INTERNALERR 0x0002 #define AIM_CONN_STATUS_RESOLVERR 0x0040 #define AIM_CONN_STATUS_CONNERR 0x0080 #define AIM_CONN_STATUS_INPROGRESS 0x0100 #define AIM_FRAMETYPE_FLAP 0x0000 #define AIM_FRAMETYPE_OFT 0x0001 typedef struct aim_conn_s { int fd; fu16_t type; fu16_t subtype; flap_seqnum_t seqnum; fu32_t status; void *priv; /* misc data the client may want to store */ void *internal; /* internal conn-specific libfaim data */ time_t lastactivity; /* time of last transmit */ int forcedlatency; void *handlerlist; void *sessv; /* pointer to parent session */ void *inside; /* only accessible from inside libfaim */ struct aim_conn_s *next; } aim_conn_t; /* * Byte Stream type. Sort of. * * Use of this type serves a couple purposes: * - Buffer/buflen pairs are passed all around everywhere. This turns * that into one value, as well as abstracting it slightly. * - Through the abstraction, it is possible to enable bounds checking * for robustness at the cost of performance. But a clean failure on * weird packets is much better than a segfault. * - I like having variables named "bs". * * Don't touch the insides of this struct. Or I'll have to kill you. * */ typedef struct aim_bstream_s { fu8_t *data; fu32_t len; fu32_t offset; } aim_bstream_t; typedef struct aim_frame_s { fu8_t hdrtype; /* defines which piece of the union to use */ union { struct { fu8_t channel; flap_seqnum_t seqnum; } flap; struct { fu8_t magic[4]; /* ODC2 or OFT2 */ fu16_t hdrlen; fu16_t type; } rend; } hdr; aim_bstream_t data; /* payload stream */ aim_conn_t *conn; /* the connection it came in on/is going out on */ fu8_t handled; /* 0 = new, !0 = been handled */ struct aim_frame_s *next; } aim_frame_t; typedef struct aim_msgcookie_s { fu8_t cookie[8]; int type; void *data; time_t addtime; struct aim_msgcookie_s *next; } aim_msgcookie_t; /* * AIM Session: The main client-data interface. * */ typedef struct aim_session_s { /* ---- Client Accessible ------------------------ */ /* Our screen name. */ char sn[MAXSNLEN+1]; /* * Pointer to anything the client wants to * explicitly associate with this session. * * This is for use in the callbacks mainly. In any * callback, you can access this with sess->aux_data. * */ void *aux_data; /* ---- Internal Use Only ------------------------ */ /* Connection information */ aim_conn_t *connlist; /* * Transmit/receive queues. * * These are only used when you don't use your own lowlevel * I/O. I don't suggest that you use libfaim's internal I/O. * Its really bad and the API/event model is quirky at best. * */ aim_frame_t *queue_outgoing; aim_frame_t *queue_incoming; /* * Tx Enqueuing function. * * This is how you override the transmit direction of libfaim's * internal I/O. This function will be called whenever it needs * to send something. * */ int (*tx_enqueue)(struct aim_session_s *, aim_frame_t *); void *modlistv; struct { char server[128]; char username[128]; char password[128]; } socksproxy; fu8_t nonblocking; int debug; void (*debugcb)(struct aim_session_s *sess, int level, const char *format, va_list va); /* same as faim_debugging_callback_t */ /* * Outstanding snac handling * * XXX: Should these be per-connection? -mid */ void *snac_hash[FAIM_SNAC_HASH_SIZE]; aim_snacid_t snacid_next; aim_msgcookie_t *msgcookies; struct aim_icq_info *icq_info; struct aim_oft_info *oft_info; struct aim_authresp_info *authinfo; struct aim_emailinfo *emailinfo; struct { struct aim_userinfo_s *userinfo; struct userinfo_node *torequest; struct userinfo_node *requested; int waiting_for_response; } locate; /* Server-stored information (ssi) */ struct { int received_data; fu16_t numitems; struct aim_ssi_item *official; struct aim_ssi_item *local; struct aim_ssi_tmp *pending; time_t timestamp; int waiting_for_ack; } ssi; } aim_session_t; /* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ #define AIM_ICQ_STATE_NORMAL 0x00000000 #define AIM_ICQ_STATE_AWAY 0x00000001 #define AIM_ICQ_STATE_DND 0x00000002 #define AIM_ICQ_STATE_OUT 0x00000004 #define AIM_ICQ_STATE_BUSY 0x00000010 #define AIM_ICQ_STATE_CHAT 0x00000020 #define AIM_ICQ_STATE_INVISIBLE 0x00000100 #define AIM_ICQ_STATE_WEBAWARE 0x00010000 #define AIM_ICQ_STATE_HIDEIP 0x00020000 #define AIM_ICQ_STATE_BIRTHDAY 0x00080000 #define AIM_ICQ_STATE_DIRECTDISABLED 0x00100000 #define AIM_ICQ_STATE_ICQHOMEPAGE 0x00200000 #define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000 #define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000 /* * Get command from connections * * aim_get_commmand() is the libfaim lowlevel I/O in the receive direction. * XXX Make this easily overridable. * */ faim_export int aim_get_command(aim_session_t *, aim_conn_t *); /* * Dispatch commands that are in the rx queue. */ faim_export void aim_rxdispatch(aim_session_t *); faim_export int aim_debugconn_sendconnect(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_logoff(aim_session_t *); #if !defined(FAIM_INTERNAL) /* the library should never call aim_conn_kill */ faim_export void aim_conn_kill(aim_session_t *sess, aim_conn_t **deadconn); #endif typedef int (*aim_rxcallback_t)(aim_session_t *, aim_frame_t *, ...); /* auth.c */ struct aim_clientrelease { char *name; fu32_t build; char *url; char *info; }; struct aim_authresp_info { char *sn; fu16_t errorcode; char *errorurl; fu16_t regstatus; char *email; char *bosip; fu16_t cookielen; fu8_t *cookie; char *chpassurl; struct aim_clientrelease latestrelease; struct aim_clientrelease latestbeta; }; /* Callback data for redirect. */ struct aim_redirect_data { fu16_t group; const char *ip; fu16_t cookielen; const fu8_t *cookie; struct { /* group == AIM_CONN_TYPE_CHAT */ fu16_t exchange; const char *room; fu16_t instance; } chat; }; faim_export int aim_clientready(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn); faim_export int aim_send_login(aim_session_t *, aim_conn_t *, const char *, const char *, struct client_info_s *, const char *key); /* 0x000b */ faim_export int aim_auth_securid_send(aim_session_t *sess, const char *securid); faim_export void aim_purge_rxqueue(aim_session_t *); faim_export void aim_cleansnacs(aim_session_t *, int maxage); #define AIM_TX_QUEUED 0 /* default */ #define AIM_TX_IMMEDIATE 1 #define AIM_TX_USER 2 faim_export int aim_tx_setenqueue(aim_session_t *sess, int what, int (*func)(aim_session_t *, aim_frame_t *)); faim_export int aim_tx_flushqueue(aim_session_t *); faim_export void aim_tx_purgequeue(aim_session_t *); faim_export int aim_conn_setlatency(aim_conn_t *conn, int newval); faim_export int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t type, aim_rxcallback_t newhandler, fu16_t flags); faim_export int aim_clearhandlers(aim_conn_t *conn); faim_export aim_conn_t *aim_conn_findbygroup(aim_session_t *sess, fu16_t group); faim_export aim_session_t *aim_conn_getsess(aim_conn_t *conn); faim_export void aim_conn_close(aim_conn_t *deadconn); faim_export aim_conn_t *aim_newconn(aim_session_t *, int type, const char *dest); faim_export aim_conn_t *aim_select(aim_session_t *, struct timeval *, int *); faim_export int aim_conn_in_sess(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_conn_isready(aim_conn_t *); faim_export int aim_conn_setstatus(aim_conn_t *, int); faim_export int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_conn_isconnecting(aim_conn_t *conn); typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va); faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t); faim_export void aim_session_init(aim_session_t *, fu8_t nonblocking, int debuglevel); faim_export void aim_session_kill(aim_session_t *); faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password); faim_export aim_conn_t *aim_getconn_type(aim_session_t *, int type); faim_export aim_conn_t *aim_getconn_type_all(aim_session_t *, int type); faim_export aim_conn_t *aim_getconn_fd(aim_session_t *, int fd); /* 0x0001 - service.c */ faim_export int aim_srv_setavailmsg(aim_session_t *sess, const char *msg); faim_export int aim_srv_setidle(aim_session_t *sess, fu32_t idletime); /* misc.c */ #define AIM_VISIBILITYCHANGE_PERMITADD 0x05 #define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 #define AIM_VISIBILITYCHANGE_DENYADD 0x07 #define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08 #define AIM_PRIVFLAGS_ALLOWIDLE 0x01 #define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02 #define AIM_WARN_ANON 0x01 faim_export int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_nop(aim_session_t *, aim_conn_t *); faim_export int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_bos_changevisibility(aim_session_t *, aim_conn_t *, int, const char *); faim_export int aim_bos_setgroupperm(aim_session_t *, aim_conn_t *, fu32_t mask); faim_export int aim_bos_setprivacyflags(aim_session_t *, aim_conn_t *, fu32_t); faim_export int aim_reqpersonalinfo(aim_session_t *, aim_conn_t *); faim_export int aim_reqservice(aim_session_t *, aim_conn_t *, fu16_t); faim_export int aim_bos_reqrights(aim_session_t *, aim_conn_t *); faim_export int aim_setextstatus(aim_session_t *sess, fu32_t status); #define AIM_CLIENTTYPE_UNKNOWN 0x0000 #define AIM_CLIENTTYPE_MC 0x0001 #define AIM_CLIENTTYPE_WINAIM 0x0002 #define AIM_CLIENTTYPE_WINAIM41 0x0003 #define AIM_CLIENTTYPE_AOL_TOC 0x0004 faim_export fu16_t aim_im_fingerprint(const fu8_t *msghdr, int len); #define AIM_RATE_CODE_CHANGE 0x0001 #define AIM_RATE_CODE_WARNING 0x0002 #define AIM_RATE_CODE_LIMIT 0x0003 #define AIM_RATE_CODE_CLEARLIMIT 0x0004 faim_export int aim_ads_requestads(aim_session_t *sess, aim_conn_t *conn); /* im.c */ #define AIM_OFT_SUBTYPE_SEND_FILE 0x0001 #define AIM_OFT_SUBTYPE_SEND_DIR 0x0002 #define AIM_OFT_SUBTYPE_GET_FILE 0x0011 #define AIM_OPT_SUBTYPE_GET_LIST 0x0012 #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 #define AIM_TRANSFER_DENY_DECLINE 0x0001 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 #define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED 0x00000001 #define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED 0x00000002 /* This is what the server will give you if you don't set them yourself. */ #define AIM_IMPARAM_DEFAULTS { \ 0, \ AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \ 512, /* !! Note how small this is. */ \ (99.9)*10, (99.9)*10, \ 1000 /* !! And how large this is. */ \ } /* This is what most AIM versions use. */ #define AIM_IMPARAM_REASONABLE { \ 0, \ AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \ 8000, \ (99.9)*10, (99.9)*10, \ 0 \ } struct aim_icbmparameters { fu16_t maxchan; fu32_t flags; /* AIM_IMPARAM_FLAG_ */ fu16_t maxmsglen; /* message size that you will accept */ fu16_t maxsenderwarn; /* this and below are *10 (999=99.9%) */ fu16_t maxrecverwarn; fu32_t minmsginterval; /* in milliseconds? */ }; struct aim_chat_roominfo { fu16_t exchange; char *name; fu16_t instance; }; #define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */ #define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */ #define AIM_IMFLAGS_BUDDYREQ 0x0010 /* buddy icon requested */ #define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */ #define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */ #define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */ #define AIM_IMFLAGS_EXTDATA 0x0100 #define AIM_IMFLAGS_X 0x0200 #define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */ #define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */ #define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */ #define AIM_CHARSET_ASCII 0x0000 #define AIM_CHARSET_UNICODE 0x0002 /* UCS-2BE */ #define AIM_CHARSET_CUSTOM 0x0003 /* * Multipart message structures. */ typedef struct aim_mpmsg_section_s { fu16_t charset; fu16_t charsubset; fu8_t *data; fu16_t datalen; struct aim_mpmsg_section_s *next; } aim_mpmsg_section_t; typedef struct aim_mpmsg_s { unsigned int numparts; aim_mpmsg_section_t *parts; } aim_mpmsg_t; faim_export int aim_mpmsg_init(aim_session_t *sess, aim_mpmsg_t *mpm); faim_export int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, fu16_t charset, fu16_t charsubset, const fu8_t *data, fu16_t datalen); faim_export int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii); faim_export int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const fu16_t *unicode, fu16_t unicodelen); faim_export void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm); /* * Arguments to aim_send_im_ext(). * * This is really complicated. But immensely versatile. * */ struct aim_sendimext_args { /* These are _required_ */ const char *destsn; fu32_t flags; /* often 0 */ /* Only required if not using multipart messages */ const char *msg; int msglen; /* Required if ->msg is not provided */ aim_mpmsg_t *mpmsg; /* Only used if AIM_IMFLAGS_HASICON is set */ fu32_t iconlen; time_t iconstamp; fu32_t iconsum; /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */ fu16_t featureslen; fu8_t *features; /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */ fu16_t charset; fu16_t charsubset; }; /* * Arguments to aim_send_rtfmsg(). */ struct aim_sendrtfmsg_args { const char *destsn; fu32_t fgcolor; fu32_t bgcolor; const char *rtfmsg; /* must be in RTF */ }; /* * This information is provided in the Incoming ICBM callback for * Channel 1 ICBM's. * * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they * are optional, both are always set by the current libfaim code. * That may or may not change in the future. It is mainly for * consistency with aim_sendimext_args. * * Multipart messages require some explanation. If you want to use them, * I suggest you read all the comments in im.c. * */ struct aim_incomingim_ch1_args { /* Always provided */ aim_mpmsg_t mpmsg; fu32_t icbmflags; /* some flags apply only to ->msg, not all mpmsg */ /* Only provided if message has a human-readable section */ char *msg; int msglen; /* Only provided if AIM_IMFLAGS_HASICON is set */ time_t iconstamp; fu32_t iconlen; fu16_t iconsum; /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */ fu8_t *features; fu8_t featureslen; /* Only provided if AIM_IMFLAGS_EXTDATA is set */ fu8_t extdatalen; fu8_t *extdata; /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */ fu16_t charset; fu16_t charsubset; }; /* Valid values for channel 2 args->status */ #define AIM_RENDEZVOUS_PROPOSE 0x0000 #define AIM_RENDEZVOUS_CANCEL 0x0001 #define AIM_RENDEZVOUS_ACCEPT 0x0002 struct aim_incomingim_ch2_args { fu16_t status; fu8_t cookie[8]; int reqclass; const char *proxyip; const char *clientip; const char *verifiedip; fu16_t port; fu16_t errorcode; const char *msg; /* invite message or file description */ fu16_t msglen; const char *encoding; const char *language; union { struct { fu32_t checksum; fu32_t length; time_t timestamp; fu8_t *icon; } icon; struct { struct aim_chat_roominfo roominfo; } chat; struct { fu16_t msgtype; fu32_t fgcolor; fu32_t bgcolor; const char *rtfmsg; } rtfmsg; struct { fu16_t subtype; fu16_t totfiles; fu32_t totsize; char *filename; } sendfile; } info; void *destructor; /* used internally only */ }; /* Valid values for channel 4 args->type */ #define AIM_ICQMSG_AUTHREQUEST 0x0006 #define AIM_ICQMSG_AUTHDENIED 0x0007 #define AIM_ICQMSG_AUTHGRANTED 0x0008 struct aim_incomingim_ch4_args { fu32_t uin; /* Of the sender of the ICBM */ fu8_t type; fu8_t flags; char *msg; /* Reason for auth request, deny, or accept */ int msglen; }; /* SNAC sending functions */ /* 0x0002 */ faim_export int aim_im_setparams(aim_session_t *sess, struct aim_icbmparameters *params); /* 0x0004 */ faim_export int aim_im_reqparams(aim_session_t *sess); /* 0x0006 */ faim_export int aim_im_sendch1_ext(aim_session_t *sess, struct aim_sendimext_args *args); /* 0x0006 */ faim_export int aim_im_sendch1(aim_session_t *, const char *destsn, fu16_t flags, const char *msg); /* 0x0006 */ faim_export int aim_im_sendch2_chatinvite(aim_session_t *sess, const char *sn, const char *msg, fu16_t exchange, const char *roomname, fu16_t instance); /* 0x0006 */ faim_export int aim_im_sendch2_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum); /* 0x0006 */ faim_export int aim_im_sendch2_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args); /* 0x0006 */ faim_export int aim_im_sendch2_odcrequest(aim_session_t *sess, fu8_t *cookie, fu8_t usecookie, const char *sn, const fu8_t *ip, fu16_t port); /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_ask(aim_session_t *sess, struct aim_oft_info *oft_info); /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_accept(aim_session_t *sess, struct aim_oft_info *info); /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_cancel(aim_session_t *sess, struct aim_oft_info *oft_info); /* 0x0006 */ faim_export int aim_im_sendch2_geticqaway(aim_session_t *sess, const char *sn, int type); /* 0x0006 */ faim_export int aim_im_sendch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message); /* 0x0008 */ faim_export int aim_im_warn(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu32_t flags); /* 0x000b */ faim_export int aim_im_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, fu16_t code); /* 0x0014 */ faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, const char *sn, fu16_t type2); /* ft.c */ struct aim_fileheader_t { #if 0 char magic[4]; /* 0 */ fu16_t hdrlen; /* 4 */ fu16_t hdrtype; /* 6 */ #endif char bcookie[8]; /* 8 */ fu16_t encrypt; /* 16 */ fu16_t compress; /* 18 */ fu16_t totfiles; /* 20 */ fu16_t filesleft; /* 22 */ fu16_t totparts; /* 24 */ fu16_t partsleft; /* 26 */ fu32_t totsize; /* 28 */ fu32_t size; /* 32 */ fu32_t modtime; /* 36 */ fu32_t checksum; /* 40 */ fu32_t rfrcsum; /* 44 */ fu32_t rfsize; /* 48 */ fu32_t cretime; /* 52 */ fu32_t rfcsum; /* 56 */ fu32_t nrecvd; /* 60 */ fu32_t recvcsum; /* 64 */ fu8_t idstring[32]; /* 68 */ fu8_t flags; /* 100 */ fu8_t lnameoffset; /* 101 */ fu8_t lsizeoffset; /* 102 */ char dummy[69]; /* 103 */ char macfileinfo[16]; /* 172 */ fu16_t nencode; /* 188 */ fu16_t nlanguage; /* 190 */ char name[64]; /* 192 */ /* 256 */ }; struct aim_oft_info { char cookie[8]; char *sn; char *proxyip; char *clientip; char *verifiedip; fu16_t port; aim_conn_t *conn; aim_session_t *sess; struct aim_fileheader_t fh; struct aim_oft_info *next; }; faim_export fu32_t aim_oft_checksum_chunk(const fu8_t *buffer, int bufferlen, fu32_t prevcheck); faim_export fu32_t aim_oft_checksum_file(char *filename); faim_export int aim_handlerendconnect(aim_session_t *sess, aim_conn_t *cur); faim_export int aim_odc_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing); faim_export int aim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *msg, int len, int encoding, int isawaymsg); faim_export const char *aim_odc_getsn(aim_conn_t *conn); faim_export const char *aim_odc_getcookie(aim_conn_t *conn); faim_export aim_conn_t *aim_odc_getconn(aim_session_t *sess, const char *sn); faim_export aim_conn_t *aim_odc_initiate(aim_session_t *sess, const char *sn, int listenfd, const fu8_t *localip, fu16_t port, const fu8_t *mycookie); faim_export aim_conn_t *aim_odc_connect(aim_session_t *sess, const char *sn, const char *addr, const fu8_t *cookie); faim_export struct aim_oft_info *aim_oft_createinfo(aim_session_t *sess, const fu8_t *cookie, const char *sn, const char *ip, fu16_t port, fu32_t size, fu32_t modtime, char *filename); faim_export int aim_oft_destroyinfo(struct aim_oft_info *oft_info); faim_export int aim_sendfile_listen(aim_session_t *sess, struct aim_oft_info *oft_info, int listenfd); faim_export int aim_oft_sendheader(aim_session_t *sess, fu16_t type, struct aim_oft_info *oft_info); /* 0x0002 - locate.c */ /* * AIM User Info, Standard Form. */ #define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ #define AIM_FLAG_ADMINISTRATOR 0x0002 #define AIM_FLAG_AOL 0x0004 #define AIM_FLAG_OSCAR_PAY 0x0008 #define AIM_FLAG_FREE 0x0010 #define AIM_FLAG_AWAY 0x0020 #define AIM_FLAG_ICQ 0x0040 #define AIM_FLAG_WIRELESS 0x0080 #define AIM_FLAG_UNKNOWN100 0x0100 #define AIM_FLAG_UNKNOWN200 0x0200 #define AIM_FLAG_ACTIVEBUDDY 0x0400 #define AIM_FLAG_UNKNOWN800 0x0800 #define AIM_FLAG_ABINTERNAL 0x1000 #define AIM_FLAG_ALLUSERS 0x001f #define AIM_USERINFO_PRESENT_FLAGS 0x00000001 #define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002 #define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004 #define AIM_USERINFO_PRESENT_IDLE 0x00000008 #define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010 #define AIM_USERINFO_PRESENT_ICQIPADDR 0x00000020 #define AIM_USERINFO_PRESENT_ICQDATA 0x00000040 #define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080 #define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100 #define AIM_USERINFO_PRESENT_CREATETIME 0x00000200 struct userinfo_node { char *sn; struct userinfo_node *next; }; typedef struct aim_userinfo_s { char *sn; fu16_t warnlevel; /* evil percent * 10 (999 = 99.9%) */ fu16_t idletime; /* in seconds */ fu16_t flags; fu32_t createtime; /* time_t */ fu32_t membersince; /* time_t */ fu32_t onlinesince; /* time_t */ fu32_t sessionlen; /* in seconds */ fu32_t capabilities; struct { fu32_t status; fu32_t ipaddr; fu8_t crap[0x25]; /* until we figure it out... */ } icqinfo; fu32_t present; fu16_t iconcsumlen; fu8_t *iconcsum; char *info; char *info_encoding; fu16_t info_len; char *avail; char *avail_encoding; fu16_t avail_len; char *away; char *away_encoding; fu16_t away_len; struct aim_userinfo_s *next; } aim_userinfo_t; #define AIM_CAPS_BUDDYICON 0x00000001 #define AIM_CAPS_TALK 0x00000002 #define AIM_CAPS_DIRECTIM 0x00000004 #define AIM_CAPS_CHAT 0x00000008 #define AIM_CAPS_GETFILE 0x00000010 #define AIM_CAPS_SENDFILE 0x00000020 #define AIM_CAPS_GAMES 0x00000040 #define AIM_CAPS_ADDINS 0x00000080 #define AIM_CAPS_SENDBUDDYLIST 0x00000100 #define AIM_CAPS_GAMES2 0x00000200 #define AIM_CAPS_ICQ_DIRECT 0x00000400 #define AIM_CAPS_APINFO 0x00000800 #define AIM_CAPS_ICQRTF 0x00001000 #define AIM_CAPS_EMPTY 0x00002000 #define AIM_CAPS_ICQSERVERRELAY 0x00004000 #define AIM_CAPS_ICQUTF8OLD 0x00008000 #define AIM_CAPS_TRILLIANCRYPT 0x00010000 #define AIM_CAPS_ICQUTF8 0x00020000 #define AIM_CAPS_INTEROPERATE 0x00040000 #define AIM_CAPS_ICHAT 0x00080000 #define AIM_CAPS_HIPTOP 0x00100000 #define AIM_CAPS_SECUREIM 0x00200000 #define AIM_CAPS_SMS 0x00400000 #define AIM_CAPS_GENERICUNKNOWN 0x00800000 #define AIM_CAPS_VIDEO 0x01000000 #define AIM_CAPS_ICHATAV 0x02000000 #define AIM_CAPS_LIVEVIDEO 0x04000000 #define AIM_CAPS_CAMERA 0x08000000 #define AIM_CAPS_LAST 0x10000000 #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, fu32_t offset, fu32_t len, const fu8_t *buf, fu8_t flag); struct aim_invite_priv { char *sn; char *roomname; fu16_t exchange; fu16_t instance; }; #define AIM_COOKIETYPE_UNKNOWN 0x00 #define AIM_COOKIETYPE_ICBM 0x01 #define AIM_COOKIETYPE_ADS 0x02 #define AIM_COOKIETYPE_BOS 0x03 #define AIM_COOKIETYPE_IM 0x04 #define AIM_COOKIETYPE_CHAT 0x05 #define AIM_COOKIETYPE_CHATNAV 0x06 #define AIM_COOKIETYPE_INVITE 0x07 /* we'll move OFT up a bit to give breathing room. not like it really * matters. */ #define AIM_COOKIETYPE_OFTIM 0x10 #define AIM_COOKIETYPE_OFTGET 0x11 #define AIM_COOKIETYPE_OFTSEND 0x12 #define AIM_COOKIETYPE_OFTVOICE 0x13 #define AIM_COOKIETYPE_OFTIMAGE 0x14 #define AIM_COOKIETYPE_OFTICON 0x15 faim_export aim_userinfo_t *aim_locate_finduserinfo(aim_session_t *sess, const char *sn); faim_export void aim_locate_dorequest(aim_session_t *sess); /* 0x0002 */ faim_export int aim_locate_reqrights(aim_session_t *sess); /* 0x0004 */ faim_export int aim_locate_setprofile(aim_session_t *sess, const char *profile_encoding, const char *profile, const int profile_len, const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len); /* 0x0004 */ faim_export int aim_locate_setcaps(aim_session_t *sess, fu32_t caps); /* 0x0005 */ faim_export int aim_locate_getinfo(aim_session_t *sess, const char *, fu16_t); /* 0x0009 */ faim_export int aim_locate_setdirinfo(aim_session_t *sess, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy); /* 0x000b */ faim_export int aim_locate_000b(aim_session_t *sess, const char *sn); /* 0x000f */ faim_export int aim_locate_setinterests(aim_session_t *sess, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy); /* 0x0015 */ faim_export int aim_locate_getinfoshort(aim_session_t *sess, const char *sn, fu32_t flags); /* 0x0003 - buddylist.c */ /* 0x0002 */ faim_export int aim_buddylist_reqrights(aim_session_t *, aim_conn_t *); /* 0x0004 */ faim_export int aim_buddylist_set(aim_session_t *, aim_conn_t *, const char *); /* 0x0004 */ faim_export int aim_buddylist_addbuddy(aim_session_t *, aim_conn_t *, const char *); /* 0x0005 */ faim_export int aim_buddylist_removebuddy(aim_session_t *, aim_conn_t *, const char *); /* 0x000b */ faim_export int aim_buddylist_oncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info); /* 0x000c */ faim_export int aim_buddylist_offgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn); /* 0x000a - search.c */ faim_export int aim_search_address(aim_session_t *, aim_conn_t *, const char *); /* 0x000d - chatnav.c */ /* 0x000e - chat.c */ /* These apply to exchanges as well. */ #define AIM_CHATROOM_FLAG_EVILABLE 0x0001 #define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002 #define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004 #define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008 struct aim_chat_exchangeinfo { fu16_t number; fu16_t flags; char *name; char *charset1; char *lang1; char *charset2; char *lang2; }; #define AIM_CHATFLAGS_NOREFLECT 0x0001 #define AIM_CHATFLAGS_AWAY 0x0002 faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen, const char *encoding, const char *language); faim_export int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance); faim_export int aim_chat_attachname(aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance); faim_export char *aim_chat_getname(aim_conn_t *conn); faim_export aim_conn_t *aim_chat_getconn(aim_session_t *, const char *name); faim_export int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange); faim_export int aim_chat_leaveroom(aim_session_t *sess, const char *name); /* 0x000f - odir.c */ struct aim_odir { char *first; char *last; char *middle; char *maiden; char *email; char *country; char *state; char *city; char *sn; char *interest; char *nick; char *zip; char *region; char *address; struct aim_odir *next; }; faim_export int aim_odir_email(aim_session_t *, const char *, const char *); faim_export int aim_odir_name(aim_session_t *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *); faim_export int aim_odir_interest(aim_session_t *, const char *, const char *); /* 0x0010 - icon.c */ faim_export int aim_bart_upload(aim_session_t *sess, const fu8_t *icon, fu16_t iconlen); faim_export int aim_bart_request(aim_session_t *sess, const char *sn, const fu8_t *iconstr, fu16_t iconstrlen); /* 0x0013 - ssi.c */ #define AIM_SSI_TYPE_BUDDY 0x0000 #define AIM_SSI_TYPE_GROUP 0x0001 #define AIM_SSI_TYPE_PERMIT 0x0002 #define AIM_SSI_TYPE_DENY 0x0003 #define AIM_SSI_TYPE_PDINFO 0x0004 #define AIM_SSI_TYPE_PRESENCEPREFS 0x0005 #define AIM_SSI_TYPE_ICONINFO 0x0014 #define AIM_SSI_ACK_SUCCESS 0x0000 #define AIM_SSI_ACK_ITEMNOTFOUND 0x0002 #define AIM_SSI_ACK_IDNUMINUSE 0x000a #define AIM_SSI_ACK_ATMAX 0x000c #define AIM_SSI_ACK_INVALIDNAME 0x000d #define AIM_SSI_ACK_AUTHREQUIRED 0x000e struct aim_ssi_item { char *name; fu16_t gid; fu16_t bid; fu16_t type; struct aim_tlvlist_s *data; struct aim_ssi_item *next; }; struct aim_ssi_tmp { fu16_t action; fu16_t ack; char *name; struct aim_ssi_item *item; struct aim_ssi_tmp *next; }; /* These build the actual SNACs and queue them to be sent */ /* 0x0002 */ faim_export int aim_ssi_reqrights(aim_session_t *sess); /* 0x0004 */ faim_export int aim_ssi_reqdata(aim_session_t *sess); /* 0x0005 */ faim_export int aim_ssi_reqifchanged(aim_session_t *sess, time_t localstamp, fu16_t localrev); /* 0x0007 */ faim_export int aim_ssi_enable(aim_session_t *sess); /* 0x0008 */ faim_export int aim_ssi_addmoddel(aim_session_t *sess); /* 0x0011 */ faim_export int aim_ssi_modbegin(aim_session_t *sess); /* 0x0012 */ faim_export int aim_ssi_modend(aim_session_t *sess); /* 0x0014 */ faim_export int aim_ssi_sendauth(aim_session_t *sess, char *sn, char *msg); /* 0x0018 */ faim_export int aim_ssi_sendauthrequest(aim_session_t *sess, char *sn, char *msg); /* 0x001a */ faim_export int aim_ssi_sendauthreply(aim_session_t *sess, char *sn, fu8_t reply, char *msg); /* Client functions for retrieving SSI data */ faim_export struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, fu16_t gid, fu16_t bid); faim_export struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, fu16_t type); faim_export struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *sn); faim_export char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *sn); faim_export int aim_ssi_getpermdeny(struct aim_ssi_item *list); faim_export fu32_t aim_ssi_getpresence(struct aim_ssi_item *list); faim_export char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn); faim_export char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn); faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn); /* Client functions for changing SSI data */ faim_export int aim_ssi_addbuddy(aim_session_t *sess, const char *name, const char *group, const char *alias, const char *comment, const char *smsnum, int needauth); faim_export int aim_ssi_addpermit(aim_session_t *sess, const char *name); faim_export int aim_ssi_adddeny(aim_session_t *sess, const char *name); faim_export int aim_ssi_delbuddy(aim_session_t *sess, const char *name, const char *group); faim_export int aim_ssi_delpermit(aim_session_t *sess, const char *name); faim_export int aim_ssi_deldeny(aim_session_t *sess, const char *name); faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn); faim_export int aim_ssi_aliasbuddy(aim_session_t *sess, const char *gn, const char *sn, const char *alias); faim_export int aim_ssi_editcomment(aim_session_t *sess, const char *gn, const char *sn, const char *alias); faim_export int aim_ssi_rename_group(aim_session_t *sess, const char *oldgn, const char *newgn); faim_export int aim_ssi_cleanlist(aim_session_t *sess); faim_export int aim_ssi_deletelist(aim_session_t *sess); faim_export int aim_ssi_setpermdeny(aim_session_t *sess, fu8_t permdeny, fu32_t vismask); faim_export int aim_ssi_setpresence(aim_session_t *sess, fu32_t presence); faim_export int aim_ssi_seticon(aim_session_t *sess, fu8_t *iconsum, fu16_t iconsumlen); faim_export int aim_ssi_delicon(aim_session_t *sess); /* 0x0015 - icq.c */ #define AIM_ICQ_INFO_SIMPLE 0x001 #define AIM_ICQ_INFO_SUMMARY 0x002 #define AIM_ICQ_INFO_EMAIL 0x004 #define AIM_ICQ_INFO_PERSONAL 0x008 #define AIM_ICQ_INFO_ADDITIONAL 0x010 #define AIM_ICQ_INFO_WORK 0x020 #define AIM_ICQ_INFO_INTERESTS 0x040 #define AIM_ICQ_INFO_ORGS 0x080 #define AIM_ICQ_INFO_UNKNOWN 0x100 #define AIM_ICQ_INFO_HAVEALL 0x1ff struct aim_icq_offlinemsg { fu32_t sender; fu16_t year; fu8_t month, day, hour, minute; fu8_t type; fu8_t flags; char *msg; int msglen; }; struct aim_icq_info { fu16_t reqid; /* simple */ fu32_t uin; /* general and "home" information (0x00c8) */ char *nick; char *first; char *last; char *email; char *homecity; char *homestate; char *homephone; char *homefax; char *homeaddr; char *mobile; char *homezip; fu16_t homecountry; /* fu8_t timezone; fu8_t hideemail; */ /* personal (0x00dc) */ fu8_t age; fu8_t unknown; fu8_t gender; char *personalwebpage; fu16_t birthyear; fu8_t birthmonth; fu8_t birthday; fu8_t language1; fu8_t language2; fu8_t language3; /* work (0x00d2) */ char *workcity; char *workstate; char *workphone; char *workfax; char *workaddr; char *workzip; fu16_t workcountry; char *workcompany; char *workdivision; char *workposition; char *workwebpage; /* additional personal information (0x00e6) */ char *info; /* email (0x00eb) */ fu16_t numaddresses; char **email2; /* we keep track of these in a linked list because we're 1337 */ struct aim_icq_info *next; }; faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess); faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess); faim_export int aim_icq_setsecurity(aim_session_t *sess, const int auth, const int web, const int hide); faim_export int aim_icq_setauthsetting(aim_session_t *sess, int auth_required); faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd); faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin); faim_export int aim_icq_getalias(aim_session_t *sess, const char *uin); faim_export int aim_icq_getallinfo(aim_session_t *sess, const char *uin); /* 0x0017 - auth.c */ faim_export int aim_sendcookie(aim_session_t *, aim_conn_t *, const fu16_t length, const fu8_t *); faim_export int aim_admin_changepasswd(aim_session_t *, aim_conn_t *, const char *newpw, const char *curpw); faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info); faim_export int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newemail); faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick); /* 0x0018 - email.c */ struct aim_emailinfo { fu8_t *cookie16; fu8_t *cookie8; char *url; fu16_t nummsgs; fu8_t unread; char *domain; fu16_t flag; struct aim_emailinfo *next; }; faim_export int aim_email_sendcookies(aim_session_t *sess); faim_export int aim_email_activate(aim_session_t *sess); #if defined(FAIM_INTERNAL) || defined(FAIM_NEED_TLV) /* tlv.c - TLV handling */ /* TLV structure */ typedef struct aim_tlv_s { fu16_t type; fu16_t length; fu8_t *value; } aim_tlv_t; /* TLV List structure */ typedef struct aim_tlvlist_s { aim_tlv_t *tlv; struct aim_tlvlist_s *next; } aim_tlvlist_t; /* TLV handling functions */ faim_internal aim_tlv_t *aim_tlv_gettlv(aim_tlvlist_t *list, fu16_t type, const int nth); faim_internal int aim_tlv_getlength(aim_tlvlist_t *list, fu16_t type, const int nth); faim_internal char *aim_tlv_getstr(aim_tlvlist_t *list, const fu16_t type, const int nth); faim_internal fu8_t aim_tlv_get8(aim_tlvlist_t *list, const fu16_t type, const int nth); faim_internal fu16_t aim_tlv_get16(aim_tlvlist_t *list, const fu16_t type, const int nth); faim_internal fu32_t aim_tlv_get32(aim_tlvlist_t *list, const fu16_t type, const int nth); /* TLV list handling functions */ faim_internal aim_tlvlist_t *aim_tlvlist_read(aim_bstream_t *bs); faim_internal aim_tlvlist_t *aim_tlvlist_readnum(aim_bstream_t *bs, fu16_t num); faim_internal aim_tlvlist_t *aim_tlvlist_readlen(aim_bstream_t *bs, fu16_t len); faim_internal aim_tlvlist_t *aim_tlvlist_copy(aim_tlvlist_t *orig); faim_internal int aim_tlvlist_count(aim_tlvlist_t **list); faim_internal int aim_tlvlist_size(aim_tlvlist_t **list); faim_internal int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two); faim_internal int aim_tlvlist_write(aim_bstream_t *bs, aim_tlvlist_t **list); faim_internal void aim_tlvlist_free(aim_tlvlist_t **list); faim_internal int aim_tlvlist_add_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t length, const fu8_t *value); faim_internal int aim_tlvlist_add_noval(aim_tlvlist_t **list, const fu16_t type); faim_internal int aim_tlvlist_add_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value); faim_internal int aim_tlvlist_add_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value); faim_internal int aim_tlvlist_add_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value); faim_internal int aim_tlvlist_add_caps(aim_tlvlist_t **list, const fu16_t type, const fu32_t caps); faim_internal int aim_tlvlist_add_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *userinfo); faim_internal int aim_tlvlist_add_chatroom(aim_tlvlist_t **list, fu16_t type, fu16_t exchange, const char *roomname, fu16_t instance); faim_internal int aim_tlvlist_add_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl); faim_internal int aim_tlvlist_replace_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t lenth, const fu8_t *value); faim_internal int aim_tlvlist_replace_noval(aim_tlvlist_t **list, const fu16_t type); faim_internal int aim_tlvlist_replace_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value); faim_internal int aim_tlvlist_replace_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value); faim_internal int aim_tlvlist_replace_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value); faim_internal void aim_tlvlist_remove(aim_tlvlist_t **list, const fu16_t type); #endif /* FAIM_INTERNAL */ /* util.c */ /* * These are really ugly. You'd think this was LISP. I wish it was. * * XXX With the advent of bstream's, these should be removed to enforce * their use. * */ #define aimutil_put8(buf, data) ((*(buf) = (fu8_t)(data)&0xff),1) #define aimutil_get8(buf) ((*(buf))&0xff) #define aimutil_put16(buf, data) ( \ (*(buf) = (fu8_t)((data)>>8)&0xff), \ (*((buf)+1) = (fu8_t)(data)&0xff), \ 2) #define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) #define aimutil_put32(buf, data) ( \ (*((buf)) = (fu8_t)((data)>>24)&0xff), \ (*((buf)+1) = (fu8_t)((data)>>16)&0xff), \ (*((buf)+2) = (fu8_t)((data)>>8)&0xff), \ (*((buf)+3) = (fu8_t)(data)&0xff), \ 4) #define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \ (((*((buf)+1))<<16)&0x00ff0000) + \ (((*((buf)+2))<< 8)&0x0000ff00) + \ (((*((buf)+3) )&0x000000ff))) /* Little-endian versions (damn ICQ) */ #define aimutil_putle8(buf, data) ( \ (*(buf) = (fu8_t)(data) & 0xff), \ 1) #define aimutil_getle8(buf) ( \ (*(buf)) & 0xff \ ) #define aimutil_putle16(buf, data) ( \ (*((buf)+0) = (fu8_t)((data) >> 0) & 0xff), \ (*((buf)+1) = (fu8_t)((data) >> 8) & 0xff), \ 2) #define aimutil_getle16(buf) ( \ (((*((buf)+0)) << 0) & 0x00ff) + \ (((*((buf)+1)) << 8) & 0xff00) \ ) #define aimutil_putle32(buf, data) ( \ (*((buf)+0) = (fu8_t)((data) >> 0) & 0xff), \ (*((buf)+1) = (fu8_t)((data) >> 8) & 0xff), \ (*((buf)+2) = (fu8_t)((data) >> 16) & 0xff), \ (*((buf)+3) = (fu8_t)((data) >> 24) & 0xff), \ 4) #define aimutil_getle32(buf) ( \ (((*((buf)+0)) << 0) & 0x000000ff) + \ (((*((buf)+1)) << 8) & 0x0000ff00) + \ (((*((buf)+2)) << 16) & 0x00ff0000) + \ (((*((buf)+3)) << 24) & 0xff000000)) faim_export int aimutil_putstr(char *, const char *, int); faim_export fu16_t aimutil_iconsum(const fu8_t *buf, int buflen); faim_export int aimutil_tokslen(char *toSearch, int theindex, char dl); faim_export int aimutil_itemcnt(char *toSearch, char dl); faim_export char *aimutil_itemindex(char *toSearch, int theindex, char dl); faim_export int aim_snvalid(const char *sn); faim_export int aim_sn_is_icq(const char *sn); faim_export int aim_snlen(const char *sn); faim_export int aim_sncmp(const char *sn1, const char *sn2); #include #ifdef __cplusplus } #endif #endif /* __AIM_H__ */ pork-0.99.8.1/src/protocols/aim/libfaim/bos.c0000644000175000017500000001071310234217332020611 0ustar ryanryan00000000000000/* * Family 0x0009 - Basic Oscar Service. * * The functionality of this family has been replaced by SSI. */ #define FAIM_INTERNAL #include #include /* Subtype 0x0002 - Request BOS rights. */ faim_export int aim_bos_reqrights(aim_session_t *sess, aim_conn_t *conn) { return aim_genericreq_n_snacid(sess, conn, 0x0009, 0x0002); } /* Subtype 0x0003 - BOS Rights. */ static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; aim_tlvlist_t *tlvlist; fu16_t maxpermits = 0, maxdenies = 0; int ret = 0; /* * TLVs follow */ tlvlist = aim_tlvlist_read(bs); /* * TLV type 0x0001: Maximum number of buddies on permit list. */ if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) maxpermits = aim_tlv_get16(tlvlist, 0x0001, 1); /* * TLV type 0x0002: Maximum number of buddies on deny list. */ if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) maxdenies = aim_tlv_get16(tlvlist, 0x0002, 1); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, maxpermits, maxdenies); aim_tlvlist_free(&tlvlist); return ret; } /* * Subtype 0x0004 - Set group permission mask. * * Normally 0x1f (all classes). * * The group permission mask allows you to keep users of a certain * class or classes from talking to you. The mask should be * a bitwise OR of all the user classes you want to see you. * */ faim_export int aim_bos_setgroupperm(aim_session_t *sess, aim_conn_t *conn, fu32_t mask) { return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); } /* * Stubtypes 0x0005, 0x0006, 0x0007, and 0x0008 - Modify permit/deny lists. * * Changes your visibility depending on changetype: * * AIM_VISIBILITYCHANGE_PERMITADD: Lets provided list of names see you * AIM_VISIBILITYCHANGE_PERMIDREMOVE: Removes listed names from permit list * AIM_VISIBILITYCHANGE_DENYADD: Hides you from provided list of names * AIM_VISIBILITYCHANGE_DENYREMOVE: Lets list see you again * * list should be a list of * screen names in the form "Screen Name One&ScreenNameTwo&" etc. * * Equivelents to options in WinAIM: * - Allow all users to contact me: Send an AIM_VISIBILITYCHANGE_DENYADD * with only your name on it. * - Allow only users on my Buddy List: Send an * AIM_VISIBILITYCHANGE_PERMITADD with the list the same as your * buddy list * - Allow only the uesrs below: Send an AIM_VISIBILITYCHANGE_PERMITADD * with everyone listed that you want to see you. * - Block all users: Send an AIM_VISIBILITYCHANGE_PERMITADD with only * yourself in the list * - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with * the list of users to be blocked * * XXX ye gods. */ faim_export int aim_bos_changevisibility(aim_session_t *sess, aim_conn_t *conn, int changetype, const char *denylist) { aim_frame_t *fr; int packlen = 0; fu16_t subtype; char *localcpy = NULL, *tmpptr = NULL; int i; int listcount; aim_snacid_t snacid; if (!denylist) return -EINVAL; if (changetype == AIM_VISIBILITYCHANGE_PERMITADD) subtype = 0x05; else if (changetype == AIM_VISIBILITYCHANGE_PERMITREMOVE) subtype = 0x06; else if (changetype == AIM_VISIBILITYCHANGE_DENYADD) subtype = 0x07; else if (changetype == AIM_VISIBILITYCHANGE_DENYREMOVE) subtype = 0x08; else return -EINVAL; localcpy = strdup(denylist); listcount = aimutil_itemcnt(localcpy, '&'); packlen = aimutil_tokslen(localcpy, 99, '&') + listcount + 9; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, packlen))) { free(localcpy); return -ENOMEM; } snacid = aim_cachesnac(sess, 0x0009, subtype, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0009, subtype, 0x00, snacid); for (i = 0; (i < (listcount - 1)) && (i < 99); i++) { tmpptr = aimutil_itemindex(localcpy, i, '&'); aimbs_put8(&fr->data, strlen(tmpptr)); aimbs_putraw(&fr->data, tmpptr, strlen(tmpptr)); free(tmpptr); } free(localcpy); aim_tx_enqueue(sess, fr); return 0; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0003) return rights(sess, mod, rx, snac, bs); return 0; } faim_internal int bos_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0009; mod->version = 0x0001; mod->toolid = 0x0110; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "bos", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/icq.c0000644000175000017500000005067110234217334020613 0ustar ryanryan00000000000000/* * Family 0x0015 - Encapsulated ICQ. * */ #define FAIM_INTERNAL #include faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; bslen = 2 + 4 + 2 + 2; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x003c); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aim_tx_enqueue(sess, fr); return 0; } faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; bslen = 2 + 4 + 2 + 2; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x003e); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aim_tx_enqueue(sess, fr); return 0; } /** * Set your ICQ security. * * @param sess The oscar session. * @param auth Ask authorization when a buddy adds us? * @param web Show our presence on the ICQ web site. * @param hide Hide our IP address. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_icq_setsecurity(aim_session_t *sess, const int auth, const int web, const int hide) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; bslen = 2+4+2+2+2+4; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x0424); /* shrug. */ aimbs_putle8(&fr->data, (auth == TRUE) ? 0x00 : 0x01); aimbs_putle8(&fr->data, (web == TRUE) ? 0x00 : 0x01); aimbs_putle8(&fr->data, (hide == TRUE) ? 0x00 : 0x01); aimbs_putle8(&fr->data, 0x00); aim_tx_enqueue(sess, fr); return 0; } /** * I'm not really sure what the difference is between this function * and the one above. They both definitely exist. */ faim_export int aim_icq_setauthsetting(aim_session_t *sess, int auth_required) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; bslen = 2+4+2+2+2+4; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x0c3a); /* shrug. */ aimbs_putle16(&fr->data, 0x02f8); aimbs_putle16(&fr->data, 0x0001); aimbs_putle8(&fr->data, auth_required); aimbs_putle8(&fr->data, 0x0c); aimbs_putle16(&fr->data, 0x0103); aimbs_putle16(&fr->data, 0x0000); /* web enabled or not! */ aim_tx_enqueue(sess, fr); return 0; } /** * Change your ICQ password. * * @param sess The oscar session * @param passwd The new password. If this is longer than 8 characters it * will be truncated. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen, passwdlen; if (!passwd) return -EINVAL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; passwdlen = strlen(passwd); if (passwdlen > MAXICQPASSLEN) passwdlen = MAXICQPASSLEN; bslen = 2+4+2+2+2+2+passwdlen+1; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x042e); /* shrug. */ aimbs_putle16(&fr->data, passwdlen+1); aimbs_putraw(&fr->data, passwd, passwdlen); aimbs_putle8(&fr->data, '\0'); aim_tx_enqueue(sess, fr); return 0; } faim_export int aim_icq_getallinfo(aim_session_t *sess, const char *uin) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen; struct aim_icq_info *info; if (!uin || uin[0] < '0' || uin[0] > '9') return -EINVAL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; bslen = 2 + 4 + 2 + 2 + 2 + 4; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x04b2); /* shrug. */ aimbs_putle32(&fr->data, atoi(uin)); aim_tx_enqueue(sess, fr); /* Keep track of this request and the ICQ number and request ID */ info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); info->reqid = snacid; info->uin = atoi(uin); info->next = sess->icq_info; sess->icq_info = info; return 0; } faim_export int aim_icq_getalias(aim_session_t *sess, const char *uin) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen; struct aim_icq_info *info; if (!uin || uin[0] < '0' || uin[0] > '9') return -EINVAL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; bslen = 2 + 4 + 2 + 2 + 2 + 4; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x04ba); /* shrug. */ aimbs_putle32(&fr->data, atoi(uin)); aim_tx_enqueue(sess, fr); /* Keep track of this request and the ICQ number and request ID */ info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); info->reqid = snacid; info->uin = atoi(uin); info->next = sess->icq_info; sess->icq_info = info; return 0; } faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen; if (!uin || uin[0] < '0' || uin[0] > '9') return -EINVAL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; bslen = 2 + 4 + 2 + 2 + 2 + 4; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x051f); /* shrug. */ aimbs_putle32(&fr->data, atoi(uin)); aim_tx_enqueue(sess, fr); return 0; } faim_export int aim_icq_sendxmlreq(aim_session_t *sess, const char *xml) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen; if (!xml || !strlen(xml)) return -EINVAL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; bslen = 2 + 10 + 2 + strlen(xml) + 1; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x0998); /* shrug. */ aimbs_putle16(&fr->data, strlen(xml) + 1); aimbs_putraw(&fr->data, xml, strlen(xml) + 1); aim_tx_enqueue(sess, fr); return 0; } /* * Send an SMS message. This is the non-US way. The US-way is to IM * their cell phone number (+19195551234). * * We basically construct and send an XML message. The format is: * * full_phone_without_leading_+ * message * 1252 * self_uin * self_name * Yes|No * * * * Yeah hi Peter, whaaaat's happening. If there's any way to use * a codepage other than 1252 that would be great. Thaaaanks. */ faim_export int aim_icq_sendsms(aim_session_t *sess, const char *name, const char *msg, const char *alias) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int bslen, xmllen; char *xml, timestr[30]; time_t t; struct tm *tm; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) return -EINVAL; if (!name || !msg || !alias) return -EINVAL; time(&t); tm = gmtime(&t); strftime(timestr, 30, "%a, %d %b %Y %T %Z", tm); /* The length of xml included the null terminating character */ xmllen = 225 + strlen(name) + strlen(msg) + strlen(sess->sn) + strlen(alias) + strlen(timestr) + 1; if (!(xml = (char *)malloc(xmllen*sizeof(char)))) return -ENOMEM; snprintf(xml, xmllen, "\n" "\t%s\n" "\t%s\n" "\t1252\n" "\t%s\n" "\t%s\n" "\tYes\n" "\t\n" "\n", name, msg, sess->sn, alias, timestr); bslen = 37 + xmllen; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) { free(xml); return -ENOMEM; } snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); /* For simplicity, don't bother using a tlvlist */ aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, bslen); aimbs_putle16(&fr->data, bslen - 2); aimbs_putle32(&fr->data, atoi(sess->sn)); aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ /* From libicq200-0.3.2/src/SNAC-SRV.cpp */ aimbs_putle16(&fr->data, 0x8214); aimbs_put16(&fr->data, 0x0001); aimbs_put16(&fr->data, 0x0016); aimbs_put32(&fr->data, 0x00000000); aimbs_put32(&fr->data, 0x00000000); aimbs_put32(&fr->data, 0x00000000); aimbs_put32(&fr->data, 0x00000000); aimbs_put16(&fr->data, 0x0000); aimbs_put16(&fr->data, xmllen); aimbs_putraw(&fr->data, xml, xmllen); aim_tx_enqueue(sess, fr); free(xml); return 0; } static void aim_icq_freeinfo(struct aim_icq_info *info) { int i; if (!info) return; free(info->nick); free(info->first); free(info->last); free(info->email); free(info->homecity); free(info->homestate); free(info->homephone); free(info->homefax); free(info->homeaddr); free(info->mobile); free(info->homezip); free(info->personalwebpage); if (info->email2) for (i = 0; i < info->numaddresses; i++) free(info->email2[i]); free(info->email2); free(info->workcity); free(info->workstate); free(info->workphone); free(info->workfax); free(info->workaddr); free(info->workzip); free(info->workcompany); free(info->workdivision); free(info->workposition); free(info->workwebpage); free(info->info); free(info); } /** * Subtype 0x0003 - Response to 0x0015/0x002, contains an ICQesque packet. */ static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_tlvlist_t *tl; aim_tlv_t *datatlv; aim_bstream_t qbs; fu32_t ouruin; fu16_t cmdlen, cmd, reqid; if (!(tl = aim_tlvlist_read(bs)) || !(datatlv = aim_tlv_gettlv(tl, 0x0001, 1))) { aim_tlvlist_free(&tl); faimdprintf(sess, 0, "corrupt ICQ response\n"); return 0; } aim_bstream_init(&qbs, datatlv->value, datatlv->length); cmdlen = aimbs_getle16(&qbs); ouruin = aimbs_getle32(&qbs); cmd = aimbs_getle16(&qbs); reqid = aimbs_getle16(&qbs); faimdprintf(sess, 1, "icq response: %d bytes, %ld, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid); if (cmd == 0x0041) { /* offline message */ struct aim_icq_offlinemsg msg; aim_rxcallback_t userfunc; memset(&msg, 0, sizeof(msg)); msg.sender = aimbs_getle32(&qbs); msg.year = aimbs_getle16(&qbs); msg.month = aimbs_getle8(&qbs); msg.day = aimbs_getle8(&qbs); msg.hour = aimbs_getle8(&qbs); msg.minute = aimbs_getle8(&qbs); msg.type = aimbs_getle8(&qbs); msg.flags = aimbs_getle8(&qbs); msg.msglen = aimbs_getle16(&qbs); msg.msg = aimbs_getstr(&qbs, msg.msglen); if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG))) ret = userfunc(sess, rx, &msg); free(msg.msg); } else if (cmd == 0x0042) { aim_rxcallback_t userfunc; if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE))) ret = userfunc(sess, rx); } else if (cmd == 0x07da) { /* information */ fu16_t subtype; struct aim_icq_info *info; aim_rxcallback_t userfunc; subtype = aimbs_getle16(&qbs); aim_bstream_advance(&qbs, 1); /* 0x0a */ /* find other data from the same request */ for (info = sess->icq_info; info && (info->reqid != reqid); info = info->next); if (!info) { info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); info->reqid = reqid; info->next = sess->icq_info; sess->icq_info = info; } switch (subtype) { case 0x00a0: { /* hide ip status */ /* nothing */ } break; case 0x00aa: { /* password change status */ /* nothing */ } break; case 0x00c8: { /* general and "home" information */ info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->homecity = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->homestate = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->homephone = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->homefax = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->homeaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->mobile = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->homezip = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->homecountry = aimbs_getle16(&qbs); /* 0x0a 00 02 00 */ /* 1 byte timezone? */ /* 1 byte hide email flag? */ } break; case 0x00dc: { /* personal information */ info->age = aimbs_getle8(&qbs); info->unknown = aimbs_getle8(&qbs); info->gender = aimbs_getle8(&qbs); /* Not specified=0x00, Female=0x01, Male=0x02 */ info->personalwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->birthyear = aimbs_getle16(&qbs); info->birthmonth = aimbs_getle8(&qbs); info->birthday = aimbs_getle8(&qbs); info->language1 = aimbs_getle8(&qbs); info->language2 = aimbs_getle8(&qbs); info->language3 = aimbs_getle8(&qbs); /* 0x00 00 01 00 00 01 00 00 00 00 00 */ } break; case 0x00d2: { /* work information */ info->workcity = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->workstate = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->workphone = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->workfax = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->workaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->workzip = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->workcountry = aimbs_getle16(&qbs); info->workcompany = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->workdivision = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->workposition = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); aim_bstream_advance(&qbs, 2); /* 0x01 00 */ info->workwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); } break; case 0x00e6: { /* additional personal information */ info->info = aimbs_getstr(&qbs, aimbs_getle16(&qbs)-1); } break; case 0x00eb: { /* email address(es) */ int i; info->numaddresses = aimbs_getle16(&qbs); info->email2 = (char **)calloc(info->numaddresses, sizeof(char *)); for (i = 0; i < info->numaddresses; i++) { info->email2[i] = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); if (i+1 != info->numaddresses) aim_bstream_advance(&qbs, 1); /* 0x00 */ } } break; case 0x00f0: { /* personal interests */ } break; case 0x00fa: { /* past background and current organizations */ } break; case 0x0104: { /* alias info */ info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); aim_bstream_advance(&qbs, aimbs_getle16(&qbs)); /* email address? */ /* Then 0x00 02 00 */ } break; case 0x010e: { /* unknown */ /* 0x00 00 */ } break; case 0x019a: { /* simple info */ aim_bstream_advance(&qbs, 2); info->uin = aimbs_getle32(&qbs); info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); /* Then 0x00 02 00 00 00 00 00 */ } break; } /* End switch statement */ if (!(snac->flags & 0x0001)) { if (subtype != 0x0104) if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO))) ret = userfunc(sess, rx, info); if (info->uin && info->nick) if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS))) ret = userfunc(sess, rx, info); if (sess->icq_info == info) { sess->icq_info = info->next; } else { struct aim_icq_info *cur; for (cur=sess->icq_info; (cur->next && (cur->next!=info)); cur=cur->next); if (cur->next) cur->next = cur->next->next; } aim_icq_freeinfo(info); } } aim_tlvlist_free(&tl); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0003) return icqresponse(sess, mod, rx, snac, bs); return 0; } static void icq_shutdown(aim_session_t *sess, aim_module_t *mod) { struct aim_icq_info *del; while (sess->icq_info) { del = sess->icq_info; sess->icq_info = sess->icq_info->next; aim_icq_freeinfo(del); } return; } faim_internal int icq_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0015; mod->version = 0x0001; mod->toolid = 0x0110; mod->toolversion = 0x047c; mod->flags = 0; strncpy(mod->name, "icq", sizeof(mod->name)); mod->snachandler = snachandler; mod->shutdown = icq_shutdown; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/md5.c0000644000175000017500000002553010234217334020520 0ustar ryanryan00000000000000/* Copyright (C) 1999 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch ghost@aladdin.com */ /* Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321. It is derived directly from the text of the RFC and not from the reference implementation. The original and principal author of md5.c is L. Peter Deutsch . Other authors are noted in the change history that follows (in reverse chronological order): 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). 1999-05-03 lpd Original version. */ #include "md5.h" #include #ifdef TEST /* * Compile with -DTEST to create a self-contained executable test program. * The test program should print out the same values as given in section * A.5 of RFC 1321, reproduced below. */ #include main() { static const char *const test[7] = { "", /*d41d8cd98f00b204e9800998ecf8427e*/ "945399884.61923487334tuvga", /*0cc175b9c0f1b6a831c399e269772661*/ "abc", /*900150983cd24fb0d6963f7d28e17f72*/ "message digest", /*f96b697d7cb7938d525a2f31aaf161d0*/ "abcdefghijklmnopqrstuvwxyz", /*c3fcd3d76192e4007dfb496cca67e13b*/ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", /*d174ab98d277d9f5a5611c2c9f419d9f*/ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" /*57edf4a22be3c955ac49da2e2107b67a*/ }; int i; for (i = 0; i < 7; ++i) { md5_state_t state; md5_byte_t digest[16]; int di; md5_init(&state); md5_append(&state, (const md5_byte_t *)test[i], strlen(test[i])); md5_finish(&state, digest); printf("MD5 (\"%s\") = ", test[i]); for (di = 0; di < 16; ++di) printf("%02x", digest[di]); printf("\n"); } return 0; } #endif /* TEST */ /* * For reference, here is the program that computed the T values. */ #if 0 #include main() { int i; for (i = 1; i <= 64; ++i) { unsigned long v = (unsigned long)(4294967296.0 * fabs(sin((double)i))); printf("#define T%d 0x%08lx\n", i, v); } return 0; } #endif /* * End of T computation program. */ #define T1 0xd76aa478 #define T2 0xe8c7b756 #define T3 0x242070db #define T4 0xc1bdceee #define T5 0xf57c0faf #define T6 0x4787c62a #define T7 0xa8304613 #define T8 0xfd469501 #define T9 0x698098d8 #define T10 0x8b44f7af #define T11 0xffff5bb1 #define T12 0x895cd7be #define T13 0x6b901122 #define T14 0xfd987193 #define T15 0xa679438e #define T16 0x49b40821 #define T17 0xf61e2562 #define T18 0xc040b340 #define T19 0x265e5a51 #define T20 0xe9b6c7aa #define T21 0xd62f105d #define T22 0x02441453 #define T23 0xd8a1e681 #define T24 0xe7d3fbc8 #define T25 0x21e1cde6 #define T26 0xc33707d6 #define T27 0xf4d50d87 #define T28 0x455a14ed #define T29 0xa9e3e905 #define T30 0xfcefa3f8 #define T31 0x676f02d9 #define T32 0x8d2a4c8a #define T33 0xfffa3942 #define T34 0x8771f681 #define T35 0x6d9d6122 #define T36 0xfde5380c #define T37 0xa4beea44 #define T38 0x4bdecfa9 #define T39 0xf6bb4b60 #define T40 0xbebfbc70 #define T41 0x289b7ec6 #define T42 0xeaa127fa #define T43 0xd4ef3085 #define T44 0x04881d05 #define T45 0xd9d4d039 #define T46 0xe6db99e5 #define T47 0x1fa27cf8 #define T48 0xc4ac5665 #define T49 0xf4292244 #define T50 0x432aff97 #define T51 0xab9423a7 #define T52 0xfc93a039 #define T53 0x655b59c3 #define T54 0x8f0ccc92 #define T55 0xffeff47d #define T56 0x85845dd1 #define T57 0x6fa87e4f #define T58 0xfe2ce6e0 #define T59 0xa3014314 #define T60 0x4e0811a1 #define T61 0xf7537e82 #define T62 0xbd3af235 #define T63 0x2ad7d2bb #define T64 0xeb86d391 static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) { md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2], d = pms->abcd[3]; md5_word_t t; #ifndef ARCH_IS_BIG_ENDIAN # define ARCH_IS_BIG_ENDIAN 1 /* slower, default implementation */ #endif #if ARCH_IS_BIG_ENDIAN /* * On big-endian machines, we must arrange the bytes in the right * order. (This also works on machines of unknown byte order.) */ md5_word_t X[16]; const md5_byte_t *xp = data; int i; for (i = 0; i < 16; ++i, xp += 4) X[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); #else /* !ARCH_IS_BIG_ENDIAN */ /* * On little-endian machines, we can process properly aligned data * without copying it. */ md5_word_t xbuf[16]; const md5_word_t *X; if (!((data - (const md5_byte_t *)0) & 3)) { /* data are properly aligned */ X = (const md5_word_t *)data; } else { /* not aligned */ memcpy(xbuf, data, 64); X = xbuf; } #endif #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) /* Round 1. */ /* Let [abcd k s i] denote the operation a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ #define F(x, y, z) (((x) & (y)) | (~(x) & (z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + F(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 0, 7, T1); SET(d, a, b, c, 1, 12, T2); SET(c, d, a, b, 2, 17, T3); SET(b, c, d, a, 3, 22, T4); SET(a, b, c, d, 4, 7, T5); SET(d, a, b, c, 5, 12, T6); SET(c, d, a, b, 6, 17, T7); SET(b, c, d, a, 7, 22, T8); SET(a, b, c, d, 8, 7, T9); SET(d, a, b, c, 9, 12, T10); SET(c, d, a, b, 10, 17, T11); SET(b, c, d, a, 11, 22, T12); SET(a, b, c, d, 12, 7, T13); SET(d, a, b, c, 13, 12, T14); SET(c, d, a, b, 14, 17, T15); SET(b, c, d, a, 15, 22, T16); #undef SET /* Round 2. */ /* Let [abcd k s i] denote the operation a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ #define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + G(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 1, 5, T17); SET(d, a, b, c, 6, 9, T18); SET(c, d, a, b, 11, 14, T19); SET(b, c, d, a, 0, 20, T20); SET(a, b, c, d, 5, 5, T21); SET(d, a, b, c, 10, 9, T22); SET(c, d, a, b, 15, 14, T23); SET(b, c, d, a, 4, 20, T24); SET(a, b, c, d, 9, 5, T25); SET(d, a, b, c, 14, 9, T26); SET(c, d, a, b, 3, 14, T27); SET(b, c, d, a, 8, 20, T28); SET(a, b, c, d, 13, 5, T29); SET(d, a, b, c, 2, 9, T30); SET(c, d, a, b, 7, 14, T31); SET(b, c, d, a, 12, 20, T32); #undef SET /* Round 3. */ /* Let [abcd k s t] denote the operation a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ #define H(x, y, z) ((x) ^ (y) ^ (z)) #define SET(a, b, c, d, k, s, Ti)\ t = a + H(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 5, 4, T33); SET(d, a, b, c, 8, 11, T34); SET(c, d, a, b, 11, 16, T35); SET(b, c, d, a, 14, 23, T36); SET(a, b, c, d, 1, 4, T37); SET(d, a, b, c, 4, 11, T38); SET(c, d, a, b, 7, 16, T39); SET(b, c, d, a, 10, 23, T40); SET(a, b, c, d, 13, 4, T41); SET(d, a, b, c, 0, 11, T42); SET(c, d, a, b, 3, 16, T43); SET(b, c, d, a, 6, 23, T44); SET(a, b, c, d, 9, 4, T45); SET(d, a, b, c, 12, 11, T46); SET(c, d, a, b, 15, 16, T47); SET(b, c, d, a, 2, 23, T48); #undef SET /* Round 4. */ /* Let [abcd k s t] denote the operation a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ #define I(x, y, z) ((y) ^ ((x) | ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + I(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 0, 6, T49); SET(d, a, b, c, 7, 10, T50); SET(c, d, a, b, 14, 15, T51); SET(b, c, d, a, 5, 21, T52); SET(a, b, c, d, 12, 6, T53); SET(d, a, b, c, 3, 10, T54); SET(c, d, a, b, 10, 15, T55); SET(b, c, d, a, 1, 21, T56); SET(a, b, c, d, 8, 6, T57); SET(d, a, b, c, 15, 10, T58); SET(c, d, a, b, 6, 15, T59); SET(b, c, d, a, 13, 21, T60); SET(a, b, c, d, 4, 6, T61); SET(d, a, b, c, 11, 10, T62); SET(c, d, a, b, 2, 15, T63); SET(b, c, d, a, 9, 21, T64); #undef SET /* Then perform the following additions. (That is increment each of the four registers by the value it had before this block was started.) */ pms->abcd[0] += a; pms->abcd[1] += b; pms->abcd[2] += c; pms->abcd[3] += d; } void md5_init(md5_state_t *pms) { pms->count[0] = pms->count[1] = 0; pms->abcd[0] = 0x67452301; pms->abcd[1] = 0xefcdab89; pms->abcd[2] = 0x98badcfe; pms->abcd[3] = 0x10325476; } void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) { const md5_byte_t *p = data; int left = nbytes; int offset = (pms->count[0] >> 3) & 63; md5_word_t nbits = (md5_word_t)(nbytes << 3); if (nbytes <= 0) return; /* Update the message length. */ pms->count[1] += nbytes >> 29; pms->count[0] += nbits; if (pms->count[0] < nbits) pms->count[1]++; /* Process an initial partial block. */ if (offset) { int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); memcpy(pms->buf + offset, p, copy); if (offset + copy < 64) return; p += copy; left -= copy; md5_process(pms, pms->buf); } /* Process full blocks. */ for (; left >= 64; p += 64, left -= 64) md5_process(pms, p); /* Process a final partial block. */ if (left) memcpy(pms->buf, p, left); } void md5_finish(md5_state_t *pms, md5_byte_t digest[16]) { static const md5_byte_t pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; md5_byte_t data[8]; int i; /* Save the length before padding. */ for (i = 0; i < 8; ++i) data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); /* Pad to 56 bytes mod 64. */ md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); /* Append the length. */ md5_append(pms, data, 8); for (i = 0; i < 16; ++i) digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); } pork-0.99.8.1/src/protocols/aim/libfaim/md5.h0000644000175000017500000000565010234217334020526 0ustar ryanryan00000000000000/* Copyright (C) 1999 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch ghost@aladdin.com */ /* Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321. It is derived directly from the text of the RFC and not from the reference implementation. The original and principal author of md5.h is L. Peter Deutsch . Other authors are noted in the change history that follows (in reverse chronological order): 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); added conditionalization for C++ compilation from Martin Purschke . 1999-05-03 lpd Original version. */ #ifndef md5_INCLUDED # define md5_INCLUDED /* * This code has some adaptations for the Ghostscript environment, but it * will compile and run correctly in any environment with 8-bit chars and * 32-bit ints. Specifically, it assumes that if the following are * defined, they have the same meaning as in Ghostscript: P1, P2, P3, * ARCH_IS_BIG_ENDIAN. */ typedef unsigned char md5_byte_t; /* 8-bit byte */ typedef unsigned int md5_word_t; /* 32-bit word */ /* Define the state of the MD5 Algorithm. */ typedef struct md5_state_s { md5_word_t count[2]; /* message length in bits, lsw first */ md5_word_t abcd[4]; /* digest buffer */ md5_byte_t buf[64]; /* accumulate block */ } md5_state_t; #ifdef __cplusplus extern "C" { #endif /* Initialize the algorithm. */ #ifdef P1 void md5_init(P1(md5_state_t *pms)); #else void md5_init(md5_state_t *pms); #endif /* Append a string to the message. */ #ifdef P3 void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes)); #else void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); #endif /* Finish the message and return the digest. */ #ifdef P2 void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16])); #else void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); #endif #ifdef __cplusplus } /* end extern "C" */ #endif #endif /* md5_INCLUDED */ pork-0.99.8.1/src/protocols/aim/libfaim/ssi.c0000644000175000017500000015456310234217334020642 0ustar ryanryan00000000000000/* * Family 0x0013 - Server-Side/Stored Information. * * Relatively new facility that allows certain types of information, such as * a user's buddy list, permit/deny list, and permit/deny preferences, to be * stored on the server, so that they can be accessed from any client. * * We keep 2 copies of SSI data: * 1) An exact copy of what is stored on the AIM servers. * 2) A local copy that we make changes to, and then send diffs * between this and the exact copy to keep them in sync. * * All the "aim_ssi_itemlist_bleh" functions near the top just modify the list * that is given to them (i.e. they don't send SNACs). * * The SNAC sending and receiving functions are lower down in the file, and * they're simpler. They are in the order of the subtypes they deal with, * starting with the request rights function (subtype 0x0002), then parse * rights (subtype 0x0003), then--well, you get the idea. * * This is entirely too complicated. * You don't know the half of it. * */ #define FAIM_INTERNAL #include /** * Locally rebuild the 0x00c8 TLV in the additional data of the given group. * * @param list A pointer to a pointer to the current list of items. * @param name A null terminated string containing the group name, or NULL * if you want to modify the master group. * @return Return a pointer to the modified item. */ static struct aim_ssi_item *aim_ssi_itemlist_rebuildgroup(struct aim_ssi_item *list, const char *name) { int newlen; struct aim_ssi_item *cur, *group; if (!list) return NULL; /* Find the group */ if (!(group = aim_ssi_itemlist_finditem(list, name, NULL, AIM_SSI_TYPE_GROUP))) return NULL; /* Find the length for the new additional data */ newlen = 0; if (group->gid == 0x0000) { for (cur=list; cur; cur=cur->next) if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) newlen += 2; } else { for (cur=list; cur; cur=cur->next) if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) newlen += 2; } /* Build the new TLV list */ if (newlen > 0) { fu8_t *newdata; if (!(newdata = (fu8_t *)malloc((newlen)*sizeof(fu8_t)))) return NULL; newlen = 0; if (group->gid == 0x0000) { for (cur=list; cur; cur=cur->next) if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) newlen += aimutil_put16(newdata+newlen, cur->gid); } else { for (cur=list; cur; cur=cur->next) if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) newlen += aimutil_put16(newdata+newlen, cur->bid); } aim_tlvlist_replace_raw(&group->data, 0x00c8, newlen, newdata); free(newdata); } return group; } /** * Locally add a new item to the given item list. * * @param list A pointer to a pointer to the current list of items. * @param name A null terminated string of the name of the new item, or NULL if the * item should have no name. * @param gid The group ID# you want the new item to have, or 0xFFFF if we should pick something. * @param bid The buddy ID# you want the new item to have, or 0xFFFF if we should pick something. * @param type The type of the item, 0x0000 for a contact, 0x0001 for a group, etc. * @param data The additional data for the new item. * @return A pointer to the newly created item. */ static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, const char *name, fu16_t gid, fu16_t bid, fu16_t type, aim_tlvlist_t *data) { int i; struct aim_ssi_item *cur, *new; if (!list) return NULL; if (!(new = (struct aim_ssi_item *)malloc(sizeof(struct aim_ssi_item)))) return NULL; /* Set the name */ if (name) { new->name = (char *)malloc((strlen(name)+1)*sizeof(char)); strcpy(new->name, name); } else new->name = NULL; /* Set the group ID# and buddy ID# */ new->gid = gid; new->bid = bid; if (type == AIM_SSI_TYPE_GROUP) { if ((new->gid == 0xFFFF) && name) { do { new->gid += 0x0001; for (cur=*list, i=0; ((cur) && (!i)); cur=cur->next) if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid == new->gid)) i=1; } while (i); } } else { if (new->bid == 0xFFFF) { do { new->bid += 0x0001; for (cur=*list, i=0; ((cur) && (!i)); cur=cur->next) if ((cur->bid == new->bid) && (cur->gid == new->gid)) i=1; } while (i); } } /* Set the type */ new->type = type; /* Set the TLV list */ new->data = aim_tlvlist_copy(data); /* Add the item to the list in the correct numerical position. Fancy, eh? */ if (*list) { if ((new->gid < (*list)->gid) || ((new->gid == (*list)->gid) && (new->bid < (*list)->bid))) { new->next = *list; *list = new; } else { struct aim_ssi_item *prev; for ((prev=*list, cur=(*list)->next); (cur && ((new->gid > cur->gid) || ((new->gid == cur->gid) && (new->bid > cur->bid)))); prev=cur, cur=cur->next); new->next = prev->next; prev->next = new; } } else { new->next = *list; *list = new; } return new; } /** * Locally delete an item from the given item list. * * @param list A pointer to a pointer to the current list of items. * @param del A pointer to the item you want to remove from the list. * @return Return 0 if no errors, otherwise return the error number. */ static int aim_ssi_itemlist_del(struct aim_ssi_item **list, struct aim_ssi_item *del) { if (!list || !(*list) || !del) return -EINVAL; /* Remove the item from the list */ if (*list == del) { *list = (*list)->next; } else { struct aim_ssi_item *cur; for (cur=*list; (cur->next && (cur->next!=del)); cur=cur->next); if (cur->next) cur->next = del->next; } /* Free the removed item */ free(del->name); aim_tlvlist_free(&del->data); free(del); return 0; } /** * Compare two items to see if they have the same data. * * @param cur1 A pointer to a pointer to the first item. * @param cur2 A pointer to a pointer to the second item. * @return Return 0 if no differences, or a number if there are differences. */ static int aim_ssi_itemlist_cmp(struct aim_ssi_item *cur1, struct aim_ssi_item *cur2) { if (!cur1 || !cur2) return 1; if (cur1->data && !cur2->data) return 2; if (!cur1->data && cur2->data) return 3; if ((cur1->data && cur2->data) && (aim_tlvlist_cmp(cur1->data, cur2->data))) return 4; if (cur1->name && !cur2->name) return 5; if (!cur1->name && cur2->name) return 6; if (cur1->name && cur2->name && aim_sncmp(cur1->name, cur2->name)) return 7; if (cur1->gid != cur2->gid) return 8; if (cur1->bid != cur2->bid) return 9; if (cur1->type != cur2->type) return 10; return 0; } faim_export int aim_ssi_itemlist_valid(struct aim_ssi_item *list, struct aim_ssi_item *item) { struct aim_ssi_item *cur; for (cur=list; cur; cur=cur->next) if (cur == item) return 1; return 0; } /** * Locally find an item given a group ID# and a buddy ID#. * * @param list A pointer to the current list of items. * @param gid The group ID# of the desired item. * @param bid The buddy ID# of the desired item. * @return Return a pointer to the item if found, else return NULL; */ faim_export struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, fu16_t gid, fu16_t bid) { struct aim_ssi_item *cur; for (cur=list; cur; cur=cur->next) if ((cur->gid == gid) && (cur->bid == bid)) return cur; return NULL; } /** * Locally find an item given a group name, screen name, and type. If group name * and screen name are null, then just return the first item of the given type. * * @param list A pointer to the current list of items. * @param gn The group name of the desired item. * @param bn The buddy name of the desired item. * @param type The type of the desired item. * @return Return a pointer to the item if found, else return NULL. */ faim_export struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, fu16_t type) { struct aim_ssi_item *cur; if (!list) return NULL; if (gn && sn) { /* For finding buddies in groups */ for (cur=list; cur; cur=cur->next) if ((cur->type == type) && (cur->name) && !(aim_sncmp(cur->name, sn))) { struct aim_ssi_item *curg; for (curg=list; curg; curg=curg->next) if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid) && (curg->name) && !(aim_sncmp(curg->name, gn))) return cur; } } else if (gn) { /* For finding groups */ for (cur=list; cur; cur=cur->next) { if ((cur->type == type) && (cur->bid == 0x0000) && (cur->name) && !(aim_sncmp(cur->name, gn))) { return cur; } } } else if (sn) { /* For finding permits, denies, and ignores */ for (cur=list; cur; cur=cur->next) { if ((cur->type == type) && (cur->name) && !(aim_sncmp(cur->name, sn))) { return cur; } } /* For stuff without names--permit deny setting, visibility mask, etc. */ } else for (cur=list; cur; cur=cur->next) { if ((cur->type == type) && (!cur->name)) return cur; } return NULL; } /** * Check if the given buddy exists in any group in the buddy list. * * @param list A pointer to the current list of items. * @param sn The group name of the desired item. * @return Return a pointer to the name of the item if found, else return NULL; */ faim_export struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *sn) { struct aim_ssi_item *cur; if (!list || !sn) return NULL; for (cur=list; cur; cur=cur->next) if ((cur->type == AIM_SSI_TYPE_BUDDY) && (cur->name) && (!aim_sncmp(cur->name, sn))) return cur; return NULL; } /** * Locally find the parent item of the given buddy name. * * @param list A pointer to the current list of items. * @param bn The buddy name of the desired item. * @return Return a pointer to the name of the item if found, else return NULL; */ faim_export char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *sn) { struct aim_ssi_item *cur, *curg; if (!list || !sn) return NULL; if (!(cur = aim_ssi_itemlist_exists(list, sn))) return NULL; if (!(curg = aim_ssi_itemlist_find(list, cur->gid, 0x0000))) return NULL; return curg->name; } /** * Locally find the permit/deny setting item, and return the setting. * * @param list A pointer to the current list of items. * @return Return the current SSI permit deny setting, or 0 if no setting was found. */ faim_export int aim_ssi_getpermdeny(struct aim_ssi_item *list) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PDINFO); if (cur) { aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00ca, 1); if (tlv && tlv->value) return aimutil_get8(tlv->value); } return 0; } /** * Locally find the presence flag item, and return the setting. The returned setting is a * bitmask of the user flags that you are visible to. See the AIM_FLAG_* #defines * in aim.h * * @param list A pointer to the current list of items. * @return Return the current visibility mask. */ faim_export fu32_t aim_ssi_getpresence(struct aim_ssi_item *list) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS); if (cur) { aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00c9, 1); if (tlv && tlv->length) return aimutil_get32(tlv->value); } return 0xFFFFFFFF; } /** * Locally find the alias of the given buddy. * * @param list A pointer to the current list of items. * @param gn The group of the buddy. * @param sn The name of the buddy. * @return A pointer to a NULL terminated string that is the buddy's * alias, or NULL if the buddy has no alias. You should free * this returned value! */ faim_export char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, sn, AIM_SSI_TYPE_BUDDY); if (cur) { aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x0131, 1); if (tlv && tlv->length) { char *alias = (char *)malloc((tlv->length+1)*sizeof(char)); strncpy(alias, tlv->value, tlv->length); alias[tlv->length] = 0; return alias; } } return NULL; } /** * Locally find the comment of the given buddy. * * @param list A pointer to the current list of items. * @param gn The group of the buddy. * @param sn The name of the buddy. * @return A pointer to a NULL terminated string that is the buddy's * comment, or NULL if the buddy has no comment. You should free * this returned value! */ faim_export char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, sn, AIM_SSI_TYPE_BUDDY); if (cur) { aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x013c, 1); if (tlv && tlv->length) { char *alias = (char *)malloc((tlv->length+1)*sizeof(char)); strncpy(alias, tlv->value, tlv->length); alias[tlv->length] = 0; return alias; } } return NULL; } /** * Locally find if you are waiting for authorization for a buddy. * * @param list A pointer to the current list of items. * @param gn The group of the buddy. * @param sn The name of the buddy. * @return A pointer to a NULL terminated string that is the buddies * alias, or NULL if the buddy has no alias. You should free * this returned value! */ faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, sn, AIM_SSI_TYPE_BUDDY); if (cur) { if (aim_tlv_gettlv(cur->data, 0x0066, 1)) return 1; } return 0; } /** * If there are changes, then create temporary items and * call addmoddel. * * @param sess The oscar session. * @return Return 0 if no errors, otherwise return the error number. */ static int aim_ssi_sync(aim_session_t *sess) { struct aim_ssi_item *cur1, *cur2; struct aim_ssi_tmp *cur, *new; if (!sess) return -EINVAL; /* If we're waiting for an ack, we shouldn't do anything else */ if (sess->ssi.waiting_for_ack) return 0; /* * Compare the 2 lists and create an aim_ssi_tmp for each difference. * We should only send either additions, modifications, or deletions * before waiting for an acknowledgement. So first do deletions, then * additions, then modifications. Also, both the official and the local * list should be in ascending numerical order for the group ID#s and the * buddy ID#s, which makes things more efficient. I think. */ /* Additions */ if (!sess->ssi.pending) { for (cur1=sess->ssi.local; cur1; cur1=cur1->next) { if (!aim_ssi_itemlist_find(sess->ssi.official, cur1->gid, cur1->bid)) { new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp)); new->action = AIM_CB_SSI_ADD; new->ack = 0xffff; new->name = NULL; new->item = cur1; new->next = NULL; if (sess->ssi.pending) { for (cur=sess->ssi.pending; cur->next; cur=cur->next); cur->next = new; } else sess->ssi.pending = new; } } } /* Deletions */ if (!sess->ssi.pending) { for (cur1=sess->ssi.official; cur1; cur1=cur1->next) { if (!aim_ssi_itemlist_find(sess->ssi.local, cur1->gid, cur1->bid)) { new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp)); new->action = AIM_CB_SSI_DEL; new->ack = 0xffff; new->name = NULL; new->item = cur1; new->next = NULL; if (sess->ssi.pending) { for (cur=sess->ssi.pending; cur->next; cur=cur->next); cur->next = new; } else sess->ssi.pending = new; } } } /* Modifications */ if (!sess->ssi.pending) { for (cur1=sess->ssi.local; cur1; cur1=cur1->next) { cur2 = aim_ssi_itemlist_find(sess->ssi.official, cur1->gid, cur1->bid); if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) { new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp)); new->action = AIM_CB_SSI_MOD; new->ack = 0xffff; new->name = NULL; new->item = cur1; new->next = NULL; if (sess->ssi.pending) { for (cur=sess->ssi.pending; cur->next; cur=cur->next); cur->next = new; } else sess->ssi.pending = new; } } } /* We're out of stuff to do, so tell the AIM servers we're done and exit */ if (!sess->ssi.pending) { aim_ssi_modend(sess); return 0; } /* Make sure we don't send anything else between now * and when we receive the ack for the following operation */ sess->ssi.waiting_for_ack = 1; /* Now go mail off our data and wait 4 to 6 weeks */ aim_ssi_addmoddel(sess); return 0; } /** * Free all SSI data. * * This doesn't remove it from the server, that's different. * * @param sess The oscar session. * @return Return 0 if no errors, otherwise return the error number. */ static int aim_ssi_freelist(aim_session_t *sess) { struct aim_ssi_item *cur, *del; struct aim_ssi_tmp *curtmp, *deltmp; cur = sess->ssi.official; while (cur) { del = cur; cur = cur->next; free(del->name); aim_tlvlist_free(&del->data); free(del); } cur = sess->ssi.local; while (cur) { del = cur; cur = cur->next; free(del->name); aim_tlvlist_free(&del->data); free(del); } curtmp = sess->ssi.pending; while (curtmp) { deltmp = curtmp; curtmp = curtmp->next; free(deltmp); } sess->ssi.numitems = 0; sess->ssi.official = NULL; sess->ssi.local = NULL; sess->ssi.pending = NULL; sess->ssi.timestamp = (time_t)0; return 0; } /** * Delete all SSI data. * * @param sess The oscar session. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_deletelist(aim_session_t *sess) { struct aim_ssi_item *cur, *del; if (!sess) return -EINVAL; /* Free the local list */ cur = sess->ssi.local; while (cur) { del = cur; cur = cur->next; free(del->name); aim_tlvlist_free(&del->data); free(del); } sess->ssi.local = NULL; /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * This "cleans" the ssi list. It does the following: * 1) Makes sure all buddies, permits, and denies have names. * 2) Makes sure that all buddies are in a group that exist. * 3) Deletes any empty groups * * @param sess The oscar session. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_cleanlist(aim_session_t *sess) { struct aim_ssi_item *cur, *next; if (!sess) return -EINVAL; /* Delete any buddies, permits, or denies with empty names. */ /* If there are any buddies directly in the master group, add them to a real group. */ /* DESTROY any buddies that are directly in the master group. */ /* Do the same for buddies that are in a non-existant group. */ /* This will kind of mess up if you hit the item limit, but this function isn't too critical */ cur = sess->ssi.local; while (cur) { next = cur->next; if (!cur->name) { if (cur->type == AIM_SSI_TYPE_BUDDY) aim_ssi_delbuddy(sess, NULL, NULL); else if (cur->type == AIM_SSI_TYPE_PERMIT) aim_ssi_delpermit(sess, NULL); else if (cur->type == AIM_SSI_TYPE_DENY) aim_ssi_deldeny(sess, NULL); } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(sess->ssi.local, cur->gid, 0x0000)))) { aim_ssi_addbuddy(sess, cur->name, "orphans", NULL, NULL, NULL, 0); aim_ssi_delbuddy(sess, cur->name, NULL); } cur = next; } /* Check if there are empty groups and delete them */ cur = sess->ssi.local; while (cur) { next = cur->next; if (cur->type == AIM_SSI_TYPE_GROUP) { aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00c8, 1); if (!tlv || !tlv->length) aim_ssi_itemlist_del(&sess->ssi.local, cur); } cur = next; } /* Check if the master group is empty */ if ((cur = aim_ssi_itemlist_find(sess->ssi.local, 0x0000, 0x0000)) && (!cur->data)) aim_ssi_itemlist_del(&sess->ssi.local, cur); return 0; } /** * Add a buddy to the list. * * @param sess The oscar session. * @param name The name of the item. * @param group The group of the item. * @param alias The alias/nickname of the item, or NULL. * @param comment The buddy comment for the item, or NULL. * @param smsnum The locally assigned SMS number, or NULL. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_addbuddy(aim_session_t *sess, const char *name, const char *group, const char *alias, const char *comment, const char *smsnum, int needauth) { struct aim_ssi_item *parent; aim_tlvlist_t *data = NULL; if (!sess || !name || !group) return -EINVAL; /* Find the parent */ if (!(parent = aim_ssi_itemlist_finditem(sess->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) { /* Find the parent's parent (the master group) */ if (!(parent = aim_ssi_itemlist_find(sess->ssi.local, 0x0000, 0x0000))) if (!(parent = aim_ssi_itemlist_add(&sess->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL))) return -ENOMEM; /* Add the parent */ if (!(parent = aim_ssi_itemlist_add(&sess->ssi.local, group, 0xFFFF, 0x0000, AIM_SSI_TYPE_GROUP, NULL))) return -ENOMEM; /* Modify the parent's parent (the master group) */ aim_ssi_itemlist_rebuildgroup(sess->ssi.local, NULL); } /* Create a TLV list for the new buddy */ if (needauth) aim_tlvlist_add_noval(&data, 0x0066); if (alias) aim_tlvlist_add_raw(&data, 0x0131, strlen(alias), alias); if (smsnum) aim_tlvlist_add_raw(&data, 0x013a, strlen(smsnum), smsnum); if (comment) aim_tlvlist_add_raw(&data, 0x013c, strlen(comment), comment); /* Add that bad boy */ aim_ssi_itemlist_add(&sess->ssi.local, name, parent->gid, 0xFFFF, AIM_SSI_TYPE_BUDDY, data); aim_tlvlist_free(&data); /* Modify the parent group */ aim_ssi_itemlist_rebuildgroup(sess->ssi.local, group); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Add a permit buddy to the list. * * @param sess The oscar session. * @param name The name of the item.. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_addpermit(aim_session_t *sess, const char *name) { if (!sess || !name) return -EINVAL; /* Add that bad boy */ aim_ssi_itemlist_add(&sess->ssi.local, name, 0x0000, 0xFFFF, AIM_SSI_TYPE_PERMIT, NULL); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Add a deny buddy to the list. * * @param sess The oscar session. * @param name The name of the item.. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_adddeny(aim_session_t *sess, const char *name) { if (!sess || !name) return -EINVAL; /* Add that bad boy */ aim_ssi_itemlist_add(&sess->ssi.local, name, 0x0000, 0xFFFF, AIM_SSI_TYPE_DENY, NULL); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Deletes a buddy from the list. * * @param sess The oscar session. * @param name The name of the item, or NULL. * @param group The group of the item, or NULL. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_delbuddy(aim_session_t *sess, const char *name, const char *group) { struct aim_ssi_item *del; if (!sess) return -EINVAL; /* Find the buddy */ if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, group, name, AIM_SSI_TYPE_BUDDY))) return -EINVAL; /* Remove the item from the list */ aim_ssi_itemlist_del(&sess->ssi.local, del); /* Modify the parent group */ aim_ssi_itemlist_rebuildgroup(sess->ssi.local, group); /* Check if we should delete the parent group */ if ((del = aim_ssi_itemlist_finditem(sess->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP)) && (!del->data)) { aim_ssi_itemlist_del(&sess->ssi.local, del); /* Modify the parent group */ aim_ssi_itemlist_rebuildgroup(sess->ssi.local, NULL); /* Check if we should delete the parent's parent (the master group) */ if ((del = aim_ssi_itemlist_find(sess->ssi.local, 0x0000, 0x0000)) && (!del->data)) { aim_ssi_itemlist_del(&sess->ssi.local, del); } } /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Deletes a permit buddy from the list. * * @param sess The oscar session. * @param name The name of the item, or NULL. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_delpermit(aim_session_t *sess, const char *name) { struct aim_ssi_item *del; if (!sess) return -EINVAL; /* Find the item */ if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, name, AIM_SSI_TYPE_PERMIT))) return -EINVAL; /* Remove the item from the list */ aim_ssi_itemlist_del(&sess->ssi.local, del); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Deletes a deny buddy from the list. * * @param sess The oscar session. * @param name The name of the item, or NULL. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_deldeny(aim_session_t *sess, const char *name) { struct aim_ssi_item *del; if (!sess) return -EINVAL; /* Find the item */ if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, name, AIM_SSI_TYPE_DENY))) return -EINVAL; /* Remove the item from the list */ aim_ssi_itemlist_del(&sess->ssi.local, del); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Move a buddy from one group to another group. This basically just deletes the * buddy and re-adds it. * * @param sess The oscar session. * @param oldgn The group that the buddy is currently in. * @param newgn The group that the buddy should be moved in to. * @param sn The name of the buddy to be moved. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn) { aim_ssi_addbuddy(sess, sn, newgn, aim_ssi_getalias(sess->ssi.local, oldgn, sn), NULL, NULL, aim_ssi_waitingforauth(sess->ssi.local, oldgn, sn)); aim_ssi_delbuddy(sess, sn, oldgn); return 0; } /** * Change the alias stored on the server for a given buddy. * * @param sess The oscar session. * @param gn The group that the buddy is currently in. * @param sn The screen name of the buddy. * @param alias The new alias for the buddy, or NULL if you want to remove * a buddy's comment. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_aliasbuddy(aim_session_t *sess, const char *gn, const char *sn, const char *alias) { struct aim_ssi_item *tmp; if (!sess || !gn || !sn) return -EINVAL; if (!(tmp = aim_ssi_itemlist_finditem(sess->ssi.local, gn, sn, AIM_SSI_TYPE_BUDDY))) return -EINVAL; /* Either add or remove the 0x0131 TLV from the TLV chain */ if ((alias != NULL) && (strlen(alias) > 0)) aim_tlvlist_replace_raw(&tmp->data, 0x0131, strlen(alias), alias); else aim_tlvlist_remove(&tmp->data, 0x0131); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Change the comment stored on the server for a given buddy. * * @param sess The oscar session. * @param gn The group that the buddy is currently in. * @param sn The screen name of the buddy. * @param alias The new comment for the buddy, or NULL if you want to remove * a buddy's comment. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_editcomment(aim_session_t *sess, const char *gn, const char *sn, const char *comment) { struct aim_ssi_item *tmp; if (!sess || !gn || !sn) return -EINVAL; if (!(tmp = aim_ssi_itemlist_finditem(sess->ssi.local, gn, sn, AIM_SSI_TYPE_BUDDY))) return -EINVAL; /* Either add or remove the 0x0131 TLV from the TLV chain */ if ((comment != NULL) && (strlen(comment) > 0)) aim_tlvlist_replace_raw(&tmp->data, 0x013c, strlen(comment), comment); else aim_tlvlist_remove(&tmp->data, 0x013c); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Rename a group. * * @param sess The oscar session. * @param oldgn The old group name. * @param newgn The new group name. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_rename_group(aim_session_t *sess, const char *oldgn, const char *newgn) { struct aim_ssi_item *group; if (!sess || !oldgn || !newgn) return -EINVAL; if (!(group = aim_ssi_itemlist_finditem(sess->ssi.local, oldgn, NULL, AIM_SSI_TYPE_GROUP))) return -EINVAL; free(group->name); group->name = (char *)malloc((strlen(newgn)+1)*sizeof(char)); strcpy(group->name, newgn); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Stores your permit/deny setting on the server, and starts using it. * * @param sess The oscar session. * @param permdeny Your permit/deny setting. Can be one of the following: * 1 - Allow all users * 2 - Block all users * 3 - Allow only the users below * 4 - Block only the users below * 5 - Allow only users on my buddy list * @param vismask A bitmask of the class of users to whom you want to be * visible. See the AIM_FLAG_BLEH #defines in aim.h * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_setpermdeny(aim_session_t *sess, fu8_t permdeny, fu32_t vismask) { struct aim_ssi_item *tmp; if (!sess) return -EINVAL; /* Find the PDINFO item, or add it if it does not exist */ if (!(tmp = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, NULL, AIM_SSI_TYPE_PDINFO))) tmp = aim_ssi_itemlist_add(&sess->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PDINFO, NULL); /* Need to add the 0x00ca TLV to the TLV chain */ aim_tlvlist_replace_8(&tmp->data, 0x00ca, permdeny); /* Need to add the 0x00cb TLV to the TLV chain */ aim_tlvlist_replace_32(&tmp->data, 0x00cb, vismask); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Set buddy icon information * * @param sess The oscar session. * @param iconcsum The MD5 checksum of the icon you are using. * @param iconcsumlen Length of the MD5 checksum given above. Should be 0x10 bytes. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_seticon(aim_session_t *sess, fu8_t *iconsum, fu16_t iconsumlen) { struct aim_ssi_item *tmp; fu8_t *csumdata; if (!sess || !iconsum || !iconsumlen) return -EINVAL; /* Find the ICONINFO item, or add it if it does not exist */ if (!(tmp = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) { tmp = aim_ssi_itemlist_add(&sess->ssi.local, "1", 0x0000, 0x51F4, AIM_SSI_TYPE_ICONINFO, NULL); } /* Need to add the 0x00d5 TLV to the TLV chain */ if (!(csumdata = (fu8_t *)malloc((iconsumlen+2)*sizeof(fu8_t)))) return -ENOMEM; csumdata[0] = 0x00; csumdata[1] = 0x10; memcpy(&csumdata[2], iconsum, iconsumlen); aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(fu8_t), csumdata); free(csumdata); /* Need to add the 0x0131 TLV to the TLV chain, used to cache the icon */ aim_tlvlist_replace_noval(&tmp->data, 0x0131); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Remove a reference to a server stored buddy icon. This will make your * icon stop showing up to other people. * * @param sess The oscar session. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_delicon(aim_session_t *sess) { struct aim_ssi_item *tmp; if (!sess) return -EINVAL; /* Find the ICONINFO item and delete it if it exists*/ if ((tmp = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) aim_ssi_itemlist_del(&sess->ssi.local, tmp); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /** * Stores your setting for various SSI settings. Whether you * should show up as idle or not, etc. * * @param sess The oscar session. * @param presence I think it's a bitmask, but I only know what one of the bits is: * 0x00000002 - Hide wireless? * 0x00000400 - Allow others to see your idle time * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_setpresence(aim_session_t *sess, fu32_t presence) { struct aim_ssi_item *tmp; if (!sess) return -EINVAL; /* Find the PRESENCEPREFS item, or add it if it does not exist */ if (!(tmp = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS))) tmp = aim_ssi_itemlist_add(&sess->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PRESENCEPREFS, NULL); /* Need to add the x00c9 TLV to the TLV chain */ aim_tlvlist_replace_32(&tmp->data, 0x00c9, presence); /* Sync our local list with the server list */ aim_ssi_sync(sess); return 0; } /* * Subtype 0x0002 - Request SSI Rights. */ faim_export int aim_ssi_reqrights(aim_session_t *sess) { aim_conn_t *conn; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI))) return -EINVAL; return aim_genericreq_n_snacid(sess, conn, AIM_CB_FAM_SSI, AIM_CB_SSI_REQRIGHTS); } /* * Subtype 0x0003 - SSI Rights Information. */ static int parserights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0, i; aim_rxcallback_t userfunc; aim_tlvlist_t *tlvlist; aim_tlv_t *tlv; aim_bstream_t bstream; fu16_t *maxitems; /* This SNAC is made up of a bunch of TLVs */ tlvlist = aim_tlvlist_read(bs); /* TLV 0x0004 contains the maximum number of each item */ if (!(tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { aim_tlvlist_free(&tlvlist); return 0; } aim_bstream_init(&bstream, tlv->value, tlv->length); if (!(maxitems = (fu16_t *)malloc((tlv->length/2)*sizeof(fu16_t)))) { aim_tlvlist_free(&tlvlist); return 0; } for (i=0; i<(tlv->length/2); i++) maxitems[i] = aimbs_get16(&bstream); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, tlv->length/2, maxitems); aim_tlvlist_free(&tlvlist); free(maxitems); return ret; } /* * Subtype 0x0004 - Request SSI Data when you don't have a timestamp and * revision number. * */ faim_export int aim_ssi_reqdata(aim_session_t *sess) { aim_conn_t *conn; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI))) return -EINVAL; /* Free any current data, just in case */ aim_ssi_freelist(sess); return aim_genericreq_n_snacid(sess, conn, AIM_CB_FAM_SSI, AIM_CB_SSI_REQDATA); } /* * Subtype 0x0005 - Request SSI Data when you have a timestamp and revision * number. * * The data will only be sent if it is newer than the posted local * timestamp and revision. * * Note that the client should never increment the revision, only the server. * */ faim_export int aim_ssi_reqifchanged(aim_session_t *sess, time_t timestamp, fu16_t numitems) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI))) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+2))) return -ENOMEM; snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_REQIFCHANGED, 0x0000, NULL, 0); aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_REQIFCHANGED, 0x0000, snacid); aimbs_put32(&fr->data, timestamp); aimbs_put16(&fr->data, numitems); aim_tx_enqueue(sess, fr); /* Free any current data, just in case */ aim_ssi_freelist(sess); return 0; } /* * Subtype 0x0006 - SSI Data. */ static int parsedata(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu8_t fmtver; /* guess */ fu16_t namelen, gid, bid, type; char *name; aim_tlvlist_t *data; fmtver = aimbs_get8(bs); /* Version of ssi data. Should be 0x00 */ sess->ssi.numitems += aimbs_get16(bs); /* # of items in this SSI SNAC */ /* Read in the list */ while (aim_bstream_empty(bs) > 4) { /* last four bytes are timestamp */ if ((namelen = aimbs_get16(bs))) name = aimbs_getstr(bs, namelen); else name = NULL; gid = aimbs_get16(bs); bid = aimbs_get16(bs); type = aimbs_get16(bs); data = aim_tlvlist_readlen(bs, aimbs_get16(bs)); aim_ssi_itemlist_add(&sess->ssi.official, name, gid, bid, type, data); free(name); aim_tlvlist_free(&data); } /* Read in the timestamp */ sess->ssi.timestamp = aimbs_get32(bs); if (!(snac->flags & 0x0001)) { /* Make a copy of the list */ struct aim_ssi_item *cur; for (cur=sess->ssi.official; cur; cur=cur->next) aim_ssi_itemlist_add(&sess->ssi.local, cur->name, cur->gid, cur->bid, cur->type, cur->data); sess->ssi.received_data = 1; if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, fmtver, sess->ssi.numitems, sess->ssi.official, sess->ssi.timestamp); } return ret; } /* * Subtype 0x0007 - SSI Activate Data. * * Should be sent after receiving 13/6 or 13/f to tell the server you * are ready to begin using the list. It will promptly give you the * presence information for everyone in your list and put your permit/deny * settings into effect. * */ faim_export int aim_ssi_enable(aim_session_t *sess) { aim_conn_t *conn; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI))) return -EINVAL; return aim_genericreq_n(sess, conn, AIM_CB_FAM_SSI, 0x0007); } /* * Subtype 0x0008/0x0009/0x000a - SSI Add/Mod/Del Item(s). * * Sends the SNAC to add, modify, or delete an item from the server-stored * information. These 3 SNACs all have an identical structure. The only * difference is the subtype that is set for the SNAC. * */ faim_export int aim_ssi_addmoddel(aim_session_t *sess) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int snaclen; struct aim_ssi_tmp *cur; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)) || !sess->ssi.pending || !sess->ssi.pending->item) return -EINVAL; /* Calculate total SNAC size */ snaclen = 10; /* For family, subtype, flags, and SNAC ID */ for (cur=sess->ssi.pending; cur; cur=cur->next) { snaclen += 10; /* For length, GID, BID, type, and length */ if (cur->item->name) snaclen += strlen(cur->item->name); if (cur->item->data) snaclen += aim_tlvlist_size(&cur->item->data); } if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen))) return -ENOMEM; snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, sess->ssi.pending->action, 0x0000, NULL, 0); aim_putsnac(&fr->data, AIM_CB_FAM_SSI, sess->ssi.pending->action, 0x0000, snacid); for (cur=sess->ssi.pending; cur; cur=cur->next) { aimbs_put16(&fr->data, cur->item->name ? strlen(cur->item->name) : 0); if (cur->item->name) aimbs_putraw(&fr->data, cur->item->name, strlen(cur->item->name)); aimbs_put16(&fr->data, cur->item->gid); aimbs_put16(&fr->data, cur->item->bid); aimbs_put16(&fr->data, cur->item->type); aimbs_put16(&fr->data, cur->item->data ? aim_tlvlist_size(&cur->item->data) : 0); if (cur->item->data) aim_tlvlist_write(&fr->data, &cur->item->data); } aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0008 - Incoming SSI add. * * Sent by the server, for example, when someone is added to * your "Recent Buddies" group. */ static int parseadd(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; char *name; fu16_t len, gid, bid, type; aim_tlvlist_t *data; while (aim_bstream_empty(bs)) { if ((len = aimbs_get16(bs))) name = aimbs_getstr(bs, len); else name = NULL; gid = aimbs_get16(bs); bid = aimbs_get16(bs); type = aimbs_get16(bs); if ((len = aimbs_get16(bs))) data = aim_tlvlist_readlen(bs, len); else data = NULL; aim_ssi_itemlist_add(&sess->ssi.local, name, gid, bid, type, data); aim_ssi_itemlist_add(&sess->ssi.official, name, gid, bid, type, data); aim_tlvlist_free(&data); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, type, name); free(name); } return ret; } /* * Subtype 0x0009 - Incoming SSI mod. * * XXX - It would probably be good for the client to actually do something when it gets this. */ static int parsemod(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; char *name; fu16_t len, gid, bid, type; aim_tlvlist_t *data; struct aim_ssi_item *item; while (aim_bstream_empty(bs)) { if ((len = aimbs_get16(bs))) name = aimbs_getstr(bs, len); else name = NULL; gid = aimbs_get16(bs); bid = aimbs_get16(bs); type = aimbs_get16(bs); if ((len = aimbs_get16(bs))) data = aim_tlvlist_readlen(bs, len); else data = NULL; /* Replace the 2 local items with the given one */ if ((item = aim_ssi_itemlist_find(sess->ssi.local, gid, bid))) { item->type = type; free(item->name); if (name) { item->name = (char *)malloc((strlen(name)+1)*sizeof(char)); strcpy(item->name, name); } else item->name = NULL; aim_tlvlist_free(&item->data); item->data = aim_tlvlist_copy(data); } if ((item = aim_ssi_itemlist_find(sess->ssi.official, gid, bid))) { item->type = type; free(item->name); if (name) { item->name = (char *)malloc((strlen(name)+1)*sizeof(char)); strcpy(item->name, name); } else item->name = NULL; aim_tlvlist_free(&item->data); item->data = aim_tlvlist_copy(data); } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx); free(name); aim_tlvlist_free(&data); } return ret; } /* * Subtype 0x000a - Incoming SSI del. * * XXX - It would probably be good for the client to actually do something when it gets this. */ static int parsedel(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t gid, bid; struct aim_ssi_item *del; while (aim_bstream_empty(bs)) { aim_bstream_advance(bs, aimbs_get16(bs)); gid = aimbs_get16(bs); bid = aimbs_get16(bs); aimbs_get16(bs); aim_bstream_advance(bs, aimbs_get16(bs)); if ((del = aim_ssi_itemlist_find(sess->ssi.local, gid, bid))) aim_ssi_itemlist_del(&sess->ssi.local, del); if ((del = aim_ssi_itemlist_find(sess->ssi.official, gid, bid))) aim_ssi_itemlist_del(&sess->ssi.official, del); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx); } return ret; } /* * Subtype 0x000e - SSI Add/Mod/Del Ack. * * Response to add, modify, or delete SNAC (sent with aim_ssi_addmoddel). * */ static int parseack(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; struct aim_ssi_tmp *cur, *del; /* Read in the success/failure flags from the ack SNAC */ cur = sess->ssi.pending; while (cur && (aim_bstream_empty(bs)>0)) { cur->ack = aimbs_get16(bs); cur = cur->next; } /* * If outcome is 0, then add the item to the item list, or replace the other item, * or remove the old item. If outcome is non-zero, then remove the item from the * local list, or unmodify it, or add it. */ for (cur=sess->ssi.pending; (cur && (cur->ack != 0xffff)); cur=cur->next) { if (cur->item) { if (cur->ack) { /* Our action was unsuccessful, so change the local list back to how it was */ if (cur->action == AIM_CB_SSI_ADD) { /* Remove the item from the local list */ /* Make sure cur->item is still valid memory */ if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) { if (cur->item->name) { cur->name = (char *)malloc((strlen(cur->item->name)+1)*sizeof(char)); strcpy(cur->name, cur->item->name); } aim_ssi_itemlist_del(&sess->ssi.local, cur->item); } cur->item = NULL; } else if (cur->action == AIM_CB_SSI_MOD) { /* Replace the local item with the item from the official list */ if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) { struct aim_ssi_item *cur1; if ((cur1 = aim_ssi_itemlist_find(sess->ssi.official, cur->item->gid, cur->item->bid))) { free(cur->item->name); if (cur1->name) { cur->item->name = (char *)malloc((strlen(cur1->name)+1)*sizeof(char)); strcpy(cur->item->name, cur1->name); } else cur->item->name = NULL; aim_tlvlist_free(&cur->item->data); cur->item->data = aim_tlvlist_copy(cur1->data); } } else cur->item = NULL; } else if (cur->action == AIM_CB_SSI_DEL) { /* Add the item back into the local list */ if (aim_ssi_itemlist_valid(sess->ssi.official, cur->item)) { aim_ssi_itemlist_add(&sess->ssi.local, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); } else cur->item = NULL; } } else { /* Do the exact opposite */ if (cur->action == AIM_CB_SSI_ADD) { /* Add the local item to the official list */ if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) { aim_ssi_itemlist_add(&sess->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); } else cur->item = NULL; } else if (cur->action == AIM_CB_SSI_MOD) { /* Replace the official item with the item from the local list */ if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) { struct aim_ssi_item *cur1; if ((cur1 = aim_ssi_itemlist_find(sess->ssi.official, cur->item->gid, cur->item->bid))) { free(cur1->name); if (cur->item->name) { cur1->name = (char *)malloc((strlen(cur->item->name)+1)*sizeof(char)); strcpy(cur1->name, cur->item->name); } else cur1->name = NULL; aim_tlvlist_free(&cur1->data); cur1->data = aim_tlvlist_copy(cur->item->data); } } else cur->item = NULL; } else if (cur->action == AIM_CB_SSI_DEL) { /* Remove the item from the official list */ if (aim_ssi_itemlist_valid(sess->ssi.official, cur->item)) aim_ssi_itemlist_del(&sess->ssi.official, cur->item); cur->item = NULL; } } } /* End if (cur->item) */ } /* End for loop */ if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, sess->ssi.pending); /* Free all aim_ssi_tmp's with an outcome */ cur = sess->ssi.pending; while (cur && (cur->ack != 0xffff)) { del = cur; cur = cur->next; free(del->name); free(del); } sess->ssi.pending = cur; /* If we're not waiting for any more acks, then send more SNACs */ if (!sess->ssi.pending) { sess->ssi.pending = NULL; sess->ssi.waiting_for_ack = 0; aim_ssi_sync(sess); } return ret; } /* * Subtype 0x000f - SSI Data Unchanged. * * Response to aim_ssi_reqifchanged() if the server-side data is not newer than * posted local stamp/revision. * */ static int parsedataunchanged(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; sess->ssi.received_data = 1; if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx); return ret; } /* * Subtype 0x0011 - SSI Begin Data Modification. * * Tells the server you're going to start modifying data. * */ faim_export int aim_ssi_modbegin(aim_session_t *sess) { aim_conn_t *conn; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI))) return -EINVAL; return aim_genericreq_n(sess, conn, AIM_CB_FAM_SSI, AIM_CB_SSI_EDITSTART); } /* * Subtype 0x0012 - SSI End Data Modification. * * Tells the server you're finished modifying data. * */ faim_export int aim_ssi_modend(aim_session_t *sess) { aim_conn_t *conn; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI))) return -EINVAL; return aim_genericreq_n(sess, conn, AIM_CB_FAM_SSI, AIM_CB_SSI_EDITSTOP); } /* * Subtype 0x0014 - Grant authorization * * Authorizes a contact so they can add you to their contact list. * */ faim_export int aim_ssi_sendauth(aim_session_t *sess, char *sn, char *msg) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)) || !sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)+2+(msg ? strlen(msg)+1 : 0)+2))) return -ENOMEM; snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTH, 0x0000, NULL, 0); aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTH, 0x0000, snacid); /* Screen name */ aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); /* Message (null terminated) */ aimbs_put16(&fr->data, msg ? strlen(msg) : 0); if (msg) { aimbs_putraw(&fr->data, msg, strlen(msg)); aimbs_put8(&fr->data, 0x00); } /* Unknown */ aimbs_put16(&fr->data, 0x0000); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0015 - Receive an authorization grant */ static int receiveauthgrant(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t tmp; char *sn, *msg; /* Read screen name */ if ((tmp = aimbs_get8(bs))) sn = aimbs_getstr(bs, tmp); else sn = NULL; /* Read message (null terminated) */ if ((tmp = aimbs_get16(bs))) msg = aimbs_getstr(bs, tmp); else msg = NULL; /* Unknown */ tmp = aimbs_get16(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, sn, msg); free(sn); free(msg); return ret; } /* * Subtype 0x0018 - Send authorization request * * Sends a request for authorization to the given contact. The request will either be * granted, denied, or dropped. * */ faim_export int aim_ssi_sendauthrequest(aim_session_t *sess, char *sn, char *msg) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)) || !sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)+2+(msg ? strlen(msg)+1 : 0)+2))) return -ENOMEM; snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREQ, 0x0000, NULL, 0); aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREQ, 0x0000, snacid); /* Screen name */ aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); /* Message (null terminated) */ aimbs_put16(&fr->data, msg ? strlen(msg) : 0); if (msg) { aimbs_putraw(&fr->data, msg, strlen(msg)); aimbs_put8(&fr->data, 0x00); } /* Unknown */ aimbs_put16(&fr->data, 0x0000); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0019 - Receive an authorization request */ static int receiveauthrequest(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t tmp; char *sn, *msg; /* Read screen name */ if ((tmp = aimbs_get8(bs))) sn = aimbs_getstr(bs, tmp); else sn = NULL; /* Read message (null terminated) */ if ((tmp = aimbs_get16(bs))) msg = aimbs_getstr(bs, tmp); else msg = NULL; /* Unknown */ tmp = aimbs_get16(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, sn, msg); free(sn); free(msg); return ret; } /* * Subtype 0x001a - Send authorization reply * * Sends a reply to a request for authorization. The reply can either * grant authorization or deny authorization. * * if reply=0x00 then deny * if reply=0x01 then grant * */ faim_export int aim_ssi_sendauthreply(aim_session_t *sess, char *sn, fu8_t reply, char *msg) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)) || !sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 1+strlen(sn) + 1 + 2+(msg ? strlen(msg)+1 : 0) + 2))) return -ENOMEM; snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREP, 0x0000, NULL, 0); aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREP, 0x0000, snacid); /* Screen name */ aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); /* Grant or deny */ aimbs_put8(&fr->data, reply); /* Message (null terminated) */ aimbs_put16(&fr->data, msg ? (strlen(msg)+1) : 0); if (msg) { aimbs_putraw(&fr->data, msg, strlen(msg)); aimbs_put8(&fr->data, 0x00); } /* Unknown */ aimbs_put16(&fr->data, 0x0000); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x001b - Receive an authorization reply * You get this bad boy when other people respond to the authorization * request that you have previously sent them. */ static int receiveauthreply(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t tmp; fu8_t reply; char *sn, *msg; /* Read screen name */ if ((tmp = aimbs_get8(bs))) sn = aimbs_getstr(bs, tmp); else sn = NULL; /* Read reply */ reply = aimbs_get8(bs); /* Read message (null terminated) */ if ((tmp = aimbs_get16(bs))) msg = aimbs_getstr(bs, tmp); else msg = NULL; /* Unknown */ tmp = aimbs_get16(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, sn, reply, msg); free(sn); free(msg); return ret; } /* * Subtype 0x001c - Receive a message telling you someone added you to their list. */ static int receiveadded(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t tmp; char *sn; /* Read screen name */ if ((tmp = aimbs_get8(bs))) sn = aimbs_getstr(bs, tmp); else sn = NULL; if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, sn); free(sn); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == AIM_CB_SSI_RIGHTSINFO) return parserights(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_LIST) return parsedata(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_ADD) return parseadd(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_MOD) return parsemod(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_DEL) return parsedel(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_SRVACK) return parseack(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_NOLIST) return parsedataunchanged(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_RECVAUTH) return receiveauthgrant(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_RECVAUTHREQ) return receiveauthrequest(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_RECVAUTHREP) return receiveauthreply(sess, mod, rx, snac, bs); else if (snac->subtype == AIM_CB_SSI_ADDED) return receiveadded(sess, mod, rx, snac, bs); return 0; } static void ssi_shutdown(aim_session_t *sess, aim_module_t *mod) { aim_ssi_freelist(sess); } faim_internal int ssi_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = AIM_CB_FAM_SSI; mod->version = 0x0004; mod->toolid = 0x0110; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "ssi", sizeof(mod->name)); mod->snachandler = snachandler; mod->shutdown = ssi_shutdown; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/tlv.c0000644000175000017500000005367610234217334020654 0ustar ryanryan00000000000000 #define FAIM_INTERNAL #include static aim_tlv_t *createtlv(fu16_t type, fu16_t length, fu8_t *value) { aim_tlv_t *ret; if (!(ret = (aim_tlv_t *)malloc(sizeof(aim_tlv_t)))) return NULL; ret->type = type; ret->length = length; ret->value = value; return ret; } static void freetlv(aim_tlv_t **oldtlv) { if (!oldtlv || !*oldtlv) return; free((*oldtlv)->value); free(*oldtlv); *oldtlv = NULL; return; } /** * Read a TLV chain from a buffer. * * Reads and parses a series of TLV patterns from a data buffer; the * returned structure is manipulatable with the rest of the TLV * routines. When done with a TLV chain, aim_tlvlist_free() should * be called to free the dynamic substructures. * * XXX There should be a flag setable here to have the tlvlist contain * bstream references, so that at least the ->value portion of each * element doesn't need to be malloc/memcpy'd. This could prove to be * just as efficient as the in-place TLV parsing used in a couple places * in libfaim. * * @param bs Input bstream * @return Return the TLV chain read */ faim_internal aim_tlvlist_t *aim_tlvlist_read(aim_bstream_t *bs) { aim_tlvlist_t *list = NULL, *cur; while (aim_bstream_empty(bs) > 0) { fu16_t type, length; type = aimbs_get16(bs); length = aimbs_get16(bs); #if 0 /* temporarily disabled until I know if they're still doing it or not */ /* * Okay, so now AOL has decided that any TLV of * type 0x0013 can only be two bytes, despite * what the actual given length is. So here * we dump any invalid TLVs of that sort. Hopefully * there's no special cases to this special case. * - mid (30jun2000) */ if ((type == 0x0013) && (length != 0x0002)) length = 0x0002; #else if (0) ; #endif else { if (length > aim_bstream_empty(bs)) { aim_tlvlist_free(&list); return NULL; } cur = (aim_tlvlist_t *)malloc(sizeof(aim_tlvlist_t)); if (!cur) { aim_tlvlist_free(&list); return NULL; } memset(cur, 0, sizeof(aim_tlvlist_t)); cur->tlv = createtlv(type, length, NULL); if (!cur->tlv) { free(cur); aim_tlvlist_free(&list); return NULL; } if (cur->tlv->length > 0) { cur->tlv->value = aimbs_getraw(bs, length); if (!cur->tlv->value) { freetlv(&cur->tlv); free(cur); aim_tlvlist_free(&list); return NULL; } } cur->next = list; list = cur; } } return list; } /** * Read a TLV chain from a buffer. * * Reads and parses a series of TLV patterns from a data buffer; the * returned structure is manipulatable with the rest of the TLV * routines. When done with a TLV chain, aim_tlvlist_free() should * be called to free the dynamic substructures. * * XXX There should be a flag setable here to have the tlvlist contain * bstream references, so that at least the ->value portion of each * element doesn't need to be malloc/memcpy'd. This could prove to be * just as efficient as the in-place TLV parsing used in a couple places * in libfaim. * * @param bs Input bstream * @param num The max number of TLVs that will be read, or -1 if unlimited. * There are a number of places where you want to read in a tlvchain, * but the chain is not at the end of the SNAC, and the chain is * preceded by the number of TLVs. So you can limit that with this. * @return Return the TLV chain read */ faim_internal aim_tlvlist_t *aim_tlvlist_readnum(aim_bstream_t *bs, fu16_t num) { aim_tlvlist_t *list = NULL, *cur; while ((aim_bstream_empty(bs) > 0) && (num != 0)) { fu16_t type, length; type = aimbs_get16(bs); length = aimbs_get16(bs); if (length > aim_bstream_empty(bs)) { aim_tlvlist_free(&list); return NULL; } cur = (aim_tlvlist_t *)malloc(sizeof(aim_tlvlist_t)); if (!cur) { aim_tlvlist_free(&list); return NULL; } memset(cur, 0, sizeof(aim_tlvlist_t)); cur->tlv = createtlv(type, length, NULL); if (!cur->tlv) { free(cur); aim_tlvlist_free(&list); return NULL; } if (cur->tlv->length > 0) { cur->tlv->value = aimbs_getraw(bs, length); if (!cur->tlv->value) { freetlv(&cur->tlv); free(cur); aim_tlvlist_free(&list); return NULL; } } if (num > 0) num--; cur->next = list; list = cur; } return list; } /** * Read a TLV chain from a buffer. * * Reads and parses a series of TLV patterns from a data buffer; the * returned structure is manipulatable with the rest of the TLV * routines. When done with a TLV chain, aim_tlvlist_free() should * be called to free the dynamic substructures. * * XXX There should be a flag setable here to have the tlvlist contain * bstream references, so that at least the ->value portion of each * element doesn't need to be malloc/memcpy'd. This could prove to be * just as efficient as the in-place TLV parsing used in a couple places * in libfaim. * * @param bs Input bstream * @param len The max length in bytes that will be read. * There are a number of places where you want to read in a tlvchain, * but the chain is not at the end of the SNAC, and the chain is * preceded by the length of the TLVs. So you can limit that with this. * @return Return the TLV chain read */ faim_internal aim_tlvlist_t *aim_tlvlist_readlen(aim_bstream_t *bs, fu16_t len) { aim_tlvlist_t *list = NULL, *cur; while ((aim_bstream_empty(bs) > 0) && (len > 0)) { fu16_t type, length; type = aimbs_get16(bs); length = aimbs_get16(bs); if (length > aim_bstream_empty(bs)) { aim_tlvlist_free(&list); return NULL; } cur = (aim_tlvlist_t *)malloc(sizeof(aim_tlvlist_t)); if (!cur) { aim_tlvlist_free(&list); return NULL; } memset(cur, 0, sizeof(aim_tlvlist_t)); cur->tlv = createtlv(type, length, NULL); if (!cur->tlv) { free(cur); aim_tlvlist_free(&list); return NULL; } if (cur->tlv->length > 0) { cur->tlv->value = aimbs_getraw(bs, length); if (!cur->tlv->value) { freetlv(&cur->tlv); free(cur); aim_tlvlist_free(&list); return NULL; } } len -= aim_tlvlist_size(&cur); cur->next = list; list = cur; } return list; } /** * Duplicate a TLV chain. * This is pretty self explanatory. * * @param orig The TLV chain you want to make a copy of. * @return A newly allocated TLV chain. */ faim_internal aim_tlvlist_t *aim_tlvlist_copy(aim_tlvlist_t *orig) { aim_tlvlist_t *new = NULL; while (orig) { aim_tlvlist_add_raw(&new, orig->tlv->type, orig->tlv->length, orig->tlv->value); orig = orig->next; } return new; } /* * Compare two TLV lists for equality. This probably is not the most * efficient way to do this. * * @param one One of the TLV chains to compare. * @param two The other TLV chain to compare. * @return Return 0 if the lists are the same, return 1 if they are different. */ faim_internal int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two) { aim_bstream_t bs1, bs2; if (aim_tlvlist_size(&one) != aim_tlvlist_size(&two)) return 1; aim_bstream_init(&bs1, ((fu8_t *)malloc(aim_tlvlist_size(&one)*sizeof(fu8_t))), aim_tlvlist_size(&one)); aim_bstream_init(&bs2, ((fu8_t *)malloc(aim_tlvlist_size(&two)*sizeof(fu8_t))), aim_tlvlist_size(&two)); aim_tlvlist_write(&bs1, &one); aim_tlvlist_write(&bs2, &two); if (memcmp(bs1.data, bs2.data, bs1.len)) { free(bs1.data); free(bs2.data); return 1; } free(bs1.data); free(bs2.data); return 0; } /** * Free a TLV chain structure * * Walks the list of TLVs in the passed TLV chain and * frees each one. Note that any references to this data * should be removed before calling this. * * @param list Chain to be freed */ faim_internal void aim_tlvlist_free(aim_tlvlist_t **list) { aim_tlvlist_t *cur; if (!list || !*list) return; for (cur = *list; cur; ) { aim_tlvlist_t *tmp; freetlv(&cur->tlv); tmp = cur->next; free(cur); cur = tmp; } list = NULL; return; } /** * Count the number of TLVs in a chain. * * @param list Chain to be counted. * @return The number of TLVs stored in the passed chain. */ faim_internal int aim_tlvlist_count(aim_tlvlist_t **list) { aim_tlvlist_t *cur; int count; if (!list || !*list) return 0; for (cur = *list, count = 0; cur; cur = cur->next) count++; return count; } /** * Count the number of bytes in a TLV chain. * * @param list Chain to be sized * @return The number of bytes that would be needed to * write the passed TLV chain to a data buffer. */ faim_internal int aim_tlvlist_size(aim_tlvlist_t **list) { aim_tlvlist_t *cur; int size; if (!list || !*list) return 0; for (cur = *list, size = 0; cur; cur = cur->next) size += (4 + cur->tlv->length); return size; } /** * Adds the passed string as a TLV element of the passed type * to the TLV chain. * * @param list Desination chain (%NULL pointer if empty). * @param type TLV type. * @param length Length of string to add (not including %NULL). * @param value String to add. * @return The size of the value added. */ faim_internal int aim_tlvlist_add_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t length, const fu8_t *value) { aim_tlvlist_t *newtlv, *cur; if (list == NULL) return 0; if (!(newtlv = (aim_tlvlist_t *)malloc(sizeof(aim_tlvlist_t)))) return 0; memset(newtlv, 0x00, sizeof(aim_tlvlist_t)); if (!(newtlv->tlv = createtlv(type, length, NULL))) { free(newtlv); return 0; } if (newtlv->tlv->length > 0) { newtlv->tlv->value = (fu8_t *)malloc(newtlv->tlv->length); memcpy(newtlv->tlv->value, value, newtlv->tlv->length); } if (!*list) *list = newtlv; else { for(cur = *list; cur->next; cur = cur->next) ; cur->next = newtlv; } return newtlv->tlv->length; } /** * Add a one byte integer to a TLV chain. * * @param list Destination chain. * @param type TLV type to add. * @param value Value to add. * @return The size of the value added. */ faim_internal int aim_tlvlist_add_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value) { fu8_t v8[1]; aimutil_put8(v8, value); return aim_tlvlist_add_raw(list, type, 1, v8); } /** * Add a two byte integer to a TLV chain. * * @param list Destination chain. * @param type TLV type to add. * @param value Value to add. * @return The size of the value added. */ faim_internal int aim_tlvlist_add_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value) { fu8_t v16[2]; aimutil_put16(v16, value); return aim_tlvlist_add_raw(list, type, 2, v16); } /** * Add a four byte integer to a TLV chain. * * @param list Destination chain. * @param type TLV type to add. * @param value Value to add. * @return The size of the value added. */ faim_internal int aim_tlvlist_add_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value) { fu8_t v32[4]; aimutil_put32(v32, value); return aim_tlvlist_add_raw(list, type, 4, v32); } /** * Adds a block of capability blocks to a TLV chain. The bitfield * passed in should be a bitwise %OR of any of the %AIM_CAPS constants: * * %AIM_CAPS_BUDDYICON Supports Buddy Icons * %AIM_CAPS_TALK Supports Voice Chat * %AIM_CAPS_IMIMAGE Supports DirectIM/IMImage * %AIM_CAPS_CHAT Supports Chat * %AIM_CAPS_GETFILE Supports Get File functions * %AIM_CAPS_SENDFILE Supports Send File functions * * @param list Destination chain * @param type TLV type to add * @param caps Bitfield of capability flags to send * @return The size of the value added. */ faim_internal int aim_tlvlist_add_caps(aim_tlvlist_t **list, const fu16_t type, const fu32_t caps) { fu8_t buf[16*16]; /* XXX icky fixed length buffer */ aim_bstream_t bs; if (!caps) return 0; /* nothing there anyway */ aim_bstream_init(&bs, buf, sizeof(buf)); aim_putcap(&bs, caps); return aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf); } /** * Adds the given userinfo struct to a TLV chain. * * @param list Destination chain. * @param type TLV type to add. * @return The size of the value added. */ faim_internal int aim_tlvlist_add_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *userinfo) { fu8_t buf[1024]; /* bleh */ aim_bstream_t bs; aim_bstream_init(&bs, buf, sizeof(buf)); aim_putuserinfo(&bs, userinfo); return aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf); } /** * Adds the given chatroom info to a TLV chain. * * @param list Destination chain. * @param type TLV type to add. * @param roomname The name of the chat. * @param instance The instance. * @return The size of the value added. */ faim_internal int aim_tlvlist_add_chatroom(aim_tlvlist_t **list, fu16_t type, fu16_t exchange, const char *roomname, fu16_t instance) { fu8_t *buf; int len; aim_bstream_t bs; len = 2 + 1 + strlen(roomname) + 2; if (!(buf = malloc(len))) return 0; aim_bstream_init(&bs, buf, len); aimbs_put16(&bs, exchange); aimbs_put8(&bs, strlen(roomname)); aimbs_putraw(&bs, roomname, strlen(roomname)); aimbs_put16(&bs, instance); len = aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf); free(buf); return len; } /** * Adds a TLV with a zero length to a TLV chain. * * @param list Destination chain. * @param type TLV type to add. * @return The size of the value added. */ faim_internal int aim_tlvlist_add_noval(aim_tlvlist_t **list, const fu16_t type) { return aim_tlvlist_add_raw(list, type, 0, NULL); } /* * Note that the inner TLV chain will not be modifiable as a tlvchain once * it is written using this. Or rather, it can be, but updates won't be * made to this. * * XXX should probably support sublists for real. * * This is so neat. * * @param list Destination chain. * @param type TLV type to add. * @param t1 The TLV chain you want to write. * @return The number of bytes written to the destination TLV chain. * 0 is returned if there was an error or if the destination * TLV chain has length 0. */ faim_internal int aim_tlvlist_add_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl) { fu8_t *buf; int buflen; aim_bstream_t bs; buflen = aim_tlvlist_size(tl); if (buflen <= 0) return 0; if (!(buf = malloc(buflen))) return 0; aim_bstream_init(&bs, buf, buflen); aim_tlvlist_write(&bs, tl); aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf); free(buf); return buflen; } /** * Substitute a TLV of a given type with a new TLV of the same type. If * you attempt to replace a TLV that does not exist, this function will * just add a new TLV as if you called aim_tlvlist_add_raw(). * * @param list Desination chain (%NULL pointer if empty). * @param type TLV type. * @param length Length of string to add (not including %NULL). * @param value String to add. * @return The length of the TLV. */ faim_internal int aim_tlvlist_replace_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t length, const fu8_t *value) { aim_tlvlist_t *cur; if (list == NULL) return 0; for (cur = *list; ((cur != NULL) && (cur->tlv->type != type)); cur = cur->next); if (cur == NULL) return aim_tlvlist_add_raw(list, type, length, value); free(cur->tlv->value); cur->tlv->length = length; if (cur->tlv->length > 0) { cur->tlv->value = (fu8_t *)malloc(cur->tlv->length); memcpy(cur->tlv->value, value, cur->tlv->length); } else cur->tlv->value = NULL; return cur->tlv->length; } /** * Substitute a TLV of a given type with a new TLV of the same type. If * you attempt to replace a TLV that does not exist, this function will * just add a new TLV as if you called aim_tlvlist_add_raw(). * * @param list Desination chain (%NULL pointer if empty). * @param type TLV type. * @return The length of the TLV. */ faim_internal int aim_tlvlist_replace_noval(aim_tlvlist_t **list, const fu16_t type) { return aim_tlvlist_replace_raw(list, type, 0, NULL); } /** * Substitute a TLV of a given type with a new TLV of the same type. If * you attempt to replace a TLV that does not exist, this function will * just add a new TLV as if you called aim_tlvlist_add_raw(). * * @param list Desination chain (%NULL pointer if empty). * @param type TLV type. * @param value 8 bit value to add. * @return The length of the TLV. */ faim_internal int aim_tlvlist_replace_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value) { fu8_t v8[1]; aimutil_put8(v8, value); return aim_tlvlist_replace_raw(list, type, 1, v8); } /** * Substitute a TLV of a given type with a new TLV of the same type. If * you attempt to replace a TLV that does not exist, this function will * just add a new TLV as if you called aim_tlvlist_add_raw(). * * @param list Desination chain (%NULL pointer if empty). * @param type TLV type. * @param value 32 bit value to add. * @return The length of the TLV. */ faim_internal int aim_tlvlist_replace_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value) { fu8_t v32[4]; aimutil_put32(v32, value); return aim_tlvlist_replace_raw(list, type, 4, v32); } /** * Remove a TLV of a given type. If you attempt to remove a TLV that * does not exist, nothing happens. * * @param list Desination chain (%NULL pointer if empty). * @param type TLV type. */ faim_internal void aim_tlvlist_remove(aim_tlvlist_t **list, const fu16_t type) { aim_tlvlist_t *del; if (!list || !(*list)) return; /* Remove the item from the list */ if ((*list)->tlv->type == type) { del = *list; *list = (*list)->next; } else { aim_tlvlist_t *cur; for (cur=*list; (cur->next && (cur->next->tlv->type!=type)); cur=cur->next); if (!cur->next) return; del = cur->next; cur->next = del->next; } /* Free the removed item */ free(del->tlv->value); free(del->tlv); free(del); } /** * Write a TLV chain into a data buffer. * * Copies a TLV chain into a raw data buffer, writing only the number * of bytes specified. This operation does not free the chain; * aim_tlvlist_free() must still be called to free up the memory used * by the chain structures. * * XXX clean this up, make better use of bstreams * * @param bs Input bstream * @param list Source TLV chain * @return Return 0 if the destination bstream is too small. */ faim_internal int aim_tlvlist_write(aim_bstream_t *bs, aim_tlvlist_t **list) { int goodbuflen; aim_tlvlist_t *cur; /* do an initial run to test total length */ goodbuflen = aim_tlvlist_size(list); if (goodbuflen > aim_bstream_empty(bs)) return 0; /* not enough buffer */ /* do the real write-out */ for (cur = *list; cur; cur = cur->next) { aimbs_put16(bs, cur->tlv->type); aimbs_put16(bs, cur->tlv->length); if (cur->tlv->length) aimbs_putraw(bs, cur->tlv->value, cur->tlv->length); } return 1; /* XXX this is a nonsensical return */ } /** * Grab the Nth TLV of type type in the TLV list list. * * Returns a pointer to an aim_tlv_t of the specified type; * %NULL on error. The @nth parameter is specified starting at %1. * In most cases, there will be no more than one TLV of any type * in a chain. * * @param list Source chain. * @param type Requested TLV type. * @param nth Index of TLV of type to get. * @return The TLV you were looking for, or NULL if one could not be found. */ faim_internal aim_tlv_t *aim_tlv_gettlv(aim_tlvlist_t *list, const fu16_t type, const int nth) { aim_tlvlist_t *cur; int i; for (cur = list, i = 0; cur; cur = cur->next) { if (cur && cur->tlv) { if (cur->tlv->type == type) i++; if (i >= nth) return cur->tlv; } } return NULL; } /** * Get the length of the data of the nth TLV in the given TLV chain. * * @param list Source chain. * @param type Requested TLV type. * @param nth Index of TLV of type to get. * @return The length of the data in this TLV, or -1 if the TLV could not be * found. Unless -1 is returned, this value will be 2 bytes. */ faim_internal int aim_tlv_getlength(aim_tlvlist_t *list, const fu16_t type, const int nth) { aim_tlvlist_t *cur; int i; for (cur = list, i = 0; cur; cur = cur->next) { if (cur && cur->tlv) { if (cur->tlv->type == type) i++; if (i >= nth) return cur->tlv->length; } } return -1; } /** * Retrieve the data from the nth TLV in the given TLV chain as a string. * * @param list Source TLV chain. * @param type TLV type to search for. * @param nth Index of TLV to return. * @return The value of the TLV you were looking for, or NULL if one could * not be found. This is a dynamic buffer and must be freed by the * caller. */ faim_internal char *aim_tlv_getstr(aim_tlvlist_t *list, const fu16_t type, const int nth) { aim_tlv_t *tlv; char *newstr; if (!(tlv = aim_tlv_gettlv(list, type, nth))) return NULL; newstr = (char *) malloc(tlv->length + 1); memcpy(newstr, tlv->value, tlv->length); newstr[tlv->length] = '\0'; return newstr; } /** * Retrieve the data from the nth TLV in the given TLV chain as an 8bit * integer. * * @param list Source TLV chain. * @param type TLV type to search for. * @param nth Index of TLV to return. * @return The value the TLV you were looking for, or 0 if one could * not be found. */ faim_internal fu8_t aim_tlv_get8(aim_tlvlist_t *list, const fu16_t type, const int nth) { aim_tlv_t *tlv; if (!(tlv = aim_tlv_gettlv(list, type, nth))) return 0; /* erm */ return aimutil_get8(tlv->value); } /** * Retrieve the data from the nth TLV in the given TLV chain as a 16bit * integer. * * @param list Source TLV chain. * @param type TLV type to search for. * @param nth Index of TLV to return. * @return The value the TLV you were looking for, or 0 if one could * not be found. */ faim_internal fu16_t aim_tlv_get16(aim_tlvlist_t *list, const fu16_t type, const int nth) { aim_tlv_t *tlv; if (!(tlv = aim_tlv_gettlv(list, type, nth))) return 0; /* erm */ return aimutil_get16(tlv->value); } /** * Retrieve the data from the nth TLV in the given TLV chain as a 32bit * integer. * * @param list Source TLV chain. * @param type TLV type to search for. * @param nth Index of TLV to return. * @return The value the TLV you were looking for, or 0 if one could * not be found. */ faim_internal fu32_t aim_tlv_get32(aim_tlvlist_t *list, const fu16_t type, const int nth) { aim_tlv_t *tlv; if (!(tlv = aim_tlv_gettlv(list, type, nth))) return 0; /* erm */ return aimutil_get32(tlv->value); } pork-0.99.8.1/src/protocols/aim/libfaim/bstream.c0000644000175000017500000001124010234217334021461 0ustar ryanryan00000000000000/* * bstream.c * * This file contains all functions needed to use bstreams. */ #define FAIM_INTERNAL #include faim_internal int aim_bstream_init(aim_bstream_t *bs, fu8_t *data, int len) { if (!bs) return -1; bs->data = data; bs->len = len; bs->offset = 0; return 0; } faim_internal int aim_bstream_empty(aim_bstream_t *bs) { return bs->len - bs->offset; } faim_internal int aim_bstream_curpos(aim_bstream_t *bs) { return bs->offset; } faim_internal int aim_bstream_setpos(aim_bstream_t *bs, unsigned int off) { if (off > bs->len) return -1; bs->offset = off; return off; } faim_internal void aim_bstream_rewind(aim_bstream_t *bs) { aim_bstream_setpos(bs, 0); return; } /* * N can be negative, which can be used for going backwards * in a bstream. I'm not sure if libfaim actually does * this anywhere... */ faim_internal int aim_bstream_advance(aim_bstream_t *bs, int n) { if ((aim_bstream_curpos(bs) + n < 0) || (aim_bstream_empty(bs) < n)) return 0; /* XXX throw an exception */ bs->offset += n; return n; } faim_internal fu8_t aimbs_get8(aim_bstream_t *bs) { if (aim_bstream_empty(bs) < 1) return 0; /* XXX throw an exception */ bs->offset++; return aimutil_get8(bs->data + bs->offset - 1); } faim_internal fu16_t aimbs_get16(aim_bstream_t *bs) { if (aim_bstream_empty(bs) < 2) return 0; /* XXX throw an exception */ bs->offset += 2; return aimutil_get16(bs->data + bs->offset - 2); } faim_internal fu32_t aimbs_get32(aim_bstream_t *bs) { if (aim_bstream_empty(bs) < 4) return 0; /* XXX throw an exception */ bs->offset += 4; return aimutil_get32(bs->data + bs->offset - 4); } faim_internal fu8_t aimbs_getle8(aim_bstream_t *bs) { if (aim_bstream_empty(bs) < 1) return 0; /* XXX throw an exception */ bs->offset++; return aimutil_getle8(bs->data + bs->offset - 1); } faim_internal fu16_t aimbs_getle16(aim_bstream_t *bs) { if (aim_bstream_empty(bs) < 2) return 0; /* XXX throw an exception */ bs->offset += 2; return aimutil_getle16(bs->data + bs->offset - 2); } faim_internal fu32_t aimbs_getle32(aim_bstream_t *bs) { if (aim_bstream_empty(bs) < 4) return 0; /* XXX throw an exception */ bs->offset += 4; return aimutil_getle32(bs->data + bs->offset - 4); } faim_internal int aimbs_put8(aim_bstream_t *bs, fu8_t v) { if (aim_bstream_empty(bs) < 1) return 0; /* XXX throw an exception */ bs->offset += aimutil_put8(bs->data + bs->offset, v); return 1; } faim_internal int aimbs_put16(aim_bstream_t *bs, fu16_t v) { if (aim_bstream_empty(bs) < 2) return 0; /* XXX throw an exception */ bs->offset += aimutil_put16(bs->data + bs->offset, v); return 2; } faim_internal int aimbs_put32(aim_bstream_t *bs, fu32_t v) { if (aim_bstream_empty(bs) < 4) return 0; /* XXX throw an exception */ bs->offset += aimutil_put32(bs->data + bs->offset, v); return 1; } faim_internal int aimbs_putle8(aim_bstream_t *bs, fu8_t v) { if (aim_bstream_empty(bs) < 1) return 0; /* XXX throw an exception */ bs->offset += aimutil_putle8(bs->data + bs->offset, v); return 1; } faim_internal int aimbs_putle16(aim_bstream_t *bs, fu16_t v) { if (aim_bstream_empty(bs) < 2) return 0; /* XXX throw an exception */ bs->offset += aimutil_putle16(bs->data + bs->offset, v); return 2; } faim_internal int aimbs_putle32(aim_bstream_t *bs, fu32_t v) { if (aim_bstream_empty(bs) < 4) return 0; /* XXX throw an exception */ bs->offset += aimutil_putle32(bs->data + bs->offset, v); return 1; } faim_internal int aimbs_getrawbuf(aim_bstream_t *bs, fu8_t *buf, int len) { if (aim_bstream_empty(bs) < len) return 0; memcpy(buf, bs->data + bs->offset, len); bs->offset += len; return len; } faim_internal fu8_t *aimbs_getraw(aim_bstream_t *bs, int len) { fu8_t *ob; if (!(ob = malloc(len))) return NULL; if (aimbs_getrawbuf(bs, ob, len) < len) { free(ob); return NULL; } return ob; } faim_internal char *aimbs_getstr(aim_bstream_t *bs, int len) { char *ob; if (!(ob = malloc(len+1))) return NULL; if (aimbs_getrawbuf(bs, ob, len) < len) { free(ob); return NULL; } ob[len] = '\0'; return ob; } faim_internal int aimbs_putraw(aim_bstream_t *bs, const fu8_t *v, int len) { if (aim_bstream_empty(bs) < len) return 0; /* XXX throw an exception */ memcpy(bs->data + bs->offset, v, len); bs->offset += len; return len; } faim_internal int aimbs_putbs(aim_bstream_t *bs, aim_bstream_t *srcbs, int len) { if (aim_bstream_empty(srcbs) < len) return 0; /* XXX throw exception (underrun) */ if (aim_bstream_empty(bs) < len) return 0; /* XXX throw exception (overflow) */ memcpy(bs->data + bs->offset, srcbs->data + srcbs->offset, len); bs->offset += len; srcbs->offset += len; return len; } pork-0.99.8.1/src/protocols/aim/libfaim/README0000644000175000017500000000604010234217334020542 0ustar ryanryan00000000000000 libfaim pre-0.90 or so ---------------------- This is libfaim, the purpose of which is to implement as much as the AOL AIM/OSCAR protocol as possible (which should be all of it). After over two years of development, its still nowhere close. This is not a full client and never will be. libfaim only implements the routines to implement a client (ie, there's no user interface). Status ------ I would not recommend using this version of libfaim in any form yet. It's beta-quality and I know it leaks memory quite badly. It seems fairly stable, however. YMMV, YAYOR, etc. I suppose I should say regardless of that warning, that several clients use it and people use those clients on a daily basis (in particular, me). Also, you're probably reading this from a CVS version, since I haven't made a release in a very long time. The CVS version changes fairly rapidly when I'm in the mood, so a version you checked out an hour ago may be better or worse than a version you check out now. Building -------- Everything in this libfaim dist should build cleanly on any UNIX(-like) operating system. Originally developed on Linux+glibc. Past versions known to work on Linux+libc5, FreeBSD, HP/UX, Solaris, Mac OS X Server, Win32 using VC++ 98/6 and others. libfaim builds as both libfaim.a and libfaim.so. If your platform for some reason does not support dynamic libraries (eg, you get errors when building libfaim.so), you'll have to tweak the makefiles a bit to get the utils/ directory to build. Otherwise, just do a 'make'. I don't believe I use any specific features GNU make, but if something fails, make sure you have it. And bash too. Accessories ----------- In utils/, you'll find a few things extra: faimtest: very rudimentary front-end. no user interface, but does illustrate the basics of logging in and sending/recieving messages and buddy list notifications. Potential front- end authors start here. aimpasswd: utility to change an AIM password without using a full client. Note that at the time of this writing, this didn't work quite right yet. See the top of the code for latest status. License ------- libfaim is covered under my copyright under the terms of the Lesser GNU Public License, as documented in the file COPYING in the top level directory. Documentation ------------- Unfortunatly, there is not currently any documentation on the libfaim API. Use the source and utils/faimtest/faimtest.c as a reference when coding front-ends. Mailing Lists ------------- Thanks to Sourceforge, we have our mailing lists back. See: http://www.sourceforge.org/mail/?group_id=920 for instructions on subscribing to the lists: libfaim-devel: Discussion of libfaim and its developement. libfaim-aim-protocol: Discussion of the finer points of OSCAR hacking Contact Info ------------ The author (Adam Fritzler), can be reached at mid@auk.cx. Front-end information: http://www.auk.cx/faim/ Protocol information: http://www.auk.cx/faim/protocol/ pork-0.99.8.1/src/protocols/aim/libfaim/service.c0000644000175000017500000007637010234217334021503 0ustar ryanryan00000000000000/* * Family 0x0001 - This is a very special group. All connections support * this group, as it does some particularly good things (like rate limiting). */ #define FAIM_INTERNAL #define FAIM_NEED_CONN_INTERNAL #include #include "md5.h" /* Subtype 0x0002 - Client Online */ faim_export int aim_clientready(aim_session_t *sess, aim_conn_t *conn) { aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; struct snacgroup *sg; aim_frame_t *fr; aim_snacid_t snacid; if (!ins) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x0002, 0x0000, snacid); /* * Send only the tool versions that the server cares about (that it * marked as supporting in the server ready SNAC). */ for (sg = ins->groups; sg; sg = sg->next) { aim_module_t *mod; if ((mod = aim__findmodulebygroup(sess, sg->group))) { aimbs_put16(&fr->data, mod->family); aimbs_put16(&fr->data, mod->version); aimbs_put16(&fr->data, mod->toolid); aimbs_put16(&fr->data, mod->toolversion); } else faimdprintf(sess, 1, "aim_clientready: server supports group 0x%04x but we don't!\n", sg->group); } aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0003 - Host Online * * See comments in conn.c about how the group associations are supposed * to work, and how they really work. * * This info probably doesn't even need to make it to the client. * * We don't actually call the client here. This starts off the connection * initialization routine required by all AIM connections. The next time * the client is called is the CONNINITDONE callback, which should be * shortly after the rate information is acknowledged. * */ static int hostonline(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { fu16_t *families; int famcount; if (!(families = malloc(aim_bstream_empty(bs)))) return 0; for (famcount = 0; aim_bstream_empty(bs); famcount++) { families[famcount] = aimbs_get16(bs); aim_conn_addgroup(rx->conn, families[famcount]); } free(families); /* * Next step is in the Host Versions handler. * * Note that we must send this before we request rates, since * the format of the rate information depends on the versions we * give it. * */ aim_setversions(sess, rx->conn); return 1; } /* Subtype 0x0004 - Service request */ faim_export int aim_reqservice(aim_session_t *sess, aim_conn_t *conn, fu16_t serviceid) { return aim_genericreq_s(sess, conn, 0x0001, 0x0004, &serviceid); } /* * Join a room of name roomname. This is the first step to joining an * already created room. It's basically a Service Request for * family 0x000e, with a little added on to specify the exchange and room * name. */ faim_export int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance) { aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; struct chatsnacinfo csi; if (!sess || !conn || !roomname || !strlen(roomname)) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512))) return -ENOMEM; memset(&csi, 0, sizeof(csi)); csi.exchange = exchange; strncpy(csi.name, roomname, sizeof(csi.name)); csi.instance = instance; snacid = aim_cachesnac(sess, 0x0001, 0x0004, 0x0000, &csi, sizeof(csi)); aim_putsnac(&fr->data, 0x0001, 0x0004, 0x0000, snacid); /* * Requesting service chat (0x000e) */ aimbs_put16(&fr->data, 0x000e); aim_tlvlist_add_chatroom(&tl, 0x0001, exchange, roomname, instance); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* Subtype 0x0005 - Redirect */ static int redirect(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { struct aim_redirect_data redir; aim_rxcallback_t userfunc; aim_tlvlist_t *tlvlist; aim_snac_t *origsnac = NULL; int ret = 0; memset(&redir, 0, sizeof(redir)); tlvlist = aim_tlvlist_read(bs); if (!aim_tlv_gettlv(tlvlist, 0x000d, 1) || !aim_tlv_gettlv(tlvlist, 0x0005, 1) || !aim_tlv_gettlv(tlvlist, 0x0006, 1)) { aim_tlvlist_free(&tlvlist); return 0; } redir.group = aim_tlv_get16(tlvlist, 0x000d, 1); redir.ip = aim_tlv_getstr(tlvlist, 0x0005, 1); redir.cookielen = aim_tlv_gettlv(tlvlist, 0x0006, 1)->length; redir.cookie = aim_tlv_getstr(tlvlist, 0x0006, 1); /* Fetch original SNAC so we can get csi if needed */ origsnac = aim_remsnac(sess, snac->id); if ((redir.group == AIM_CONN_TYPE_CHAT) && origsnac) { struct chatsnacinfo *csi = (struct chatsnacinfo *)origsnac->data; redir.chat.exchange = csi->exchange; redir.chat.room = csi->name; redir.chat.instance = csi->instance; } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, &redir); free((void *)redir.ip); free((void *)redir.cookie); if (origsnac) free(origsnac->data); free(origsnac); aim_tlvlist_free(&tlvlist); return ret; } /* Subtype 0x0006 - Request Rate Information. */ faim_internal int aim_reqrates(aim_session_t *sess, aim_conn_t *conn) { return aim_genericreq_n_snacid(sess, conn, 0x0001, 0x0006); } /* * OSCAR defines several 'rate classes'. Each class has separate * rate limiting properties (limit level, alert level, disconnect * level, etc), and a set of SNAC family/type pairs associated with * it. The rate classes, their limiting properties, and the definitions * of which SNACs are belong to which class, are defined in the * Rate Response packet at login to each host. * * Logically, all rate offenses within one class count against further * offenses for other SNACs in the same class (ie, sending messages * too fast will limit the number of user info requests you can send, * since those two SNACs are in the same rate class). * * Since the rate classes are defined dynamically at login, the values * below may change. But they seem to be fairly constant. * * Currently, BOS defines five rate classes, with the commonly used * members as follows... * * Rate class 0x0001: * - Everything thats not in any of the other classes * * Rate class 0x0002: * - Buddy list add/remove * - Permit list add/remove * - Deny list add/remove * * Rate class 0x0003: * - User information requests * - Outgoing ICBMs * * Rate class 0x0004: * - A few unknowns: 2/9, 2/b, and f/2 * * Rate class 0x0005: * - Chat room create * - Outgoing chat ICBMs * * The only other thing of note is that class 5 (chat) has slightly looser * limiting properties than class 3 (normal messages). But thats just a * small bit of trivia for you. * * The last thing that needs to be learned about the rate limiting * system is how the actual numbers relate to the passing of time. This * seems to be a big mystery. * */ static void rc_addclass(struct rateclass **head, struct rateclass *inrc) { struct rateclass *rc, *rc2; if (!(rc = malloc(sizeof(struct rateclass)))) return; memcpy(rc, inrc, sizeof(struct rateclass)); rc->next = NULL; for (rc2 = *head; rc2 && rc2->next; rc2 = rc2->next) ; if (!rc2) *head = rc; else rc2->next = rc; return; } static struct rateclass *rc_findclass(struct rateclass **head, fu16_t id) { struct rateclass *rc; for (rc = *head; rc; rc = rc->next) { if (rc->classid == id) return rc; } return NULL; } static void rc_addpair(struct rateclass *rc, fu16_t group, fu16_t type) { struct snacpair *sp, *sp2; if (!(sp = malloc(sizeof(struct snacpair)))) return; memset(sp, 0, sizeof(struct snacpair)); sp->group = group; sp->subtype = type; sp->next = NULL; for (sp2 = rc->members; sp2 && sp2->next; sp2 = sp2->next) ; if (!sp2) rc->members = sp; else sp2->next = sp; return; } /* Subtype 0x0007 - Rate Parameters */ static int rateresp(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_conn_inside_t *ins = (aim_conn_inside_t *)rx->conn->inside; fu16_t numclasses, i; aim_rxcallback_t userfunc; /* * First are the parameters for each rate class. */ numclasses = aimbs_get16(bs); for (i = 0; i < numclasses; i++) { struct rateclass rc; memset(&rc, 0, sizeof(struct rateclass)); rc.classid = aimbs_get16(bs); rc.windowsize = aimbs_get32(bs); rc.clear = aimbs_get32(bs); rc.alert = aimbs_get32(bs); rc.limit = aimbs_get32(bs); rc.disconnect = aimbs_get32(bs); rc.current = aimbs_get32(bs); rc.max = aimbs_get32(bs); /* * The server will send an extra five bytes of parameters * depending on the version we advertised in 1/17. If we * didn't send 1/17 (evil!), then this will crash and you * die, as it will default to the old version but we have * the new version hardcoded here. */ if (mod->version >= 3) aimbs_getrawbuf(bs, rc.unknown, sizeof(rc.unknown)); faimdprintf(sess, 1, "--- Adding rate class %d to connection type %d: window size = %ld, clear = %ld, alert = %ld, limit = %ld, disconnect = %ld, current = %ld, max = %ld\n", rx->conn->type, rc.classid, rc.windowsize, rc.clear, rc.alert, rc.limit, rc.disconnect, rc.current, rc.max); rc_addclass(&ins->rates, &rc); } /* * Then the members of each class. */ for (i = 0; i < numclasses; i++) { fu16_t classid, count; struct rateclass *rc; int j; classid = aimbs_get16(bs); count = aimbs_get16(bs); rc = rc_findclass(&ins->rates, classid); for (j = 0; j < count; j++) { fu16_t group, subtype; group = aimbs_get16(bs); subtype = aimbs_get16(bs); if (rc) rc_addpair(rc, group, subtype); } } /* * We don't pass the rate information up to the client, as it really * doesn't care. The information is stored in the connection, however * so that we can do more fun stuff later (not really). */ /* * Last step in the conn init procedure is to acknowledge that we * agree to these draconian limitations. */ aim_rates_addparam(sess, rx->conn); /* * Finally, tell the client it's ready to go... */ if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE))) userfunc(sess, rx); return 1; } /* Subtype 0x0008 - Add Rate Parameter */ faim_internal int aim_rates_addparam(aim_session_t *sess, aim_conn_t *conn) { aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; aim_frame_t *fr; aim_snacid_t snacid; struct rateclass *rc; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x0008, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x0008, 0x0000, snacid); for (rc = ins->rates; rc; rc = rc->next) aimbs_put16(&fr->data, rc->classid); aim_tx_enqueue(sess, fr); return 0; } /* Subtype 0x0009 - Delete Rate Parameter */ faim_internal int aim_rates_delparam(aim_session_t *sess, aim_conn_t *conn) { aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; aim_frame_t *fr; aim_snacid_t snacid; struct rateclass *rc; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x0009, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x0009, 0x0000, snacid); for (rc = ins->rates; rc; rc = rc->next) aimbs_put16(&fr->data, rc->classid); aim_tx_enqueue(sess, fr); return 0; } /* Subtype 0x000a - Rate Change */ static int ratechange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t code, rateclass; fu32_t currentavg, maxavg, windowsize, clear, alert, limit, disconnect; code = aimbs_get16(bs); rateclass = aimbs_get16(bs); windowsize = aimbs_get32(bs); clear = aimbs_get32(bs); alert = aimbs_get32(bs); limit = aimbs_get32(bs); disconnect = aimbs_get32(bs); currentavg = aimbs_get32(bs); maxavg = aimbs_get32(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg); return ret; } /* * How Migrations work. * * The server sends a Server Pause message, which the client should respond to * with a Server Pause Ack, which contains the families it needs on this * connection. The server will send a Migration Notice with an IP address, and * then disconnect. Next the client should open the connection and send the * cookie. Repeat the normal login process and pretend this never happened. * * The Server Pause contains no data. * */ /* Subtype 0x000b - Service Pause */ static int serverpause(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx); return ret; } /* * Subtype 0x000c - Service Pause Acknowledgement * * It is rather important that aim_sendpauseack() gets called for the exact * same connection that the Server Pause callback was called for, since * libfaim extracts the data for the SNAC from the connection structure. * * Of course, if you don't do that, more bad things happen than just what * libfaim can cause. * */ faim_export int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn) { aim_frame_t *fr; aim_snacid_t snacid; aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; struct snacgroup *sg; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1024))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x000c, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x000c, 0x0000, snacid); /* * This list should have all the groups that the original * Host Online / Server Ready said this host supports. And * we want them all back after the migration. */ for (sg = ins->groups; sg; sg = sg->next) aimbs_put16(&fr->data, sg->group); aim_tx_enqueue(sess, fr); return 0; } /* Subtype 0x000d - Service Resume */ static int serverresume(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx); return ret; } /* Subtype 0x000e - Request self-info */ faim_export int aim_reqpersonalinfo(aim_session_t *sess, aim_conn_t *conn) { return aim_genericreq_n_snacid(sess, conn, 0x0001, 0x000e); } /* Subtype 0x000f - Self User Info */ static int selfinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; aim_userinfo_t userinfo; aim_info_extract(sess, bs, &userinfo); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, &userinfo); aim_info_free(&userinfo); return ret; } /* Subtype 0x0010 - Evil Notification */ static int evilnotify(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t newevil; aim_userinfo_t userinfo; memset(&userinfo, 0, sizeof(aim_userinfo_t)); newevil = aimbs_get16(bs); if (aim_bstream_empty(bs)) aim_info_extract(sess, bs, &userinfo); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, newevil, &userinfo); aim_info_free(&userinfo); return ret; } /* * Subtype 0x0011 - Idle Notification * * Should set your current idle time in seconds. Note that this should * never be called consecutively with a non-zero idle time. That makes * OSCAR do funny things. Instead, just set it once you go idle, and then * call it again with zero when you're back. * */ faim_export int aim_srv_setidle(aim_session_t *sess, fu32_t idletime) { aim_conn_t *conn; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_BOS))) return -EINVAL; return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime); } /* * Subtype 0x0012 - Service Migrate * * This is the final SNAC sent on the original connection during a migration. * It contains the IP and cookie used to connect to the new server, and * optionally a list of the SNAC groups being migrated. * */ static int migrate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; int ret = 0; fu16_t groupcount, i; aim_tlvlist_t *tl; char *ip = NULL; aim_tlv_t *cktlv; /* * Apparently there's some fun stuff that can happen right here. The * migration can actually be quite selective about what groups it * moves to the new server. When not all the groups for a connection * are migrated, or they are all migrated but some groups are moved * to a different server than others, it is called a bifurcated * migration. * * Let's play dumb and not support that. * */ groupcount = aimbs_get16(bs); for (i = 0; i < groupcount; i++) { fu16_t group; group = aimbs_get16(bs); faimdprintf(sess, 0, "bifurcated migration unsupported -- group 0x%04x\n", group); } tl = aim_tlvlist_read(bs); if (aim_tlv_gettlv(tl, 0x0005, 1)) ip = aim_tlv_getstr(tl, 0x0005, 1); cktlv = aim_tlv_gettlv(tl, 0x0006, 1); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, ip, cktlv ? cktlv->value : NULL); aim_tlvlist_free(&tl); free(ip); return ret; } /* Subtype 0x0013 - Message of the Day */ static int motd(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; char *msg = NULL; int ret = 0; aim_tlvlist_t *tlvlist; fu16_t id; /* * Code. * * Valid values: * 1 Mandatory upgrade * 2 Advisory upgrade * 3 System bulletin * 4 Nothing's wrong ("top o the world" -- normal) * 5 Lets-break-something. * */ id = aimbs_get16(bs); /* * TLVs follow */ tlvlist = aim_tlvlist_read(bs); msg = aim_tlv_getstr(tlvlist, 0x000b, 1); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, id, msg); free(msg); aim_tlvlist_free(&tlvlist); return ret; } /* * Subtype 0x0014 - Set privacy flags * * Normally 0x03. * * Bit 1: Allows other AIM users to see how long you've been idle. * Bit 2: Allows other AIM users to see how long you've been a member. * */ faim_export int aim_bos_setprivacyflags(aim_session_t *sess, aim_conn_t *conn, fu32_t flags) { return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags); } /* * Subtype 0x0016 - No-op * * WinAIM sends these every 4min or so to keep the connection alive. Its not * really necessary. * * Wha? No? Since when? I think WinAIM sends an empty channel 3 * SNAC as a no-op... */ faim_export int aim_nop(aim_session_t *sess, aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0001, 0x0016); } /* * Subtype 0x0017 - Set client versions * * If you've seen the clientonline/clientready SNAC you're probably * wondering what the point of this one is. And that point seems to be * that the versions in the client online SNAC are sent too late for the * server to be able to use them to change the protocol for the earlier * login packets (client versions are sent right after Host Online is * received, but client online versions aren't sent until quite a bit later). * We can see them already making use of this by changing the format of * the rate information based on what version of group 1 we advertise here. * */ faim_internal int aim_setversions(aim_session_t *sess, aim_conn_t *conn) { aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; struct snacgroup *sg; aim_frame_t *fr; aim_snacid_t snacid; if (!ins) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x0017, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x0017, 0x0000, snacid); /* * Send only the versions that the server cares about (that it * marked as supporting in the server ready SNAC). */ for (sg = ins->groups; sg; sg = sg->next) { aim_module_t *mod; if ((mod = aim__findmodulebygroup(sess, sg->group))) { aimbs_put16(&fr->data, mod->family); aimbs_put16(&fr->data, mod->version); } else faimdprintf(sess, 1, "aim_setversions: server supports group 0x%04x but we don't!\n", sg->group); } aim_tx_enqueue(sess, fr); return 0; } /* Subtype 0x0018 - Host versions */ static int hostversions(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int vercount; fu8_t *versions; /* This is frivolous. (Thank you SmarterChild.) */ vercount = aim_bstream_empty(bs)/4; versions = aimbs_getraw(bs, aim_bstream_empty(bs)); free(versions); /* * Now request rates. */ aim_reqrates(sess, rx->conn); return 1; } /* * Subtype 0x001e - Set various account settings (mostly ICQ related). * * These settings are transient, not server-stored (i.e. they only * apply to this session, and must be re-set the next time you sign * on). * * You can set your ICQ status (available, away, do not disturb, * etc.), or whether your IP address should be hidden or not, or * if your status is visible on ICQ web sites, and you can set * your IP address info and what not. * * These are the same TLVs seen in user info. You can * also set 0x0008 and 0x000c. */ faim_export int aim_setextstatus(aim_session_t *sess, fu32_t status) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; fu32_t data; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_MSG))) return -EINVAL; data = AIM_ICQ_STATE_DIRECTREQUIREAUTH | AIM_ICQ_STATE_HIDEIP | AIM_ICQ_STATE_WEBAWARE | status; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid); aim_tlvlist_add_32(&tl, 0x0006, data); #if 0 aim_tlvlist_add_raw(&tl, 0x000c, 0x0025, chunk_of_x25_bytes_with_ip_address_etc); aim_tlvlist_add_raw(&tl, 0x0011, 0x0005, unknown 0x01 61 10 f6 41); aim_tlvlist_add_16(&tl, 0x0012, unknown 0x00 00); #endif aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x001e - Extended Status. * * Sets your "available" message. This is currently only supported by iChat * and Gaim. * * These are the same TLVs seen in user info. You can * also set 0x0008 and 0x000c. */ faim_export int aim_srv_setavailmsg(aim_session_t *sess, const char *msg) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) return -EINVAL; if (msg != NULL) { if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(msg) + 8))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid); aimbs_put16(&fr->data, 0x001d); /* userinfo TLV type */ aimbs_put16(&fr->data, strlen(msg)+8); /* total length of userinfo TLV data */ aimbs_put16(&fr->data, 0x0002); aimbs_put8(&fr->data, 0x04); aimbs_put8(&fr->data, strlen(msg)+4); aimbs_put16(&fr->data, strlen(msg)); aimbs_putraw(&fr->data, msg, strlen(msg)); aimbs_put16(&fr->data, 0x0000); } else { if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + 8))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid); aimbs_put16(&fr->data, 0x001d); aimbs_put16(&fr->data, 0x0008); aimbs_put16(&fr->data, 0x0002); aimbs_put16(&fr->data, 0x0404); aimbs_put16(&fr->data, 0x0000); aimbs_put16(&fr->data, 0x0000); } aim_tx_enqueue(sess, fr); return 0; } /* * Starting this past week (26 Mar 2001, say), AOL has started sending * this nice little extra SNAC. AFAIK, it has never been used until now. * * The request contains eight bytes. The first four are an offset, the * second four are a length. * * The offset is an offset into aim.exe when it is mapped during execution * on Win32. So far, AOL has only been requesting bytes in static regions * of memory. (I won't put it past them to start requesting data in * less static regions -- regions that are initialized at run time, but still * before the client receives this request.) * * When the client receives the request, it adds it to the current ds * (0x00400000) and dereferences it, copying the data into a buffer which * it then runs directly through the MD5 hasher. The 16 byte output of * the hash is then sent back to the server. * * If the client does not send any data back, or the data does not match * the data that the specific client should have, the client will get the * following message from "AOL Instant Messenger": * "You have been disconnected from the AOL Instant Message Service (SM) * for accessing the AOL network using unauthorized software. You can * download a FREE, fully featured, and authorized client, here * http://www.aol.com/aim/download2.html" * The connection is then closed, receiving disconnect code 1, URL * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html. * * Note, however, that numerous inconsistencies can cause the above error, * not just sending back a bad hash. Do not immediatly suspect this code * if you get disconnected. AOL and the open/free software community have * played this game for a couple years now, generating the above message * on numerous ocassions. * * Anyway, neener. We win again. * */ /* Subtype 0x001f - Client verification */ static int memrequest(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu32_t offset, len; aim_tlvlist_t *list; char *modname; offset = aimbs_get32(bs); len = aimbs_get32(bs); list = aim_tlvlist_read(bs); modname = aim_tlv_getstr(list, 0x0001, 1); faimdprintf(sess, 1, "data at 0x%08lx (%d bytes) of requested\n", offset, len, modname ? modname : "aim.exe"); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, offset, len, modname); free(modname); aim_tlvlist_free(&list); return ret; } #if 0 static void dumpbox(aim_session_t *sess, unsigned char *buf, int len) { int i; if (!sess || !buf || !len) return; faimdprintf(sess, 1, "\nDump of %d bytes at %p:", len, buf); for (i = 0; i < len; i++) { if ((i % 8) == 0) faimdprintf(sess, 1, "\n\t"); faimdprintf(sess, 1, "0x%2x ", buf[i]); } faimdprintf(sess, 1, "\n\n"); return; } #endif /* Subtype 0x0020 - Client verification reply */ faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, fu32_t offset, fu32_t len, const fu8_t *buf, fu8_t flag) { aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !conn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+16))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0001, 0x0020, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0001, 0x0020, 0x0000, snacid); aimbs_put16(&fr->data, 0x0010); /* md5 is always 16 bytes */ if ((flag == AIM_SENDMEMBLOCK_FLAG_ISHASH) && buf && (len == 0x10)) { /* we're getting a hash */ aimbs_putraw(&fr->data, buf, 0x10); } else if (buf && (len > 0)) { /* use input buffer */ md5_state_t state; md5_byte_t digest[0x10]; md5_init(&state); md5_append(&state, (const md5_byte_t *)buf, len); md5_finish(&state, digest); aimbs_putraw(&fr->data, (fu8_t *)digest, 0x10); } else if (len == 0) { /* no length, just hash NULL (buf is optional) */ md5_state_t state; fu8_t nil = '\0'; md5_byte_t digest[0x10]; /* * These MD5 routines are stupid in that you have to have * at least one append. So thats why this doesn't look * real logical. */ md5_init(&state); md5_append(&state, (const md5_byte_t *)&nil, 0); md5_finish(&state, digest); aimbs_putraw(&fr->data, (fu8_t *)digest, 0x10); } else { /* * This data is correct for AIM 3.5.1670. * * Using these blocks is as close to "legal" as you can get * without using an AIM binary. * */ if ((offset == 0x03ffffff) && (len == 0x03ffffff)) { #if 1 /* with "AnrbnrAqhfzcd" */ aimbs_put32(&fr->data, 0x44a95d26); aimbs_put32(&fr->data, 0xd2490423); aimbs_put32(&fr->data, 0x93b8821f); aimbs_put32(&fr->data, 0x51c54b01); #else /* no filename */ aimbs_put32(&fr->data, 0x1df8cbae); aimbs_put32(&fr->data, 0x5523b839); aimbs_put32(&fr->data, 0xa0e10db3); aimbs_put32(&fr->data, 0xa46d3b39); #endif } else if ((offset == 0x00001000) && (len == 0x00000000)) { aimbs_put32(&fr->data, 0xd41d8cd9); aimbs_put32(&fr->data, 0x8f00b204); aimbs_put32(&fr->data, 0xe9800998); aimbs_put32(&fr->data, 0xecf8427e); } else faimdprintf(sess, 0, "sendmemblock: WARNING: unknown hash request\n"); } aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0021 - Receive our extended status * * This is used for iChat's "available" messages, and maybe ICQ extended * status messages? It's also used to tell the client whether or not it * needs to upload an SSI buddy icon... who engineers this stuff, anyway? */ static int aim_parse_extstatus(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t type; fu8_t flags, length; type = aimbs_get16(bs); flags = aimbs_get8(bs); length = aimbs_get8(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { switch (type) { case 0x0000: case 0x0001: { /* buddy icon checksum */ /* not sure what the difference between 1 and 0 is */ fu8_t *md5 = aimbs_getraw(bs, length); ret = userfunc(sess, rx, type, flags, length, md5); free(md5); } break; case 0x0002: { /* available message */ /* there is a second length that is just for the message */ char *msg = aimbs_getstr(bs, aimbs_get16(bs)); ret = userfunc(sess, rx, msg); free(msg); } break; } } return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0003) return hostonline(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0005) return redirect(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0007) return rateresp(sess, mod, rx, snac, bs); else if (snac->subtype == 0x000a) return ratechange(sess, mod, rx, snac, bs); else if (snac->subtype == 0x000b) return serverpause(sess, mod, rx, snac, bs); else if (snac->subtype == 0x000d) return serverresume(sess, mod, rx, snac, bs); else if (snac->subtype == 0x000f) return selfinfo(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0010) return evilnotify(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0012) return migrate(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0013) return motd(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0018) return hostversions(sess, mod, rx, snac, bs); else if (snac->subtype == 0x001f) return memrequest(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0021) return aim_parse_extstatus(sess, mod, rx, snac, bs); return 0; } faim_internal int service_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0001; mod->version = 0x0003; mod->toolid = 0x0110; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "service", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/email.c0000644000175000017500000001406410234217334021122 0ustar ryanryan00000000000000/* * Family 0x0018 - Email notification * * Used for being alerted when the email address(es) associated with * your screen name get new electronic-m. For normal AIM accounts, you * get the email address screenname@netscape.net. AOL accounts have * screenname@aol.com, and can also activate a netscape.net account. * */ #define FAIM_INTERNAL #include /** * Subtype 0x0006 - Request information about your email account * * @param sess The oscar session. * @param conn The email connection for this session. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_email_sendcookies(aim_session_t *sess) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_EML))) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+16+16))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0018, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0018, 0x0006, 0x0000, snacid); /* Number of cookies to follow */ aimbs_put16(&fr->data, 0x0002); /* Cookie */ aimbs_put16(&fr->data, 0x5d5e); aimbs_put16(&fr->data, 0x1708); aimbs_put16(&fr->data, 0x55aa); aimbs_put16(&fr->data, 0x11d3); aimbs_put16(&fr->data, 0xb143); aimbs_put16(&fr->data, 0x0060); aimbs_put16(&fr->data, 0xb0fb); aimbs_put16(&fr->data, 0x1ecb); /* Cookie */ aimbs_put16(&fr->data, 0xb380); aimbs_put16(&fr->data, 0x9ad8); aimbs_put16(&fr->data, 0x0dba); aimbs_put16(&fr->data, 0x11d5); aimbs_put16(&fr->data, 0x9f8a); aimbs_put16(&fr->data, 0x0060); aimbs_put16(&fr->data, 0xb0ee); aimbs_put16(&fr->data, 0x0631); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0007 - Receive information about your email account * * So I don't even know if you can have multiple 16 byte keys, * but this is coded so it will handle that, and handle it well. * This tells you if you have unread mail or not, the URL you * should use to access that mail, and the domain name for the * email account (screenname@domainname.com). If this is the * first 0x0007 SNAC you've received since you signed on, or if * this is just a periodic status update, this will also contain * the number of unread emails that you have. */ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; struct aim_emailinfo *new; aim_tlvlist_t *tlvlist; fu8_t *cookie8, *cookie16; int tmp, havenewmail = 0; /* Used to tell the client we have _new_ mail */ char *alertitle = NULL, *alerturl = NULL; cookie8 = aimbs_getraw(bs, 8); /* Possibly the code used to log you in to mail? */ cookie16 = aimbs_getraw(bs, 16); /* Mail cookie sent above */ /* See if we already have some info associated with this cookie */ for (new=sess->emailinfo; (new && strncmp(cookie16, new->cookie16, 16)); new=new->next); if (new) { /* Free some of the old info, if it exists */ free(new->cookie8); free(new->cookie16); free(new->url); free(new->domain); } else { /* We don't already have info, so create a new struct for it */ if (!(new = malloc(sizeof(struct aim_emailinfo)))) return -ENOMEM; memset(new, 0, sizeof(struct aim_emailinfo)); new->next = sess->emailinfo; sess->emailinfo = new; } new->cookie8 = cookie8; new->cookie16 = cookie16; tlvlist = aim_tlvlist_readnum(bs, aimbs_get16(bs)); tmp = aim_tlv_get16(tlvlist, 0x0080, 1); if (tmp) { if (new->nummsgs < tmp) havenewmail = 1; new->nummsgs = tmp; } else { /* If they don't send a 0x0080 TLV, it means we definitely have new mail */ /* (ie. this is not just another status update) */ havenewmail = 1; new->nummsgs++; /* We know we have at least 1 new email */ } new->url = aim_tlv_getstr(tlvlist, 0x0007, 1); if (!(new->unread = aim_tlv_get8(tlvlist, 0x0081, 1))) { havenewmail = 0; new->nummsgs = 0; } new->domain = aim_tlv_getstr(tlvlist, 0x0082, 1); new->flag = aim_tlv_get16(tlvlist, 0x0084, 1); alertitle = aim_tlv_getstr(tlvlist, 0x0005, 1); alerturl = aim_tlv_getstr(tlvlist, 0x000d, 1); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, new, havenewmail, alertitle, (alerturl ? alerturl + 2 : NULL)); aim_tlvlist_free(&tlvlist); free(alertitle); free(alerturl); return ret; } /** * Subtype 0x0016 - Send something or other * * @param sess The oscar session. * @param conn The email connection for this session. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_email_activate(aim_session_t *sess) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_EML))) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+16))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0018, 0x0016, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0018, 0x0016, 0x0000, snacid); /* I would guess this tells AIM that you want updates for your mail accounts */ /* ...but I really have no idea */ aimbs_put8(&fr->data, 0x02); aimbs_put32(&fr->data, 0x04000000); aimbs_put32(&fr->data, 0x04000000); aimbs_put32(&fr->data, 0x04000000); aimbs_put32(&fr->data, 0x00000000); aim_tx_enqueue(sess, fr); return 0; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0007) return parseinfo(sess, mod, rx, snac, bs); return 0; } static void email_shutdown(aim_session_t *sess, aim_module_t *mod) { while (sess->emailinfo) { struct aim_emailinfo *tmp = sess->emailinfo; sess->emailinfo = sess->emailinfo->next; free(tmp->cookie16); free(tmp->cookie8); free(tmp->url); free(tmp->domain); free(tmp); } return; } faim_internal int email_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0018; mod->version = 0x0001; mod->toolid = 0x0010; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "email", sizeof(mod->name)); mod->snachandler = snachandler; mod->shutdown = email_shutdown; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/aim_cbtypes.h0000644000175000017500000002143010234217334022332 0ustar ryanryan00000000000000/* * AIM Callback Types * */ #ifndef __AIM_CBTYPES_H__ #define __AIM_CBTYPES_H__ /* * SNAC Families. */ #define AIM_CB_FAM_ACK 0x0000 #define AIM_CB_FAM_GEN 0x0001 #define AIM_CB_FAM_LOC 0x0002 #define AIM_CB_FAM_BUD 0x0003 #define AIM_CB_FAM_MSG 0x0004 #define AIM_CB_FAM_ADS 0x0005 #define AIM_CB_FAM_INV 0x0006 #define AIM_CB_FAM_ADM 0x0007 #define AIM_CB_FAM_POP 0x0008 #define AIM_CB_FAM_BOS 0x0009 #define AIM_CB_FAM_LOK 0x000a #define AIM_CB_FAM_STS 0x000b #define AIM_CB_FAM_TRN 0x000c #define AIM_CB_FAM_CTN 0x000d /* ChatNav */ #define AIM_CB_FAM_CHT 0x000e /* Chat */ #define AIM_CB_FAM_SCH 0x000f /* "New" search */ #define AIM_CB_FAM_ICO 0x0010 /* Used for uploading buddy icons */ #define AIM_CB_FAM_SSI 0x0013 /* Server stored information */ #define AIM_CB_FAM_ICQ 0x0015 #define AIM_CB_FAM_ATH 0x0017 #define AIM_CB_FAM_EML 0x0018 #define AIM_CB_FAM_OFT 0xfffe /* OFT/Rvous */ #define AIM_CB_FAM_SPECIAL 0xffff /* Internal libfaim use */ /* * SNAC Family: Ack. * * Not really a family, but treating it as one really * helps it fit into the libfaim callback structure better. * */ #define AIM_CB_ACK_ACK 0x0001 /* * SNAC Family: General. */ #define AIM_CB_GEN_ERROR 0x0001 #define AIM_CB_GEN_CLIENTREADY 0x0002 #define AIM_CB_GEN_SERVERREADY 0x0003 #define AIM_CB_GEN_SERVICEREQ 0x0004 #define AIM_CB_GEN_REDIRECT 0x0005 #define AIM_CB_GEN_RATEINFOREQ 0x0006 #define AIM_CB_GEN_RATEINFO 0x0007 #define AIM_CB_GEN_RATEINFOACK 0x0008 #define AIM_CB_GEN_RATECHANGE 0x000a #define AIM_CB_GEN_SERVERPAUSE 0x000b #define AIM_CB_GEN_SERVERRESUME 0x000d #define AIM_CB_GEN_REQSELFINFO 0x000e #define AIM_CB_GEN_SELFINFO 0x000f #define AIM_CB_GEN_EVIL 0x0010 #define AIM_CB_GEN_SETIDLE 0x0011 #define AIM_CB_GEN_MIGRATIONREQ 0x0012 #define AIM_CB_GEN_MOTD 0x0013 #define AIM_CB_GEN_SETPRIVFLAGS 0x0014 #define AIM_CB_GEN_WELLKNOWNURL 0x0015 #define AIM_CB_GEN_NOP 0x0016 #define AIM_CB_GEN_DEFAULT 0xffff /* * SNAC Family: Location Services. */ #define AIM_CB_LOC_ERROR 0x0001 #define AIM_CB_LOC_REQRIGHTS 0x0002 #define AIM_CB_LOC_RIGHTSINFO 0x0003 #define AIM_CB_LOC_SETUSERINFO 0x0004 #define AIM_CB_LOC_REQUSERINFO 0x0005 #define AIM_CB_LOC_USERINFO 0x0006 #define AIM_CB_LOC_WATCHERSUBREQ 0x0007 #define AIM_CB_LOC_WATCHERNOT 0x0008 #define AIM_CB_LOC_GOTINFOBLOCK 0xfffd #define AIM_CB_LOC_REQUESTINFOTIMEOUT 0xfffe #define AIM_CB_LOC_DEFAULT 0xffff /* * SNAC Family: Buddy List Management Services. */ #define AIM_CB_BUD_ERROR 0x0001 #define AIM_CB_BUD_REQRIGHTS 0x0002 #define AIM_CB_BUD_RIGHTSINFO 0x0003 #define AIM_CB_BUD_ADDBUDDY 0x0004 #define AIM_CB_BUD_REMBUDDY 0x0005 #define AIM_CB_BUD_REJECT 0x000a #define AIM_CB_BUD_ONCOMING 0x000b #define AIM_CB_BUD_OFFGOING 0x000c #define AIM_CB_BUD_DEFAULT 0xffff /* * SNAC Family: Messaging Services. */ #define AIM_CB_MSG_ERROR 0x0001 #define AIM_CB_MSG_PARAMINFO 0x0005 #define AIM_CB_MSG_INCOMING 0x0007 #define AIM_CB_MSG_EVIL 0x0009 #define AIM_CB_MSG_MISSEDCALL 0x000a #define AIM_CB_MSG_CLIENTAUTORESP 0x000b #define AIM_CB_MSG_ACK 0x000c #define AIM_CB_MSG_MTN 0x0014 #define AIM_CB_MSG_DEFAULT 0xffff /* * SNAC Family: Advertisement Services */ #define AIM_CB_ADS_ERROR 0x0001 #define AIM_CB_ADS_DEFAULT 0xffff /* * SNAC Family: Invitation Services. */ #define AIM_CB_INV_ERROR 0x0001 #define AIM_CB_INV_DEFAULT 0xffff /* * SNAC Family: Administrative Services. */ #define AIM_CB_ADM_ERROR 0x0001 #define AIM_CB_ADM_INFOCHANGE_REPLY 0x0005 #define AIM_CB_ADM_DEFAULT 0xffff /* * SNAC Family: Popup Messages */ #define AIM_CB_POP_ERROR 0x0001 #define AIM_CB_POP_DEFAULT 0xffff /* * SNAC Family: Misc BOS Services. */ #define AIM_CB_BOS_ERROR 0x0001 #define AIM_CB_BOS_RIGHTSQUERY 0x0002 #define AIM_CB_BOS_RIGHTS 0x0003 #define AIM_CB_BOS_DEFAULT 0xffff /* * SNAC Family: User Lookup Services */ #define AIM_CB_LOK_ERROR 0x0001 #define AIM_CB_LOK_DEFAULT 0xffff /* * SNAC Family: User Status Services */ #define AIM_CB_STS_ERROR 0x0001 #define AIM_CB_STS_SETREPORTINTERVAL 0x0002 #define AIM_CB_STS_REPORTACK 0x0004 #define AIM_CB_STS_DEFAULT 0xffff /* * SNAC Family: Translation Services */ #define AIM_CB_TRN_ERROR 0x0001 #define AIM_CB_TRN_DEFAULT 0xffff /* * SNAC Family: Chat Navigation Services */ #define AIM_CB_CTN_ERROR 0x0001 #define AIM_CB_CTN_CREATE 0x0008 #define AIM_CB_CTN_INFO 0x0009 #define AIM_CB_CTN_DEFAULT 0xffff /* * SNAC Family: Chat Services */ #define AIM_CB_CHT_ERROR 0x0001 #define AIM_CB_CHT_ROOMINFOUPDATE 0x0002 #define AIM_CB_CHT_USERJOIN 0x0003 #define AIM_CB_CHT_USERLEAVE 0x0004 #define AIM_CB_CHT_OUTGOINGMSG 0x0005 #define AIM_CB_CHT_INCOMINGMSG 0x0006 #define AIM_CB_CHT_DEFAULT 0xffff /* * SNAC Family: "New" Search */ #define AIM_CB_SCH_ERROR 0x0001 #define AIM_CB_SCH_SEARCH 0x0002 #define AIM_CB_SCH_RESULTS 0x0003 /* * SNAC Family: Buddy icons */ #define AIM_CB_ICO_ERROR 0x0001 #define AIM_CB_ICO_REQUEST 0x0004 #define AIM_CB_ICO_RESPONSE 0x0005 /* * SNAC Family: ICQ * * Most of these are actually special. */ #define AIM_CB_ICQ_ERROR 0x0001 #define AIM_CB_ICQ_OFFLINEMSG 0x00f0 #define AIM_CB_ICQ_OFFLINEMSGCOMPLETE 0x00f1 #define AIM_CB_ICQ_INFO 0x00f2 #define AIM_CB_ICQ_ALIAS 0x00f3 #define AIM_CB_ICQ_DEFAULT 0xffff /* * SNAC Family: Server-Stored Buddy Lists */ #define AIM_CB_SSI_ERROR 0x0001 #define AIM_CB_SSI_REQRIGHTS 0x0002 #define AIM_CB_SSI_RIGHTSINFO 0x0003 #define AIM_CB_SSI_REQDATA 0x0004 #define AIM_CB_SSI_REQIFCHANGED 0x0005 #define AIM_CB_SSI_LIST 0x0006 #define AIM_CB_SSI_ACTIVATE 0x0007 #define AIM_CB_SSI_ADD 0x0008 #define AIM_CB_SSI_MOD 0x0009 #define AIM_CB_SSI_DEL 0x000A #define AIM_CB_SSI_SRVACK 0x000E #define AIM_CB_SSI_NOLIST 0x000F #define AIM_CB_SSI_EDITSTART 0x0011 #define AIM_CB_SSI_EDITSTOP 0x0012 #define AIM_CB_SSI_SENDAUTH 0x0014 #define AIM_CB_SSI_RECVAUTH 0x0015 #define AIM_CB_SSI_SENDAUTHREQ 0x0018 #define AIM_CB_SSI_RECVAUTHREQ 0x0019 #define AIM_CB_SSI_SENDAUTHREP 0x001a #define AIM_CB_SSI_RECVAUTHREP 0x001b #define AIM_CB_SSI_ADDED 0x001c /* * SNAC Family: Authorizer * * Used only in protocol versions three and above. * */ #define AIM_CB_ATH_ERROR 0x0001 #define AIM_CB_ATH_LOGINREQEST 0x0002 #define AIM_CB_ATH_LOGINRESPONSE 0x0003 #define AIM_CB_ATH_AUTHREQ 0x0006 #define AIM_CB_ATH_AUTHRESPONSE 0x0007 #define AIM_CB_ATH_SECURID_REQUEST 0x000a #define AIM_CB_ATH_SECURID_RESPONSE 0x000b /* * SNAC Family: Email * * Used for getting information on the email address * associated with your screen name. * */ #define AIM_CB_EML_ERROR 0x0001 #define AIM_CB_EML_SENDCOOKIES 0x0006 #define AIM_CB_EML_MAILSTATUS 0x0007 #define AIM_CB_EML_INIT 0x0016 /* * OFT Services * * For all of the above #defines, the number is the subtype * of the SNAC. For OFT #defines, the number is the * "hdrtype" which comes after the magic string and OFT * packet length. * * I'm pretty sure the ODC ones are arbitrary right now, * that should be changed. */ #define AIM_CB_OFT_DIRECTIMCONNECTREQ 0x0001 /* connect request -- actually an OSCAR CAP */ #define AIM_CB_OFT_DIRECTIMINCOMING 0x0002 #define AIM_CB_OFT_DIRECTIMDISCONNECT 0x0003 #define AIM_CB_OFT_DIRECTIMTYPING 0x0004 #define AIM_CB_OFT_DIRECTIM_ESTABLISHED 0x0005 #define AIM_CB_OFT_PROMPT 0x0101 /* "I am going to send you this file, is that ok?" */ #define AIM_CB_OFT_RESUMESOMETHING 0x0106 /* I really don't know */ #define AIM_CB_OFT_ACK 0x0202 /* "Yes, it is ok for you to send me that file" */ #define AIM_CB_OFT_DONE 0x0204 /* "I received that file with no problems, thanks a bunch" */ #define AIM_CB_OFT_RESUME 0x0205 /* Resume transferring, sent by whoever paused? */ #define AIM_CB_OFT_RESUMEACK 0x0207 /* Not really sure */ #define AIM_CB_OFT_GETFILE_REQUESTLISTING 0x1108 /* "I have a listing.txt file, do you want it?" */ #define AIM_CB_OFT_GETFILE_RECEIVELISTING 0x1209 /* "Yes, please send me your listing.txt file" */ #define AIM_CB_OFT_GETFILE_RECEIVEDLISTING 0x120a /* received corrupt listing.txt file? I'm just guessing about this one... */ #define AIM_CB_OFT_GETFILE_ACKLISTING 0x120b /* "I received the listing.txt file successfully" */ #define AIM_CB_OFT_GETFILE_REQUESTFILE 0x120c /* "Please send me this file" */ #define AIM_CB_OFT_ESTABLISHED 0xFFFF /* connection to buddy initiated */ /* * SNAC Family: Internal Messages * * This isn't truly a SNAC family either, but using * these, we can integrated non-SNAC services into * the SNAC-centered libfaim callback structure. * */ #define AIM_CB_SPECIAL_AUTHSUCCESS 0x0001 #define AIM_CB_SPECIAL_AUTHOTHER 0x0002 #define AIM_CB_SPECIAL_CONNERR 0x0003 #define AIM_CB_SPECIAL_CONNCOMPLETE 0x0004 #define AIM_CB_SPECIAL_FLAPVER 0x0005 #define AIM_CB_SPECIAL_CONNINITDONE 0x0006 #define AIM_CB_SPECIAL_IMAGETRANSFER 0x0007 #define AIM_CB_SPECIAL_MSGTIMEOUT 0x0008 #define AIM_CB_SPECIAL_CONNDEAD 0x0009 #define AIM_CB_SPECIAL_UNKNOWN 0xffff #define AIM_CB_SPECIAL_DEFAULT AIM_CB_SPECIAL_UNKNOWN /* SNAC flags */ #define AIM_SNACFLAGS_DESTRUCTOR 0x0001 #endif/*__AIM_CBTYPES_H__ */ pork-0.99.8.1/src/protocols/aim/libfaim/msgcookie.c0000644000175000017500000001204710234217334022012 0ustar ryanryan00000000000000/* * Cookie Caching stuff. Adam wrote this, apparently just some * derivatives of n's SNAC work. I cleaned it up, added comments. * */ /* * I'm assuming that cookies are type-specific. that is, we can have * "1234578" for type 1 and type 2 concurrently. if i'm wrong, then we * lose some error checking. if we assume cookies are not type-specific and are * wrong, we get quirky behavior when cookies step on each others' toes. */ #define FAIM_INTERNAL #include /** * aim_cachecookie - appends a cookie to the cookie list * * if cookie->cookie for type cookie->type is found, updates the * ->addtime of the found structure; otherwise adds the given cookie * to the cache * * @param sess session to add to * @param cookie pointer to struct to append * @return returns -1 on error, 0 on append, 1 on update. the cookie you pass * in may be free'd, so don't count on its value after calling this! */ faim_internal int aim_cachecookie(aim_session_t *sess, aim_msgcookie_t *cookie) { aim_msgcookie_t *newcook; if (!sess || !cookie) return -EINVAL; newcook = aim_checkcookie(sess, cookie->cookie, cookie->type); if (newcook == cookie) { newcook->addtime = time(NULL); return 1; } else if (newcook) aim_cookie_free(sess, newcook); cookie->addtime = time(NULL); cookie->next = sess->msgcookies; sess->msgcookies = cookie; return 0; } /** * aim_uncachecookie - grabs a cookie from the cookie cache (removes it from the list) * * takes a cookie string and a cookie type and finds the cookie struct associated with that duple, removing it from the cookie list ikn the process. * * @param sess session to grab cookie from * @param cookie cookie string to look for * @param type cookie type to look for * @return if found, returns the struct; if none found (or on error), returns NULL: */ faim_internal aim_msgcookie_t *aim_uncachecookie(aim_session_t *sess, fu8_t *cookie, int type) { aim_msgcookie_t *cur, **prev; if (!cookie || !sess->msgcookies) return NULL; for (prev = &sess->msgcookies; (cur = *prev); ) { if ((cur->type == type) && (memcmp(cur->cookie, cookie, 8) == 0)) { *prev = cur->next; return cur; } prev = &cur->next; } return NULL; } /** * aim_mkcookie - generate an aim_msgcookie_t *struct from a cookie string, a type, and a data pointer. * * @param c pointer to the cookie string array * @param type cookie type to use * @param data data to be cached with the cookie * @return returns NULL on error, a pointer to the newly-allocated * cookie on success. */ faim_internal aim_msgcookie_t *aim_mkcookie(fu8_t *c, int type, void *data) { aim_msgcookie_t *cookie; if (!c) return NULL; if (!(cookie = calloc(1, sizeof(aim_msgcookie_t)))) return NULL; cookie->data = data; cookie->type = type; memcpy(cookie->cookie, c, 8); return cookie; } /** * aim_checkcookie - check to see if a cookietuple has been cached * * @param sess session to check for the cookie in * @param cookie pointer to the cookie string array * @param type type of the cookie to look for * @return returns a pointer to the cookie struct (still in the list) * on success; returns NULL on error/not found */ faim_internal aim_msgcookie_t *aim_checkcookie(aim_session_t *sess, const fu8_t *cookie, int type) { aim_msgcookie_t *cur; for (cur = sess->msgcookies; cur; cur = cur->next) { if ((cur->type == type) && (memcmp(cur->cookie, cookie, 8) == 0)) return cur; } return NULL; } #if 0 /* debugging feature */ faim_internal int aim_dumpcookie(aim_session_t *sess, aim_msgcookie_t *cookie) { if (!cookie) return -EINVAL; faimdprintf(sess, 0, "\tCookie at %p: %d/%s with %p, next %p\n", cookie, cookie->type, cookie->cookie, cookie->data, cookie->next); return 0; } #endif /** * aim_cookie_free - free an aim_msgcookie_t struct * * this function removes the cookie *cookie from the list of cookies * in sess, and then frees all memory associated with it. including * its data! if you want to use the private data after calling this, * make sure you copy it first. * * @param sess session to remove the cookie from * @param cookie the address of a pointer to the cookie struct to remove * @return returns -1 on error, 0 on success. * */ faim_internal int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie) { aim_msgcookie_t *cur, **prev; if (!sess || !cookie) return -EINVAL; for (prev = &sess->msgcookies; (cur = *prev); ) { if (cur == cookie) *prev = cur->next; else prev = &cur->next; } free(cookie->data); free(cookie); return 0; } /* XXX I hate switch */ faim_internal int aim_msgcookie_gettype(int reqclass) { /* XXX: hokey-assed. needs fixed. */ switch(reqclass) { case AIM_CAPS_BUDDYICON: return AIM_COOKIETYPE_OFTICON; case AIM_CAPS_TALK: return AIM_COOKIETYPE_OFTVOICE; case AIM_CAPS_DIRECTIM: return AIM_COOKIETYPE_OFTIMAGE; case AIM_CAPS_CHAT: return AIM_COOKIETYPE_CHAT; case AIM_CAPS_GETFILE: return AIM_COOKIETYPE_OFTGET; case AIM_CAPS_SENDFILE: return AIM_COOKIETYPE_OFTSEND; default: return AIM_COOKIETYPE_UNKNOWN; } } pork-0.99.8.1/src/protocols/aim/libfaim/chatnav.c0000644000175000017500000002650510234217334021462 0ustar ryanryan00000000000000/* * Family 0x000d - Handle ChatNav. * * The ChatNav(igation) service does various things to keep chat * alive. It provides room information, room searching and creating, * as well as giving users the right ("permission") to use chat. * */ #define FAIM_INTERNAL #include /* * Subtype 0x0002 * * conn must be a chatnav connection! * */ faim_export int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn) { return aim_genericreq_n_snacid(sess, conn, 0x000d, 0x0002); } /* * Subtype 0x0008 */ faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange) { static const char ck[] = {"create"}; static const char lang[] = {"en"}; static const char charset[] = {"us-ascii"}; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x000d, 0x0008, 0x0000, snacid); /* exchange */ aimbs_put16(&fr->data, exchange); /* * This looks to be a big hack. You'll note that this entire * SNAC is just a room info structure, but the hard room name, * here, is set to "create". * * Either this goes on the "list of questions concerning * why-the-hell-did-you-do-that", or this value is completely * ignored. Without experimental evidence, but a good knowledge of * AOL style, I'm going to guess that it is the latter, and that * the value of the room name in create requests is ignored. */ aimbs_put8(&fr->data, strlen(ck)); aimbs_putraw(&fr->data, ck, strlen(ck)); /* * instance * * Setting this to 0xffff apparently assigns the last instance. * */ aimbs_put16(&fr->data, 0xffff); /* detail level */ aimbs_put8(&fr->data, 0x01); aim_tlvlist_add_raw(&tl, 0x00d3, strlen(name), name); aim_tlvlist_add_raw(&tl, 0x00d6, strlen(charset), charset); aim_tlvlist_add_raw(&tl, 0x00d7, strlen(lang), lang); /* tlvcount */ aimbs_put16(&fr->data, aim_tlvlist_count(&tl)); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } static int parseinfo_perms(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2) { aim_rxcallback_t userfunc; int ret = 0; struct aim_chat_exchangeinfo *exchanges = NULL; int curexchange; aim_tlv_t *exchangetlv; fu8_t maxrooms = 0; aim_tlvlist_t *tlvlist, *innerlist; tlvlist = aim_tlvlist_read(bs); /* * Type 0x0002: Maximum concurrent rooms. */ if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) maxrooms = aim_tlv_get8(tlvlist, 0x0002, 1); /* * Type 0x0003: Exchange information * * There can be any number of these, each one * representing another exchange. * */ for (curexchange = 0; ((exchangetlv = aim_tlv_gettlv(tlvlist, 0x0003, curexchange+1))); ) { aim_bstream_t tbs; aim_bstream_init(&tbs, exchangetlv->value, exchangetlv->length); curexchange++; exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo)); /* exchange number */ exchanges[curexchange-1].number = aimbs_get16(&tbs); innerlist = aim_tlvlist_read(&tbs); /* * Type 0x000a: Unknown. * * Usually three bytes: 0x0114 (exchange 1) or 0x010f (others). * */ if (aim_tlv_gettlv(innerlist, 0x000a, 1)) ; /* * Type 0x000d: Unknown. */ if (aim_tlv_gettlv(innerlist, 0x000d, 1)) ; /* * Type 0x0004: Unknown */ if (aim_tlv_gettlv(innerlist, 0x0004, 1)) ; /* * Type 0x0002: Unknown */ if (aim_tlv_gettlv(innerlist, 0x0002, 1)) { fu16_t classperms; classperms = aim_tlv_get16(innerlist, 0x0002, 1); faimdprintf(sess, 1, "faim: class permissions %x\n", classperms); } /* * Type 0x00c9: Flags * * 1 Evilable * 2 Nav Only * 4 Instancing Allowed * 8 Occupant Peek Allowed * */ if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) exchanges[curexchange-1].flags = aim_tlv_get16(innerlist, 0x00c9, 1); /* * Type 0x00ca: Creation Date */ if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) ; /* * Type 0x00d0: Mandatory Channels? */ if (aim_tlv_gettlv(innerlist, 0x00d0, 1)) ; /* * Type 0x00d1: Maximum Message length */ if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) ; /* * Type 0x00d2: Maximum Occupancy? */ if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) ; /* * Type 0x00d3: Exchange Description */ if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) exchanges[curexchange-1].name = aim_tlv_getstr(innerlist, 0x00d3, 1); else exchanges[curexchange-1].name = NULL; /* * Type 0x00d4: Exchange Description URL */ if (aim_tlv_gettlv(innerlist, 0x00d4, 1)) ; /* * Type 0x00d5: Creation Permissions * * 0 Creation not allowed * 1 Room creation allowed * 2 Exchange creation allowed * */ if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) { fu8_t createperms; createperms = aim_tlv_get8(innerlist, 0x00d5, 1); } /* * Type 0x00d6: Character Set (First Time) */ if (aim_tlv_gettlv(innerlist, 0x00d6, 1)) exchanges[curexchange-1].charset1 = aim_tlv_getstr(innerlist, 0x00d6, 1); else exchanges[curexchange-1].charset1 = NULL; /* * Type 0x00d7: Language (First Time) */ if (aim_tlv_gettlv(innerlist, 0x00d7, 1)) exchanges[curexchange-1].lang1 = aim_tlv_getstr(innerlist, 0x00d7, 1); else exchanges[curexchange-1].lang1 = NULL; /* * Type 0x00d8: Character Set (Second Time) */ if (aim_tlv_gettlv(innerlist, 0x00d8, 1)) exchanges[curexchange-1].charset2 = aim_tlv_getstr(innerlist, 0x00d8, 1); else exchanges[curexchange-1].charset2 = NULL; /* * Type 0x00d9: Language (Second Time) */ if (aim_tlv_gettlv(innerlist, 0x00d9, 1)) exchanges[curexchange-1].lang2 = aim_tlv_getstr(innerlist, 0x00d9, 1); else exchanges[curexchange-1].lang2 = NULL; /* * Type 0x00da: Unknown */ if (aim_tlv_gettlv(innerlist, 0x00da, 1)) ; aim_tlvlist_free(&innerlist); } /* * Call client. */ if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, snac2->type, maxrooms, curexchange, exchanges); for (curexchange--; curexchange >= 0; curexchange--) { free(exchanges[curexchange].name); free(exchanges[curexchange].charset1); free(exchanges[curexchange].lang1); free(exchanges[curexchange].charset2); free(exchanges[curexchange].lang2); } free(exchanges); aim_tlvlist_free(&tlvlist); return ret; } static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2) { aim_rxcallback_t userfunc; aim_tlvlist_t *tlvlist, *innerlist; char *ck = NULL, *fqcn = NULL, *name = NULL; fu16_t exchange = 0, instance = 0, unknown = 0, flags = 0, maxmsglen = 0, maxoccupancy = 0; fu32_t createtime = 0; fu8_t createperms = 0, detaillevel; int cklen; aim_tlv_t *bigblock; int ret = 0; aim_bstream_t bbbs; tlvlist = aim_tlvlist_read(bs); if (!(bigblock = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { faimdprintf(sess, 0, "no bigblock in top tlv in create room response\n"); aim_tlvlist_free(&tlvlist); return 0; } aim_bstream_init(&bbbs, bigblock->value, bigblock->length); exchange = aimbs_get16(&bbbs); cklen = aimbs_get8(&bbbs); ck = aimbs_getstr(&bbbs, cklen); instance = aimbs_get16(&bbbs); detaillevel = aimbs_get8(&bbbs); if (detaillevel != 0x02) { faimdprintf(sess, 0, "unknown detaillevel in create room response (0x%02x)\n", detaillevel); aim_tlvlist_free(&tlvlist); free(ck); return 0; } unknown = aimbs_get16(&bbbs); innerlist = aim_tlvlist_read(&bbbs); if (aim_tlv_gettlv(innerlist, 0x006a, 1)) fqcn = aim_tlv_getstr(innerlist, 0x006a, 1); if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) flags = aim_tlv_get16(innerlist, 0x00c9, 1); if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) createtime = aim_tlv_get32(innerlist, 0x00ca, 1); if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) maxmsglen = aim_tlv_get16(innerlist, 0x00d1, 1); if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) maxoccupancy = aim_tlv_get16(innerlist, 0x00d2, 1); if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) name = aim_tlv_getstr(innerlist, 0x00d3, 1); if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) createperms = aim_tlv_get8(innerlist, 0x00d5, 1); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck); } free(ck); free(name); free(fqcn); aim_tlvlist_free(&innerlist); aim_tlvlist_free(&tlvlist); return ret; } /* * Subtype 0x0009 * * Since multiple things can trigger this callback, we must lookup the * snacid to determine the original snac subtype that was called. * * XXX This isn't really how this works. But this is: Every d/9 response * has a 16bit value at the beginning. That matches to: * Short Desc = 1 * Full Desc = 2 * Instance Info = 4 * Nav Short Desc = 8 * Nav Instance Info = 16 * And then everything is really asynchronous. There is no specific * attachment of a response to a create room request, for example. Creating * the room yields no different a response than requesting the room's info. * */ static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_snac_t *snac2; int ret = 0; if (!(snac2 = aim_remsnac(sess, snac->id))) { faimdprintf(sess, 0, "faim: chatnav_parse_info: received response to unknown request! (%08lx)\n", snac->id); return 0; } if (snac2->family != 0x000d) { faimdprintf(sess, 0, "faim: chatnav_parse_info: recieved response that maps to corrupt request! (fam=%04x)\n", snac2->family); return 0; } /* * We now know what the original SNAC subtype was. */ if (snac2->type == 0x0002) /* request chat rights */ ret = parseinfo_perms(sess, mod, rx, snac, bs, snac2); else if (snac2->type == 0x0003) /* request exchange info */ faimdprintf(sess, 0, "chatnav_parse_info: resposne to exchange info\n"); else if (snac2->type == 0x0004) /* request room info */ faimdprintf(sess, 0, "chatnav_parse_info: response to room info\n"); else if (snac2->type == 0x0005) /* request more room info */ faimdprintf(sess, 0, "chatnav_parse_info: response to more room info\n"); else if (snac2->type == 0x0006) /* request occupant list */ faimdprintf(sess, 0, "chatnav_parse_info: response to occupant info\n"); else if (snac2->type == 0x0007) /* search for a room */ faimdprintf(sess, 0, "chatnav_parse_info: search results\n"); else if (snac2->type == 0x0008) /* create room */ ret = parseinfo_create(sess, mod, rx, snac, bs, snac2); else faimdprintf(sess, 0, "chatnav_parse_info: unknown request subtype (%04x)\n", snac2->type); if (snac2) free(snac2->data); free(snac2); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0009) return parseinfo(sess, mod, rx, snac, bs); return 0; } faim_internal int chatnav_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x000d; mod->version = 0x0001; mod->toolid = 0x0010; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "chatnav", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/popups.c0000644000175000017500000000265010234217334021357 0ustar ryanryan00000000000000/* * Family 0x0008 - Popups. * * Popups are just what it sounds like. They're a way for the server to * open up an informative box on the client's screen. */ #define FAIM_INTERNAL #include /* * This is all there is to it. * * The message is probably HTML. * */ static int parsepopup(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; aim_tlvlist_t *tl; int ret = 0; char *msg, *url; fu16_t width, height, delay; tl = aim_tlvlist_read(bs); msg = aim_tlv_getstr(tl, 0x0001, 1); url = aim_tlv_getstr(tl, 0x0002, 1); width = aim_tlv_get16(tl, 0x0003, 1); height = aim_tlv_get16(tl, 0x0004, 1); delay = aim_tlv_get16(tl, 0x0005, 1); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, msg, url, width, height, delay); aim_tlvlist_free(&tl); free(msg); free(url); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0002) return parsepopup(sess, mod, rx, snac, bs); return 0; } faim_internal int popups_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0008; mod->version = 0x0001; mod->toolid = 0x0104; mod->toolversion = 0x0001; mod->flags = 0; strncpy(mod->name, "popups", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/stats.c0000644000175000017500000000165210234217334021170 0ustar ryanryan00000000000000/* * Family 0x000b - Statistics. * */ #define FAIM_INTERNAL #include static int reportinterval(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t interval; interval = aimbs_get16(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, interval); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0002) return reportinterval(sess, mod, rx, snac, bs); return 0; } faim_internal int stats_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x000b; mod->version = 0x0001; mod->toolid = 0x0104; mod->toolversion = 0x0001; mod->flags = 0; strncpy(mod->name, "stats", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/bart.c0000644000175000017500000001061210234217334020756 0ustar ryanryan00000000000000/* * Family 0x0010 - Server stored buddy art * * Used for storing and retrieving your cute little buddy icon * from the AIM servers. * */ #define FAIM_INTERNAL #include /** * Subtype 0x0002 - Upload your icon. * * @param sess The oscar session. * @param conn The icon connection for this session. * @param icon The raw data of the icon image file. * @param iconlen Length of the raw data of the icon image file. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_bart_upload(aim_session_t *sess, const fu8_t *icon, fu16_t iconlen) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0010)) || !icon || !iconlen) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2+iconlen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0010, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0010, 0x0002, 0x0000, snacid); /* The reference number for the icon */ aimbs_put16(&fr->data, 1); /* The icon */ aimbs_put16(&fr->data, iconlen); aimbs_putraw(&fr->data, icon, iconlen); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0003 - Acknowledgement for uploading a buddy icon. * * You get this honky after you upload a buddy icon. */ static int uploadack(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t something, somethingelse; fu8_t onemorething; something = aimbs_get16(bs); somethingelse = aimbs_get16(bs); onemorething = aimbs_get8(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx); return ret; } /** * Subtype 0x0004 - Request someone's icon. * * @param sess The oscar session. * @param conn The icon connection for this session. * @param sn The screen name of the person who's icon you are requesting. * @param iconcsum The MD5 checksum of the icon you are requesting. * @param iconcsumlen Length of the MD5 checksum given above. Should be 10 bytes. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_bart_request(aim_session_t *sess, const char *sn, const fu8_t *iconcsum, fu16_t iconcsumlen) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0010)) || !sn || !strlen(sn) || !iconcsum || !iconcsumlen) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 1+strlen(sn) + 4 + 1+iconcsumlen))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0010, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0010, 0x0004, 0x0000, snacid); /* Screen name */ aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); /* Some numbers. You like numbers, right? */ aimbs_put8(&fr->data, 0x01); aimbs_put16(&fr->data, 0x0001); aimbs_put8(&fr->data, 0x01); /* Icon string */ aimbs_put8(&fr->data, iconcsumlen); aimbs_putraw(&fr->data, iconcsum, iconcsumlen); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0005 - Receive a buddy icon. * * This is sent in response to a buddy icon request. */ static int parseicon(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; char *sn; fu16_t flags, iconlen; fu8_t number, iconcsumlen, *iconcsum, *icon; sn = aimbs_getstr(bs, aimbs_get8(bs)); flags = aimbs_get16(bs); number = aimbs_get8(bs); iconcsumlen = aimbs_get8(bs); iconcsum = aimbs_getraw(bs, iconcsumlen); iconlen = aimbs_get16(bs); icon = aimbs_getraw(bs, iconlen); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, sn, iconcsum, iconcsumlen, icon, iconlen); free(sn); free(iconcsum); free(icon); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0003) return uploadack(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0005) return parseicon(sess, mod, rx, snac, bs); return 0; } faim_internal int bart_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0010; mod->version = 0x0001; mod->toolid = 0x0010; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "bart", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/auth.c0000644000175000017500000004240310234217334020772 0ustar ryanryan00000000000000/* * Family 0x0017 - Authentication. * * Deals with the authorizer for SNAC-based login, and also old-style * non-SNAC login. * */ #define FAIM_INTERNAL #include #include "md5.h" #include #ifdef USE_XOR_FOR_ICQ /** * Encode a password using old XOR method * * This takes a const pointer to a (null terminated) string * containing the unencoded password. It also gets passed * an already allocated buffer to store the encoded password. * This buffer should be the exact length of the password without * the null. The encoded password buffer /is not %NULL terminated/. * * The encoding_table seems to be a fixed set of values. We'll * hope it doesn't change over time! * * This is only used for the XOR method, not the better MD5 method. * * @param password Incoming password. * @param encoded Buffer to put encoded password. */ static int aim_encode_password(const char *password, fu8_t *encoded) { fu8_t encoding_table[] = { #if 0 /* old v1 table */ 0xf3, 0xb3, 0x6c, 0x99, 0x95, 0x3f, 0xac, 0xb6, 0xc5, 0xfa, 0x6b, 0x63, 0x69, 0x6c, 0xc3, 0x9f #else /* v2.1 table, also works for ICQ */ 0xf3, 0x26, 0x81, 0xc4, 0x39, 0x86, 0xdb, 0x92, 0x71, 0xa3, 0xb9, 0xe6, 0x53, 0x7a, 0x95, 0x7c #endif }; unsigned int i; for (i = 0; i < strlen(password); i++) encoded[i] = (password[i] ^ encoding_table[i]); return 0; } #endif #ifdef USE_OLD_MD5 static int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest) { md5_state_t state; md5_init(&state); md5_append(&state, (const md5_byte_t *)key, strlen(key)); md5_append(&state, (const md5_byte_t *)password, strlen(password)); md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); md5_finish(&state, (md5_byte_t *)digest); return 0; } #else static int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest) { md5_state_t state; fu8_t passdigest[16]; md5_init(&state); md5_append(&state, (const md5_byte_t *)password, strlen(password)); md5_finish(&state, (md5_byte_t *)&passdigest); md5_init(&state); md5_append(&state, (const md5_byte_t *)key, strlen(key)); md5_append(&state, (const md5_byte_t *)&passdigest, 16); md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); md5_finish(&state, (md5_byte_t *)digest); return 0; } #endif /* * The FLAP version is sent by itself at the beginning of authorization * connections. The FLAP version is also sent before the cookie when connecting * for other services (BOS, chatnav, chat, etc.). */ faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn) { aim_frame_t *fr; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4))) return -ENOMEM; aimbs_put32(&fr->data, 0x00000001); aim_tx_enqueue(sess, fr); return 0; } /* * This just pushes the passed cookie onto the passed connection, without * the SNAC header or any of that. * * Very commonly used, as every connection except auth will require this to * be the first thing you send. * */ faim_export int aim_sendcookie(aim_session_t *sess, aim_conn_t *conn, const fu16_t length, const fu8_t *chipsahoy) { aim_frame_t *fr; aim_tlvlist_t *tl = NULL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4+2+2+length))) return -ENOMEM; aimbs_put32(&fr->data, 0x00000001); aim_tlvlist_add_raw(&tl, 0x0006, length, chipsahoy); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } #ifdef USE_XOR_FOR_ICQ /* * Part two of the ICQ hack. Note the ignoring of the key. */ static int goddamnicq2(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci) { aim_frame_t *fr; aim_tlvlist_t *tl = NULL; int passwdlen; fu8_t *password_encoded; passwdlen = strlen(password); if (!(password_encoded = (char *)malloc(passwdlen+1))) return -ENOMEM; if (passwdlen > MAXICQPASSLEN) passwdlen = MAXICQPASSLEN; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 1152))) { free(password_encoded); return -ENOMEM; } aim_encode_password(password, password_encoded); aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */ aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); aim_tlvlist_add_raw(&tl, 0x0002, passwdlen, password_encoded); if (ci->clientstring) aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid); aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major); aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor); aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point); aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build); aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); /* distribution chan */ aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country); aim_tlvlist_write(&fr->data, &tl); free(password_encoded); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } #endif /* * Subtype 0x0002 * * This is the initial login request packet. * * NOTE!! If you want/need to make use of the aim_sendmemblock() function, * then the client information you send here must exactly match the * executable that you're pulling the data from. * * Java AIM 1.1.19: * clientstring = "AOL Instant Messenger (TM) version 1.1.19 for Java built 03/24/98, freeMem 215871 totalMem 1048567, i686, Linus, #2 SMP Sun Feb 11 03:41:17 UTC 2001 2.4.1-ac9, IBM Corporation, 1.1.8, 45.3, Tue Mar 27 12:09:17 PST 2001" * clientid = 0x0001 * major = 0x0001 * minor = 0x0001 * point = (not sent) * build = 0x0013 * unknown= (not sent) * * AIM for Linux 1.1.112: * clientstring = "AOL Instant Messenger (SM)" * clientid = 0x1d09 * major = 0x0001 * minor = 0x0001 * point = 0x0001 * build = 0x0070 * unknown= 0x0000008b * serverstore = 0x01 * */ faim_export int aim_send_login(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci, const char *key) { aim_frame_t *fr; aim_tlvlist_t *tl = NULL; fu8_t digest[16]; aim_snacid_t snacid; if (!ci || !sn || !password) return -EINVAL; #ifdef USE_XOR_FOR_ICQ /* If we're signing on an ICQ account then use the older, XOR login method */ if (isdigit(sn[0])) return goddamnicq2(sess, conn, sn, password, ci); #endif if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0017, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0017, 0x0002, 0x0000, snacid); aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); /* Truncate ICQ passwords, if necessary */ if (isdigit(sn[0]) && (strlen(password) > MAXICQPASSLEN)) { char truncated[MAXICQPASSLEN + 1]; strncpy(truncated, password, MAXICQPASSLEN); truncated[MAXICQPASSLEN] = 0; aim_encode_password_md5(truncated, key, digest); } else { aim_encode_password_md5(password, key, digest); } aim_tlvlist_add_raw(&tl, 0x0025, 16, digest); #ifndef USE_OLD_MD5 aim_tlvlist_add_noval(&tl, 0x004c); #endif if (ci->clientstring) aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid); aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major); aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor); aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point); aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build); aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country); /* * If set, old-fashioned buddy lists will not work. You will need * to use SSI. */ aim_tlvlist_add_8(&tl, 0x004a, 0x01); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * This is sent back as a general response to the login command. * It can be either an error or a success, depending on the * presence of certain TLVs. * * The client should check the value passed as errorcode. If * its nonzero, there was an error. */ static int parse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_tlvlist_t *tlvlist; aim_rxcallback_t userfunc; struct aim_authresp_info *info; int ret = 0; info = (struct aim_authresp_info *)malloc(sizeof(struct aim_authresp_info)); memset(info, 0, sizeof(struct aim_authresp_info)); /* * Read block of TLVs. All further data is derived * from what is parsed here. */ tlvlist = aim_tlvlist_read(bs); /* * No matter what, we should have a screen name. */ memset(sess->sn, 0, sizeof(sess->sn)); if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) { info->sn = aim_tlv_getstr(tlvlist, 0x0001, 1); strncpy(sess->sn, info->sn, sizeof(sess->sn)); } /* * Check for an error code. If so, we should also * have an error url. */ if (aim_tlv_gettlv(tlvlist, 0x0008, 1)) info->errorcode = aim_tlv_get16(tlvlist, 0x0008, 1); if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) info->errorurl = aim_tlv_getstr(tlvlist, 0x0004, 1); /* * BOS server address. */ if (aim_tlv_gettlv(tlvlist, 0x0005, 1)) info->bosip = aim_tlv_getstr(tlvlist, 0x0005, 1); /* * Authorization cookie. */ if (aim_tlv_gettlv(tlvlist, 0x0006, 1)) { aim_tlv_t *tmptlv; tmptlv = aim_tlv_gettlv(tlvlist, 0x0006, 1); info->cookielen = tmptlv->length; info->cookie = tmptlv->value; } /* * The email address attached to this account * Not available for ICQ or @mac.com logins. * If you receive this TLV, then you are allowed to use * family 0x0018 to check the status of your email. * XXX - Not really true! */ if (aim_tlv_gettlv(tlvlist, 0x0011, 1)) info->email = aim_tlv_getstr(tlvlist, 0x0011, 1); /* * The registration status. (Not real sure what it means.) * Not available for ICQ or @mac.com logins. * * 1 = No disclosure * 2 = Limited disclosure * 3 = Full disclosure * * This has to do with whether your email address is available * to other users or not. AFAIK, this feature is no longer used. * * Means you can use the admin family? (0x0007) * */ if (aim_tlv_gettlv(tlvlist, 0x0013, 1)) info->regstatus = aim_tlv_get16(tlvlist, 0x0013, 1); if (aim_tlv_gettlv(tlvlist, 0x0040, 1)) info->latestbeta.build = aim_tlv_get32(tlvlist, 0x0040, 1); if (aim_tlv_gettlv(tlvlist, 0x0041, 1)) info->latestbeta.url = aim_tlv_getstr(tlvlist, 0x0041, 1); if (aim_tlv_gettlv(tlvlist, 0x0042, 1)) info->latestbeta.info = aim_tlv_getstr(tlvlist, 0x0042, 1); if (aim_tlv_gettlv(tlvlist, 0x0043, 1)) info->latestbeta.name = aim_tlv_getstr(tlvlist, 0x0043, 1); if (aim_tlv_gettlv(tlvlist, 0x0048, 1)) ; /* beta serial */ if (aim_tlv_gettlv(tlvlist, 0x0044, 1)) info->latestrelease.build = aim_tlv_get32(tlvlist, 0x0044, 1); if (aim_tlv_gettlv(tlvlist, 0x0045, 1)) info->latestrelease.url = aim_tlv_getstr(tlvlist, 0x0045, 1); if (aim_tlv_gettlv(tlvlist, 0x0046, 1)) info->latestrelease.info = aim_tlv_getstr(tlvlist, 0x0046, 1); if (aim_tlv_gettlv(tlvlist, 0x0047, 1)) info->latestrelease.name = aim_tlv_getstr(tlvlist, 0x0047, 1); if (aim_tlv_gettlv(tlvlist, 0x0049, 1)) ; /* lastest release serial */ /* * URL to change password. */ if (aim_tlv_gettlv(tlvlist, 0x0054, 1)) info->chpassurl = aim_tlv_getstr(tlvlist, 0x0054, 1); /* * Unknown. Seen on an @mac.com screen name with value of 0x003f */ if (aim_tlv_gettlv(tlvlist, 0x0055, 1)) ; sess->authinfo = info; if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003))) ret = userfunc(sess, rx, info); aim_tlvlist_free(&tlvlist); return ret; } #ifdef USE_XOR_FOR_ICQ /* * Subtype 0x0007 (kind of) - Send a fake type 0x0007 SNAC to the client * * This is a bit confusing. * * Normal SNAC login goes like this: * - connect * - server sends flap version * - client sends flap version * - client sends screen name (17/6) * - server sends hash key (17/7) * - client sends auth request (17/2 -- aim_send_login) * - server yells * * XOR login (for ICQ) goes like this: * - connect * - server sends flap version * - client sends auth request which contains flap version (aim_send_login) * - server yells * * For the client API, we make them implement the most complicated version, * and for the simpler version, we fake it and make it look like the more * complicated process. * * This is done by giving the client a faked key, just so we can convince * them to call aim_send_login right away, which will detect the session * flag that says this is XOR login and ignore the key, sending an ICQ * login request instead of the normal SNAC one. * * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. * * XXX This may cause problems if the client relies on callbacks only * being called from the context of aim_rxdispatch()... * */ static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn) { aim_frame_t fr; aim_rxcallback_t userfunc; fr.conn = conn; if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007))) userfunc(sess, &fr, ""); return 0; } #endif /* * Subtype 0x0006 * * In AIM 3.5 protocol, the first stage of login is to request login from the * Authorizer, passing it the screen name for verification. If the name is * invalid, a 0017/0003 is spit back, with the standard error contents. If * valid, a 0017/0007 comes back, which is the signal to send it the main * login command (0017/0002). * */ faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn) { aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!sess || !conn || !sn) return -EINVAL; #ifdef USE_XOR_FOR_ICQ if (isdigit(sn[0])) return goddamnicq(sess, conn, sn); #endif aim_sendflapver(sess, conn); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn)+8 ))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); /* Tell the server we support SecurID logins. */ aim_tlvlist_add_noval(&tl, 0x004b); /* Unknown. Sent in recent WinAIM clients.*/ aim_tlvlist_add_noval(&tl, 0x005a); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0007 * * Middle handler for 0017/0007 SNACs. Contains the auth key prefixed * by only its length in a two byte word. * * Calls the client, which should then use the value to call aim_send_login. * */ static int keyparse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int keylen, ret = 1; aim_rxcallback_t userfunc; char *keystr; keylen = aimbs_get16(bs); keystr = aimbs_getstr(bs, keylen); /* XXX - When GiantGrayPanda signed on AIM I got a thing asking me to register * for the netscape network. This SNAC had a type 0x0058 TLV with length 10. * Data is 0x0007 0004 3e19 ae1e 0006 0004 0000 0005 */ if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, keystr); free(keystr); return ret; } /** * Subtype 0x000a * * Receive SecurID request. */ static int got_securid_request(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx); return ret; } /** * Subtype 0x000b * * Send SecurID response. */ faim_export int aim_auth_securid_send(aim_session_t *sess, const char *securid) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; int len; if (!sess || !(conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH)) || !securid) return -EINVAL; len = strlen(securid); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+len))) return -ENOMEM; snacid = aim_cachesnac(sess, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_RESPONSE, 0x0000, NULL, 0); aim_putsnac(&fr->data, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_RESPONSE, 0x0000, 0); aimbs_put16(&fr->data, len); aimbs_putraw(&fr->data, securid, len); aim_tx_enqueue(sess, fr); return 0; } static void auth_shutdown(aim_session_t *sess, aim_module_t *mod) { if (sess->authinfo) { free(sess->authinfo->sn); free(sess->authinfo->bosip); free(sess->authinfo->errorurl); free(sess->authinfo->email); free(sess->authinfo->chpassurl); free(sess->authinfo->latestrelease.name); free(sess->authinfo->latestrelease.url); free(sess->authinfo->latestrelease.info); free(sess->authinfo->latestbeta.name); free(sess->authinfo->latestbeta.url); free(sess->authinfo->latestbeta.info); free(sess->authinfo); } } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0003) return parse(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0007) return keyparse(sess, mod, rx, snac, bs); else if (snac->subtype == 0x000a) return got_securid_request(sess, mod, rx, snac, bs); return 0; } faim_internal int auth_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0017; mod->version = 0x0000; mod->flags = 0; strncpy(mod->name, "auth", sizeof(mod->name)); mod->snachandler = snachandler; mod->shutdown = auth_shutdown; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/chat.c0000644000175000017500000003033510234217334020751 0ustar ryanryan00000000000000/* * Family 0x000e - Routines for the Chat service. * */ #define FAIM_INTERNAL #include #include /* Stored in the ->internal of chat connections */ struct chatconnpriv { fu16_t exchange; char *name; fu16_t instance; }; faim_internal void aim_conn_kill_chat(aim_session_t *sess, aim_conn_t *conn) { struct chatconnpriv *ccp = (struct chatconnpriv *)conn->internal; if (ccp) free(ccp->name); free(ccp); return; } faim_export char *aim_chat_getname(aim_conn_t *conn) { struct chatconnpriv *ccp; if (!conn) return NULL; if (conn->type != AIM_CONN_TYPE_CHAT) return NULL; ccp = (struct chatconnpriv *)conn->internal; return ccp->name; } /* XXX get this into conn.c -- evil!! */ faim_export aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name) { aim_conn_t *cur; for (cur = sess->connlist; cur; cur = cur->next) { struct chatconnpriv *ccp = (struct chatconnpriv *)cur->internal; if (cur->type != AIM_CONN_TYPE_CHAT) continue; if (!cur->internal) { faimdprintf(sess, 0, "faim: chat: chat connection with no name! (fd = %d)\n", cur->fd); continue; } if (strcmp(ccp->name, name) == 0) break; } return cur; } faim_export int aim_chat_attachname(aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance) { struct chatconnpriv *ccp; if (!conn || !roomname) return -EINVAL; if (conn->internal) free(conn->internal); if (!(ccp = malloc(sizeof(struct chatconnpriv)))) return -ENOMEM; ccp->exchange = exchange; ccp->name = strdup(roomname); ccp->instance = instance; conn->internal = (void *)ccp; return 0; } faim_internal int aim_chat_readroominfo(aim_bstream_t *bs, struct aim_chat_roominfo *outinfo) { int namelen; if (!bs || !outinfo) return 0; outinfo->exchange = aimbs_get16(bs); namelen = aimbs_get8(bs); outinfo->name = aimbs_getstr(bs, namelen); outinfo->instance = aimbs_get16(bs); return 0; } faim_export int aim_chat_leaveroom(aim_session_t *sess, const char *name) { aim_conn_t *conn; if (!(conn = aim_chat_getconn(sess, name))) return -ENOENT; aim_conn_close(conn); return 0; } /* * Subtype 0x0002 - General room information. Lots of stuff. * * Values I know are in here but I haven't attached * them to any of the 'Unknown's: * - Language (English) * */ static int infoupdate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_userinfo_t *userinfo = NULL; aim_rxcallback_t userfunc; int ret = 0; int usercount = 0; fu8_t detaillevel = 0; char *roomname = NULL; struct aim_chat_roominfo roominfo; fu16_t tlvcount = 0; aim_tlvlist_t *tlvlist; char *roomdesc = NULL; fu16_t flags = 0; fu32_t creationtime = 0; fu16_t maxmsglen = 0, maxvisiblemsglen = 0; fu16_t unknown_d2 = 0, unknown_d5 = 0; aim_chat_readroominfo(bs, &roominfo); detaillevel = aimbs_get8(bs); if (detaillevel != 0x02) { faimdprintf(sess, 0, "faim: chat_roomupdateinfo: detail level %d not supported\n", detaillevel); return 1; } tlvcount = aimbs_get16(bs); /* * Everything else are TLVs. */ tlvlist = aim_tlvlist_read(bs); /* * TLV type 0x006a is the room name in Human Readable Form. */ if (aim_tlv_gettlv(tlvlist, 0x006a, 1)) roomname = aim_tlv_getstr(tlvlist, 0x006a, 1); /* * Type 0x006f: Number of occupants. */ if (aim_tlv_gettlv(tlvlist, 0x006f, 1)) usercount = aim_tlv_get16(tlvlist, 0x006f, 1); /* * Type 0x0073: Occupant list. */ if (aim_tlv_gettlv(tlvlist, 0x0073, 1)) { int curoccupant = 0; aim_tlv_t *tmptlv; aim_bstream_t occbs; tmptlv = aim_tlv_gettlv(tlvlist, 0x0073, 1); /* Allocate enough userinfo structs for all occupants */ userinfo = calloc(usercount, sizeof(aim_userinfo_t)); aim_bstream_init(&occbs, tmptlv->value, tmptlv->length); while (curoccupant < usercount) aim_info_extract(sess, &occbs, &userinfo[curoccupant++]); } /* * Type 0x00c9: Flags. (AIM_CHATROOM_FLAG) */ if (aim_tlv_gettlv(tlvlist, 0x00c9, 1)) flags = aim_tlv_get16(tlvlist, 0x00c9, 1); /* * Type 0x00ca: Creation time (4 bytes) */ if (aim_tlv_gettlv(tlvlist, 0x00ca, 1)) creationtime = aim_tlv_get32(tlvlist, 0x00ca, 1); /* * Type 0x00d1: Maximum Message Length */ if (aim_tlv_gettlv(tlvlist, 0x00d1, 1)) maxmsglen = aim_tlv_get16(tlvlist, 0x00d1, 1); /* * Type 0x00d2: Unknown. (2 bytes) */ if (aim_tlv_gettlv(tlvlist, 0x00d2, 1)) unknown_d2 = aim_tlv_get16(tlvlist, 0x00d2, 1); /* * Type 0x00d3: Room Description */ if (aim_tlv_gettlv(tlvlist, 0x00d3, 1)) roomdesc = aim_tlv_getstr(tlvlist, 0x00d3, 1); /* * Type 0x000d4: Unknown (flag only) */ if (aim_tlv_gettlv(tlvlist, 0x000d4, 1)) ; /* * Type 0x00d5: Unknown. (1 byte) */ if (aim_tlv_gettlv(tlvlist, 0x00d5, 1)) unknown_d5 = aim_tlv_get8(tlvlist, 0x00d5, 1); /* * Type 0x00d6: Encoding 1 ("us-ascii") */ if (aim_tlv_gettlv(tlvlist, 0x000d6, 1)) ; /* * Type 0x00d7: Language 1 ("en") */ if (aim_tlv_gettlv(tlvlist, 0x000d7, 1)) ; /* * Type 0x00d8: Encoding 2 ("us-ascii") */ if (aim_tlv_gettlv(tlvlist, 0x000d8, 1)) ; /* * Type 0x00d9: Language 2 ("en") */ if (aim_tlv_gettlv(tlvlist, 0x000d9, 1)) ; /* * Type 0x00da: Maximum visible message length */ if (aim_tlv_gettlv(tlvlist, 0x000da, 1)) maxvisiblemsglen = aim_tlv_get16(tlvlist, 0x00da, 1); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { ret = userfunc(sess, rx, &roominfo, roomname, usercount, userinfo, roomdesc, flags, creationtime, maxmsglen, unknown_d2, unknown_d5, maxvisiblemsglen); } free(roominfo.name); while (usercount > 0) aim_info_free(&userinfo[--usercount]); free(userinfo); free(roomname); free(roomdesc); aim_tlvlist_free(&tlvlist); return ret; } /* Subtypes 0x0003 and 0x0004 */ static int userlistchange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_userinfo_t *userinfo = NULL; aim_rxcallback_t userfunc; int curcount = 0, ret = 0; while (aim_bstream_empty(bs)) { curcount++; userinfo = realloc(userinfo, curcount * sizeof(aim_userinfo_t)); aim_info_extract(sess, bs, &userinfo[curcount-1]); } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, curcount, userinfo); aim_info_free(userinfo); free(userinfo); return ret; } /* * Subtype 0x0005 - Send a Chat Message. * * Possible flags: * AIM_CHATFLAGS_NOREFLECT -- Unset the flag that requests messages * should be sent to their sender. * AIM_CHATFLAGS_AWAY -- Mark the message as an autoresponse * (Note that WinAIM does not honor this, * and displays the message as normal.) * * XXX convert this to use tlvchains */ faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen, const char *encoding, const char *language) { int i; aim_frame_t *fr; aim_msgcookie_t *cookie; aim_snacid_t snacid; fu8_t ckstr[8]; aim_tlvlist_t *otl = NULL, *itl = NULL; if (!sess || !conn || !msg || (msglen <= 0)) return 0; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x000e, 0x0005, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x000e, 0x0005, 0x0000, snacid); /* * Cookie * * XXX mkcookie should generate the cookie and cache it in one * operation to preserve uniqueness. */ for (i = 0; i < 8; i++) ckstr[i] = (fu8_t)rand(); cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_CHAT, NULL); cookie->data = NULL; /* XXX store something useful here */ aim_cachecookie(sess, cookie); /* ICBM Header */ aimbs_putraw(&fr->data, ckstr, 8); /* Cookie */ aimbs_put16(&fr->data, 0x0003); /* Channel */ /* * Type 1: Flag meaning this message is destined to the room. */ aim_tlvlist_add_noval(&otl, 0x0001); /* * Type 6: Reflect */ if (!(flags & AIM_CHATFLAGS_NOREFLECT)) aim_tlvlist_add_noval(&otl, 0x0006); /* * Type 7: Autoresponse */ if (flags & AIM_CHATFLAGS_AWAY) aim_tlvlist_add_noval(&otl, 0x0007); /* * SubTLV: Type 1: Message */ aim_tlvlist_add_raw(&itl, 0x0001, msglen, msg); /* * SubTLV: Type 2: Encoding */ if (encoding != NULL) aim_tlvlist_add_raw(&itl, 0x0002, strlen(encoding), encoding); /* * SubTLV: Type 3: Language */ if (language != NULL) aim_tlvlist_add_raw(&itl, 0x0003, strlen(language), language); /* * Type 5: Message block. Contains more TLVs. * * This could include other information... We just * put in a message TLV however. * */ aim_tlvlist_add_frozentlvlist(&otl, 0x0005, &itl); aim_tlvlist_write(&fr->data, &otl); aim_tlvlist_free(&itl); aim_tlvlist_free(&otl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0006 * * We could probably include this in the normal ICBM parsing * code as channel 0x0003, however, since only the start * would be the same, we might as well do it here. * * General outline of this SNAC: * snac * cookie * channel id * tlvlist * unknown * source user info * name * evility * userinfo tlvs * online time * etc * message metatlv * message tlv * message string * possibly others * */ static int incomingim_ch3(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0, i; aim_rxcallback_t userfunc; aim_userinfo_t userinfo; fu8_t cookie[8]; fu16_t channel; aim_tlvlist_t *otl; char *msg = NULL; int len = 0; char *encoding = NULL, *language = NULL; aim_msgcookie_t *ck; memset(&userinfo, 0, sizeof(aim_userinfo_t)); /* * Read ICBM Cookie. */ for (i = 0; i < 8; i++) cookie[i] = aimbs_get8(bs); if ((ck = aim_uncachecookie(sess, cookie, AIM_COOKIETYPE_CHAT))) { free(ck->data); free(ck); } /* * Channel ID * * Channel 0x0003 is used for chat messages. * */ channel = aimbs_get16(bs); if (channel != 0x0003) { faimdprintf(sess, 0, "faim: chat_incoming: unknown channel! (0x%04x)\n", channel); return 0; } /* * Start parsing TLVs right away. */ otl = aim_tlvlist_read(bs); /* * Type 0x0003: Source User Information */ if (aim_tlv_gettlv(otl, 0x0003, 1)) { aim_tlv_t *userinfotlv; aim_bstream_t tbs; userinfotlv = aim_tlv_gettlv(otl, 0x0003, 1); aim_bstream_init(&tbs, userinfotlv->value, userinfotlv->length); aim_info_extract(sess, &tbs, &userinfo); } /* * Type 0x0001: If present, it means it was a message to the * room (as opposed to a whisper). */ if (aim_tlv_gettlv(otl, 0x0001, 1)) ; /* * Type 0x0005: Message Block. Conains more TLVs. */ if (aim_tlv_gettlv(otl, 0x0005, 1)) { aim_tlvlist_t *itl; aim_tlv_t *msgblock; aim_bstream_t tbs; msgblock = aim_tlv_gettlv(otl, 0x0005, 1); aim_bstream_init(&tbs, msgblock->value, msgblock->length); itl = aim_tlvlist_read(&tbs); /* * Type 0x0001: Message. */ if (aim_tlv_gettlv(itl, 0x0001, 1)) { msg = aim_tlv_getstr(itl, 0x0001, 1); len = aim_tlv_gettlv(itl, 0x0001, 1)->length; } /* * Type 0x0002: Encoding. */ if (aim_tlv_gettlv(itl, 0x0002, 1)) encoding = aim_tlv_getstr(itl, 0x0002, 1); /* * Type 0x0003: Language. */ if (aim_tlv_gettlv(itl, 0x0003, 1)) language = aim_tlv_getstr(itl, 0x0003, 1); aim_tlvlist_free(&itl); } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, &userinfo, len, msg, encoding, language); aim_info_free(&userinfo); free(msg); aim_tlvlist_free(&otl); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0002) return infoupdate(sess, mod, rx, snac, bs); else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004)) return userlistchange(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0006) return incomingim_ch3(sess, mod, rx, snac, bs); return 0; } faim_internal int chat_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x000e; mod->version = 0x0001; mod->toolid = 0x0010; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "chat", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/conn.c0000644000175000017500000006363310234217334020776 0ustar ryanryan00000000000000/** * Low-level connection handling. * * Does all this gloriously nifty connection handling stuff... * */ #define FAIM_INTERNAL #define FAIM_NEED_CONN_INTERNAL #include #ifndef _WIN32 #include #include #include #endif #ifdef _WIN32 #include "win32dep.h" #endif /** * In OSCAR, every connection has a set of SNAC groups associated * with it. These are the groups that you can send over this connection * without being guaranteed a "Not supported" SNAC error. * * The grand theory of things says that these associations transcend * what libfaim calls "connection types" (conn->type). You can probably * see the elegance here, but since I want to revel in it for a bit, you * get to hear it all spelled out. * * So let us say that you have your core BOS connection running. One * of your modules has just given you a SNAC of the group 0x0004 to send * you. Maybe an IM destined for some twit in Greenland. So you start * at the top of your connection list, looking for a connection that * claims to support group 0x0004. You find one. Why, that neat BOS * connection of yours can do that. So you send it on its way. * * Now, say, that fellow from Greenland has friends and they all want to * meet up with you in a lame chat room. This has landed you a SNAC * in the family 0x000e and you have to admit you're a bit lost. You've * searched your connection list for someone who wants to make your life * easy and deliver this SNAC for you, but there isn't one there. * * Here comes the good bit. Without even letting anyone know, particularly * the module that decided to send this SNAC, and definitely not that twit * in Greenland, you send out a service request. In this request, you have * marked the need for a connection supporting group 0x000e. A few seconds * later, you receive a service redirect with an IP address and a cookie in * it. Great, you say. Now I have something to do. Off you go, making * that connection. One of the first things you get from this new server * is a message saying that indeed it does support the group you were looking * for. So you continue and send rate confirmation and all that. * * Then you remember you had that SNAC to send, and now you have a means to * do it, and you do, and everyone is happy. Except the Greenlander, who is * still stuck in the bitter cold. * * Oh, and this is useful for building the Migration SNACs, too. In the * future, this may help convince me to implement rate limit mitigation * for real. We'll see. * * Just to make me look better, I'll say that I've known about this great * scheme for quite some time now. But I still haven't convinced myself * to make libfaim work that way. It would take a fair amount of effort, * and probably some client API changes as well. (Whenever I don't want * to do something, I just say it would change the client API. Then I * instantly have a couple of supporters of not doing it.) * * Generally, addgroup is only called by the internal handling of the * server ready SNAC. So if you want to do something before that, you'll * have to be more creative. That is done rather early, though, so I don't * think you have to worry about it. Unless you're me. I care deeply * about such inane things. * */ faim_internal void aim_conn_addgroup(aim_conn_t *conn, fu16_t group) { aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; struct snacgroup *sg; if (!(sg = malloc(sizeof(struct snacgroup)))) return; faimdprintf(aim_conn_getsess(conn), 1, "adding group 0x%04x\n", group); sg->group = group; sg->next = ins->groups; ins->groups = sg; return; } faim_export aim_conn_t *aim_conn_findbygroup(aim_session_t *sess, fu16_t group) { aim_conn_t *cur; for (cur = sess->connlist; cur; cur = cur->next) { aim_conn_inside_t *ins = (aim_conn_inside_t *)cur->inside; struct snacgroup *sg; for (sg = ins->groups; sg; sg = sg->next) { if (sg->group == group) return cur; } } return NULL; } static void connkill_snacgroups(struct snacgroup **head) { struct snacgroup *sg; for (sg = *head; sg; ) { struct snacgroup *tmp; tmp = sg->next; free(sg); sg = tmp; } *head = NULL; return; } static void connkill_rates(struct rateclass **head) { struct rateclass *rc; for (rc = *head; rc; ) { struct rateclass *tmp; struct snacpair *sp; tmp = rc->next; for (sp = rc->members; sp; ) { struct snacpair *tmpsp; tmpsp = sp->next; free(sp); sp = tmpsp; } free(rc); rc = tmp; } *head = NULL; return; } static void connkill_real(aim_session_t *sess, aim_conn_t **deadconn) { aim_rxqueue_cleanbyconn(sess, *deadconn); aim_tx_cleanqueue(sess, *deadconn); if ((*deadconn)->fd != -1) aim_conn_close(*deadconn); /* * This will free ->internal if it necessary... */ if ((*deadconn)->type == AIM_CONN_TYPE_CHAT) aim_conn_kill_chat(sess, *deadconn); if ((*deadconn)->inside) { aim_conn_inside_t *inside = (aim_conn_inside_t *)(*deadconn)->inside; connkill_snacgroups(&inside->groups); connkill_rates(&inside->rates); free(inside); } free(*deadconn); *deadconn = NULL; return; } /** * This sends an empty channel 4 SNAC. This is sent to signify * that we're logging off. This shouldn't really be necessary-- * usually the AIM server will detect that the TCP connection has * been destroyed. */ static int aim_flap_close(aim_session_t *sess, aim_conn_t *conn) { aim_frame_t *fr; if (!sess || !conn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x04, 0))) return -ENOMEM; aim_tx_enqueue(sess, fr); return 0; } /** * Clears out the connection list, killing remaining connections. * * @param sess Session to be cleared. */ static void aim_connrst(aim_session_t *sess) { if (sess->connlist) { aim_conn_t *cur = sess->connlist, *tmp; /* Attempt to send the log-off packet */ if (cur->type == AIM_CONN_TYPE_BOS) aim_flap_close(sess, cur); while (cur) { tmp = cur->next; aim_conn_close(cur); connkill_real(sess, &cur); cur = tmp; } } sess->connlist = NULL; return; } /** * Initializes and/or resets a connection structure to the default values. * * @param deadconn Connection to be reset. */ static void aim_conn_init(aim_conn_t *deadconn) { if (!deadconn) return; deadconn->fd = -1; deadconn->subtype = -1; deadconn->type = -1; deadconn->seqnum = 0; deadconn->lastactivity = 0; deadconn->forcedlatency = 0; deadconn->handlerlist = NULL; deadconn->priv = NULL; memset(deadconn->inside, 0, sizeof(aim_conn_inside_t)); return; } /** * Allocate a new empty connection structure. * * @param sess Session * @return Returns the new connection structure. */ static aim_conn_t *aim_conn_getnext(aim_session_t *sess) { aim_conn_t *newconn; if (!(newconn = malloc(sizeof(aim_conn_t)))) return NULL; memset(newconn, 0, sizeof(aim_conn_t)); if (!(newconn->inside = malloc(sizeof(aim_conn_inside_t)))) { free(newconn); return NULL; } memset(newconn->inside, 0, sizeof(aim_conn_inside_t)); aim_conn_init(newconn); newconn->next = sess->connlist; sess->connlist = newconn; return newconn; } /** * Close, clear, and free a connection structure. Should never be * called from within libfaim. * * @param sess Session for the connection. * @param deadconn Connection to be freed. */ faim_export void aim_conn_kill(aim_session_t *sess, aim_conn_t **deadconn) { aim_conn_t *cur, **prev; if (!deadconn || !*deadconn) return; for (prev = &sess->connlist; (cur = *prev); ) { if (cur == *deadconn) { *prev = cur->next; break; } prev = &cur->next; } if (!cur) return; /* oops */ connkill_real(sess, &cur); return; } /** * Close (but not free) a connection. * * This leaves everything untouched except for clearing the * handler list and setting the fd to -1 (used to recognize * dead connections). It will also remove cookies if necessary. * * Why only if fd >= 3? Seems rather implementation specific... * fd's do not have to be distributed in a particular order, do they? * * @param deadconn The connection to close. */ faim_export void aim_conn_close(aim_conn_t *deadconn) { aim_rxcallback_t userfunc; if (deadconn->fd >= 0) close(deadconn->fd); deadconn->fd = -1; if ((userfunc = aim_callhandler(deadconn->sessv, deadconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNDEAD))) userfunc(deadconn->sessv, NULL, deadconn); if (deadconn->handlerlist) aim_clearhandlers(deadconn); return; } /** * Locates a connection of the specified type in the * specified session. * * XXX - Except for rendezvous, all uses of this should be removed and * aim_conn_findbygroup() should be used instead. * * @param sess The session to search. * @param type The type of connection to look for. * @return Returns the first connection found of the given target type, * or NULL if none could be found. */ faim_export aim_conn_t *aim_getconn_type(aim_session_t *sess, int type) { aim_conn_t *cur; for (cur = sess->connlist; cur; cur = cur->next) { if ((cur->type == type) && !(cur->status & AIM_CONN_STATUS_INPROGRESS)) break; } return cur; } faim_export aim_conn_t *aim_getconn_type_all(aim_session_t *sess, int type) { aim_conn_t *cur; for (cur = sess->connlist; cur; cur = cur->next) { if (cur->type == type) break; } return cur; } /* If you pass -1 for the fd, you'll get what you ask for. Gibberish. */ faim_export aim_conn_t *aim_getconn_fd(aim_session_t *sess, int fd) { aim_conn_t *cur; for (cur = sess->connlist; cur; cur = cur->next) { if (cur->fd == fd) break; } return cur; } /** * Handle normal connections or SOCKS5 via an extrememly quick and * dirty SOCKS5 interface. * * Attempts to connect to the specified host via the configured * proxy settings, if present. If no proxy is configured for * this session, the connection is done directly. * * XXX - this is really awful. * XXX - Split the SOCKS5 and the normal connection stuff into two * separate functions. * * @param sess Session to connect. * @param host Host to connect to. * @param port Port to connect to. * @param statusret Return value of the connection. */ static int aim_proxyconnect(aim_session_t *sess, const char *host, fu16_t port, fu32_t *statusret) { int fd = -1; if (strlen(sess->socksproxy.server)) { /* connecting via proxy */ int i; unsigned char buf[512]; struct sockaddr_in sa; struct hostent *hp; char *proxy; unsigned short proxyport = 1080; for(i=0;i<(int)strlen(sess->socksproxy.server);i++) { if (sess->socksproxy.server[i] == ':') { proxyport = atoi(&(sess->socksproxy.server[i+1])); break; } } proxy = (char *)malloc(i+1); strncpy(proxy, sess->socksproxy.server, i); proxy[i] = '\0'; if (!(hp = gethostbyname(proxy))) { faimdprintf(sess, 0, "proxyconnect: unable to resolve proxy name\n"); *statusret = (h_errno | AIM_CONN_STATUS_RESOLVERR); return -1; } free(proxy); memset(&sa.sin_zero, 0, 8); sa.sin_port = htons(proxyport); memcpy(&sa.sin_addr, hp->h_addr, hp->h_length); sa.sin_family = hp->h_addrtype; fd = socket(hp->h_addrtype, SOCK_STREAM, 0); if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) { faimdprintf(sess, 0, "proxyconnect: unable to connect to proxy\n"); close(fd); return -1; } i = 0; buf[0] = 0x05; /* SOCKS version 5 */ if (strlen(sess->socksproxy.username)) { buf[1] = 0x02; /* two methods */ buf[2] = 0x00; /* no authentication */ buf[3] = 0x02; /* username/password authentication */ i = 4; } else { buf[1] = 0x01; buf[2] = 0x00; i = 3; } if (write(fd, buf, i) < i) { *statusret = errno; close(fd); return -1; } if (read(fd, buf, 2) < 2) { *statusret = errno; close(fd); return -1; } if ((buf[0] != 0x05) || (buf[1] == 0xff)) { *statusret = EINVAL; close(fd); return -1; } /* check if we're doing username authentication */ if (buf[1] == 0x02) { i = aimutil_put8(buf, 0x01); /* version 1 */ i += aimutil_put8(buf+i, strlen(sess->socksproxy.username)); i += aimutil_putstr(buf+i, sess->socksproxy.username, strlen(sess->socksproxy.username)); i += aimutil_put8(buf+i, strlen(sess->socksproxy.password)); i += aimutil_putstr(buf+i, sess->socksproxy.password, strlen(sess->socksproxy.password)); if (write(fd, buf, i) < i) { *statusret = errno; close(fd); return -1; } if (read(fd, buf, 2) < 2) { *statusret = errno; close(fd); return -1; } if ((buf[0] != 0x01) || (buf[1] != 0x00)) { *statusret = EINVAL; close(fd); return -1; } } i = aimutil_put8(buf, 0x05); i += aimutil_put8(buf+i, 0x01); /* CONNECT */ i += aimutil_put8(buf+i, 0x00); /* reserved */ i += aimutil_put8(buf+i, 0x03); /* address type: host name */ i += aimutil_put8(buf+i, strlen(host)); i += aimutil_putstr(buf+i, host, strlen(host)); i += aimutil_put16(buf+i, port); if (write(fd, buf, i) < i) { *statusret = errno; close(fd); return -1; } if (read(fd, buf, 10) < 10) { *statusret = errno; close(fd); return -1; } if ((buf[0] != 0x05) || (buf[1] != 0x00)) { *statusret = EINVAL; close(fd); return -1; } } else { /* connecting directly */ struct sockaddr_in sa; struct hostent *hp; if (!(hp = gethostbyname(host))) { *statusret = (h_errno | AIM_CONN_STATUS_RESOLVERR); return -1; } memset(&sa, 0, sizeof(struct sockaddr_in)); sa.sin_port = htons(port); memcpy(&sa.sin_addr, hp->h_addr, hp->h_length); sa.sin_family = hp->h_addrtype; fd = socket(hp->h_addrtype, SOCK_STREAM, 0); if (sess->nonblocking) fcntl(fd, F_SETFL, O_NONBLOCK); /* XXX save flags */ if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) { if (sess->nonblocking) { if ((errno == EINPROGRESS) || (errno == EINTR)) { if (statusret) *statusret |= AIM_CONN_STATUS_INPROGRESS; return fd; } } close(fd); fd = -1; } } return fd; } /** * Clone an aim_conn_t. * * A new connection is allocated, and the values are filled in * appropriately. Note that this function sets the new connnection's * ->priv pointer to be equal to that of its parent: only the pointer * is copied, not the data it points to. * * @param sess The session containing this connection. * @param src The connection to clone. * @return Returns a pointer to the new aim_conn_t, or %NULL on error. */ faim_internal aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src) { aim_conn_t *conn; if (!(conn = aim_conn_getnext(sess))) return NULL; conn->fd = src->fd; conn->type = src->type; conn->subtype = src->subtype; conn->seqnum = src->seqnum; conn->priv = src->priv; conn->internal = src->internal; conn->lastactivity = src->lastactivity; conn->forcedlatency = src->forcedlatency; conn->sessv = src->sessv; aim_clonehandlers(sess, conn, src); if (src->inside) { /* * XXX should clone this section as well, but since currently * this function only gets called for some of that rendezvous * crap, and not on SNAC connections, its probably okay for * now. * */ } return conn; } /** * Opens a new connection to the specified dest host of specified * type, using the proxy settings if available. If @host is %NULL, * the connection is allocated and returned, but no connection * is made. * * FIXME: Return errors in a more sane way. * * @param sess Session to create connection in * @param type Type of connection to create * @param dest Host to connect to (in "host:port" syntax) */ faim_export aim_conn_t *aim_newconn(aim_session_t *sess, int type, const char *dest) { aim_conn_t *connstruct; fu16_t port = FAIM_LOGIN_PORT; char *host; int i, ret; if (!(connstruct = aim_conn_getnext(sess))) return NULL; connstruct->sessv = (void *)sess; connstruct->type = type; if (!dest) { /* just allocate a struct */ connstruct->fd = -1; connstruct->status = 0; return connstruct; } /* * As of 23 Jul 1999, AOL now sends the port number, preceded by a * colon, in the BOS redirect. This fatally breaks all previous * libfaims. Bad, bad AOL. * * We put this here to catch every case. * */ for(i = 0; i < (int)strlen(dest); i++) { if (dest[i] == ':') { port = atoi(&(dest[i+1])); break; } } host = (char *)malloc(i+1); strncpy(host, dest, i); host[i] = '\0'; if ((ret = aim_proxyconnect(sess, host, port, &connstruct->status)) < 0) { connstruct->fd = -1; connstruct->status = (errno | AIM_CONN_STATUS_CONNERR); free(host); return connstruct; } else connstruct->fd = ret; free(host); return connstruct; } /** * Searches @sess for the passed connection. * * @param sess Session in which to look. * @param conn Connection to look for. * @return Returns 1 if the passed connection is present, zero otherwise. */ faim_export int aim_conn_in_sess(aim_session_t *sess, aim_conn_t *conn) { aim_conn_t *cur; for (cur = sess->connlist; cur; cur = cur->next) { if (cur == conn) return 1; } return 0; } /** * Waits for a socket with data or for timeout, whichever comes first. * See select(2). * * Return codes in *status: * -1 error in select() (%NULL returned) * 0 no events pending (%NULL returned) * 1 outgoing data pending (%NULL returned) * 2 incoming data pending (connection with pending data returned) * * @param sess Session to wait on * @param timeout How long to wait * @param status Return status * @return If @status is 2, returns connection with pending data, otherwise %NULL */ faim_export aim_conn_t *aim_select(aim_session_t *sess, struct timeval *timeout, int *status) { aim_conn_t *cur; fd_set fds, wfds; int maxfd, i, haveconnecting = 0; if (!sess->connlist) { *status = -1; return NULL; } FD_ZERO(&fds); FD_ZERO(&wfds); for (cur = sess->connlist, maxfd = 0; cur; cur = cur->next) { if (cur->fd == -1) { /* don't let invalid/dead connections sit around */ *status = 2; return cur; } else if (cur->status & AIM_CONN_STATUS_INPROGRESS) { FD_SET(cur->fd, &wfds); haveconnecting++; } FD_SET(cur->fd, &fds); if (cur->fd > maxfd) maxfd = cur->fd; } /* * If we have data waiting to be sent, return * * We have to not do this if theres at least one * connection thats still connecting, since that connection * may have queued data and this return would prevent * the connection from ever completing! This is a major * inadequacy of the libfaim way of doing things. It means * that nothing can transmit as long as there's connecting * sockets. Evil. * * But its still better than having blocking connects. * */ if (!haveconnecting && sess->queue_outgoing) { *status = 1; return NULL; } if ((i = select(maxfd+1, &fds, &wfds, NULL, timeout))>=1) { for (cur = sess->connlist; cur; cur = cur->next) { if ((FD_ISSET(cur->fd, &fds)) || ((cur->status & AIM_CONN_STATUS_INPROGRESS) && FD_ISSET(cur->fd, &wfds))) { *status = 2; return cur; } } *status = 0; /* shouldn't happen */ } else if ((i == -1) && (errno == EINTR)) /* treat interrupts as a timeout */ *status = 0; else *status = i; /* can be 0 or -1 */ return NULL; /* no waiting or error, return */ } /** * Set a forced latency value for connection. Basically causes * @newval seconds to be spent between transmits on a connection. * * This is my lame attempt at overcoming not understanding the rate * limiting. * * XXX: This should really be replaced with something that scales and * backs off like the real rate limiting does. * * @param conn Conn to set latency for. * @param newval Number of seconds to force between transmits. * @return Returns -1 if the connection does not exist, zero otherwise. */ faim_export int aim_conn_setlatency(aim_conn_t *conn, int newval) { if (!conn) return -1; conn->forcedlatency = newval; conn->lastactivity = 0; /* reset this just to make sure */ return 0; } /** * Configure a proxy for this session. * * Call this with your SOCKS5 proxy server parameters before * the first call to aim_newconn(). If called with all %NULL * args, it will clear out a previously set proxy. * * Set username and password to %NULL if not applicable. * * @param sess Session to set proxy for. * @param server SOCKS server. * @param username SOCKS username. * @param password SOCKS password. */ faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password) { /* clear out the proxy info */ if (!server || !strlen(server)) { memset(sess->socksproxy.server, 0, sizeof(sess->socksproxy.server)); memset(sess->socksproxy.username, 0, sizeof(sess->socksproxy.username)); memset(sess->socksproxy.password, 0, sizeof(sess->socksproxy.password)); return; } strncpy(sess->socksproxy.server, server, sizeof(sess->socksproxy.server)); if (username && strlen(username)) strncpy(sess->socksproxy.username, username, sizeof(sess->socksproxy.username)); if (password && strlen(password)) strncpy(sess->socksproxy.password, password, sizeof(sess->socksproxy.password)); return; } static void defaultdebugcb(aim_session_t *sess, int level, const char *format, va_list va) { vfprintf(stderr, format, va); return; } /** * Initializes a session structure by setting the initial values * stuff in the aim_session_t struct. * * @param sess Session to initialize. * @param nonblocking Set to true if you want connections to be non-blocking. * @param debuglevel Level of debugging output (zero is least). */ faim_export void aim_session_init(aim_session_t *sess, fu8_t nonblocking, int debuglevel) { if (!sess) return; memset(sess, 0, sizeof(aim_session_t)); aim_connrst(sess); sess->queue_outgoing = NULL; sess->queue_incoming = NULL; aim_initsnachash(sess); sess->msgcookies = NULL; sess->nonblocking = nonblocking; sess->debug = debuglevel; sess->debugcb = defaultdebugcb; sess->modlistv = NULL; sess->snacid_next = 0x00000001; sess->locate.userinfo = NULL; sess->locate.torequest = NULL; sess->locate.requested = NULL; sess->locate.waiting_for_response = FALSE; sess->ssi.received_data = 0; sess->ssi.numitems = 0; sess->ssi.official = NULL; sess->ssi.local = NULL; sess->ssi.pending = NULL; sess->ssi.timestamp = (time_t)0; sess->ssi.waiting_for_ack = 0; sess->icq_info = NULL; sess->authinfo = NULL; sess->emailinfo = NULL; sess->oft_info = NULL; /* * This must always be set. Default to the queue-based * version for back-compatibility. */ aim_tx_setenqueue(sess, AIM_TX_QUEUED, NULL); /* * Register all the modules for this session... */ aim__registermodule(sess, misc_modfirst); /* load the catch-all first */ aim__registermodule(sess, service_modfirst); aim__registermodule(sess, locate_modfirst); aim__registermodule(sess, buddylist_modfirst); aim__registermodule(sess, msg_modfirst); aim__registermodule(sess, adverts_modfirst); aim__registermodule(sess, invite_modfirst); aim__registermodule(sess, admin_modfirst); aim__registermodule(sess, popups_modfirst); aim__registermodule(sess, bos_modfirst); aim__registermodule(sess, search_modfirst); aim__registermodule(sess, stats_modfirst); aim__registermodule(sess, translate_modfirst); aim__registermodule(sess, chatnav_modfirst); aim__registermodule(sess, chat_modfirst); aim__registermodule(sess, odir_modfirst); aim__registermodule(sess, bart_modfirst); /* missing 0x11 - 0x12 */ aim__registermodule(sess, ssi_modfirst); /* missing 0x14 */ aim__registermodule(sess, icq_modfirst); /* XXX - Make sure this isn't sent for AIM */ /* missing 0x16 */ aim__registermodule(sess, auth_modfirst); aim__registermodule(sess, email_modfirst); return; } /** * Logoff and deallocate a session. * * @param sess Session to kill */ faim_export void aim_session_kill(aim_session_t *sess) { aim_cleansnacs(sess, -1); aim_logoff(sess); aim__shutdownmodules(sess); return; } /** * Set the function to call when outputting debugging info. * * The function specified is called whenever faimdprintf() is used within * libfaim, and the session's debugging level is greater tha nor equal to * the value faimdprintf was called with. * * @param sess Session to change. * @param cb Function to call. * @return Returns -1 if the session does not exist, zero otherwise. */ faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t cb) { if (!sess) return -1; sess->debugcb = cb; return 0; } /** * Determine if a connection is connecting. * * @param conn Connection to examine. * @return Returns nonzero if the connection is in the process of * connecting (or if it just completed and * aim_conn_completeconnect() has yet to be called on it). */ faim_export int aim_conn_isconnecting(aim_conn_t *conn) { if (!conn) return 0; return !!(conn->status & AIM_CONN_STATUS_INPROGRESS); } /* * XXX this is nearly as ugly as proxyconnect(). */ faim_export int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn) { aim_rxcallback_t userfunc; if (!conn || (conn->fd == -1)) return -1; if (!(conn->status & AIM_CONN_STATUS_INPROGRESS)) return -1; fcntl(conn->fd, F_SETFL, 0); conn->status &= ~AIM_CONN_STATUS_INPROGRESS; if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE))) userfunc(sess, NULL, conn); /* Flush out the queues if there was something waiting for this conn */ aim_tx_flushqueue(sess); return 0; } faim_export aim_session_t *aim_conn_getsess(aim_conn_t *conn) { if (!conn) return NULL; return (aim_session_t *)conn->sessv; } /** * Close -ALL- open connections. * * @param sess The session. * @return Zero. */ faim_export int aim_logoff(aim_session_t *sess) { aim_connrst(sess); /* in case we want to connect again */ return 0; } /** * No-op. This sends an empty channel 5 SNAC. WinAIM 4.x and higher * sends these _every minute_ to keep the connection alive. */ faim_export int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn) { aim_frame_t *fr; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x05, 0))) return -ENOMEM; aim_tx_enqueue(sess, fr); /* clean out SNACs over 60sec old */ aim_cleansnacs(sess, 60); return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/search.c0000644000175000017500000000570210234217334021277 0ustar ryanryan00000000000000/* * Family 0x000a - User Search. * * TODO: Add aim_usersearch_name() * */ #define FAIM_INTERNAL #include /* * Subtype 0x0001 * * XXX can this be integrated with the rest of the error handling? */ static int error(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; aim_snac_t *snac2; /* XXX the modules interface should have already retrieved this for us */ if (!(snac2 = aim_remsnac(sess, snac->id))) { faimdprintf(sess, 2, "search error: couldn't get a snac for 0x%08lx\n", snac->id); return 0; } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, snac2->data /* address */); /* XXX freesnac()? */ if (snac2) free(snac2->data); free(snac2); return ret; } /* * Subtype 0x0002 * */ faim_export int aim_search_address(aim_session_t *sess, aim_conn_t *conn, const char *address) { aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !conn || !address) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+strlen(address)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x000a, 0x0002, 0x0000, strdup(address), strlen(address)+1); aim_putsnac(&fr->data, 0x000a, 0x0002, 0x0000, snacid); aimbs_putraw(&fr->data, address, strlen(address)); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0003 * */ static int reply(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int j = 0, m, ret = 0; aim_tlvlist_t *tlvlist; char *cur = NULL, *buf = NULL; aim_rxcallback_t userfunc; aim_snac_t *snac2; char *searchaddr = NULL; if ((snac2 = aim_remsnac(sess, snac->id))) searchaddr = (char *)snac2->data; tlvlist = aim_tlvlist_read(bs); m = aim_tlvlist_count(&tlvlist); /* XXX uhm. * This is the only place that uses something other than 1 for the 3rd * parameter to aim_tlv_gettlv_whatever(). */ while ((cur = aim_tlv_getstr(tlvlist, 0x0001, j+1)) && j < m) { buf = realloc(buf, (j+1) * (MAXSNLEN+1)); strncpy(&buf[j * (MAXSNLEN+1)], cur, MAXSNLEN); free(cur); j++; } aim_tlvlist_free(&tlvlist); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, searchaddr, j, buf); /* XXX freesnac()? */ if (snac2) free(snac2->data); free(snac2); free(buf); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0001) return error(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0003) return reply(sess, mod, rx, snac, bs); return 0; } faim_internal int search_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x000a; mod->version = 0x0001; mod->toolid = 0x0110; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "search", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/faimconfig.h0000644000175000017500000000250110234217334022133 0ustar ryanryan00000000000000/* * faimconfig.h * * Contains various compile-time options that apply _only_ to libfaim. * */ #ifndef __FAIMCONFIG_H__ #define __FAIMCONFIG_H__ /* * USE_SNAC_FOR_IMS is an old feature that allowed better * tracking of error messages by caching SNAC IDs of outgoing * ICBMs and comparing them to incoming errors. However, * its a helluvalot of overhead for something that should * rarely happen. * * Default: defined. This is now defined by default * because it should be stable and its not too bad. * And Josh wanted it. * */ #define USE_SNAC_FOR_IMS /* * Default Authorizer server name and TCP port for the OSCAR farm. * * You shouldn't need to change this unless you're writing * your own server. * * Note that only one server is needed to start the whole * AIM process. The later server addresses come from * the authorizer service. * * This is only here for convenience. Its still up to * the client to connect to it. * */ #define FAIM_LOGIN_SERVER "login.oscar.aol.com" #define FAIM_LOGIN_PORT 5190 /* * Size of the SNAC caching hash. * * Default: 16 * */ #define FAIM_SNAC_HASH_SIZE 16 /* * If building on Win32, define WIN32_STATIC if you don't want * to compile libfaim as a DLL (and instead link it right into * your app). */ #define WIN32_STATIC #endif /* __FAIMCONFIG_H__ */ pork-0.99.8.1/src/protocols/aim/libfaim/misc.c0000644000175000017500000000704710234217334020771 0ustar ryanryan00000000000000/* * misc.c * * Random stuff. Basically just a few functions for sending * simple SNACs, and then the generic error handler. * */ #define FAIM_INTERNAL #include /* * Generic routine for sending commands. * * I know I can do this in a smarter way...but I'm not thinking straight * right now... * * I had one big function that handled all three cases, but then it broke * and I split it up into three. But then I fixed it. I just never went * back to the single. I don't see any advantage to doing it either way. * */ faim_internal int aim_genericreq_n(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t subtype) { aim_frame_t *fr; aim_snacid_t snacid = 0x00000000; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) return -ENOMEM; aim_putsnac(&fr->data, family, subtype, 0x0000, snacid); aim_tx_enqueue(sess, fr); return 0; } faim_internal int aim_genericreq_n_snacid(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t subtype) { aim_frame_t *fr; aim_snacid_t snacid; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) return -ENOMEM; snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0); aim_putsnac(&fr->data, family, subtype, 0x0000, snacid); aim_tx_enqueue(sess, fr); return 0; } faim_internal int aim_genericreq_l(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t subtype, fu32_t *longdata) { aim_frame_t *fr; aim_snacid_t snacid; if (!longdata) return aim_genericreq_n(sess, conn, family, subtype); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4))) return -ENOMEM; snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0); aim_putsnac(&fr->data, family, subtype, 0x0000, snacid); aimbs_put32(&fr->data, *longdata); aim_tx_enqueue(sess, fr); return 0; } faim_internal int aim_genericreq_s(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t subtype, fu16_t *shortdata) { aim_frame_t *fr; aim_snacid_t snacid; if (!shortdata) return aim_genericreq_n(sess, conn, family, subtype); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2))) return -ENOMEM; snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0); aim_putsnac(&fr->data, family, subtype, 0x0000, snacid); aimbs_put16(&fr->data, *shortdata); aim_tx_enqueue(sess, fr); return 0; } /* * Should be generic enough to handle the errors for all groups. * */ static int generror(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; int error = 0; aim_rxcallback_t userfunc; aim_snac_t *snac2; snac2 = aim_remsnac(sess, snac->id); if (aim_bstream_empty(bs)) error = aimbs_get16(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, error, snac2 ? snac2->data : NULL); if (snac2) free(snac2->data); free(snac2); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0001) return generror(sess, mod, rx, snac, bs); else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) { aim_rxcallback_t userfunc; if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) return userfunc(sess, rx); } return 0; } faim_internal int misc_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0xffff; mod->version = 0x0000; mod->flags = AIM_MODFLAG_MULTIFAMILY; strncpy(mod->name, "misc", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/odir.c0000644000175000017500000001706510234217334020774 0ustar ryanryan00000000000000/* * Family 0x000f - Newer Search Method * * Used for searching for other AIM users by email address, name, * location, commmon interests, and a few other similar things. * */ #define FAIM_INTERNAL #include /** * Subtype 0x0002 - Submit a User Search Request * * Search for an AIM screen name based on their email address. * * @param sess The oscar session. * @param region Should be "us-ascii" unless you know what you're doing. * @param email The email address you want to search for. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_odir_email(aim_session_t *sess, const char *region, const char *email) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region || !email) return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */ aim_tlvlist_add_raw(&tl, 0x0005, strlen(email), email); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0002 - Submit a User Search Request * * Search for an AIM screen name based on various info * about the person. * * @param sess The oscar session. * @param region Should be "us-ascii" unless you know what you're doing. * @param first The first name of the person you want to search for. * @param middle The middle name of the person you want to search for. * @param last The last name of the person you want to search for. * @param maiden The maiden name of the person you want to search for. * @param nick The nick name of the person you want to search for. * @param city The city where the person you want to search for resides. * @param state The state where the person you want to search for resides. * @param country The country where the person you want to search for resides. * @param zip The zip code where the person you want to search for resides. * @param address The street address where the person you want to seach for resides. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_odir_name(aim_session_t *sess, const char *region, const char *first, const char *middle, const char *last, const char *maiden, const char *nick, const char *city, const char *state, const char *country, const char *zip, const char *address) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region) return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); aim_tlvlist_add_16(&tl, 0x000a, 0x0000); /* Type of search */ if (first) aim_tlvlist_add_raw(&tl, 0x0001, strlen(first), first); if (last) aim_tlvlist_add_raw(&tl, 0x0002, strlen(last), last); if (middle) aim_tlvlist_add_raw(&tl, 0x0003, strlen(middle), middle); if (maiden) aim_tlvlist_add_raw(&tl, 0x0004, strlen(maiden), maiden); if (country) aim_tlvlist_add_raw(&tl, 0x0006, strlen(country), country); if (state) aim_tlvlist_add_raw(&tl, 0x0007, strlen(state), state); if (city) aim_tlvlist_add_raw(&tl, 0x0008, strlen(city), city); if (nick) aim_tlvlist_add_raw(&tl, 0x000c, strlen(nick), nick); if (zip) aim_tlvlist_add_raw(&tl, 0x000d, strlen(zip), zip); if (address) aim_tlvlist_add_raw(&tl, 0x0021, strlen(address), address); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0002 - Submit a User Search Request * * @param sess The oscar session. * @param interest1 An interest you want to search for. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_odir_interest(aim_session_t *sess, const char *region, const char *interest) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region) return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */ if (interest) aim_tlvlist_add_raw(&tl, 0x0001, strlen(interest), interest); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /** * Subtype 0x0003 - Receive Reply From a User Search * */ static int parseresults(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t tmp, numresults; struct aim_odir *results = NULL; tmp = aimbs_get16(bs); /* Unknown */ tmp = aimbs_get16(bs); /* Unknown */ aim_bstream_advance(bs, tmp); numresults = aimbs_get16(bs); /* Number of results to follow */ /* Allocate a linked list, 1 node per result */ while (numresults) { struct aim_odir *new; aim_tlvlist_t *tl = aim_tlvlist_readnum(bs, aimbs_get16(bs)); new = (struct aim_odir *)malloc(sizeof(struct aim_odir)); new->first = aim_tlv_getstr(tl, 0x0001, 1); new->last = aim_tlv_getstr(tl, 0x0002, 1); new->middle = aim_tlv_getstr(tl, 0x0003, 1); new->maiden = aim_tlv_getstr(tl, 0x0004, 1); new->email = aim_tlv_getstr(tl, 0x0005, 1); new->country = aim_tlv_getstr(tl, 0x0006, 1); new->state = aim_tlv_getstr(tl, 0x0007, 1); new->city = aim_tlv_getstr(tl, 0x0008, 1); new->sn = aim_tlv_getstr(tl, 0x0009, 1); new->interest = aim_tlv_getstr(tl, 0x000b, 1); new->nick = aim_tlv_getstr(tl, 0x000c, 1); new->zip = aim_tlv_getstr(tl, 0x000d, 1); new->region = aim_tlv_getstr(tl, 0x001c, 1); new->address = aim_tlv_getstr(tl, 0x0021, 1); new->next = results; results = new; numresults--; } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, results); /* Now free everything from above */ while (results) { struct aim_odir *del = results; results = results->next; free(del->first); free(del->last); free(del->middle); free(del->maiden); free(del->email); free(del->country); free(del->state); free(del->city); free(del->sn); free(del->interest); free(del->nick); free(del->zip); free(del->region); free(del->address); free(del); } return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0003) return parseresults(sess, mod, rx, snac, bs); return 0; } faim_internal int odir_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x000f; mod->version = 0x0001; mod->toolid = 0x0010; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "odir", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/admin.c0000644000175000017500000001303110234217334021114 0ustar ryanryan00000000000000/* * Family 0x0007 - Account Administration. * * Used for stuff like changing the formating of your screen name, changing your * email address, requesting an account confirmation email, getting account info, * */ #define FAIM_INTERNAL #include /* * Subtype 0x0002 - Request a bit of account info. * * Info should be one of the following: * 0x0001 - Screen name formatting * 0x0011 - Email address * 0x0013 - Unknown * */ faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info) { aim_frame_t *fr; aim_snacid_t snacid; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0007, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0002, 0x0000, snacid); aimbs_put16(&fr->data, info); aimbs_put16(&fr->data, 0x0000); aim_tx_enqueue(sess, fr); return 0; } /* * Subtypes 0x0003 and 0x0005 - Parse account info. * * Called in reply to both an information request (subtype 0x0002) and * an information change (subtype 0x0004). * */ static int infochange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; char *url=NULL, *sn=NULL, *email=NULL; fu16_t perms, tlvcount, err=0; perms = aimbs_get16(bs); tlvcount = aimbs_get16(bs); while (tlvcount && aim_bstream_empty(bs)) { fu16_t type, length; type = aimbs_get16(bs); length = aimbs_get16(bs); switch (type) { case 0x0001: { sn = aimbs_getstr(bs, length); } break; case 0x0004: { url = aimbs_getstr(bs, length); } break; case 0x0008: { err = aimbs_get16(bs); } break; case 0x0011: { if (length == 0) { email = (char*)malloc(13*sizeof(char)); strcpy(email, "*suppressed*"); } else email = aimbs_getstr(bs, length); } break; } tlvcount--; } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) userfunc(sess, rx, (snac->subtype == 0x0005) ? 1 : 0, perms, err, url, sn, email); if (sn) free(sn); if (url) free(url); if (email) free(email); return 1; } /* * Subtype 0x0004 - Set screenname formatting. * */ faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick) { aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newnick)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); aim_tlvlist_add_raw(&tl, 0x0001, strlen(newnick), newnick); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0004 - Change password. * */ faim_export int aim_admin_changepasswd(aim_session_t *sess, aim_conn_t *conn, const char *newpw, const char *curpw) { aim_frame_t *fr; aim_tlvlist_t *tl = NULL; aim_snacid_t snacid; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+strlen(curpw)+4+strlen(newpw)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); /* new password TLV t(0002) */ aim_tlvlist_add_raw(&tl, 0x0002, strlen(newpw), newpw); /* current password TLV t(0012) */ aim_tlvlist_add_raw(&tl, 0x0012, strlen(curpw), curpw); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0004 - Change email address. * */ faim_export int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newemail) { aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newemail)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); aim_tlvlist_add_raw(&tl, 0x0011, strlen(newemail), newemail); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0006 - Request account confirmation. * * This will cause an email to be sent to the address associated with * the account. By following the instructions in the mail, you can * get the TRIAL flag removed from your account. * */ faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0007, 0x0006); } /* * Subtype 0x0007 - Account confirmation request acknowledgement. * */ static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; fu16_t status; aim_tlvlist_t *tl; status = aimbs_get16(bs); /* This is 0x0013 if unable to confirm at this time */ tl = aim_tlvlist_read(bs); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, status); return ret; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) return infochange(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0007) return accountconfirm(sess, mod, rx, snac, bs); return 0; } faim_internal int admin_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0007; mod->version = 0x0001; mod->toolid = 0x0010; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "admin", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/snac.c0000644000175000017500000000622710234217334020761 0ustar ryanryan00000000000000/* * * Various SNAC-related dodads... * * outstanding_snacs is a list of aim_snac_t structs. A SNAC should be added * whenever a new SNAC is sent and it should remain in the list until the * response for it has been received. * * cleansnacs() should be called periodically by the client in order * to facilitate the aging out of unreplied-to SNACs. This can and does * happen, so it should be handled. * */ #define FAIM_INTERNAL #include /* * Called from aim_session_init() to initialize the hash. */ faim_internal void aim_initsnachash(aim_session_t *sess) { int i; for (i = 0; i < FAIM_SNAC_HASH_SIZE; i++) sess->snac_hash[i] = NULL; return; } faim_internal aim_snacid_t aim_cachesnac(aim_session_t *sess, const fu16_t family, const fu16_t type, const fu16_t flags, const void *data, const int datalen) { aim_snac_t snac; snac.id = sess->snacid_next++; snac.family = family; snac.type = type; snac.flags = flags; if (datalen) { if (!(snac.data = malloc(datalen))) return 0; /* er... */ memcpy(snac.data, data, datalen); } else snac.data = NULL; return aim_newsnac(sess, &snac); } /* * Clones the passed snac structure and caches it in the * list/hash. */ faim_internal aim_snacid_t aim_newsnac(aim_session_t *sess, aim_snac_t *newsnac) { aim_snac_t *snac; int index; if (!newsnac) return 0; if (!(snac = malloc(sizeof(aim_snac_t)))) return 0; memcpy(snac, newsnac, sizeof(aim_snac_t)); snac->issuetime = time(NULL); index = snac->id % FAIM_SNAC_HASH_SIZE; snac->next = (aim_snac_t *)sess->snac_hash[index]; sess->snac_hash[index] = (void *)snac; return snac->id; } /* * Finds a snac structure with the passed SNAC ID, * removes it from the list/hash, and returns a pointer to it. * * The returned structure must be freed by the caller. * */ faim_internal aim_snac_t *aim_remsnac(aim_session_t *sess, aim_snacid_t id) { aim_snac_t *cur, **prev; int index; index = id % FAIM_SNAC_HASH_SIZE; for (prev = (aim_snac_t **)&sess->snac_hash[index]; (cur = *prev); ) { if (cur->id == id) { *prev = cur->next; if (cur->flags & AIM_SNACFLAGS_DESTRUCTOR) { free(cur->data); cur->data = NULL; } return cur; } else prev = &cur->next; } return cur; } /* * This is for cleaning up old SNACs that either don't get replies or * a reply was never received for. Garbage collection. Plain and simple. * * maxage is the _minimum_ age in seconds to keep SNACs. * */ faim_export void aim_cleansnacs(aim_session_t *sess, int maxage) { int i; for (i = 0; i < FAIM_SNAC_HASH_SIZE; i++) { aim_snac_t *cur, **prev; time_t curtime; if (!sess->snac_hash[i]) continue; curtime = time(NULL); /* done here in case we waited for the lock */ for (prev = (aim_snac_t **)&sess->snac_hash[i]; (cur = *prev); ) { if ((curtime - cur->issuetime) > maxage) { *prev = cur->next; free(cur->data); free(cur); } else prev = &cur->next; } } return; } faim_internal int aim_putsnac(aim_bstream_t *bs, fu16_t family, fu16_t subtype, fu16_t flags, aim_snacid_t snacid) { aimbs_put16(bs, family); aimbs_put16(bs, subtype); aimbs_put16(bs, flags); aimbs_put32(bs, snacid); return 10; } pork-0.99.8.1/src/protocols/aim/libfaim/aim_internal.h0000644000175000017500000002241710234217334022503 0ustar ryanryan00000000000000/* * aim_internal.h -- prototypes/structs for the guts of libfaim * */ #ifdef FAIM_INTERNAL #ifndef __AIM_INTERNAL_H__ #define __AIM_INTERNAL_H__ 1 typedef struct { fu16_t family; fu16_t subtype; fu16_t flags; fu32_t id; } aim_modsnac_t; #define AIM_MODULENAME_MAXLEN 16 #define AIM_MODFLAG_MULTIFAMILY 0x0001 typedef struct aim_module_s { fu16_t family; fu16_t version; fu16_t toolid; fu16_t toolversion; fu16_t flags; char name[AIM_MODULENAME_MAXLEN+1]; int (*snachandler)(aim_session_t *sess, struct aim_module_s *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs); void (*shutdown)(aim_session_t *sess, struct aim_module_s *mod); void *priv; struct aim_module_s *next; } aim_module_t; faim_internal int aim__registermodule(aim_session_t *sess, int (*modfirst)(aim_session_t *, aim_module_t *)); faim_internal void aim__shutdownmodules(aim_session_t *sess); faim_internal aim_module_t *aim__findmodulebygroup(aim_session_t *sess, fu16_t group); faim_internal aim_module_t *aim__findmodule(aim_session_t *sess, const char *name); faim_internal int admin_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int buddylist_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int bos_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int search_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int stats_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int auth_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int msg_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int misc_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int chatnav_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int chat_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int locate_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int service_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int invite_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int translate_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int popups_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int adverts_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int odir_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int bart_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int ssi_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int icq_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int email_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int aim_genericreq_n(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype); faim_internal int aim_genericreq_n_snacid(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype); faim_internal int aim_genericreq_l(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype, fu32_t *); faim_internal int aim_genericreq_s(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype, fu16_t *); #define AIMBS_CURPOSPAIR(x) ((x)->data + (x)->offset), ((x)->len - (x)->offset) /* bstream.c */ faim_internal int aim_bstream_init(aim_bstream_t *bs, fu8_t *data, int len); faim_internal int aim_bstream_empty(aim_bstream_t *bs); faim_internal int aim_bstream_curpos(aim_bstream_t *bs); faim_internal int aim_bstream_setpos(aim_bstream_t *bs, unsigned int off); faim_internal void aim_bstream_rewind(aim_bstream_t *bs); faim_internal int aim_bstream_advance(aim_bstream_t *bs, int n); faim_internal fu8_t aimbs_get8(aim_bstream_t *bs); faim_internal fu16_t aimbs_get16(aim_bstream_t *bs); faim_internal fu32_t aimbs_get32(aim_bstream_t *bs); faim_internal fu8_t aimbs_getle8(aim_bstream_t *bs); faim_internal fu16_t aimbs_getle16(aim_bstream_t *bs); faim_internal fu32_t aimbs_getle32(aim_bstream_t *bs); faim_internal int aimbs_put8(aim_bstream_t *bs, fu8_t v); faim_internal int aimbs_put16(aim_bstream_t *bs, fu16_t v); faim_internal int aimbs_put32(aim_bstream_t *bs, fu32_t v); faim_internal int aimbs_putle8(aim_bstream_t *bs, fu8_t v); faim_internal int aimbs_putle16(aim_bstream_t *bs, fu16_t v); faim_internal int aimbs_putle32(aim_bstream_t *bs, fu32_t v); faim_internal int aimbs_getrawbuf(aim_bstream_t *bs, fu8_t *buf, int len); faim_internal fu8_t *aimbs_getraw(aim_bstream_t *bs, int len); faim_internal char *aimbs_getstr(aim_bstream_t *bs, int len); faim_internal int aimbs_putraw(aim_bstream_t *bs, const fu8_t *v, int len); faim_internal int aimbs_putbs(aim_bstream_t *bs, aim_bstream_t *srcbs, int len); /* conn.c */ faim_internal aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src); /* ft.c */ faim_internal int aim_rxdispatch_rendezvous(aim_session_t *sess, aim_frame_t *fr); /* rxhandlers.c */ faim_internal aim_rxcallback_t aim_callhandler(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t type); faim_internal int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t type, aim_frame_t *ptr); faim_internal int aim_parse_unknown(aim_session_t *, aim_frame_t *, ...); faim_internal void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src); /* rxqueue.c */ faim_internal int aim_recv(int fd, void *buf, size_t count); faim_internal int aim_bstream_recv(aim_bstream_t *bs, int fd, size_t count); faim_internal void aim_rxqueue_cleanbyconn(aim_session_t *sess, aim_conn_t *conn); faim_internal void aim_frame_destroy(aim_frame_t *); /* txqueue.c */ faim_internal aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, fu8_t framing, fu16_t chan, int datalen); faim_internal int aim_tx_enqueue(aim_session_t *, aim_frame_t *); faim_internal int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *cur); faim_internal void aim_tx_cleanqueue(aim_session_t *, aim_conn_t *); /* * Generic SNAC structure. Rarely if ever used. */ typedef struct aim_snac_s { aim_snacid_t id; fu16_t family; fu16_t type; fu16_t flags; void *data; time_t issuetime; struct aim_snac_s *next; } aim_snac_t; /* snac.c */ faim_internal void aim_initsnachash(aim_session_t *sess); faim_internal aim_snacid_t aim_newsnac(aim_session_t *, aim_snac_t *newsnac); faim_internal aim_snacid_t aim_cachesnac(aim_session_t *sess, const fu16_t family, const fu16_t type, const fu16_t flags, const void *data, const int datalen); faim_internal aim_snac_t *aim_remsnac(aim_session_t *, aim_snacid_t id); faim_internal int aim_putsnac(aim_bstream_t *, fu16_t family, fu16_t type, fu16_t flags, aim_snacid_t id); /* Stored in ->priv of the service request SNAC for chats. */ struct chatsnacinfo { fu16_t exchange; char name[128]; fu16_t instance; }; /* * In SNACland, the terms 'family' and 'group' are synonymous -- the former * is my term, the latter is AOL's. */ struct snacgroup { fu16_t group; struct snacgroup *next; }; #ifdef FAIM_NEED_CONN_INTERNAL struct snacpair { fu16_t group; fu16_t subtype; struct snacpair *next; }; struct rateclass { fu16_t classid; fu32_t windowsize; fu32_t clear; fu32_t alert; fu32_t limit; fu32_t disconnect; fu32_t current; fu32_t max; fu8_t unknown[5]; /* only present in versions >= 3 */ struct snacpair *members; struct rateclass *next; }; #endif /* FAIM_NEED_CONN_INTERNAL */ /* * This is inside every connection. But it is a void * to anything * outside of libfaim. It should remain that way. It's called data * abstraction. Maybe you've heard of it. (Probably not if you're a * libfaim user.) * */ typedef struct aim_conn_inside_s { struct snacgroup *groups; struct rateclass *rates; } aim_conn_inside_t; faim_internal void aim_conn_addgroup(aim_conn_t *conn, fu16_t group); faim_internal int aim_cachecookie(aim_session_t *sess, aim_msgcookie_t *cookie); faim_internal aim_msgcookie_t *aim_uncachecookie(aim_session_t *sess, fu8_t *cookie, int type); faim_internal aim_msgcookie_t *aim_mkcookie(fu8_t *, int, void *); faim_internal aim_msgcookie_t *aim_checkcookie(aim_session_t *, const unsigned char *, const int); faim_internal int aim_freecookie(aim_session_t *sess, aim_msgcookie_t *cookie); faim_internal int aim_msgcookie_gettype(int reqclass); faim_internal int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie); /* 0x0002 - locate.c */ faim_internal void aim_locate_requestuserinfo(aim_session_t *sess, const char *sn); faim_internal fu32_t aim_locate_getcaps(aim_session_t *sess, aim_bstream_t *bs, int len); faim_internal fu32_t aim_locate_getcaps_short(aim_session_t *sess, aim_bstream_t *bs, int len); faim_internal int aim_putcap(aim_bstream_t *bs, fu32_t caps); faim_internal void aim_info_free(aim_userinfo_t *); faim_internal int aim_info_extract(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *); faim_internal int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info); faim_internal int aim_chat_readroominfo(aim_bstream_t *bs, struct aim_chat_roominfo *outinfo); faim_internal void aim_conn_kill_chat(aim_session_t *sess, aim_conn_t *conn); /* These are all handled internally now. */ faim_internal int aim_setversions(aim_session_t *sess, aim_conn_t *conn); faim_internal int aim_reqrates(aim_session_t *, aim_conn_t *); faim_internal int aim_rates_addparam(aim_session_t *, aim_conn_t *); faim_internal int aim_rates_delparam(aim_session_t *, aim_conn_t *); faim_internal void faimdprintf(aim_session_t *sess, int dlevel, const char *format, ...); #endif /* __AIM_INTERNAL_H__ */ #endif /* FAIM_INTERNAL */ pork-0.99.8.1/src/protocols/aim/libfaim/adverts.c0000644000175000017500000000120610234217334021475 0ustar ryanryan00000000000000/* * Family 0x0005 - Advertisements. * */ #define FAIM_INTERNAL #include faim_export int aim_ads_requestads(aim_session_t *sess, aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0005, 0x0002); } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { return 0; } faim_internal int adverts_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x0005; mod->version = 0x0001; mod->toolid = 0x0001; mod->toolversion = 0x0001; mod->flags = 0; strncpy(mod->name, "adverts", sizeof(mod->name)); mod->snachandler = snachandler; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/locate.c0000644000175000017500000011172410234217334021303 0ustar ryanryan00000000000000/* * Family 0x0002 - Locate. * * The functions here are responsible for requesting and parsing information- * gathering SNACs. Or something like that. This family contains the SNACs * for getting and setting info, away messages, directory profile thingy, etc. */ #define FAIM_INTERNAL #include #ifdef _WIN32 #include "win32dep.h" #endif /* * Capability blocks. * * These are CLSIDs. They should actually be of the form: * * {0x0946134b, 0x4c7f, 0x11d1, * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}}, * * But, eh. */ static const struct { fu32_t flag; fu8_t data[16]; } aim_caps[] = { /* * These are in ascending numerical order. */ /* * Perhaps better called AIM_CAPS_SHORTCAPS */ {AIM_CAPS_ICHAT, {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_SECUREIM, {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_VIDEO, {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, /* "Live Video" support in Windows AIM 5.5.3501 and newer */ {AIM_CAPS_LIVEVIDEO, {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, /* "Camera" support in Windows AIM 5.5.3501 and newer */ {AIM_CAPS_CAMERA, {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, /* In Windows AIM 5.5.3501 and newer */ {AIM_CAPS_GENERICUNKNOWN, {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, /* In iChatAV (version numbers...?) */ {AIM_CAPS_ICHATAV, {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}}, /* * Not really sure about this one. In an email from * 26 Sep 2003, Matthew Sachs suggested that, "this * is probably the capability for the SMS features." */ {AIM_CAPS_SMS, {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_GENERICUNKNOWN, {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_GENERICUNKNOWN, {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_GENERICUNKNOWN, {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_HIPTOP, {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_TALK, {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_SENDFILE, {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_ICQ_DIRECT, {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_DIRECTIM, {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_BUDDYICON, {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_ADDINS, {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_GETFILE, {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_ICQSERVERRELAY, {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, /* * Indeed, there are two of these. The former appears to be correct, * but in some versions of winaim, the second one is set. Either they * forgot to fix endianness, or they made a typo. It really doesn't * matter which. */ {AIM_CAPS_GAMES, {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_GAMES2, {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_SENDBUDDYLIST, {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, /* * Setting this lets AIM users receive messages from ICQ users, and ICQ * users receive messages from AIM users. It also lets ICQ users show * up in buddy lists for AIM users, and AIM users show up in buddy lists * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy, * in that if you add a user to your deny list, you will not be able to * see them as online (previous you could still see them, but they * couldn't see you. */ {AIM_CAPS_INTEROPERATE, {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_ICQUTF8, {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, {AIM_CAPS_ICQUTF8OLD, {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8, 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}}, /* * Chat is oddball. */ {AIM_CAPS_CHAT, {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, /* {AIM_CAPS_ICQ2GO, {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd, 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}}, */ {AIM_CAPS_ICQRTF, {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}, /* This is added by the servers and it only shows up for ourselves... */ {AIM_CAPS_GENERICUNKNOWN, {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, {AIM_CAPS_APINFO, {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, {AIM_CAPS_TRILLIANCRYPT, {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb, 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}, {AIM_CAPS_EMPTY, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, {AIM_CAPS_LAST} }; /* * Add the userinfo to our linked list. If we already have userinfo * for this buddy, then just overwrite parts of the old data. * * @param userinfo Contains the new information for the buddy. */ static void aim_locate_adduserinfo(aim_session_t *sess, aim_userinfo_t *userinfo) { aim_userinfo_t *cur; aim_conn_t *conn; aim_rxcallback_t userfunc; cur = aim_locate_finduserinfo(sess, userinfo->sn); if (cur == NULL) { cur = (aim_userinfo_t *)calloc(1, sizeof(aim_userinfo_t)); cur->sn = strdup(userinfo->sn); cur->next = sess->locate.userinfo; sess->locate.userinfo = cur; } cur->warnlevel = userinfo->warnlevel; cur->idletime = userinfo->idletime; if (userinfo->flags != 0) cur->flags = userinfo->flags; if (userinfo->createtime != 0) cur->createtime = userinfo->createtime; if (userinfo->membersince != 0) cur->membersince = userinfo->membersince; if (userinfo->onlinesince != 0) cur->onlinesince = userinfo->onlinesince; if (userinfo->sessionlen != 0) cur->sessionlen = userinfo->sessionlen; if (userinfo->capabilities != 0) cur->capabilities = userinfo->capabilities; cur->present |= userinfo->present; if (userinfo->iconcsumlen > 0) { free(cur->iconcsum); cur->iconcsum = (fu8_t *)malloc(userinfo->iconcsumlen); memcpy(cur->iconcsum, userinfo->iconcsum, userinfo->iconcsumlen); cur->iconcsumlen = userinfo->iconcsumlen; } if (userinfo->info != NULL) { free(cur->info); free(cur->info_encoding); if (userinfo->info_len > 0) { cur->info = (char *)malloc(userinfo->info_len); memcpy(cur->info, userinfo->info, userinfo->info_len); } else cur->info = NULL; cur->info_encoding = strdup(userinfo->info_encoding); cur->info_len = userinfo->info_len; } if (userinfo->away != NULL) { free(cur->away); free(cur->away_encoding); if (userinfo->away_len > 0) { cur->away = (char *)malloc(userinfo->away_len); memcpy(cur->away, userinfo->away, userinfo->away_len); } else cur->away = NULL; cur->away_encoding = strdup(userinfo->away_encoding); cur->away_len = userinfo->away_len; } /* * This callback can be used by a client if they want to know whenever * info for a buddy is updated. For example, if a client shows away * messages in its buddy list, then it would need to know if a user's * away message changes. */ conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC); if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_GOTINFOBLOCK))) userfunc(sess, NULL, cur); } faim_export void aim_locate_dorequest(aim_session_t *sess) { struct userinfo_node *cur = sess->locate.torequest; if (cur == NULL) return; if (sess->locate.waiting_for_response == TRUE) return; sess->locate.waiting_for_response = TRUE; aim_locate_getinfoshort(sess, cur->sn, 0x00000003); /* Move this node to the "requested" queue */ sess->locate.torequest = cur->next; cur->next = sess->locate.requested; sess->locate.requested = cur; } /** * Remove this screen name from our queue. If this info was requested * by our info request queue, then pop the next element off of the queue. * * @param sess The aim session. * @param sn Screen name of the info we just received. * @return True if the request was explicit (client requested the info), * false if the request was implicit (libfaim request the info). */ static int aim_locate_gotuserinfo(aim_session_t *sess, const char *sn) { struct userinfo_node *cur, *del; int was_explicit = TRUE; while ((sess->locate.requested != NULL) && (aim_sncmp(sn, sess->locate.requested->sn) == 0)) { del = sess->locate.requested; sess->locate.requested = del->next; was_explicit = FALSE; free(del->sn); free(del); } cur = sess->locate.requested; while ((cur != NULL) && (cur->next != NULL)) { if (aim_sncmp(sn, cur->next->sn) == 0) { del = cur->next; cur->next = del->next; was_explicit = FALSE; free(del->sn); free(del); } else cur = cur->next; } if (!was_explicit) { aim_conn_t *conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC); aim_rxcallback_t userfunc; sess->locate.waiting_for_response = FALSE; if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_REQUESTINFOTIMEOUT))) userfunc(sess, NULL); else aim_locate_dorequest(sess); } return was_explicit; } faim_internal void aim_locate_requestuserinfo(aim_session_t *sess, const char *sn) { struct userinfo_node *cur; /* Make sure we aren't already requesting info for this buddy */ cur = sess->locate.torequest; while (cur != NULL) { if (aim_sncmp(sn, cur->sn) == 0) return; cur = cur->next; } /* Add a new node to our request queue */ cur = (struct userinfo_node *)malloc(sizeof(struct userinfo_node)); cur->sn = strdup(sn); cur->next = sess->locate.torequest; sess->locate.torequest = cur; /* Actually request some info up in this piece */ aim_locate_dorequest(sess); } faim_export aim_userinfo_t *aim_locate_finduserinfo(aim_session_t *sess, const char *sn) { aim_userinfo_t *cur = NULL; if (sn == NULL) return NULL; cur = sess->locate.userinfo; while (cur != NULL) { if (aim_sncmp(cur->sn, sn) == 0) return cur; cur = cur->next; } return NULL; } faim_internal fu32_t aim_locate_getcaps(aim_session_t *sess, aim_bstream_t *bs, int len) { fu32_t flags = 0; int offset; for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x10) { fu8_t *cap; int i, identified; cap = aimbs_getraw(bs, 0x10); for (i = 0, identified = 0; !(aim_caps[i].flag & AIM_CAPS_LAST); i++) { if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) { flags |= aim_caps[i].flag; identified++; break; /* should only match once... */ } } if (!identified) faimdprintf(sess, 0, "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", cap[0], cap[1], cap[2], cap[3], cap[4], cap[5], cap[6], cap[7], cap[8], cap[9], cap[10], cap[11], cap[12], cap[13], cap[14], cap[15]); free(cap); } return flags; } faim_internal fu32_t aim_locate_getcaps_short(aim_session_t *sess, aim_bstream_t *bs, int len) { fu32_t flags = 0; int offset; for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x02) { fu8_t *cap; int i, identified; cap = aimbs_getraw(bs, 0x02); for (i = 0, identified = 0; !(aim_caps[i].flag & AIM_CAPS_LAST); i++) { if (memcmp(&aim_caps[i].data[2], cap, 0x02) == 0) { flags |= aim_caps[i].flag; identified++; break; /* should only match once... */ } } if (!identified) faimdprintf(sess, 0, "unknown short capability: {%02x%02x}\n", cap[0], cap[1]); free(cap); } return flags; } faim_internal int aim_putcap(aim_bstream_t *bs, fu32_t caps) { int i; if (!bs) return -EINVAL; for (i = 0; aim_bstream_empty(bs); i++) { if (aim_caps[i].flag == AIM_CAPS_LAST) break; if (caps & aim_caps[i].flag) aimbs_putraw(bs, aim_caps[i].data, 0x10); } return 0; } static void dumptlv(aim_session_t *sess, fu16_t type, aim_bstream_t *bs, fu8_t len) { int i; if (!sess || !bs || !len) return; faimdprintf(sess, 0, "userinfo: type =0x%04x\n", type); faimdprintf(sess, 0, "userinfo: length=0x%04x\n", len); faimdprintf(sess, 0, "userinfo: value:\n"); for (i = 0; i < len; i++) { if ((i % 8) == 0) faimdprintf(sess, 0, "\nuserinfo: "); faimdprintf(sess, 0, "0x%2x ", aimbs_get8(bs)); } faimdprintf(sess, 0, "\n"); return; } faim_internal void aim_info_free(aim_userinfo_t *info) { free(info->sn); free(info->iconcsum); free(info->info); free(info->info_encoding); free(info->avail); free(info->avail_encoding); free(info->away); free(info->away_encoding); } /* * AIM is fairly regular about providing user info. This is a generic * routine to extract it in its standard form. */ faim_internal int aim_info_extract(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *outinfo) { int curtlv, tlvcnt; fu8_t snlen; if (!bs || !outinfo) return -EINVAL; /* Clear out old data first */ memset(outinfo, 0x00, sizeof(aim_userinfo_t)); /* * Screen name. Stored as an unterminated string prepended with a * byte containing its length. */ snlen = aimbs_get8(bs); outinfo->sn = aimbs_getstr(bs, snlen); /* * Warning Level. Stored as an unsigned short. */ outinfo->warnlevel = aimbs_get16(bs); /* * TLV Count. Unsigned short representing the number of * Type-Length-Value triples that follow. */ tlvcnt = aimbs_get16(bs); /* * Parse out the Type-Length-Value triples as they're found. */ for (curtlv = 0; curtlv < tlvcnt; curtlv++) { int endpos; fu16_t type, length; type = aimbs_get16(bs); length = aimbs_get16(bs); endpos = aim_bstream_curpos(bs) + length; if (type == 0x0001) { /* * Type = 0x0001: User flags * * Specified as any of the following ORed together: * 0x0001 Trial (user less than 60days) * 0x0002 Unknown bit 2 * 0x0004 AOL Main Service user * 0x0008 Unknown bit 4 * 0x0010 Free (AIM) user * 0x0020 Away * 0x0400 ActiveBuddy * */ outinfo->flags = aimbs_get16(bs); outinfo->present |= AIM_USERINFO_PRESENT_FLAGS; } else if (type == 0x0002) { /* * Type = 0x0002: Account creation time. * * The time/date that the user originally registered for * the service, stored in time_t format. * * I'm not sure how this differs from type 5 ("member * since"). * * Note: This is the field formerly known as "member * since". All these years and I finally found out * that I got the name wrong. */ outinfo->createtime = aimbs_get32(bs); outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME; } else if (type == 0x0003) { /* * Type = 0x0003: On-Since date. * * The time/date that the user started their current * session, stored in time_t format. */ outinfo->onlinesince = aimbs_get32(bs); outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE; } else if (type == 0x0004) { /* * Type = 0x0004: Idle time. * * Number of minutes since the user actively used the * service. * * Note that the client tells the server when to start * counting idle times, so this may or may not be * related to reality. */ outinfo->idletime = aimbs_get16(bs); outinfo->present |= AIM_USERINFO_PRESENT_IDLE; } else if (type == 0x0005) { /* * Type = 0x0005: Member since date. * * The time/date that the user originally registered for * the service, stored in time_t format. * * This is sometimes sent instead of type 2 ("account * creation time"), particularly in the self-info. * And particularly for ICQ? */ outinfo->membersince = aimbs_get32(bs); outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE; } else if (type == 0x0006) { /* * Type = 0x0006: ICQ Online Status * * ICQ's Away/DND/etc "enriched" status. Some decoding * of values done by Scott */ aimbs_get16(bs); outinfo->icqinfo.status = aimbs_get16(bs); outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS; } else if (type == 0x0008) { /* * Type = 0x0008 * * Client type, or some such. */ } else if (type == 0x000a) { /* * Type = 0x000a * * ICQ User IP Address. * Ahh, the joy of ICQ security. */ outinfo->icqinfo.ipaddr = aimbs_get32(bs); outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR; } else if (type == 0x000c) { /* * Type = 0x000c * * random crap containing the IP address, * apparently a port number, and some Other Stuff. * * Format is: * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43 * * */ aimbs_getrawbuf(bs, outinfo->icqinfo.crap, 0x25); outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA; } else if (type == 0x000d) { /* * Type = 0x000d * * OSCAR Capability information. * */ outinfo->capabilities |= aim_locate_getcaps(sess, bs, length); outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; } else if (type == 0x000e) { /* * Type = 0x000e * * AOL capability information. * */ } else if ((type == 0x000f) || (type == 0x0010)) { /* * Type = 0x000f: Session Length. (AIM) * Type = 0x0010: Session Length. (AOL) * * The duration, in seconds, of the user's current * session. * * Which TLV type this comes in depends on the * service the user is using (AIM or AOL). * */ outinfo->sessionlen = aimbs_get32(bs); outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN; } else if (type == 0x0019) { /* * Type = 0x0019 * * OSCAR short capability information. A shortened * form of the normal capabilities. */ outinfo->capabilities |= aim_locate_getcaps_short(sess, bs, length); outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; } else if (type == 0x001b) { /* * Type = 0x001a * * AOL short capability information. A shortened * form of the normal capabilities. */ } else if (type == 0x001b) { /* * Type = 0x0019 * * Encryption certification MD5 checksum. */ } else if (type == 0x001d) { /* * Type = 0x001d * * Buddy icon information and available messages. * * This almost seems like the AIM protocol guys gave * the iChat guys a Type, and the iChat guys tried to * cram as much cool shit into it as possible. Then * the Windows AIM guys were like, "hey, that's * pretty neat, let's copy those prawns." * * In that spirit, this can contain a custom message, * kind of like an away message, but you're not away * (it's called an "available" message). Or it can * contain information about the buddy icon the user * has stored on the server. */ int type2, number, length2; while (aim_bstream_curpos(bs) < endpos) { type2 = aimbs_get16(bs); number = aimbs_get8(bs); length2 = aimbs_get8(bs); switch (type2) { case 0x0000: { /* This is an official buddy icon? */ /* This is always 5 bytes of "0x02 01 d2 04 72"? */ aim_bstream_advance(bs, length2); } break; case 0x0001: { /* A buddy icon checksum */ if ((length2 > 0) && (number == 0x01)) { free(outinfo->iconcsum); outinfo->iconcsum = aimbs_getraw(bs, length2); outinfo->iconcsumlen = length2; } else aim_bstream_advance(bs, length2); } break; case 0x0002: { /* An available message */ if (length2 >= 4) { free(outinfo->avail); outinfo->avail_len = aimbs_get16(bs); outinfo->avail = aimbs_getstr(bs, outinfo->avail_len); if (aimbs_get16(bs) == 0x0001) { /* We have an encoding */ aimbs_get16(bs); outinfo->avail_encoding = aimbs_getstr(bs, aimbs_get16(bs)); } else { /* No explicit encoding, client should use UTF-8 */ outinfo->avail_encoding = NULL; } } else aim_bstream_advance(bs, length2); } break; default: { aim_bstream_advance(bs, length2); } break; } } } else if (type == 0x001e) { /* * Type 30: Unknown. * * Always four bytes, but it doesn't look like an int. */ } else if (type == 0x001f) { /* * Type 31: Unknown. * * Seen on a buddy using DeadAIM. Data was 4 bytes: * 0x00 00 00 10 */ } else { /* * Reaching here indicates that either AOL has * added yet another TLV for us to deal with, * or the parsing has gone Terribly Wrong. * * Either way, inform the owner and attempt * recovery. * */ faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV:\n"); faimdprintf(sess, 0, "userinfo: sn =%s\n", outinfo->sn); dumptlv(sess, type, bs, length); } /* Save ourselves. */ aim_bstream_setpos(bs, endpos); } aim_locate_adduserinfo(sess, outinfo); return 0; } /* * Inverse of aim_info_extract() */ faim_internal int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info) { aim_tlvlist_t *tlvlist = NULL; if (!bs || !info) return -EINVAL; aimbs_put8(bs, strlen(info->sn)); aimbs_putraw(bs, info->sn, strlen(info->sn)); aimbs_put16(bs, info->warnlevel); if (info->present & AIM_USERINFO_PRESENT_FLAGS) aim_tlvlist_add_16(&tlvlist, 0x0001, info->flags); if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) aim_tlvlist_add_32(&tlvlist, 0x0002, info->membersince); if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) aim_tlvlist_add_32(&tlvlist, 0x0003, info->onlinesince); if (info->present & AIM_USERINFO_PRESENT_IDLE) aim_tlvlist_add_16(&tlvlist, 0x0004, info->idletime); /* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */ #if ICQ_OSCAR_SUPPORT if (atoi(info->sn) != 0) { if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) aim_tlvlist_add_16(&tlvlist, 0x0006, info->icqinfo.status); if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) aim_tlvlist_add_32(&tlvlist, 0x000a, info->icqinfo.ipaddr); } #endif if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities); if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) aim_tlvlist_add_32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); aimbs_put16(bs, aim_tlvlist_count(&tlvlist)); aim_tlvlist_write(bs, &tlvlist); aim_tlvlist_free(&tlvlist); return 0; } /* * Subtype 0x0001 */ static int error(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; aim_snac_t *snac2; fu16_t reason; char *sn; int was_explicit; if (!(snac2 = aim_remsnac(sess, snac->id))) { faimdprintf(sess, 0, "faim: locate.c, error(): received response from unknown request!\n"); return 0; } if ((snac2->family != 0x0002) && (snac2->type != 0x0015)) { faimdprintf(sess, 0, "faim: locate.c, error(): received response from invalid request! %d\n", snac2->family); return 0; } if (!(sn = snac2->data)) { faimdprintf(sess, 0, "faim: locate.c, error(): received response from request without a screen name!\n"); return 0; } reason = aimbs_get16(bs); /* * Remove this screen name from our queue. If the client requested * this buddy's info explicitly, then notify them that we do not have * info for this buddy. */ was_explicit = aim_locate_gotuserinfo(sess, sn); if (was_explicit == TRUE) if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, reason, sn); if (snac2) free(snac2->data); free(snac2); return ret; } /* * Subtype 0x0002 * * Request Location services rights. * */ faim_export int aim_locate_reqrights(aim_session_t *sess) { aim_conn_t *conn; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC))) return -EINVAL; return aim_genericreq_n_snacid(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_REQRIGHTS); } /* * Subtype 0x0003 * * Normally contains: * t(0001) - short containing max profile length (value = 1024) * t(0002) - short - unknown (value = 16) [max MIME type length?] * t(0003) - short - unknown (value = 10) * t(0004) - short - unknown (value = 2048) [ICQ only?] */ static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_tlvlist_t *tlvlist; aim_rxcallback_t userfunc; int ret = 0; fu16_t maxsiglen = 0; tlvlist = aim_tlvlist_read(bs); if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) maxsiglen = aim_tlv_get16(tlvlist, 0x0001, 1); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, maxsiglen); aim_tlvlist_free(&tlvlist); return ret; } /* * Subtype 0x0004 * * Gives BOS your profile. * * profile_encoding and awaymsg_encoding MUST be set if profile or * away are set, respectively, and their value may or may not be * restricted to a few choices. I am currently aware of: * * us-ascii Just that * unicode-2-0 UCS2-BE * * profile_len and awaymsg_len MUST be set similarly, and they MUST * be the length of their respective strings in bytes. * * To get the previous behavior of awaymsg == "" un-setting the away * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the * obvious equivalent). * */ faim_export int aim_locate_setprofile(aim_session_t *sess, const char *profile_encoding, const char *profile, const int profile_len, const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; char *encoding; static const char defencoding[] = {"text/aolrtf; charset=\"%s\""}; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC))) return -EINVAL; if (!profile && !awaymsg) return -EINVAL; if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) { return -EINVAL; } /* Build the packet first to get real length */ if (profile) { /* no + 1 here because of %s */ encoding = malloc(strlen(defencoding) + strlen(profile_encoding)); if (encoding == NULL) { return -ENOMEM; } snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding); aim_tlvlist_add_raw(&tl, 0x0001, strlen(encoding), encoding); aim_tlvlist_add_raw(&tl, 0x0002, profile_len, profile); free(encoding); } /* * So here's how this works: * - You are away when you have a non-zero-length type 4 TLV stored. * - You become unaway when you clear the TLV with a zero-length * type 4 TLV. * - If you do not send the type 4 TLV, your status does not change * (that is, if you were away, you'll remain away). */ if (awaymsg) { if (awaymsg_len) { encoding = malloc(strlen(defencoding) + strlen(awaymsg_encoding)); if (encoding == NULL) { return -ENOMEM; } snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding); aim_tlvlist_add_raw(&tl, 0x0003, strlen(encoding), encoding); aim_tlvlist_add_raw(&tl, 0x0004, awaymsg_len, awaymsg); free(encoding); } else aim_tlvlist_add_noval(&tl, 0x0004); } if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_tlvlist_size(&tl)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0004 - Set your client's capabilities. */ faim_export int aim_locate_setcaps(aim_session_t *sess, fu32_t caps) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC))) return -EINVAL; aim_tlvlist_add_caps(&tl, 0x0005, caps); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_tlvlist_size(&tl)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0005 - Request info of another AIM user. * * @param sn The screenname whose info you wish to request. * @param infotype The type of info you wish to request. * 0x0001 - Info/profile * 0x0003 - Away message * 0x0004 - Capabilities */ faim_export int aim_locate_getinfo(aim_session_t *sess, const char *sn, fu16_t infotype) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid); aimbs_put16(&fr->data, infotype); aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); aim_tx_enqueue(sess, fr); return 0; } /* Subtype 0x0006 */ static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { int ret = 0; aim_rxcallback_t userfunc; aim_userinfo_t *userinfo, *userinfo2; aim_tlvlist_t *tlvlist; aim_tlv_t *tlv = NULL; int was_explicit; userinfo = (aim_userinfo_t *)malloc(sizeof(aim_userinfo_t)); aim_info_extract(sess, bs, userinfo); tlvlist = aim_tlvlist_read(bs); /* Profile will be 1 and 2 */ userinfo->info_encoding = aim_tlv_getstr(tlvlist, 0x0001, 1); if ((tlv = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { userinfo->info = (char *)malloc(tlv->length); memcpy(userinfo->info, tlv->value, tlv->length); userinfo->info_len = tlv->length; } /* Away message will be 3 and 4 */ userinfo->away_encoding = aim_tlv_getstr(tlvlist, 0x0003, 1); if ((tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { userinfo->away = (char *)malloc(tlv->length); memcpy(userinfo->away, tlv->value, tlv->length); userinfo->away_len = tlv->length; } /* Caps will be 5 */ if ((tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1))) { aim_bstream_t cbs; aim_bstream_init(&cbs, tlv->value, tlv->length); userinfo->capabilities = aim_locate_getcaps(sess, &cbs, tlv->length); userinfo->present = AIM_USERINFO_PRESENT_CAPABILITIES; } aim_tlvlist_free(&tlvlist); aim_locate_adduserinfo(sess, userinfo); userinfo2 = aim_locate_finduserinfo(sess, userinfo->sn); aim_info_free(userinfo); free(userinfo); /* * Remove this screen name from our queue. If the client requested * this buddy's info explicitly, then notify them that we have info * for this buddy. */ was_explicit = aim_locate_gotuserinfo(sess, userinfo2->sn); if (was_explicit == TRUE) if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, userinfo2); return ret; } /* * Subtype 0x0009 - Set directory profile data. * * This is not the same as aim_location_setprofile! * privacy: 1 to allow searching, 0 to disallow. * */ faim_export int aim_locate_setdirinfo(aim_session_t *sess, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC))) return -EINVAL; aim_tlvlist_add_16(&tl, 0x000a, privacy); if (first) aim_tlvlist_add_raw(&tl, 0x0001, strlen(first), first); if (last) aim_tlvlist_add_raw(&tl, 0x0002, strlen(last), last); if (middle) aim_tlvlist_add_raw(&tl, 0x0003, strlen(middle), middle); if (maiden) aim_tlvlist_add_raw(&tl, 0x0004, strlen(maiden), maiden); if (state) aim_tlvlist_add_raw(&tl, 0x0007, strlen(state), state); if (city) aim_tlvlist_add_raw(&tl, 0x0008, strlen(city), city); if (nickname) aim_tlvlist_add_raw(&tl, 0x000c, strlen(nickname), nickname); if (zip) aim_tlvlist_add_raw(&tl, 0x000d, strlen(zip), zip); if (street) aim_tlvlist_add_raw(&tl, 0x0021, strlen(street), street); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0002, 0x0009, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0002, 0x0009, 0x0000, snacid); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x000b - Huh? What is this? */ faim_export int aim_locate_000b(aim_session_t *sess, const char *sn) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; return -EINVAL; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid); aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x000f * * XXX pass these in better * */ faim_export int aim_locate_setinterests(aim_session_t *sess, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC))) return -EINVAL; /* ?? privacy ?? */ aim_tlvlist_add_16(&tl, 0x000a, privacy); if (interest1) aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest1), interest1); if (interest2) aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest2), interest2); if (interest3) aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest3), interest3); if (interest4) aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest4), interest4); if (interest5) aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest5), interest5); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); aim_tx_enqueue(sess, fr); return 0; } /* * Subtype 0x0015 - Request the info a user using the short method. This is * what iChat uses. It normally is VERY leniently rate limited. * * @param sn The screen name whose info you wish to request. * @param flags The bitmask which specifies the type of info you wish to request. * 0x00000001 - Info/profile. * 0x00000002 - Away message. * 0x00000004 - Capabilities. * 0x00000008 - Certification. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_locate_getinfoshort(aim_session_t *sess, const char *sn, fu32_t flags) { aim_conn_t *conn; aim_frame_t *fr; aim_snacid_t snacid; if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn) return -EINVAL; if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+1+strlen(sn)))) return -ENOMEM; snacid = aim_cachesnac(sess, 0x0002, 0x0015, 0x0000, sn, strlen(sn)+1); aim_putsnac(&fr->data, 0x0002, 0x0015, 0x0000, snacid); aimbs_put32(&fr->data, flags); aimbs_put8(&fr->data, strlen(sn)); aimbs_putraw(&fr->data, sn, strlen(sn)); aim_tx_enqueue(sess, fr); return 0; } static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { if (snac->subtype == 0x0001) return error(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0003) return rights(sess, mod, rx, snac, bs); else if (snac->subtype == 0x0006) return userinfo(sess, mod, rx, snac, bs); return 0; } static void locate_shutdown(aim_session_t *sess, aim_module_t *mod) { aim_userinfo_t *del; while (sess->locate.userinfo) { del = sess->locate.userinfo; sess->locate.userinfo = sess->locate.userinfo->next; aim_info_free(del); free(del); } } faim_internal int locate_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = AIM_CB_FAM_LOC; mod->version = 0x0001; mod->toolid = 0x0110; mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "locate", sizeof(mod->name)); mod->snachandler = snachandler; mod->shutdown = locate_shutdown; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/util.c0000644000175000017500000001233110234217334021003 0ustar ryanryan00000000000000/* * A little bit of this * A little bit of that * It started with a kiss * Now we're up to bat */ #define FAIM_INTERNAL #include #include #ifdef _WIN32 #include "win32dep.h" #endif faim_internal void faimdprintf(aim_session_t *sess, int dlevel, const char *format, ...) { if (!sess) { fprintf(stderr, "faimdprintf: no session! boo! (%d, %s)\n", dlevel, format); return; } if ((dlevel <= sess->debug) && sess->debugcb) { va_list ap; va_start(ap, format); sess->debugcb(sess, dlevel, format, ap); va_end(ap); } return; } faim_export int aimutil_putstr(char *dest, const char *src, int len) { memcpy(dest, src, len); return len; } /* * Tokenizing functions. Used to portably replace strtok/sep. * -- DMP. * */ faim_export int aimutil_tokslen(char *toSearch, int theindex, char dl) { int curCount = 1; char *next; char *last; int toReturn; last = toSearch; next = strchr(toSearch, dl); while(curCount < theindex && next != NULL) { curCount++; last = next + 1; next = strchr(last, dl); } if ((curCount < theindex) || (next == NULL)) toReturn = strlen(toSearch) - (curCount - 1); else toReturn = next - toSearch - (curCount - 1); return toReturn; } faim_export int aimutil_itemcnt(char *toSearch, char dl) { int curCount; char *next; curCount = 1; next = strchr(toSearch, dl); while(next != NULL) { curCount++; next = strchr(next + 1, dl); } return curCount; } faim_export char *aimutil_itemindex(char *toSearch, int theindex, char dl) { int curCount; char *next; char *last; char *toReturn; curCount = 0; last = toSearch; next = strchr(toSearch, dl); while (curCount < theindex && next != NULL) { curCount++; last = next + 1; next = strchr(last, dl); } if (curCount < theindex) { toReturn = malloc(sizeof(char)); *toReturn = '\0'; } next = strchr(last, dl); if (curCount < theindex) { toReturn = malloc(sizeof(char)); *toReturn = '\0'; } else { if (next == NULL) { toReturn = malloc((strlen(last) + 1) * sizeof(char)); strcpy(toReturn, last); } else { toReturn = malloc((next - last + 1) * sizeof(char)); memcpy(toReturn, last, (next - last)); toReturn[next - last] = '\0'; } } return toReturn; } /** * Calculate the checksum of a given icon. * */ faim_export fu16_t aimutil_iconsum(const fu8_t *buf, int buflen) { fu32_t sum; int i; for (i=0, sum=0; i+1> 16) + (sum & 0x0000ffff); return sum; } /** * Check if the given screen name is a valid AIM screen name. * Example: BobDole * Example: Henry_Ford@mac.com * * @return 1 if the screen name is valid, 0 if not. */ static int aim_snvalid_aim(const char *sn) { int i; for (i = 0; sn[i] != '\0'; i++) { if (!isalnum(sn[i]) && (sn[i] != ' ') && (sn[i] != '@') && (sn[i] != '.') && (sn[i] != '_') && (sn[i] != '-')) return 0; } return 1; } /** * Check if the given screen name is a valid ICQ screen name. * Example: 1234567 * * @return 1 if the screen name is valid, 0 if not. */ static int aim_snvalid_icq(const char *sn) { int i; for (i = 0; sn[i] != '\0'; i++) { if (!isdigit(sn[i])) return 0; } return 1; } /** * Check if the given screen name is a valid SMS screen name. * Example: +19195551234 * * @return 1 if the screen name is valid, 0 if not. */ static int aim_snvalid_sms(const char *sn) { int i; if (sn[0] != '+') return 0; for (i = 1; sn[i] != '\0'; i++) { if (!isdigit(sn[i])) return 0; } return 1; } /** * Check if the given screen name is a valid oscar screen name. * * @return 1 if the screen name is valid, 0 if not. */ faim_export int aim_snvalid(const char *sn) { if ((sn == NULL) || (*sn == '\0')) return 0; if (isalpha(sn[0])) return aim_snvalid_aim(sn); else if (isdigit(sn[0])) return aim_snvalid_icq(sn); else if (sn[0] == '+') return aim_snvalid_sms(sn); return 0; } /** * Determine if a given screen name is an ICQ screen name * (i.e. it begins with a number). * * @sn A valid AIM or ICQ screen name. * @return 1 if the screen name is an ICQ screen name. Otherwise 0 * is returned. */ faim_export int aim_sn_is_icq(const char *sn) { if (isalpha(sn[0])) return 0; return 1; } /* * int snlen(const char *) * * This takes a screen name and returns its length without * spaces. If there are no spaces in the SN, then the * return is equal to that of strlen(). * */ faim_export int aim_snlen(const char *sn) { int i = 0; if (!sn) return 0; while (*sn != '\0') { if (*sn != ' ') i++; sn++; } return i; } /* * int sncmp(const char *, const char *) * * This takes two screen names and compares them using the rules * on screen names for AIM/AOL. Mainly, this means case and space * insensitivity (all case differences and spacing differences are * ignored, with the exception that screen names can not start with * a space). * * Return: 0 if equal * non-0 if different * */ faim_export int aim_sncmp(const char *sn1, const char *sn2) { if ((sn1 == NULL) || (sn2 == NULL)) return -1; do { while (*sn2 == ' ') sn2++; while (*sn1 == ' ') sn1++; if (toupper(*sn1) != toupper(*sn2)) return 1; } while ((*sn1 != '\0') && sn1++ && sn2++); return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/AUTHORS0000644000175000017500000000114010234217334020726 0ustar ryanryan00000000000000 Anyone else want to be in here? --- N: Adam Fritzler H: mid E: mid@auk.cx W: http://www.auk.cx/~mid,http://www.auk.cx/faim D: Wrote most of the wap of crap that you see before you. N: Josh Myer E: josh@joshisanerd.com D: OFT/ODC (not quite finished yet..), random little things, Munger-At-Large, compile-time warnings. N: Daniel Reed H: n, linuxkitty E: n@ml.org W: http://users.n.ml.org/n/ D: Fixed aim_snac.c N: Eric Warmenhoven E: warmenhoven@linux.com D: Some OFT info, author of the faim interface for gaim N: Brock Wilcox H: awwaiid E: awwaiid@auk.cx D: Figured out original password roasting pork-0.99.8.1/src/protocols/aim/libfaim/translate.c0000644000175000017500000000117610234217334022030 0ustar ryanryan00000000000000/* * Family 0x000c - Translation. * * I have no idea why this group was issued. I have never seen anything * that uses it. From what I remember, the last time I tried to poke at * the server with this group, it whined about not supporting it. * * But we advertise it anyway, because its fun. * */ #define FAIM_INTERNAL #include faim_internal int translate_modfirst(aim_session_t *sess, aim_module_t *mod) { mod->family = 0x000c; mod->version = 0x0001; mod->toolid = 0x0104; mod->toolversion = 0x0001; mod->flags = 0; strncpy(mod->name, "translate", sizeof(mod->name)); mod->snachandler = NULL; return 0; } pork-0.99.8.1/src/protocols/aim/libfaim/CHANGES0000644000175000017500000013246710234217335020673 0ustar ryanryan00000000000000 No release numbers ------------------ - Fri Oct 26 15:18:10 PDT 2001 - Fix buddy icons. (the checksum is only 16bits. hum.) - Sun Oct 14 19:45:54 PDT 2001 - Fix aim_icq_setstatus - Minor touchups - Parse 1/f (selfinfo) - Add ICQ status defines - Wed Oct 3 11:07:22 PDT 2001 - Fix awful bug in ft listenestablish. - struct aim_userinfo_s becomes aim_userinfo_t. - I haven't decided what to do with this. I like it in its current form to an extent, but it is also not flexible enough. But it would become too complex and cumbersome if I were to do it more flexibly. - Also added a few accessor functions that should be used instead of directly accessing the struct, particularly for the capabilities. - Wed Sep 19 18:50:34 PDT 2001 - Remove non-standard default features from aim_send_im_ext. - Sadly, AOL 5.0 ignores messages with non-standard features. Once AOL releases AOL 6 for the Macintosh, there will no longer be any reason for anyone to use AOL 5, and this will be a non-issue. - Check for 0x2711 TLV in buddy icons. This is weird. - Add AIM_IMFLAG_ACTIVEBUDDY. - Fix ICQ login. (Oops.) - Tue Sep 11 16:41:11 PDT 2001 - Fix chat invites. - Keep faimtest from passing va_list's. That scares me. - Tue Sep 11 04:42:28 PDT 2001 - Fix faim_internal/export confusion for the TLV functions - Add aim_addtlvtochain_userinfo() (used by AP) - Clean up ICBM Channel 1 parsing ever so slightly - Add multipart message support in both directions, and some fun examples of it in faimtest. - Yes, I'm insane. - Mon Sep 10 06:15:43 PDT 2001 - Remove $Id line from md5.h. I really really hate those things. - Remove all that locking crap. It never worked right anyway. - Add conn->inside for things that should never ever be seen by clients - Store supported groups list for each connection - Support migrations. - faimtest now theoretically supports doing this. It happens so rarely that it makes it difficult to test. For more complicated clients, a flag will have to be kept so that some things that happen during login don't get triggered the second time around. But faimtest doesn't have such problems. - Added some random commentary. - Sun Sep 9 03:01:28 PDT 2001 - Three fixes in directim for gaim. It works now. Yay. - Sat Sep 8 21:26:27 PDT 2001 - Minor bug directim_connect - Sat Sep 8 20:18:34 PDT 2001 - Split up the ICBM Channel 2 handlers a bit more - Add a stub parser for recieving buddy lists. It will stay that way until someone decides on a good API for passing lists like this to the client. In case someone does, the same standard will be used for setbuddylist and the as yet nonexistant support for server-side buddy lists. - Make infochange work again. I still don't like it, but I don't want to fix it. - Sat Sep 8 19:05:05 PDT 2001 - Redo ICQ login - Fix search by email (oops). - Sat Sep 8 17:07:09 PDT 2001 - Fix directim so you can do it more than once without crashing. - This removes the connect/disconnect callbacks. They were pointless, as you can get the same information at a better spot by looking for when aim_getcommand returns -1, just like is done for FLAP connections. - (This was causing aim_conn_kill to be called twice for the same connect, once in the client callback, and once more when aim_getcommand returned the -1). - Add aim_conn_(close|kill)_rend(). This is for destroying the cookie and the internal data sections in one spot. - Fix a bug in aim_connrst (and hence aim_logout()) that caused intdata/priv to not be freed in those cases. Evil. - Sat Sep 8 07:32:27 PDT 2001 - Clean up ft.c slightly. Direct IM now works. In both directions. - This could still use a lot more help. It should use bstreams more. - Sat Sep 8 00:55:46 PDT 2001 - Chatnav loop fix. (Err. I shouldn't code when I'm that tired.) - Remove some things from BUGS - Remove USE_MACROS from faimconfig.h. Not used, and frivelous when it was. - Fri Sep 7 21:18:51 PDT 2001 - Make icon field names uniform - Add AIM_IMFLAGS_CUSTOMFEATURES. This allows the client to send/recieve the field in IMs that show client information. - This can be used to identify other open source OSCAR clients, if any one is interested. - Increase the size of args->icbmflags to 32bits - Make sure that extended-only flags are not set for aim_send_im() - Fri Sep 7 19:59:43 PDT 2001 - Fix buddyicons. Yay! (checksums are 32bits all the time. duh.) - Mon Sep 3 18:48:26 PDT 2001 - Reformat everything to use real tabs (and to my latest coding style) - Abstract out the numerical data types to fu8/16/32_t for portability. - AIM_FRAMETYPE_OSCAR -> AIM_FRAMETYPE_FLAP. This makes more sense. - aim_conn_t's FLAP sequence number was a signed int. Oops. - Get rid of the 'struct' on all types suffixed with _t. That's been annoying me for a while. They're all real typedefs now. - Yes, client people are going to be rather annoyed by this. But it doesn't stop there. Keep reading. - Make the 'struct aim_rxcblist_t' type local to rxhandlers.c. - Combine the command_tx_struct and command_rx_struct into aim_frame_t. - Mostly aim_frame_t is command_rx_struct. For command_tx_struct, the same structure is used, except where ->sent was, ->handled is now used. - This makes things a lot easier, everywhere. - Get rid of ->lock. Pointless. If libfaim is ever preemptible, it has much more important problems than that. - Welcome to aim_bstream_t. No more direct buffer accesses. Anywhere. - In fact I plan on getting rid of the aimutil macros completly. - This isn't complete yet. It will be better later. Believe me. Maybe even make more sense. - More advanced and configurable boundschecking is coming, too. - Clean up lots of stuff, everywhere. - Rearrange the implementation of the TLV functions, saving lots of code. - I'm rather pleased with the way some things got implemented with this, particularly in places where TLVs contain TLVs. - Get rid of aim_puttlv_() functions. Those were gross. Use tlvchains. - XOR login is temporarily broken. I'll fix it someday. ("Someone" needs it.) - Fix the return values of most everything -- OSCAR functions should all return 0 on sucess, negative errno on failure. - There are several things braced with #ifdef MID_REWROTE_ALL_THE_CRAP. Consider that code broken and nonfunctional for now. - I think I may have broken buddy icons. Remind me to fix that. - Renovate faimtest substantially. Reformat, split up, update to new types. - Wed Aug 29 16:59:24 PDT 2001 - Pass up entire icon triplet (checksum/length/timestamp) in all cases that it is recieved. - Eric was paying more attention than I am. - Sat Aug 25 19:46:38 PDT 2001 - Pass "Maximum visible message length" to client in chat info update - This is the real maximum message length now. There is still a "complexity" limit that will prevent you from sending messages even if they are less than this limit (102 right now), but I don't know how that is calculated. - Sat Aug 25 19:19:16 PDT 2001 - Keep parsing missed calls for entire packet - This is really easy to test now. Just talk to someone with their minmsginterval set high (like 10seconds or something) - Sat Aug 25 18:35:13 PDT 2001 - aim_sendconnack -> aim_sendflapver - Remove addicbmparam. This was identical to aim_seticbmparam - aim_seticbmparam now takes a struct with the parameters in it. See faimtest. !!! REQUIRES CLIENT CHANGES if you use aim_seticbmparam, which you really really should -- the defaults are insanely limited - Fix rendezvous IM parsing that I broke last time. - ICBM parameter info callback gives same struct as above. !!! REQUIRES CLIENT CHANGES - Reformat login.c and part of faimtest.c - !!! NOTE: don't do anything in your motd handler. If you do, it will get run twice, sine for some reason AOL is sending two MOTDs now. - Wed Aug 22 22:11:18 PDT 2001 - Reformat the rest of im.c - Fix a few returns, particularly in error cases - Thu Aug 16 06:17:57 PDT 2001 - Reformat a bit of im.c and aim.h - Rearrange encoding/subencoding checks in IM parsing - Fri Aug 3 14:19:37 EDT 2001 - Naje aun_sebd_un retyrn sabe vakyes - Thu Aug 2 13:28:37 EDT 2001 - Uhm. Why does arcanejill think its in EDT? - Cache the username on warnings so errors work right. - Someday, I'm going to convert all of libfaim to that formatting style, too. - Wed Jun 27 00:13:20 EDT 2001 - Some comments about UNICODE in faimtest. - Fri Jun 15 17:51:27 EDT 2001 - Make faimtest compile on RH7.1 (new gcc). - Add aim_conn_getsess() - Add aim_getconn_type_all() and aim_getconn_fd(). - Make aim_connrst() and aim_conn_getnext() static to conn.c. - Why does arcanejill think she is in EDT? Oh well. - Thu Jun 14 17:37:47 PDT 2001 - Rearrange aim_setprofile(). It will now let you _not_ send a profile, if you really want to (pass NULL). Note that this is quite different than sending a _blank_ profile. Also fixes the "asci" bug. - Mon Jun 4 12:57:46 PDT 2001 - Fix chatnav. Whoops. - Mon Jun 4 12:45:18 PDT 2001 - Don't use snacid's for generic requests (gets around recent blocks) - If they start doing snacid-based blocks again, an audit will have to be done to see what WinAIM requests uses snacids for and what it leaves it blank for. That will be tedious and I'm not going to do it. - Thu May 31 23:00:50 PDT 2001 - Store two hardcoded hashes in login.c. Sigh. - Add prototype for aim_callhandler_noparam in aim_internal.h - Sat May 26 03:58:27 PDT 2001 - Aha! This is why I could never get icons to work before. - Luckily the checksum is painfully simple. - Sat May 26 01:37:39 PDT 2001 - So this is my big merge with the ActiveBuddy version... - Remove use of tlvchains from IM parsing for better performance - Add in buddy icon support - Add support for sending UNICODE messages. - Split up the more complicated options to aim_send_im into a structure that is passed to aim_send_im_ext(). This makes it easier to send simple messages, and only slightly harder to send complex ones. - aim_send_im_ext() must be used if you're using buddy icons and/or you are sending UNICODE messages. - UNICODE is fully explained in commentary above aim_send_im_ext() in im.c. - The ISO-8859-1 option is also added. Use when necessary, to avoid making WinAIM barf. - This removes the msglen parameter to aim_send_im because that was only needed to do UNICODE, which can now only be done by aim_send_im_ext. - Wed May 23 18:05:46 PDT 2001 - I upgraded libtool. Which broke the faimtest makefile. - Parse locate rights - You shouldn't ask so many questions, Eric. - Wed May 16 12:48:13 PDT 2001 - Thanks Rob and Eric - Thu May 10 17:37:23 PDT 2001 - I haven't had lunch yet. What should I have? - Wed May 9 15:21:51 PDT 2001 - I had pizza for lunch. - Mon May 7 15:19:55 PDT 2001 - Rename rxhandler_t to aim_rxhandler_t. This has been bugging me for a while. - Thu May 3 15:47:23 PDT 2001 - Clean up getcap/putcaps - Add GAMES2 and SENDBUDDYLIST caps (the latter is new in winaim 4.7beta) - Update hash to latest value - Wed Apr 25 11:51:39 PDT 2001 - I think this was a bug. - Tue Apr 24 17:36:03 PDT 2001 - Let Eric generate the hash if he wants. - Mon Apr 23 15:58:11 PDT 2001 - On a clear day, you can see forever. - Thu Mar 29 13:05:50 PST 2001 - Less leaks. - Thu Mar 29 14:45:22 CST 2001 (jbm) - Add module capability to the 0001/001f stuff (jbm) - Wed Mar 28 21:20:08 PST 2001 - Add flags arg to aim_chat_send_im() - Add msglen arg to aim_send_im and aim_chat_send_im - This will make more sense when I make the UNICODE commit (tomorrow?) - Wed Mar 28 16:51:25 PST 2001 - I decided it was a good day while I was figuring out that it was a bad day. - See faimtest and login.c::memrequest(). - Hopefully I'm done for a while. - Tue Mar 27 19:15:10 PST 2001 - I haven't decided yet whether today is a good day or a bad day. - Probably both. - More later. - Mon Mar 26 16:08:45 PST 2001 - Why didn't anyone tell me buddy-offgoing wasn't working? - *** REQUIRES CLIENT CHANGES... buddy-offgoing now passes a userinfo struct (its now identical to buddy-oncoming) - Mon Mar 26 15:57:41 PST 2001 - Hrmph. - Debuglevel wasn't getting set properly by aim_session_init - Sat Mar 24 03:16:32 UTC 2001 - vaargs to msgerror and locateerror swapped - ** CLIENT CHANGE: Reason code comes before SN now. This is so that the backend code for all three error handlers is identical. - aim_getinfo() returns -1 on failure (hah! I don't think anyone checks return codes from libfaim anyway...they're known for their inconsistency and lack of sensicality) - Remove _DEFAULT handlers in faimtest... - They were not consistent. - They did not make sense. - They did not work anyway. - Most of them were #if 0'd. - Add ICBM Parameter Info callback... you can catch this if you want. - aim_getbuildstring() now takes a buffer instead of returning static (ew!) - Clean up, "factorize", etc - More stuff... (Only one "middle handler" left in rxhandlers.c!) - Fri Mar 23 05:42:11 UTC 2001 - Export aim_encode_password_md5() - Add middle handler for 000b/0002 (min report interval) - Add aim_session_kill() - CLIENTS MUST CALL THIS either in addition to or instead of aim_logoff(), particularly if you keep lots of sessions open. (Sessions now contain dynamically allocated memory which must be freed.) - Oh, and some other stuff... - Fri Mar 23 01:45:28 UTC 2001 - Add AIM_CLIENTINFO_KNOWNGOOD - Fix a few details in aim_send_login (thanks temas) - Prevent aim_rxhandlers from being called recursively - This is something that has been in my PENDING_AIM mailbox for over a year now. I figured it was trivial enough to throw in. EveryBuddy wanted it, but I don't remember why. It should never happen anyway. - Use AIM_CLIENTINFO_KNOWNGOOD - This lets faimtest log in after today's round of AOL being mean. - Fri Mar 16 23:12:58 UTC 2001 - Remove one level from aim_rxdispatch() - Wed Mar 14 20:21:49 UTC 2001 - Clean up declarations of TLV functions (ie, const) - Add -o and -O to faimtest (I didn't use your patch, josh) - Wed Mar 14 03:11:03 UTC 2001 - Err...I'll commit before I go home. More faimtest crap. - Tue Mar 13 20:23:04 UTC 2001 - Fiddle with faimtest a bit. - Sun Mar 11 06:02:19 UTC 2001 - Banish socklen_t. - Sun Mar 11 05:51:45 UTC 2001 (jbm) - Split off aim_internal.h - Add aim_tx_cleanqueue() - Remove sn from directim callback (use priv) - Mon Mar 5 01:19:48 UTC 2001 - Fix typo in last CHANGES entry. - Add fix from Eric to keep efence from complaining about malloc(0) - Add .cvsignore files (also from Eric) - Throw in josh's latest OFT/ODC kludges - Completly remove all calls to printf and (unbounded) sprintf - Add aim_setdebuggingcb() - Remove preprocessor-based debug semantics (faimconfig.h) - faimdprintf() now calls a user-specified callback to do printing - Rearrange aim_tx_new() parameters to be more sensical, add sess - Do some sanity checking in aim_tx_new() - Add #defines to keep printf from compiling inside libfaim - Who knows what else. (in total, this patch is nearly 5k lines) - Fri Mar 2 02:17:22 UTC 2001 - Add aim_fingerprintclient(). (AB will trust this, but you shouldn't.) - Add some EXTRA_DIST to Makefile.am - Mon Feb 26 01:46:34 UTC 2001 - Fix swapped bytes in aim_caps[]. Thanks to Bruce Miller for pointing this out. - Sun Feb 11 01:07:36 UTC 2001 - Make secondary connections to the authorizer work again - Make aim_auth_changepasswd() work again. - Add aim_auth_setversions(), aim_auth_getinfo(), aim_auth_setemail(), aim_auth_reqconfirm() - Add middle handlers for responses to all of above. - Add examples of above to faimtest (start with 'reqauth') - Fri Feb 9 22:31:22 UTC 2001 - Add aim_tx_setenqueue(). - Thu Feb 8 20:12:39 UTC 2001 - Let TLV functions out of aim.h if FAIM_NEED_TLV is defined. - Thu Feb 8 02:31:25 UTC 2001 - Remove aim_purgecookies() -- never used anyway - Clean up a few bits of aim_msgcookie.c - Remove AIM_CONN_MAX constant (hasn't been relevent in ages) - Change commentary on synchro in aim.h - Add NOPLOCKS and make them default - Make faim/aim.h more of a mess; try to keep interfaces hiddenish. - Add #define FAIM_INTERNAL to top of every file - Remove aim_countconn (no one uses it anyway) - Add aim_cloneconn() (cringe.) - Throw in josh's getfile patch (and then munge it enough to break it) - Add getopt() to faimtest. - Remove aim_buildcode.h/mkbuildinfo.sh crap. - Clean up aim_cleansnacs() - There may have been other stuff too. As always, the diff is the most accurate changelog there is. - *** FT is currently more broken than it was before. Also, this patch introduces even more memory leaks. You've been warned. - Sun Dec 17 07:19:04 UTC 2000 - Update the capability block list - Sat Dec 16 01:34:19 UTC 2000 - Rename paramid to rateclass - Add a long comment about the rate system - Add a few other comments - Clean up aim_bos_clientready(). - Fri Dec 15 23:35:01 UTC 2000 - Add genericerr callback/middle. - This is for catching the errors that come back, for instance, from sending a SNAC that isn't supported by the host (such as the Watcher Request SNAC). - Fri Dec 15 21:51:32 UTC 2000 - Add more info to evilnotify callback - Add a few values to aim_cbtypes.h - Fri Dec 15 20:41:15 UTC 2000 - Revise README - Make aimdebugd compile - Typos - Fri Dec 15 02:04:12 UTC 2000 - Parse rate changes *properly* - Add sample code to faimtest demonstrating my approximations on how to fiddle with aim_conn_setlatency() in relation to the rate changes (properly wildly conservative). [I also copied this stuff into mfaim.] - Thu Dec 14 03:39:34 UTC 2000 - Change the 0x01 to a 0x00 in auth request to make buddy lists work again - Rearrange bytes in setversions() to match winaim - Add several cachesnac() calls - Add hostonline and hostversions parsers (superfluous) - Wed Dec 13 02:26:39 UTC 2000 - Create aim_cachesnac() - Some long overdue cleanups - Wed Dec 13 00:38:56 UTC 2000 - Added the client update/version info to the authresp callback - Added the prototype for aim_getfile_send_chunk to aim.h - Tue Dec 12 23:02:41 UTC 2000 - Got pissed off at sess->logininfo. Got rid of it. - Now pass all that stuff in as varargs, like it should be. - *** Look at the changes to faimtest. You'll also need to change anything in your code that references sess->logininfo to reference sess->sn instead. The rest of the other info is now unavailable (it was before, too, it just didnt look like it). - A few other minor cleanups. - Added aim_gettlv8/16/32, aim_puttlv_8, and aim_addtlvtochain_noval. - Added that short 0x004a TLV to the auth request, like WinAIM 4.3. - Mon Dec 4 23:46:35 UTC 2000 - Add exchange to the create response callback (doh!) - Sat Dec 2 02:14:45 UTC 2000 - Dumb bug in aim_clearhandlers() - Fri Dec 1 23:48:38 UTC 2000 - Store exchange along with room name in the great chat hack - Fri Dec 1 22:25:56 UTC 2000 - Fix numerous tiny (but sometimes catastrophic) bugs dealing with connection death (particularly with chat connections) - *** Any connection with a -1 fd will get returned by aim_select immediatly now... your code probably already handles this implicitly. - Wed Nov 29 17:31:23 UTC 2000 - Rewrote some of the msgcookie stuff - Changed cachecookies to uncachecookies where it makes sense (arg!) - Minor other stuff - Fri Nov 10 08:24:34 UTC 2000 - Add sess->flags (replaces sess->snaclogin) - Remove odd setstatus call in chat parser - Remove aim_tx_enqueue macro, replace with a smarter one - If a connection is in progress, enqueue instead of calling the client-specified queuer - Add support for nonblocking connects through the AIM_SESS_FLAG_NONBLOCKCONNECT flag to aim_session_init() - Add AIM_CB_SPECIAL_CONNCOMPLETE callback. Not real useful. - Add AIM_CB_SPECIAL_FLAPVER callback. Can be used as an alternate way of starting the login process, or just to look like you know what you're doing. Fixed associated inconsistencies in aim_rxhandlers too. - Fix some connection status stupidities in faimtest. - Wed Nov 8 13:11:18 UTC 2000 - Reenable/reimplement older login, but only use for ICQ UINs - This is a fairly ugly hack. But...eh. It works. - You'll need to remove the aim_sendconnack() before the call to aim_request_login. It will now do it automatically if its needed. (hint: ***CLIENT CHANGE***) - Wed Nov 8 02:23:25 UTC 2000 - I'm trying out using a modified version of the kernel-doc scripts to help document the libfaim code a bit. See aim_conn.c and aim_tlv.c, as well as the scripts in utils/docs. - Wed Oct 25 17:52:20 UTC 2000 - Cleanup warnings from newer gcc's (RH7.0) - Aparently newer gcc's don't let you do as strong of integer types on va_arg as older ones... So, let me know if this breaks on your compiler - Tue Oct 17 02:10:13 UTC 2000 - Rearrange a few things - Mon Oct 16 20:56:59 UTC 2000 - Remove some warnings - Mon Oct 9 04:24:56 CDT 2000 (jbm) - took care of the XXXs in aim_putuserinfo() - now use dynamic TLV count to send ("look ma, no magic!") - now send cap blocks - now send icq info if a numeric SN - Wed Oct 4 21:29:47 CDT 2000 (jbm) - Fix borked disconnect callbacks - Add aim_conn_in_sess() - A little housekeeping in faimtest ("fixing" order of printf, remove a comment) - Mon Sep 25 00:21:31 CDT 2000 (jbm) - Add a couple of ICQ userinfo parses - Fri Sep 22 22:47:49 UTC 2000 - Add aim_icq_setstatus() (jbm) - Fri Sep 22 22:35:51 UTC 2000 - Apply jbm's patch below - Minor cleanup in cb handler stuff - Thu Sep 21 20:28:20 CDT 2000 (jbm) - DirectIM shouldn't kill us any more. - Eliminated a potential segfault in aim_send_im_direct(). - make tags (yay!). - Added an aim_tx_destroy(); need to move the lib over to using it. - Got rid of some #if 0 BS code in a couple of places (aim_ft::establish() and aim_im::aim_parse_incoming_im_middle()). - Added some file transfer stuff (so experimental, i haven't had a chance to see if it causes cancer in lab animals). - Added to faimtest for all of the above. - Added myself to AUTHORS with Real Info. - Thu Sep 21 00:24:36 UTC 2000 - Add socks5 proxy support (not tested real well, worked the few times a tried). - Added proxy support to faimtest. - Tue Sep 19 03:10:07 UTC 2000 - Add aim_setuserinterests() and aim_setdirectoryinfo() - Add ICQ away status - Thu Sep 14 00:54:48 UTC 2000 - Added create room callback - Wed Sep 13 22:01:35 UTC 2000 - Remove references to "new" and "class" for dumb C++ compilers - Renamed userinfo->class to userinfo->flags both for clarity and C++ - Remove some extraneous variables - Tue Sep 12 20:16:51 UTC 2000 - Add aim_flap_nop() from my work tree - Tue Sep 12 05:06:53 UTC 2000 - Revert the two-byte change in aim_misc, clientready - Tue Sep 5 04:41:45 GMT 2000 - Few more minor things - Added the changes needed for faimtest. - Removed aimdebugd from default build - Tue Sep 5 03:47:26 GMT 2000 - More ANSIfication for win32 - Forgot aim_misc last time. - Mon Sep 4 22:08:35 GMT 2000 - Forgot aim_snac and aim_search - Mon Sep 4 21:38:09 GMT 2000 - A mild step towards ANSI compliance - Compiles cleanly with -pedantic (except for the libc issue in socket.h) - Fixes various sign mismatch things. There may be more, we'll see what MSVC has to say about it. - Add faim_internal and faim_export macros so Win32 DLL is easier - Sun Sep 3 23:58:17 UTC 2000 - Portability fixes (for solaris, set the SOLARIS env var first) - Sat Sep 2 23:42:37 UTC 2000 - Hopefully fix aim_snac.c bugs - Add Buddy List Rights parser (max buddies and max watchers) - Fix rather major problem in rxhandlers caused by missing breaks - Add reason code for msgerr (0004/0001) callback - Add BOS Rights parser (max permit / max deny) - Add locate error (0002/0001) parser - Add parser for missed calls (0004/000a) - Fri Sep 1 23:34:28 UTC 2000 - Switched the read()s in rxqueue to use recv() - Should fix the big message problem and the big buddy list problem - Changed some values around in aim_misc to match winaim4.1 - Added aim_addicbmparm. dunno what it does - Cleanup the login process in faimtest (can now login in less than 2sec) - Fri Sep 1 00:13:04 UTC 2000 - Avoid zero-length mallocs in aim_tlv - Thu Aug 31 23:40:23 UTC 2000 - Threw in aim_select modification from nicolas - Remove stray debugging printf in aim_tlv - Mon Aug 28 03:11:15 GMT 2000 - Adds lots of comments - Add AIM_CLASS_ALLUSERS constant for setgrouppermmask() - Add warnings support (jbm) - Mon Aug 21 22:00:18 UTC 2000 - Implement SNAC login MD5 (thanks to Sonuvbob for that one) - Clear out all that old login cruft. Much cleaner now. - REQUIRES CLIENT CHANGES (see faimtest) - Fri Aug 18 19:52:54 UTC 2000 - Fix the non-pthread bug - Thu Aug 17 23:19:40 UTC 2000 - A few more leak fixes (only a few left to go...) - Thu Aug 17 23:08:08 UTC 2000 - More leak fixes (eric, eric, eric...) - Thu Aug 17 22:53:03 UTC 2000 - Change the SNAC cache to a hash instead of list - Fixed a few leaks relating to aim_gettlv_str() - Thu Aug 17 14:04:18 UTC 2000 - Fix the fd closing bug introduced last week - Tue Aug 8 04:25:35 UTC 2000 - Preserve subtype and priv after aim_conn_close - Tue Aug 8 04:15:47 UTC 2000 - Fixed double-calling of faim_mutex_init - conn->type preserved after aim_conn_close - Mon Jul 17 01:56:31 UTC 2000 - Added 0004/000c callback (for message acknowledgments) - This goes with the AIM_IMFLAGS_ACK option that has been there for ages now. When you send a message with that option, you'll get a message back containing the screenname, telling you it was sent. - Moved the aim_conn_kill's out of aim_get_command() and into the client. They're only closed in there now. This is so that you can detect what type of connection died. You'll want to handle BOS and chat connections in special ways most likely. You'll also need to call aim_conn_kill when you're done with it. - Added/fixed the Rate Change handlers. Now passes up a long that should contain a number. I'm currently in pattern-searching mode. - Sun Jul 16 22:59:39 GMT 2000 - Fixed the locking in the rendezvous code. Hopefully is safe now. - Sun Jul 16 11:03:28 GMT 2000 - Fixed 0001/000a chat printf. (Actually a one liner a few days ago.) - Started integrating josh's 3k rendezvous patch. Currently only directim is working. And its got bugs. But he's not online right now, so I can't bitch. I'd love to bitch here, but I'm tired. - Can definitly accept directim connections and send/recieve. - See faimtest for the new callbacks. (Urg.) - Here weeee gooooo. (Not sure if this will break everyone or not.) - Fri Jun 30 00:04:47 UTC 2000 - Removed the forceful ICQ-related warnings, just in case they're wrong - Added three new fields to the client info. - **REQUIRES CLIENT CHANGES -- see faimtest for new initializer - Cleaned up aim_send_login() - Put in a nice hidious fix for AOL's latest bit of the drama. See aim_readtlvchain() for the details. - Mon Jun 26 07:53:02 UTC 2000 - Added utils/aimdebugd for playing with things -- see the README - Added aim_im.c::aim_parse_outgoing_im(). Probably not useful unless you're writing a server or something (or hacking aimdebugd). - aim_send_im() now sends the same data as AIM4 does (three more bytes) - Added aim_debugconn_sendconnect() for aimdebugd-enablement. - Sat Jun 24 02:14:07 UTC 2000 - Added fakelocks for platforms without pthreads or that have no use for them. - Added workaround for MSG_WAITALL for people with the very broken libc that comes with earlier Red Hat's. - Sat Jun 24 00:44:24 UTC 2000 - Support zero-type TLVs in aim_extractinfo() - AOL now ocassionally throws extra zeros in so in order to break clients. Aparently zero-type TLVs are a special case -- if the type is zero, then _there is no length_ field. AOL are geniuses. - Note that you only get these if you send a bad client string, such as the top one in faimtest. If you #if 0 that one out and use the second one, you'll be fine. (Unless you just want to see the message for yourself. Its nifty. (FREE!)) - ICBM parser now uses aim_extractuserinfo() so that it can benefit from the above changes, as well as clean up the whole "is it the first or the second one of this type?" issue - This also fixes the changes AOL made in away messages. = Fixed a possible buffer overflow when AOL changes the max sn length - Increased MAXSNLEN to 32 (they appear to be valid) - If you start getting messages from someone called "AOL Instant Messenger", see comment one, paragraph two. - aim_select() now returns a -1 if there are no connections open - Connections are now killed completely if there is a major error on them - faimtest now calls aim_logoff() on connection error - Fri Jun 23 22:38:47 UTC 2000 - Adds start of adverts support - Adds aim_bos_nop(). You may want to send this occassionally - Fixes aim_rxhandlers.c to work for people with three-letter screen names - The week prior to Fri Jun 16 19:37:09 UTC 2000 - Rethought the rendezvous stuff. DEFINIT WORK IN PROGRESS - Do not bother trying to use this. This will probably break your clients. You may or may not want to fix them, since I may change it again soon. - I REPEAT: This really is a developer-only version. It barely compiles. I'm just committing it so I don't have so many trees floating around. - Added stuff to support OFT as well as OSCAR protocols - Added aim_send_im_direct() for directim ("IM Image") - Added caps getting/putting routines - Added more aim_login fixes to avoid more AOL stupidity - This is the same as went to libfaim-devel yesterday, so don't upgrade just to get these changes. - Removed aimicq_encode_password -- now use the same table for both ICQ and AIM - Added AUTHORS - Tue Jun 6 01:36:48 UTC 2000 - Inverted gethostbyname2() check. Not sure how that ended up in that state. - Added some of the initial framework to support file transfers - Added in a few checks for that - Can currently parse and send a denial message. - Added cookie caching. (Sorry, I just like saying that.) - Rearranged channel 2 ICBM parsing (detects the different rendezvous types better and hopefully accuratly). - Killed the connection array. Now a list. (Suits the upcoming features better.) --- REQUIRES CLIENT CHANGES... - In most cases, you need to change aim_conn_close() calls to aim_conn_kill(). This will free them as well as close them. If you don't do this, you'll pollute the connection list and leak memory. - Possibly a few other minor things (some cleanups to faimtest for one) - Fri Jun 2 23:27:28 UTC 2000 - Cleaned up aim_send_login slightly - Added aimicq_encode_password to support the new hash values required for logging in with ICQ - Removed crash when email and/or reg status aren't in the auth response (they're not in ICQ responses) - So now as long as you specify a client version of 4.30.3141 in the client info, and your ICQ number as your screen name, you can login to ICQ via libfaim and use it just like an AIM account. - Added AIM_CB_SPECIAL_CONNERR callback for recieving messages such as disconnect reasonses ("you logged on from a different machine", etc). - Added faimtest's userinfo handler to support away messages - Fri Jun 2 15:57:27 UTC 2000 - Add creation time, maxmsglen, and various unknowns to chat info update callback. - Remove 'nothing works yet' comment from top of aim_chat.c (it works!) - Wed May 31 01:17:24 UTC 2000 - Added constants for message sizes (MAXMSGLEN, MAXCHATMSGLEN) - Note that the new max message size is defined as 7988bytes, drastically larger than WinAIM lets you put out. This is a libfaim-exclusive feature :) - Reduced base buffer size on aim_send_im() - Tue May 30 22:32:31 UTC 2000 - Added lock around tx seqnum to prevent that race when transmitting from diverse threads. (actually committed earlier today) - Added aim_meta.c and a few constants and things to keep track of "releases". - Added mkbuildinfo.sh to automatically update build string "constants" on every invocation of 'make all'. - Mon May 29 12:08:28 GMT 2000 - Rearranged aim_tx_flushqueue(); moved write operation to aim_tx_sendframe() - Turned aim_tx_enqueue() into a macro that calls sess->tx_enqueue, a function pointer to whatever you want to use to enqueue things for transmition (or not) - Old aim_tx_enqueue becomes aim_tx_enqueue__queuebased. Added aim_tx_enqueue__immediate for doing immediate writes. Default is to use queue-based procedure. - Cleaned up parts of aim_conn.c - Added locking around the sockets themselves. Should allow for full cross-thread usage. - Unfortunatly, only pthreads are supported at this time. If you don't have pthreads on your arch, implement the macros your arch needs and send me a patch. (A SysV semaphore implementation would be trivial, as would a simple integer-based lock.) - Sun May 21 14:59:20 GMT 2000 - Added infotype parameter to aim_getinfo() for requesting different types of messages. AIM_GETINFO_GENERALINFO will get you the normal stuff, AIM_GETINFO_AWAYMESSAGE will get the normal stuff, with the profile replaced with the user's away message. Also, the callback adds an unsigned short to the end to give you the value that was originally passed to the request. - There were a few server-pertinent changes that didn't get documented from last month. I have no idea what they were. - Sun Apr 2 07:29:11 UTC 2000 - Redid much of the tx path to remove the superfluous copy. But it touches every function that transmits. Its been a long time in coming. - Added caps parameter to aim_bos_setprofile(). You can now control what capabilties you show up as others to - Added ->capabilities to userinfo. It should be nonzero when its coming off buddy oncoming information, but NOT requested user info. - Sun Apr 2 01:45:15 UTC 2000 - Increased AIM_CONN_MAX from 5 to 7. Precausionary only - Removed deprecated TIS_TELNET_PROXY from faim/faimconfig.h - Added macros for the simple integer functions in aim_util.c - Removed usage of aim_failsaferead() - Still not sure why I had it to begin with. I think it was a remament from when we used non-blocking sockets (which I don't know why I did either) - Removed some of the oddities in aim_get_command() - gprof showed this taking 20kns on my k6-300. Should be faster now. - Added conn parameter. This should prevent aim_select() from getting called too many times in a row. - Thu Mar 23 08:45:40 UTC 2000 - Removed aim_countconn() > 0 check in aim_select(), its logically redundent - Added aim_putuserinfo() (inverse of aim_extractuserinfo()) - Added aim_sendbuddyoncoming/offgoing() - Rearranged loop in rxdispatch() - Remove aim_conn_close() if connections dead in aim_get_command() - Thu Mar 23 00:44:32 UTC 2000 - Added a check to purge_rxqueue to skip handled commands - Mon Mar 20 05:30:59 UTC 2000 - Added some server-only functions for login - Added aim_counttlvchain() - Added aim_sncmp() and aim_snlen() - Sun Mar 19 06:07:52 UTC 2000 - Added a parameter to aim_select to return event type - REQUIRES CLIENT CHANGES. - For the most part rewrote the tx and rx queuing code - Should fix many, many outstanding problems in and related to that code, including one that keeps memory from freeing - Fixed several bugs in various places - Reformated a lot of code, and did general cleanups - Should have a generally more robust lib now. - Sun Mar 12 00:07:40 UTC 2000 - Fixed a robustness problem in aim_handleredirect_middle() - Added TLV chain creation routines (yes, aimd is progressing) - Mon Jan 3 04:07:55 UTC 2000 - Fixed bug in aim_snac.c - Fixed condition where commands read from connections that have been closed were still left in the queue. Now cancelled. - Added some printfs to aim_info to get more informative crahes - Fixed a bug in aim_rxqueue::purge - Sun Jan 2 10:31:19 UTC 2000 - Cleanups in aim_info.c - Can compile with -Ddebug=100 again - Implemented chat: Joining/Leaving, info parsing, IM parsing/sending - Implemented some chatnav: rights req/parsing, room creation - Thu Dec 30 10:08:42 UTC 1999 - Fixed bug in aim_im.c when (encoding == NULL) || (lang == NULL) - Added detection of voice chat requests - Added AIM_CLASS_* defines, including new Away flag - Added awaymsg parameter to bos_setprofile. - If awaymsg is nonnull, you will be advertised as being away (your class will be ORed with AIM_CLASS_AWAY), otherwise you'll show up normal. - Wed Dec 29 10:06:35 UTC 1999 - Fixed small bug in IM parser - Added stubs for the capability TLVs in userinfo. - Wed Dec 29 09:14:45 UTC 1999 - Added a capability block to aim_bos_setprofile. Can now get chat invites again. - Extended ICBM parser to support channel 2 messages (chat invites) - A channel parameter has been prepended to the varargs -- REQUIRES CLIENT CHANGES. - Extended faimtest to support chat invites. - Changed faimtest to get sn/password from environment - Wed Dec 29 04:17:03 UTC 1999 - Added -g to CFLAGS - Added aim_sendconnack() to aim_login.c (needed for newer login) - Added code for the new SNAC-based login/auth procedure. (see SNACLOGIN in faim/faimconfig.h for why its not enabled) - Reimplemented aim_authparse(), aim_handleredirect() using TLVlists - The old auth_failed callback is now integrated into the success one. If there was an error, logininfo->errorcode is nonzero - Fiddled with version information. Added aim_setversions() - Added table of SNAC names for showing unknown snacs (jbm) - Added a middle handler for MOTD - Added new authorization SNACs to faim/aim_cbtypes.h - Sun Dec 26 22:59:10 UTC 1999 - Renamed login_phase1_struct to aim_login_struct - Changed cookie and sn to be static arrays in aim_login_struct - Integrated the Jabber-faim changes. (temas) [BIG CLIENT CHANGES] - Added aim_session_t, removed all global variables - Changed all functions to accept a session pointer - Removed aim_global.c - Updated faimtest to use an aim_session_t. - Removed all cases where logininfo was passed as vararg to client - Fixed small bug in aim_newconn's 'fixing' of host:port addresses - Added an install rule to the makefile (installs headers+so only!) - Enabled USE_SNAC_FOR_IMS by default, assuming it got fixed by n's new aim_snac.c from ages ago - Implemented a middle handler for 0004/0001 message errors, added snacid lookup to get illfated destination SN and pass to client - Implemented a short middle handler for offgoing buddy. - Fri Dec 24 21:30:06 UTC 1999 - Added an error-counting Read() that has been sitting in my inbox - Cleaned up header files, created aim_cbtypes.h. - Added void * to aim_conn_t for private client use if they want. (Orb) - Removed all stderr output. All output is important, and goes to stdout. - Renamed isautoresponse in IM parser to icbmflags. - Added Orb's fix for the new login code, deleted old (see Orb, I do read your mail....eventually). - Added mailing lists to README. - Fri Dec 24 11:12:34 UTC 1999 - Cleaned up both outgoing and incoming ICBM handling. Anything that crashes around there is no longer libfaims fault! - The encoding flags are now passed up to the client. - Added several TLV routines to parse large blocks of continuous TLV triplets. Not terribly effecient, but quite elegent in usage. - Added icbm_setparams() back in from way-back-long-ago. It hasn't been implemented in a long time, but I think we should still send it. - Fri Dec 24 01:23:06 UTC 1999 - Fixed a very minor bug in aim_newconn(). - Added aimutil_get{16,32}() - Added aim_extractuserinfo() for extracting user data blocks and putting them into struct aim_userinfo_s's. - Added a loop to print out info on extraneous TLVs. - Put in lots of comments. - Added parse_oncoming_middle() to parse the user data block of that packet. Now passes struct aim_userinfo_s to client. - Rearranged parse_userinfo_middle(). Now passes an entire userinfo struct to client instead of individual variables. - Convered the version of parse_im_middle() thats actually getting used to pass up a userinfo struct. - Updated faimtest to accept new structs. - Tue Dec 21 06:18:50 UTC 1999 - Fixed a Win32 header problem - Tue Dec 21 03:44:13 UTC 1999 - Latency timers now update on rx as well as tx. Gets rid of even more of the rate problems that most clients are having. - Renamed lasttx and settxlatency to lastactivity and setlatency, respec. - Integrated fixes needed for Win32 -- should compile cleanly now (DMP) - Cleaned up some places, use aim_putsnac everywhere now. - Sun Sep 26 20:04:20 MST 1999 - Reduced the IM parsing to look for 3 zeros instead of 4 -- NEEDS WORK - This was needed to work with MacAIM3 and some WinAIM3s. - Added aim_conn_settxlatency() for throttling outgoing frames -- NEEDS WORK - Added an int to the userinfo and incoming IM user callbacks for new TLV that AOL put it in -- its the number of seconds elapsed since the user logged in - Worked more on the callbacks (more internal rearrangements) - Fixed bug in aim_select() (returning negative fds) - Clear out logininfo struct before putting more data into it - Other bugfixes that I can't particularly remember. - Tue Aug 24 03:13:12 UTC 1999 --- TRANSITION RELEASE!! - Added jbm's new aim_rxqueue.c, which should crash less - Started the overhaul on the callback system. No where near complete yet. - Sun Aug 1 03:02:17 UTC 1999 - Added aimutil_*()s in aim_util.c for raw byte placement - Cleaned up aim_im.c, aim_auth.c, and aim_login.c using aimutil_* - Added AIM_IMFLAGS, flags option to aim_send_im(), removed aim_send_im_away() - Added client_info parameter to aim_send_login() - Tweaked aim_send_im() (AOL changed a few things, there's some more changes left to do) - Some Chat stuff changed, still no where near functional - Finally remembered to switch the license to LGPL (from GPL) - Permit/Deny (blocking) list support added - Released a snapshot - Sat Jul 31 05:28:38 UTC 1999 - Changed aim_bos_setdeny() to aim_bos_changevisibility() and actually did the implementation. - Fri Jul 23 17:45:22 UTC 1999 - Work around for the AOL change in IP syntax (thanks to Eric Peyton) - Released snapshot - Sun Apr 25 23:31:44 UTC 1999 - Fixed stupid off-by-one bug in aim_logoff() - Sun Apr 25 22:43:31 UTC 1999 - Renamed/reclassified missed IM errors (now all callbacks -- no backend handling) - Killed aim_login() -- all connections now opened in frontend - aim_conn_close() will not close fd's < 3 - Released snapshot. - Sat Apr 10 22:44:07 UTC 1999 - Changed how rx_command->handled works; now uses return value from callback - Changed the if's in the dispatcher (aim_rxhandlers.c) to switch()es - Sat Apr 10 03:51:21 UTC 1999 - Started CHANGES - Put in n's aim_snac.c. - Updated aim_{add,remove}_buddy() to use aim_conn - Updated aim_usersearch_address() to use aim_conn - Cleaned up aim.h a bit (removed old *phase* protos) - Changed gethostbyname() to gethostbyname2() (for MacOS X) - Changed aim_newconn() to pass connection errors in connstruct->status - Updated faimtest.c to detect connection errors - Fixed a small typo in aim_im::aim_parse_incoming_im_middle() - Added free()s in that function and to userinfo counterpart (fewer leaks) - Released snapshot - Sat Apr 3 06:43:14 UTC 1999 - Released snapshot - Wed Dec 30 01:20:59 MST 1998 - Released snapshot - Mon Dec 7 16:57:57 MST 1998 - Released snapshot - Sat Dec 5 00:01:53 MST 1998 - Released snapshot - Thu Nov 26 17:50:02 MST 1998 - Released snapshot pork-0.99.8.1/src/protocols/aim/libfaim/COPYING0000644000175000017500000006347410234217335020734 0ustar ryanryan00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! pork-0.99.8.1/src/protocols/aim/libfaim/rxqueue.c0000644000175000017500000001373710234217335021540 0ustar ryanryan00000000000000/* * This file contains the management routines for the receive * (incoming packet) queue. The actual packet handlers are in * rxhandlers.c. */ #define FAIM_INTERNAL #include #ifndef _WIN32 #include #endif /* * */ faim_internal int aim_recv(int fd, void *buf, size_t count) { int left, cur; for (cur = 0, left = count; left; ) { int ret; ret = recv(fd, ((unsigned char *)buf)+cur, left, 0); /* Of course EOF is an error, only morons disagree with that. */ if (ret <= 0) return -1; cur += ret; left -= ret; } return cur; } /* * Read into a byte stream. Will not read more than count, but may read * less if there is not enough room in the stream buffer. */ faim_internal int aim_bstream_recv(aim_bstream_t *bs, int fd, size_t count) { int red = 0; if (!bs || (fd < 0) || (count < 0)) return -1; if (count > (bs->len - bs->offset)) count = bs->len - bs->offset; /* truncate to remaining space */ if (count) { red = aim_recv(fd, bs->data + bs->offset, count); if (red <= 0) return -1; } bs->offset += red; return red; } /** * Free an aim_frame_t * * @param frame The frame to free. * @return -1 on error; 0 on success. */ faim_internal void aim_frame_destroy(aim_frame_t *frame) { free(frame->data.data); /* XXX aim_bstream_free */ free(frame); return; } /* * Read a FLAP header from conn into fr, and return the number of * bytes in the payload. * * @return -1 on error, otherwise return the length of the payload. */ static int aim_get_command_flap(aim_session_t *sess, aim_conn_t *conn, aim_frame_t *fr) { fu8_t hdr_raw[6]; aim_bstream_t hdr; fr->hdrtype = AIM_FRAMETYPE_FLAP; /* * Read FLAP header. Six bytes total. * * Byte # | Description * -------|------------- * 0x00 | Always 0x2a * 0x01 | Channel number, usually "2." "1" is used during login, * | 4 is used during logoff. * 0x02 | Sequence number, 2 bytes. * 0x04 | Number of data bytes that follow, 2 bytes. */ aim_bstream_init(&hdr, hdr_raw, sizeof(hdr_raw)); if (aim_bstream_recv(&hdr, conn->fd, 6) < 6) { aim_conn_close(conn); return -1; } aim_bstream_rewind(&hdr); /* * This shouldn't happen unless the socket breaks, the server breaks, * or we break. We must handle it just in case. */ if (aimbs_get8(&hdr) != 0x2a) { faimdprintf(sess, 0, "Invalid FLAP frame received on FLAP connection!"); aim_conn_close(conn); return -1; } fr->hdr.flap.channel = aimbs_get8(&hdr); fr->hdr.flap.seqnum = aimbs_get16(&hdr); return aimbs_get16(&hdr); } /* * Read a rendezvous header from conn into fr, and return the number of * bytes in the payload. * * @return -1 on error, otherwise return the length of the payload. */ static int aim_get_command_rendezvous(aim_session_t *sess, aim_conn_t *conn, aim_frame_t *fr) { fu8_t hdr_raw[8]; aim_bstream_t hdr; fr->hdrtype = AIM_FRAMETYPE_OFT; /* * Read rendezvous header */ aim_bstream_init(&hdr, hdr_raw, sizeof(hdr_raw)); if (aim_bstream_recv(&hdr, conn->fd, 8) < 8) { aim_conn_close(conn); return -1; } aim_bstream_rewind(&hdr); aimbs_getrawbuf(&hdr, fr->hdr.rend.magic, 4); fr->hdr.rend.hdrlen = aimbs_get16(&hdr); fr->hdr.rend.type = aimbs_get16(&hdr); return fr->hdr.rend.hdrlen - 8; } /* * Grab a single command sequence off the socket, and enqueue it in the incoming event queue * in a separate struct. * * @return 0 on success, otherwise return the error number. */ faim_export int aim_get_command(aim_session_t *sess, aim_conn_t *conn) { aim_frame_t *fr; int payloadlen; if (!sess || !conn) return -EINVAL; if (conn->fd == -1) return -1; /* it's an aim_conn_close()'d connection */ if (conn->fd < 3) /* can happen when people abuse the interface */ return -1; if (conn->status & AIM_CONN_STATUS_INPROGRESS) return aim_conn_completeconnect(sess, conn); if (!(fr = (aim_frame_t *)calloc(sizeof(aim_frame_t), 1))) return -ENOMEM; /* * Rendezvous (client to client) connections do not speak FLAP, so this * function will break on them. */ if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) payloadlen = aim_get_command_rendezvous(sess, conn, fr); else if (conn->type == AIM_CONN_TYPE_LISTENER) { faimdprintf(sess, 0, "AIM_CONN_TYPE_LISTENER on fd %d\n", conn->fd); free(fr); return -1; } else payloadlen = aim_get_command_flap(sess, conn, fr); if (payloadlen < 0) { free(fr); return -1; } if (payloadlen > 0) { fu8_t *payload = NULL; if (!(payload = (fu8_t *) malloc(payloadlen))) { aim_frame_destroy(fr); return -1; } aim_bstream_init(&fr->data, payload, payloadlen); /* read the payload */ if (aim_bstream_recv(&fr->data, conn->fd, payloadlen) < payloadlen) { aim_frame_destroy(fr); /* free's payload */ aim_conn_close(conn); return -1; } } else aim_bstream_init(&fr->data, NULL, 0); aim_bstream_rewind(&fr->data); fr->conn = conn; /* Enqueue this puppy */ fr->next = NULL; /* this will always be at the bottom */ if (sess->queue_incoming == NULL) sess->queue_incoming = fr; else { aim_frame_t *cur; for (cur = sess->queue_incoming; cur->next; cur = cur->next); cur->next = fr; } fr->conn->lastactivity = time(NULL); return 0; } /* * Purge receive queue of all handled commands (->handled==1). * */ faim_export void aim_purge_rxqueue(aim_session_t *sess) { aim_frame_t *cur, **prev; for (prev = &sess->queue_incoming; (cur = *prev); ) { if (cur->handled) { *prev = cur->next; aim_frame_destroy(cur); } else prev = &cur->next; } return; } /* * Since aim_get_command will aim_conn_kill dead connections, we need * to clean up the rxqueue of unprocessed connections on that socket. * * XXX: this is something that was handled better in the old connection * handling method, but eh. */ faim_internal void aim_rxqueue_cleanbyconn(aim_session_t *sess, aim_conn_t *conn) { aim_frame_t *currx; for (currx = sess->queue_incoming; currx; currx = currx->next) { if ((!currx->handled) && (currx->conn == conn)) currx->handled = 1; } return; } pork-0.99.8.1/src/protocols/aim/Makefile.am0000644000175000017500000000171110234500667020317 0ustar ryanryan00000000000000INCLUDES = -I. -I.. -I../.. -I../../.. -I../../missing -Ilibfaim AM_CFLAGS = $(DEBUG_CFLAGS) $(PERL_CFLAGS) noinst_LIBRARIES = libaim.a libaim_a_SOURCES = \ libfaim/admin.c \ libfaim/adverts.c \ libfaim/auth.c \ libfaim/bart.c \ libfaim/bos.c \ libfaim/bstream.c \ libfaim/buddylist.c \ libfaim/chat.c \ libfaim/chatnav.c \ libfaim/conn.c \ libfaim/email.c \ libfaim/ft.c \ libfaim/icq.c \ libfaim/im.c \ libfaim/invite.c \ libfaim/locate.c \ libfaim/md5.c \ libfaim/misc.c \ libfaim/msgcookie.c \ libfaim/odir.c \ libfaim/popups.c \ libfaim/rxhandlers.c \ libfaim/rxqueue.c \ libfaim/search.c \ libfaim/service.c \ libfaim/snac.c \ libfaim/ssi.c \ libfaim/stats.c \ libfaim/tlv.c \ libfaim/translate.c \ libfaim/txqueue.c \ libfaim/util.c \ pork_aim.c \ pork_aim_proto.c noinst_HEADERS = \ libfaim/aim.h \ libfaim/aim_cbtypes.h \ libfaim/aim_internal.h \ libfaim/faimconfig.h \ libfaim/md5.h \ pork_aim.h \ pork_aim_proto.h pork-0.99.8.1/src/protocols/aim/Makefile.in0000644000175000017500000022720010236222654020332 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SOURCES = $(libaim_a_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = src/protocols/aim DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libaim_a_AR = $(AR) $(ARFLAGS) libaim_a_LIBADD = am_libaim_a_OBJECTS = admin.$(OBJEXT) adverts.$(OBJEXT) auth.$(OBJEXT) \ bart.$(OBJEXT) bos.$(OBJEXT) bstream.$(OBJEXT) \ buddylist.$(OBJEXT) chat.$(OBJEXT) chatnav.$(OBJEXT) \ conn.$(OBJEXT) email.$(OBJEXT) ft.$(OBJEXT) icq.$(OBJEXT) \ im.$(OBJEXT) invite.$(OBJEXT) locate.$(OBJEXT) md5.$(OBJEXT) \ misc.$(OBJEXT) msgcookie.$(OBJEXT) odir.$(OBJEXT) \ popups.$(OBJEXT) rxhandlers.$(OBJEXT) rxqueue.$(OBJEXT) \ search.$(OBJEXT) service.$(OBJEXT) snac.$(OBJEXT) \ ssi.$(OBJEXT) stats.$(OBJEXT) tlv.$(OBJEXT) \ translate.$(OBJEXT) txqueue.$(OBJEXT) util.$(OBJEXT) \ pork_aim.$(OBJEXT) pork_aim_proto.$(OBJEXT) libaim_a_OBJECTS = $(am_libaim_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/admin.Po ./$(DEPDIR)/adverts.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/auth.Po ./$(DEPDIR)/bart.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/bos.Po ./$(DEPDIR)/bstream.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/buddylist.Po ./$(DEPDIR)/chat.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/chatnav.Po ./$(DEPDIR)/conn.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/email.Po ./$(DEPDIR)/ft.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/icq.Po ./$(DEPDIR)/im.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/invite.Po ./$(DEPDIR)/locate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/md5.Po ./$(DEPDIR)/misc.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/msgcookie.Po ./$(DEPDIR)/odir.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/popups.Po ./$(DEPDIR)/pork_aim.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_aim_proto.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/rxhandlers.Po ./$(DEPDIR)/rxqueue.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/search.Po ./$(DEPDIR)/service.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/snac.Po ./$(DEPDIR)/ssi.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/stats.Po ./$(DEPDIR)/tlv.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/translate.Po ./$(DEPDIR)/txqueue.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/util.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libaim_a_SOURCES) DIST_SOURCES = $(libaim_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ INCLUDES = -I. -I.. -I../.. -I../../.. -I../../missing -Ilibfaim AM_CFLAGS = $(DEBUG_CFLAGS) $(PERL_CFLAGS) noinst_LIBRARIES = libaim.a libaim_a_SOURCES = \ libfaim/admin.c \ libfaim/adverts.c \ libfaim/auth.c \ libfaim/bart.c \ libfaim/bos.c \ libfaim/bstream.c \ libfaim/buddylist.c \ libfaim/chat.c \ libfaim/chatnav.c \ libfaim/conn.c \ libfaim/email.c \ libfaim/ft.c \ libfaim/icq.c \ libfaim/im.c \ libfaim/invite.c \ libfaim/locate.c \ libfaim/md5.c \ libfaim/misc.c \ libfaim/msgcookie.c \ libfaim/odir.c \ libfaim/popups.c \ libfaim/rxhandlers.c \ libfaim/rxqueue.c \ libfaim/search.c \ libfaim/service.c \ libfaim/snac.c \ libfaim/ssi.c \ libfaim/stats.c \ libfaim/tlv.c \ libfaim/translate.c \ libfaim/txqueue.c \ libfaim/util.c \ pork_aim.c \ pork_aim_proto.c noinst_HEADERS = \ libfaim/aim.h \ libfaim/aim_cbtypes.h \ libfaim/aim_internal.h \ libfaim/faimconfig.h \ libfaim/md5.h \ pork_aim.h \ pork_aim_proto.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/protocols/aim/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/protocols/aim/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libaim.a: $(libaim_a_OBJECTS) $(libaim_a_DEPENDENCIES) -rm -f libaim.a $(libaim_a_AR) libaim.a $(libaim_a_OBJECTS) $(libaim_a_LIBADD) $(RANLIB) libaim.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/admin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adverts.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bart.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bos.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bstream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddylist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chatnav.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/email.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icq.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/im.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/invite.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msgcookie.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/popups.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_aim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_aim_proto.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rxhandlers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rxqueue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snac.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stats.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/translate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/txqueue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` admin.o: libfaim/admin.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT admin.o -MD -MP -MF "$(DEPDIR)/admin.Tpo" -c -o admin.o `test -f 'libfaim/admin.c' || echo '$(srcdir)/'`libfaim/admin.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/admin.Tpo" "$(DEPDIR)/admin.Po"; else rm -f "$(DEPDIR)/admin.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/admin.c' object='admin.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/admin.Po' tmpdepfile='$(DEPDIR)/admin.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o admin.o `test -f 'libfaim/admin.c' || echo '$(srcdir)/'`libfaim/admin.c admin.obj: libfaim/admin.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT admin.obj -MD -MP -MF "$(DEPDIR)/admin.Tpo" -c -o admin.obj `if test -f 'libfaim/admin.c'; then $(CYGPATH_W) 'libfaim/admin.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/admin.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/admin.Tpo" "$(DEPDIR)/admin.Po"; else rm -f "$(DEPDIR)/admin.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/admin.c' object='admin.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/admin.Po' tmpdepfile='$(DEPDIR)/admin.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o admin.obj `if test -f 'libfaim/admin.c'; then $(CYGPATH_W) 'libfaim/admin.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/admin.c'; fi` adverts.o: libfaim/adverts.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT adverts.o -MD -MP -MF "$(DEPDIR)/adverts.Tpo" -c -o adverts.o `test -f 'libfaim/adverts.c' || echo '$(srcdir)/'`libfaim/adverts.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/adverts.Tpo" "$(DEPDIR)/adverts.Po"; else rm -f "$(DEPDIR)/adverts.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/adverts.c' object='adverts.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/adverts.Po' tmpdepfile='$(DEPDIR)/adverts.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adverts.o `test -f 'libfaim/adverts.c' || echo '$(srcdir)/'`libfaim/adverts.c adverts.obj: libfaim/adverts.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT adverts.obj -MD -MP -MF "$(DEPDIR)/adverts.Tpo" -c -o adverts.obj `if test -f 'libfaim/adverts.c'; then $(CYGPATH_W) 'libfaim/adverts.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/adverts.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/adverts.Tpo" "$(DEPDIR)/adverts.Po"; else rm -f "$(DEPDIR)/adverts.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/adverts.c' object='adverts.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/adverts.Po' tmpdepfile='$(DEPDIR)/adverts.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adverts.obj `if test -f 'libfaim/adverts.c'; then $(CYGPATH_W) 'libfaim/adverts.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/adverts.c'; fi` auth.o: libfaim/auth.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT auth.o -MD -MP -MF "$(DEPDIR)/auth.Tpo" -c -o auth.o `test -f 'libfaim/auth.c' || echo '$(srcdir)/'`libfaim/auth.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/auth.Tpo" "$(DEPDIR)/auth.Po"; else rm -f "$(DEPDIR)/auth.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/auth.c' object='auth.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/auth.Po' tmpdepfile='$(DEPDIR)/auth.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o auth.o `test -f 'libfaim/auth.c' || echo '$(srcdir)/'`libfaim/auth.c auth.obj: libfaim/auth.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT auth.obj -MD -MP -MF "$(DEPDIR)/auth.Tpo" -c -o auth.obj `if test -f 'libfaim/auth.c'; then $(CYGPATH_W) 'libfaim/auth.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/auth.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/auth.Tpo" "$(DEPDIR)/auth.Po"; else rm -f "$(DEPDIR)/auth.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/auth.c' object='auth.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/auth.Po' tmpdepfile='$(DEPDIR)/auth.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o auth.obj `if test -f 'libfaim/auth.c'; then $(CYGPATH_W) 'libfaim/auth.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/auth.c'; fi` bart.o: libfaim/bart.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bart.o -MD -MP -MF "$(DEPDIR)/bart.Tpo" -c -o bart.o `test -f 'libfaim/bart.c' || echo '$(srcdir)/'`libfaim/bart.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/bart.Tpo" "$(DEPDIR)/bart.Po"; else rm -f "$(DEPDIR)/bart.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/bart.c' object='bart.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/bart.Po' tmpdepfile='$(DEPDIR)/bart.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bart.o `test -f 'libfaim/bart.c' || echo '$(srcdir)/'`libfaim/bart.c bart.obj: libfaim/bart.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bart.obj -MD -MP -MF "$(DEPDIR)/bart.Tpo" -c -o bart.obj `if test -f 'libfaim/bart.c'; then $(CYGPATH_W) 'libfaim/bart.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/bart.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/bart.Tpo" "$(DEPDIR)/bart.Po"; else rm -f "$(DEPDIR)/bart.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/bart.c' object='bart.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/bart.Po' tmpdepfile='$(DEPDIR)/bart.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bart.obj `if test -f 'libfaim/bart.c'; then $(CYGPATH_W) 'libfaim/bart.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/bart.c'; fi` bos.o: libfaim/bos.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bos.o -MD -MP -MF "$(DEPDIR)/bos.Tpo" -c -o bos.o `test -f 'libfaim/bos.c' || echo '$(srcdir)/'`libfaim/bos.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/bos.Tpo" "$(DEPDIR)/bos.Po"; else rm -f "$(DEPDIR)/bos.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/bos.c' object='bos.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/bos.Po' tmpdepfile='$(DEPDIR)/bos.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bos.o `test -f 'libfaim/bos.c' || echo '$(srcdir)/'`libfaim/bos.c bos.obj: libfaim/bos.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bos.obj -MD -MP -MF "$(DEPDIR)/bos.Tpo" -c -o bos.obj `if test -f 'libfaim/bos.c'; then $(CYGPATH_W) 'libfaim/bos.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/bos.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/bos.Tpo" "$(DEPDIR)/bos.Po"; else rm -f "$(DEPDIR)/bos.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/bos.c' object='bos.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/bos.Po' tmpdepfile='$(DEPDIR)/bos.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bos.obj `if test -f 'libfaim/bos.c'; then $(CYGPATH_W) 'libfaim/bos.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/bos.c'; fi` bstream.o: libfaim/bstream.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bstream.o -MD -MP -MF "$(DEPDIR)/bstream.Tpo" -c -o bstream.o `test -f 'libfaim/bstream.c' || echo '$(srcdir)/'`libfaim/bstream.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/bstream.Tpo" "$(DEPDIR)/bstream.Po"; else rm -f "$(DEPDIR)/bstream.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/bstream.c' object='bstream.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/bstream.Po' tmpdepfile='$(DEPDIR)/bstream.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bstream.o `test -f 'libfaim/bstream.c' || echo '$(srcdir)/'`libfaim/bstream.c bstream.obj: libfaim/bstream.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bstream.obj -MD -MP -MF "$(DEPDIR)/bstream.Tpo" -c -o bstream.obj `if test -f 'libfaim/bstream.c'; then $(CYGPATH_W) 'libfaim/bstream.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/bstream.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/bstream.Tpo" "$(DEPDIR)/bstream.Po"; else rm -f "$(DEPDIR)/bstream.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/bstream.c' object='bstream.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/bstream.Po' tmpdepfile='$(DEPDIR)/bstream.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bstream.obj `if test -f 'libfaim/bstream.c'; then $(CYGPATH_W) 'libfaim/bstream.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/bstream.c'; fi` buddylist.o: libfaim/buddylist.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT buddylist.o -MD -MP -MF "$(DEPDIR)/buddylist.Tpo" -c -o buddylist.o `test -f 'libfaim/buddylist.c' || echo '$(srcdir)/'`libfaim/buddylist.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/buddylist.Tpo" "$(DEPDIR)/buddylist.Po"; else rm -f "$(DEPDIR)/buddylist.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/buddylist.c' object='buddylist.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/buddylist.Po' tmpdepfile='$(DEPDIR)/buddylist.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o buddylist.o `test -f 'libfaim/buddylist.c' || echo '$(srcdir)/'`libfaim/buddylist.c buddylist.obj: libfaim/buddylist.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT buddylist.obj -MD -MP -MF "$(DEPDIR)/buddylist.Tpo" -c -o buddylist.obj `if test -f 'libfaim/buddylist.c'; then $(CYGPATH_W) 'libfaim/buddylist.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/buddylist.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/buddylist.Tpo" "$(DEPDIR)/buddylist.Po"; else rm -f "$(DEPDIR)/buddylist.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/buddylist.c' object='buddylist.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/buddylist.Po' tmpdepfile='$(DEPDIR)/buddylist.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o buddylist.obj `if test -f 'libfaim/buddylist.c'; then $(CYGPATH_W) 'libfaim/buddylist.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/buddylist.c'; fi` chat.o: libfaim/chat.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT chat.o -MD -MP -MF "$(DEPDIR)/chat.Tpo" -c -o chat.o `test -f 'libfaim/chat.c' || echo '$(srcdir)/'`libfaim/chat.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/chat.Tpo" "$(DEPDIR)/chat.Po"; else rm -f "$(DEPDIR)/chat.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/chat.c' object='chat.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/chat.Po' tmpdepfile='$(DEPDIR)/chat.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o chat.o `test -f 'libfaim/chat.c' || echo '$(srcdir)/'`libfaim/chat.c chat.obj: libfaim/chat.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT chat.obj -MD -MP -MF "$(DEPDIR)/chat.Tpo" -c -o chat.obj `if test -f 'libfaim/chat.c'; then $(CYGPATH_W) 'libfaim/chat.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/chat.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/chat.Tpo" "$(DEPDIR)/chat.Po"; else rm -f "$(DEPDIR)/chat.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/chat.c' object='chat.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/chat.Po' tmpdepfile='$(DEPDIR)/chat.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o chat.obj `if test -f 'libfaim/chat.c'; then $(CYGPATH_W) 'libfaim/chat.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/chat.c'; fi` chatnav.o: libfaim/chatnav.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT chatnav.o -MD -MP -MF "$(DEPDIR)/chatnav.Tpo" -c -o chatnav.o `test -f 'libfaim/chatnav.c' || echo '$(srcdir)/'`libfaim/chatnav.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/chatnav.Tpo" "$(DEPDIR)/chatnav.Po"; else rm -f "$(DEPDIR)/chatnav.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/chatnav.c' object='chatnav.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/chatnav.Po' tmpdepfile='$(DEPDIR)/chatnav.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o chatnav.o `test -f 'libfaim/chatnav.c' || echo '$(srcdir)/'`libfaim/chatnav.c chatnav.obj: libfaim/chatnav.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT chatnav.obj -MD -MP -MF "$(DEPDIR)/chatnav.Tpo" -c -o chatnav.obj `if test -f 'libfaim/chatnav.c'; then $(CYGPATH_W) 'libfaim/chatnav.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/chatnav.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/chatnav.Tpo" "$(DEPDIR)/chatnav.Po"; else rm -f "$(DEPDIR)/chatnav.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/chatnav.c' object='chatnav.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/chatnav.Po' tmpdepfile='$(DEPDIR)/chatnav.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o chatnav.obj `if test -f 'libfaim/chatnav.c'; then $(CYGPATH_W) 'libfaim/chatnav.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/chatnav.c'; fi` conn.o: libfaim/conn.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT conn.o -MD -MP -MF "$(DEPDIR)/conn.Tpo" -c -o conn.o `test -f 'libfaim/conn.c' || echo '$(srcdir)/'`libfaim/conn.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conn.Tpo" "$(DEPDIR)/conn.Po"; else rm -f "$(DEPDIR)/conn.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/conn.c' object='conn.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/conn.Po' tmpdepfile='$(DEPDIR)/conn.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o conn.o `test -f 'libfaim/conn.c' || echo '$(srcdir)/'`libfaim/conn.c conn.obj: libfaim/conn.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT conn.obj -MD -MP -MF "$(DEPDIR)/conn.Tpo" -c -o conn.obj `if test -f 'libfaim/conn.c'; then $(CYGPATH_W) 'libfaim/conn.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/conn.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conn.Tpo" "$(DEPDIR)/conn.Po"; else rm -f "$(DEPDIR)/conn.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/conn.c' object='conn.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/conn.Po' tmpdepfile='$(DEPDIR)/conn.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o conn.obj `if test -f 'libfaim/conn.c'; then $(CYGPATH_W) 'libfaim/conn.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/conn.c'; fi` email.o: libfaim/email.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT email.o -MD -MP -MF "$(DEPDIR)/email.Tpo" -c -o email.o `test -f 'libfaim/email.c' || echo '$(srcdir)/'`libfaim/email.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/email.Tpo" "$(DEPDIR)/email.Po"; else rm -f "$(DEPDIR)/email.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/email.c' object='email.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/email.Po' tmpdepfile='$(DEPDIR)/email.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o email.o `test -f 'libfaim/email.c' || echo '$(srcdir)/'`libfaim/email.c email.obj: libfaim/email.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT email.obj -MD -MP -MF "$(DEPDIR)/email.Tpo" -c -o email.obj `if test -f 'libfaim/email.c'; then $(CYGPATH_W) 'libfaim/email.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/email.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/email.Tpo" "$(DEPDIR)/email.Po"; else rm -f "$(DEPDIR)/email.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/email.c' object='email.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/email.Po' tmpdepfile='$(DEPDIR)/email.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o email.obj `if test -f 'libfaim/email.c'; then $(CYGPATH_W) 'libfaim/email.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/email.c'; fi` ft.o: libfaim/ft.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ft.o -MD -MP -MF "$(DEPDIR)/ft.Tpo" -c -o ft.o `test -f 'libfaim/ft.c' || echo '$(srcdir)/'`libfaim/ft.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ft.Tpo" "$(DEPDIR)/ft.Po"; else rm -f "$(DEPDIR)/ft.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/ft.c' object='ft.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ft.Po' tmpdepfile='$(DEPDIR)/ft.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ft.o `test -f 'libfaim/ft.c' || echo '$(srcdir)/'`libfaim/ft.c ft.obj: libfaim/ft.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ft.obj -MD -MP -MF "$(DEPDIR)/ft.Tpo" -c -o ft.obj `if test -f 'libfaim/ft.c'; then $(CYGPATH_W) 'libfaim/ft.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/ft.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ft.Tpo" "$(DEPDIR)/ft.Po"; else rm -f "$(DEPDIR)/ft.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/ft.c' object='ft.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ft.Po' tmpdepfile='$(DEPDIR)/ft.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ft.obj `if test -f 'libfaim/ft.c'; then $(CYGPATH_W) 'libfaim/ft.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/ft.c'; fi` icq.o: libfaim/icq.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT icq.o -MD -MP -MF "$(DEPDIR)/icq.Tpo" -c -o icq.o `test -f 'libfaim/icq.c' || echo '$(srcdir)/'`libfaim/icq.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/icq.Tpo" "$(DEPDIR)/icq.Po"; else rm -f "$(DEPDIR)/icq.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/icq.c' object='icq.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/icq.Po' tmpdepfile='$(DEPDIR)/icq.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o icq.o `test -f 'libfaim/icq.c' || echo '$(srcdir)/'`libfaim/icq.c icq.obj: libfaim/icq.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT icq.obj -MD -MP -MF "$(DEPDIR)/icq.Tpo" -c -o icq.obj `if test -f 'libfaim/icq.c'; then $(CYGPATH_W) 'libfaim/icq.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/icq.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/icq.Tpo" "$(DEPDIR)/icq.Po"; else rm -f "$(DEPDIR)/icq.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/icq.c' object='icq.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/icq.Po' tmpdepfile='$(DEPDIR)/icq.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o icq.obj `if test -f 'libfaim/icq.c'; then $(CYGPATH_W) 'libfaim/icq.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/icq.c'; fi` im.o: libfaim/im.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT im.o -MD -MP -MF "$(DEPDIR)/im.Tpo" -c -o im.o `test -f 'libfaim/im.c' || echo '$(srcdir)/'`libfaim/im.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/im.Tpo" "$(DEPDIR)/im.Po"; else rm -f "$(DEPDIR)/im.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/im.c' object='im.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/im.Po' tmpdepfile='$(DEPDIR)/im.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o im.o `test -f 'libfaim/im.c' || echo '$(srcdir)/'`libfaim/im.c im.obj: libfaim/im.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT im.obj -MD -MP -MF "$(DEPDIR)/im.Tpo" -c -o im.obj `if test -f 'libfaim/im.c'; then $(CYGPATH_W) 'libfaim/im.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/im.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/im.Tpo" "$(DEPDIR)/im.Po"; else rm -f "$(DEPDIR)/im.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/im.c' object='im.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/im.Po' tmpdepfile='$(DEPDIR)/im.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o im.obj `if test -f 'libfaim/im.c'; then $(CYGPATH_W) 'libfaim/im.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/im.c'; fi` invite.o: libfaim/invite.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT invite.o -MD -MP -MF "$(DEPDIR)/invite.Tpo" -c -o invite.o `test -f 'libfaim/invite.c' || echo '$(srcdir)/'`libfaim/invite.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/invite.Tpo" "$(DEPDIR)/invite.Po"; else rm -f "$(DEPDIR)/invite.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/invite.c' object='invite.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/invite.Po' tmpdepfile='$(DEPDIR)/invite.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o invite.o `test -f 'libfaim/invite.c' || echo '$(srcdir)/'`libfaim/invite.c invite.obj: libfaim/invite.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT invite.obj -MD -MP -MF "$(DEPDIR)/invite.Tpo" -c -o invite.obj `if test -f 'libfaim/invite.c'; then $(CYGPATH_W) 'libfaim/invite.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/invite.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/invite.Tpo" "$(DEPDIR)/invite.Po"; else rm -f "$(DEPDIR)/invite.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/invite.c' object='invite.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/invite.Po' tmpdepfile='$(DEPDIR)/invite.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o invite.obj `if test -f 'libfaim/invite.c'; then $(CYGPATH_W) 'libfaim/invite.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/invite.c'; fi` locate.o: libfaim/locate.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT locate.o -MD -MP -MF "$(DEPDIR)/locate.Tpo" -c -o locate.o `test -f 'libfaim/locate.c' || echo '$(srcdir)/'`libfaim/locate.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/locate.Tpo" "$(DEPDIR)/locate.Po"; else rm -f "$(DEPDIR)/locate.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/locate.c' object='locate.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/locate.Po' tmpdepfile='$(DEPDIR)/locate.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o locate.o `test -f 'libfaim/locate.c' || echo '$(srcdir)/'`libfaim/locate.c locate.obj: libfaim/locate.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT locate.obj -MD -MP -MF "$(DEPDIR)/locate.Tpo" -c -o locate.obj `if test -f 'libfaim/locate.c'; then $(CYGPATH_W) 'libfaim/locate.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/locate.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/locate.Tpo" "$(DEPDIR)/locate.Po"; else rm -f "$(DEPDIR)/locate.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/locate.c' object='locate.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/locate.Po' tmpdepfile='$(DEPDIR)/locate.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o locate.obj `if test -f 'libfaim/locate.c'; then $(CYGPATH_W) 'libfaim/locate.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/locate.c'; fi` md5.o: libfaim/md5.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.o -MD -MP -MF "$(DEPDIR)/md5.Tpo" -c -o md5.o `test -f 'libfaim/md5.c' || echo '$(srcdir)/'`libfaim/md5.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/md5.Tpo" "$(DEPDIR)/md5.Po"; else rm -f "$(DEPDIR)/md5.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/md5.c' object='md5.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/md5.Po' tmpdepfile='$(DEPDIR)/md5.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.o `test -f 'libfaim/md5.c' || echo '$(srcdir)/'`libfaim/md5.c md5.obj: libfaim/md5.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.obj -MD -MP -MF "$(DEPDIR)/md5.Tpo" -c -o md5.obj `if test -f 'libfaim/md5.c'; then $(CYGPATH_W) 'libfaim/md5.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/md5.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/md5.Tpo" "$(DEPDIR)/md5.Po"; else rm -f "$(DEPDIR)/md5.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/md5.c' object='md5.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/md5.Po' tmpdepfile='$(DEPDIR)/md5.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.obj `if test -f 'libfaim/md5.c'; then $(CYGPATH_W) 'libfaim/md5.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/md5.c'; fi` misc.o: libfaim/misc.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT misc.o -MD -MP -MF "$(DEPDIR)/misc.Tpo" -c -o misc.o `test -f 'libfaim/misc.c' || echo '$(srcdir)/'`libfaim/misc.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/misc.Tpo" "$(DEPDIR)/misc.Po"; else rm -f "$(DEPDIR)/misc.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/misc.c' object='misc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/misc.Po' tmpdepfile='$(DEPDIR)/misc.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o misc.o `test -f 'libfaim/misc.c' || echo '$(srcdir)/'`libfaim/misc.c misc.obj: libfaim/misc.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT misc.obj -MD -MP -MF "$(DEPDIR)/misc.Tpo" -c -o misc.obj `if test -f 'libfaim/misc.c'; then $(CYGPATH_W) 'libfaim/misc.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/misc.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/misc.Tpo" "$(DEPDIR)/misc.Po"; else rm -f "$(DEPDIR)/misc.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/misc.c' object='misc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/misc.Po' tmpdepfile='$(DEPDIR)/misc.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o misc.obj `if test -f 'libfaim/misc.c'; then $(CYGPATH_W) 'libfaim/misc.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/misc.c'; fi` msgcookie.o: libfaim/msgcookie.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT msgcookie.o -MD -MP -MF "$(DEPDIR)/msgcookie.Tpo" -c -o msgcookie.o `test -f 'libfaim/msgcookie.c' || echo '$(srcdir)/'`libfaim/msgcookie.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/msgcookie.Tpo" "$(DEPDIR)/msgcookie.Po"; else rm -f "$(DEPDIR)/msgcookie.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/msgcookie.c' object='msgcookie.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/msgcookie.Po' tmpdepfile='$(DEPDIR)/msgcookie.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o msgcookie.o `test -f 'libfaim/msgcookie.c' || echo '$(srcdir)/'`libfaim/msgcookie.c msgcookie.obj: libfaim/msgcookie.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT msgcookie.obj -MD -MP -MF "$(DEPDIR)/msgcookie.Tpo" -c -o msgcookie.obj `if test -f 'libfaim/msgcookie.c'; then $(CYGPATH_W) 'libfaim/msgcookie.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/msgcookie.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/msgcookie.Tpo" "$(DEPDIR)/msgcookie.Po"; else rm -f "$(DEPDIR)/msgcookie.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/msgcookie.c' object='msgcookie.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/msgcookie.Po' tmpdepfile='$(DEPDIR)/msgcookie.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o msgcookie.obj `if test -f 'libfaim/msgcookie.c'; then $(CYGPATH_W) 'libfaim/msgcookie.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/msgcookie.c'; fi` odir.o: libfaim/odir.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT odir.o -MD -MP -MF "$(DEPDIR)/odir.Tpo" -c -o odir.o `test -f 'libfaim/odir.c' || echo '$(srcdir)/'`libfaim/odir.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/odir.Tpo" "$(DEPDIR)/odir.Po"; else rm -f "$(DEPDIR)/odir.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/odir.c' object='odir.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/odir.Po' tmpdepfile='$(DEPDIR)/odir.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o odir.o `test -f 'libfaim/odir.c' || echo '$(srcdir)/'`libfaim/odir.c odir.obj: libfaim/odir.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT odir.obj -MD -MP -MF "$(DEPDIR)/odir.Tpo" -c -o odir.obj `if test -f 'libfaim/odir.c'; then $(CYGPATH_W) 'libfaim/odir.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/odir.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/odir.Tpo" "$(DEPDIR)/odir.Po"; else rm -f "$(DEPDIR)/odir.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/odir.c' object='odir.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/odir.Po' tmpdepfile='$(DEPDIR)/odir.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o odir.obj `if test -f 'libfaim/odir.c'; then $(CYGPATH_W) 'libfaim/odir.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/odir.c'; fi` popups.o: libfaim/popups.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT popups.o -MD -MP -MF "$(DEPDIR)/popups.Tpo" -c -o popups.o `test -f 'libfaim/popups.c' || echo '$(srcdir)/'`libfaim/popups.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/popups.Tpo" "$(DEPDIR)/popups.Po"; else rm -f "$(DEPDIR)/popups.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/popups.c' object='popups.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/popups.Po' tmpdepfile='$(DEPDIR)/popups.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o popups.o `test -f 'libfaim/popups.c' || echo '$(srcdir)/'`libfaim/popups.c popups.obj: libfaim/popups.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT popups.obj -MD -MP -MF "$(DEPDIR)/popups.Tpo" -c -o popups.obj `if test -f 'libfaim/popups.c'; then $(CYGPATH_W) 'libfaim/popups.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/popups.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/popups.Tpo" "$(DEPDIR)/popups.Po"; else rm -f "$(DEPDIR)/popups.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/popups.c' object='popups.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/popups.Po' tmpdepfile='$(DEPDIR)/popups.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o popups.obj `if test -f 'libfaim/popups.c'; then $(CYGPATH_W) 'libfaim/popups.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/popups.c'; fi` rxhandlers.o: libfaim/rxhandlers.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rxhandlers.o -MD -MP -MF "$(DEPDIR)/rxhandlers.Tpo" -c -o rxhandlers.o `test -f 'libfaim/rxhandlers.c' || echo '$(srcdir)/'`libfaim/rxhandlers.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/rxhandlers.Tpo" "$(DEPDIR)/rxhandlers.Po"; else rm -f "$(DEPDIR)/rxhandlers.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/rxhandlers.c' object='rxhandlers.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/rxhandlers.Po' tmpdepfile='$(DEPDIR)/rxhandlers.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rxhandlers.o `test -f 'libfaim/rxhandlers.c' || echo '$(srcdir)/'`libfaim/rxhandlers.c rxhandlers.obj: libfaim/rxhandlers.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rxhandlers.obj -MD -MP -MF "$(DEPDIR)/rxhandlers.Tpo" -c -o rxhandlers.obj `if test -f 'libfaim/rxhandlers.c'; then $(CYGPATH_W) 'libfaim/rxhandlers.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/rxhandlers.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/rxhandlers.Tpo" "$(DEPDIR)/rxhandlers.Po"; else rm -f "$(DEPDIR)/rxhandlers.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/rxhandlers.c' object='rxhandlers.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/rxhandlers.Po' tmpdepfile='$(DEPDIR)/rxhandlers.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rxhandlers.obj `if test -f 'libfaim/rxhandlers.c'; then $(CYGPATH_W) 'libfaim/rxhandlers.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/rxhandlers.c'; fi` rxqueue.o: libfaim/rxqueue.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rxqueue.o -MD -MP -MF "$(DEPDIR)/rxqueue.Tpo" -c -o rxqueue.o `test -f 'libfaim/rxqueue.c' || echo '$(srcdir)/'`libfaim/rxqueue.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/rxqueue.Tpo" "$(DEPDIR)/rxqueue.Po"; else rm -f "$(DEPDIR)/rxqueue.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/rxqueue.c' object='rxqueue.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/rxqueue.Po' tmpdepfile='$(DEPDIR)/rxqueue.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rxqueue.o `test -f 'libfaim/rxqueue.c' || echo '$(srcdir)/'`libfaim/rxqueue.c rxqueue.obj: libfaim/rxqueue.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rxqueue.obj -MD -MP -MF "$(DEPDIR)/rxqueue.Tpo" -c -o rxqueue.obj `if test -f 'libfaim/rxqueue.c'; then $(CYGPATH_W) 'libfaim/rxqueue.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/rxqueue.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/rxqueue.Tpo" "$(DEPDIR)/rxqueue.Po"; else rm -f "$(DEPDIR)/rxqueue.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/rxqueue.c' object='rxqueue.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/rxqueue.Po' tmpdepfile='$(DEPDIR)/rxqueue.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rxqueue.obj `if test -f 'libfaim/rxqueue.c'; then $(CYGPATH_W) 'libfaim/rxqueue.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/rxqueue.c'; fi` search.o: libfaim/search.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT search.o -MD -MP -MF "$(DEPDIR)/search.Tpo" -c -o search.o `test -f 'libfaim/search.c' || echo '$(srcdir)/'`libfaim/search.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/search.Tpo" "$(DEPDIR)/search.Po"; else rm -f "$(DEPDIR)/search.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/search.c' object='search.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/search.Po' tmpdepfile='$(DEPDIR)/search.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o search.o `test -f 'libfaim/search.c' || echo '$(srcdir)/'`libfaim/search.c search.obj: libfaim/search.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT search.obj -MD -MP -MF "$(DEPDIR)/search.Tpo" -c -o search.obj `if test -f 'libfaim/search.c'; then $(CYGPATH_W) 'libfaim/search.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/search.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/search.Tpo" "$(DEPDIR)/search.Po"; else rm -f "$(DEPDIR)/search.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/search.c' object='search.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/search.Po' tmpdepfile='$(DEPDIR)/search.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o search.obj `if test -f 'libfaim/search.c'; then $(CYGPATH_W) 'libfaim/search.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/search.c'; fi` service.o: libfaim/service.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT service.o -MD -MP -MF "$(DEPDIR)/service.Tpo" -c -o service.o `test -f 'libfaim/service.c' || echo '$(srcdir)/'`libfaim/service.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/service.Tpo" "$(DEPDIR)/service.Po"; else rm -f "$(DEPDIR)/service.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/service.c' object='service.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/service.Po' tmpdepfile='$(DEPDIR)/service.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o service.o `test -f 'libfaim/service.c' || echo '$(srcdir)/'`libfaim/service.c service.obj: libfaim/service.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT service.obj -MD -MP -MF "$(DEPDIR)/service.Tpo" -c -o service.obj `if test -f 'libfaim/service.c'; then $(CYGPATH_W) 'libfaim/service.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/service.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/service.Tpo" "$(DEPDIR)/service.Po"; else rm -f "$(DEPDIR)/service.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/service.c' object='service.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/service.Po' tmpdepfile='$(DEPDIR)/service.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o service.obj `if test -f 'libfaim/service.c'; then $(CYGPATH_W) 'libfaim/service.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/service.c'; fi` snac.o: libfaim/snac.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT snac.o -MD -MP -MF "$(DEPDIR)/snac.Tpo" -c -o snac.o `test -f 'libfaim/snac.c' || echo '$(srcdir)/'`libfaim/snac.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/snac.Tpo" "$(DEPDIR)/snac.Po"; else rm -f "$(DEPDIR)/snac.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/snac.c' object='snac.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/snac.Po' tmpdepfile='$(DEPDIR)/snac.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o snac.o `test -f 'libfaim/snac.c' || echo '$(srcdir)/'`libfaim/snac.c snac.obj: libfaim/snac.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT snac.obj -MD -MP -MF "$(DEPDIR)/snac.Tpo" -c -o snac.obj `if test -f 'libfaim/snac.c'; then $(CYGPATH_W) 'libfaim/snac.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/snac.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/snac.Tpo" "$(DEPDIR)/snac.Po"; else rm -f "$(DEPDIR)/snac.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/snac.c' object='snac.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/snac.Po' tmpdepfile='$(DEPDIR)/snac.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o snac.obj `if test -f 'libfaim/snac.c'; then $(CYGPATH_W) 'libfaim/snac.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/snac.c'; fi` ssi.o: libfaim/ssi.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ssi.o -MD -MP -MF "$(DEPDIR)/ssi.Tpo" -c -o ssi.o `test -f 'libfaim/ssi.c' || echo '$(srcdir)/'`libfaim/ssi.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ssi.Tpo" "$(DEPDIR)/ssi.Po"; else rm -f "$(DEPDIR)/ssi.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/ssi.c' object='ssi.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ssi.Po' tmpdepfile='$(DEPDIR)/ssi.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ssi.o `test -f 'libfaim/ssi.c' || echo '$(srcdir)/'`libfaim/ssi.c ssi.obj: libfaim/ssi.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ssi.obj -MD -MP -MF "$(DEPDIR)/ssi.Tpo" -c -o ssi.obj `if test -f 'libfaim/ssi.c'; then $(CYGPATH_W) 'libfaim/ssi.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/ssi.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ssi.Tpo" "$(DEPDIR)/ssi.Po"; else rm -f "$(DEPDIR)/ssi.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/ssi.c' object='ssi.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ssi.Po' tmpdepfile='$(DEPDIR)/ssi.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ssi.obj `if test -f 'libfaim/ssi.c'; then $(CYGPATH_W) 'libfaim/ssi.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/ssi.c'; fi` stats.o: libfaim/stats.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stats.o -MD -MP -MF "$(DEPDIR)/stats.Tpo" -c -o stats.o `test -f 'libfaim/stats.c' || echo '$(srcdir)/'`libfaim/stats.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/stats.Tpo" "$(DEPDIR)/stats.Po"; else rm -f "$(DEPDIR)/stats.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/stats.c' object='stats.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/stats.Po' tmpdepfile='$(DEPDIR)/stats.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stats.o `test -f 'libfaim/stats.c' || echo '$(srcdir)/'`libfaim/stats.c stats.obj: libfaim/stats.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stats.obj -MD -MP -MF "$(DEPDIR)/stats.Tpo" -c -o stats.obj `if test -f 'libfaim/stats.c'; then $(CYGPATH_W) 'libfaim/stats.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/stats.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/stats.Tpo" "$(DEPDIR)/stats.Po"; else rm -f "$(DEPDIR)/stats.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/stats.c' object='stats.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/stats.Po' tmpdepfile='$(DEPDIR)/stats.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stats.obj `if test -f 'libfaim/stats.c'; then $(CYGPATH_W) 'libfaim/stats.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/stats.c'; fi` tlv.o: libfaim/tlv.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tlv.o -MD -MP -MF "$(DEPDIR)/tlv.Tpo" -c -o tlv.o `test -f 'libfaim/tlv.c' || echo '$(srcdir)/'`libfaim/tlv.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/tlv.Tpo" "$(DEPDIR)/tlv.Po"; else rm -f "$(DEPDIR)/tlv.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/tlv.c' object='tlv.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/tlv.Po' tmpdepfile='$(DEPDIR)/tlv.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tlv.o `test -f 'libfaim/tlv.c' || echo '$(srcdir)/'`libfaim/tlv.c tlv.obj: libfaim/tlv.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tlv.obj -MD -MP -MF "$(DEPDIR)/tlv.Tpo" -c -o tlv.obj `if test -f 'libfaim/tlv.c'; then $(CYGPATH_W) 'libfaim/tlv.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/tlv.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/tlv.Tpo" "$(DEPDIR)/tlv.Po"; else rm -f "$(DEPDIR)/tlv.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/tlv.c' object='tlv.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/tlv.Po' tmpdepfile='$(DEPDIR)/tlv.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tlv.obj `if test -f 'libfaim/tlv.c'; then $(CYGPATH_W) 'libfaim/tlv.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/tlv.c'; fi` translate.o: libfaim/translate.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT translate.o -MD -MP -MF "$(DEPDIR)/translate.Tpo" -c -o translate.o `test -f 'libfaim/translate.c' || echo '$(srcdir)/'`libfaim/translate.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/translate.Tpo" "$(DEPDIR)/translate.Po"; else rm -f "$(DEPDIR)/translate.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/translate.c' object='translate.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/translate.Po' tmpdepfile='$(DEPDIR)/translate.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o translate.o `test -f 'libfaim/translate.c' || echo '$(srcdir)/'`libfaim/translate.c translate.obj: libfaim/translate.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT translate.obj -MD -MP -MF "$(DEPDIR)/translate.Tpo" -c -o translate.obj `if test -f 'libfaim/translate.c'; then $(CYGPATH_W) 'libfaim/translate.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/translate.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/translate.Tpo" "$(DEPDIR)/translate.Po"; else rm -f "$(DEPDIR)/translate.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/translate.c' object='translate.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/translate.Po' tmpdepfile='$(DEPDIR)/translate.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o translate.obj `if test -f 'libfaim/translate.c'; then $(CYGPATH_W) 'libfaim/translate.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/translate.c'; fi` txqueue.o: libfaim/txqueue.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT txqueue.o -MD -MP -MF "$(DEPDIR)/txqueue.Tpo" -c -o txqueue.o `test -f 'libfaim/txqueue.c' || echo '$(srcdir)/'`libfaim/txqueue.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/txqueue.Tpo" "$(DEPDIR)/txqueue.Po"; else rm -f "$(DEPDIR)/txqueue.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/txqueue.c' object='txqueue.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/txqueue.Po' tmpdepfile='$(DEPDIR)/txqueue.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o txqueue.o `test -f 'libfaim/txqueue.c' || echo '$(srcdir)/'`libfaim/txqueue.c txqueue.obj: libfaim/txqueue.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT txqueue.obj -MD -MP -MF "$(DEPDIR)/txqueue.Tpo" -c -o txqueue.obj `if test -f 'libfaim/txqueue.c'; then $(CYGPATH_W) 'libfaim/txqueue.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/txqueue.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/txqueue.Tpo" "$(DEPDIR)/txqueue.Po"; else rm -f "$(DEPDIR)/txqueue.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/txqueue.c' object='txqueue.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/txqueue.Po' tmpdepfile='$(DEPDIR)/txqueue.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o txqueue.obj `if test -f 'libfaim/txqueue.c'; then $(CYGPATH_W) 'libfaim/txqueue.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/txqueue.c'; fi` util.o: libfaim/util.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT util.o -MD -MP -MF "$(DEPDIR)/util.Tpo" -c -o util.o `test -f 'libfaim/util.c' || echo '$(srcdir)/'`libfaim/util.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/util.Tpo" "$(DEPDIR)/util.Po"; else rm -f "$(DEPDIR)/util.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/util.c' object='util.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/util.Po' tmpdepfile='$(DEPDIR)/util.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o util.o `test -f 'libfaim/util.c' || echo '$(srcdir)/'`libfaim/util.c util.obj: libfaim/util.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT util.obj -MD -MP -MF "$(DEPDIR)/util.Tpo" -c -o util.obj `if test -f 'libfaim/util.c'; then $(CYGPATH_W) 'libfaim/util.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/util.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/util.Tpo" "$(DEPDIR)/util.Po"; else rm -f "$(DEPDIR)/util.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libfaim/util.c' object='util.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/util.Po' tmpdepfile='$(DEPDIR)/util.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o util.obj `if test -f 'libfaim/util.c'; then $(CYGPATH_W) 'libfaim/util.c'; else $(CYGPATH_W) '$(srcdir)/libfaim/util.c'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(mkdir_p) $(distdir)/libfaim @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/src/protocols/aim/pork_aim_proto.c0000644000175000017500000005236710234504130021455 0ustar ryanryan00000000000000/* ** pork_aim_proto.c - AIM OSCAR interface to pork. ** Copyright (C) 2005 Ryan McCabe ** ** This file is heavily based on src/protocols/oscar/oscar.c from gaim, ** which is more or less to say that chunks of code have been mostly ** copied from there. In turn, I think that oscar.c file was mostly lifted ** from faimtest. Any copyrights there apply here. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static int aim_buddy_add(struct pork_acct *acct, struct buddy *buddy) { int ret; struct aim_priv *priv = acct->data; aim_session_t *session = &priv->aim_session; if (session->ssi.received_data == 0) { debug("buddy add failed"); return (-1); } if (aim_ssi_itemlist_exists(session->ssi.local, buddy->nname)) { debug("buddy %s already exists for %s", buddy->nname, acct->username); return (-1); } ret = aim_ssi_addbuddy(session, buddy->nname, buddy->group->name, buddy->name, NULL, NULL, 0); return (ret); } static int aim_buddy_alias(struct pork_acct *acct, struct buddy *buddy) { struct aim_priv *priv = acct->data; int ret; if (priv->aim_session.ssi.received_data == 0) { debug("buddy alias failed"); return (-1); } ret = aim_ssi_aliasbuddy(&priv->aim_session, buddy->group->name, buddy->nname, buddy->name); return (ret); } static int aim_add_block(struct pork_acct *acct, char *target) { struct aim_priv *priv = acct->data; if (priv->aim_session.ssi.received_data == 0) return (-1); return (aim_ssi_adddeny(&priv->aim_session, target)); } static int aim_add_permit(struct pork_acct *acct, char *target) { struct aim_priv *priv = acct->data; if (priv->aim_session.ssi.received_data == 0) { debug("add permit failed"); return (-1); } return (aim_ssi_addpermit(&priv->aim_session, target)); } static int aim_buddy_remove(struct pork_acct *acct, struct buddy *buddy) { struct aim_priv *priv = acct->data; int ret; if (priv->aim_session.ssi.received_data == 0) { debug("buddy remove failed"); return (-1); } ret = aim_ssi_delbuddy(&priv->aim_session, buddy->nname, buddy->group->name); return (ret); } static int aim_remove_permit(struct pork_acct *acct, char *target) { struct aim_priv *priv = acct->data; if (priv->aim_session.ssi.received_data == 0) { debug("remove permit failed"); return (-1); } return (aim_ssi_delpermit(&priv->aim_session, target)); } static int aim_unblock(struct pork_acct *acct, char *target) { struct aim_priv *priv = acct->data; if (priv->aim_session.ssi.received_data == 0) { debug("unblock failed"); return (-1); } return (aim_ssi_deldeny(&priv->aim_session, target)); } static int aim_update_buddy(struct pork_acct *acct __notused, struct buddy *buddy, void *data) { aim_userinfo_t *userinfo = data; buddy->signon_time = userinfo->onlinesince; buddy->warn_level = (float) userinfo->warnlevel / 10; if (userinfo->present & AIM_USERINFO_PRESENT_FLAGS) buddy->type = userinfo->flags; if (userinfo->present & AIM_USERINFO_PRESENT_SESSIONLEN) buddy->idle_time = userinfo->idletime; buddy->status = STATUS_ACTIVE; if (buddy->idle_time > 0) buddy->status = STATUS_IDLE; if (userinfo->flags & AIM_FLAG_AWAY) buddy->status = STATUS_AWAY; return (0); } static struct chatroom *aim_find_chat_name_data(struct pork_acct *acct, char *name) { dlist_t *ret; ret = aim_find_chat_name(acct, name); if (ret == NULL || ret->data == NULL) return (NULL); return (ret->data); } static int aim_leave_chatroom(struct pork_acct *acct, struct chatroom *chat) { struct aim_priv *priv = acct->data; struct aim_chat *a_chat; a_chat = chat->data; pork_io_del(a_chat->conn); aim_conn_kill(&priv->aim_session, &a_chat->conn); a_chat->conn = NULL; return (0); } static int aim_join_chatroom(struct pork_acct *acct, char *name, char *args) { int ret; struct aim_priv *priv = acct->data; aim_conn_t *chatnav_conn; struct chatroom_info info; struct chatroom *chat; chat = chat_find(acct, name); if (chat != NULL && chat->data != NULL) return (0); if (aim_chat_parse_name(name, &info) != 0) { debug("aim_chat_parse_name failed for %s", name); return (-1); } chatnav_conn = priv->chatnav_conn; if (chatnav_conn == NULL) { struct chatroom_info *chat_info = xcalloc(1, sizeof(*chat_info)); chat_info->name = xstrdup(info.name); chat_info->exchange = (u_int16_t) info.exchange; priv->chat_create_list = dlist_add_head(priv->chat_create_list, chat_info); aim_reqservice(&priv->aim_session, priv->bos_conn, AIM_CONN_TYPE_CHATNAV); free(info.name); return (0); } ret = aim_chatnav_createroom(&priv->aim_session, chatnav_conn, info.name, info.exchange); free(info.name); return (ret); } static int aim_chat_send( struct pork_acct *acct, struct chatroom *chat, char *target __notused, char *msg) { char *msg_html; int msg_len; int ret; struct aim_priv *priv = acct->data; struct aim_chat *a_chat; if (msg == NULL) { debug("aim_chat_send with NULL msg"); return (-1); } a_chat = chat->data; msg_html = text_to_html(msg); msg_len = strlen(msg_html); if (msg_len > a_chat->max_msg_len) { debug("msg len too long"); return (-1); } ret = aim_chat_send_im(&priv->aim_session, a_chat->conn, AIM_CHATFLAGS_NOREFLECT, msg_html, msg_len, "us-ascii", "en"); return (ret); } static int aim_chat_action(struct pork_acct *acct, struct chatroom *chat, char *target __notused, char *msg) { char buf[8192]; int ret; if (!strncasecmp(msg, "", 6)) ret = snprintf(buf, sizeof(buf), "/me %s", &msg[6]); else ret = snprintf(buf, sizeof(buf), "/me %s", msg); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (aim_chat_send(acct, chat, chat->title_quoted, buf)); } static int aim_chat_send_invite(struct pork_acct *acct, struct chatroom *chat, char *dest, char *msg) { struct aim_priv *priv = acct->data; int ret; struct aim_chat *a_chat; a_chat = chat->data; if (msg == NULL) msg = ""; ret = aim_im_sendch2_chatinvite(&priv->aim_session, dest, msg, a_chat->exchange, a_chat->fullname, 0); return (ret); } static int aim_search(struct pork_acct *acct, char *str) { struct aim_priv *priv = acct->data; return (aim_search_address(&priv->aim_session, priv->bos_conn, str)); } static int aim_keepalive(struct pork_acct *acct) { struct aim_priv *priv = acct->data; return (aim_flap_nop(&priv->aim_session, priv->bos_conn)); } static int aim_acct_update(struct pork_acct *acct) { struct aim_priv *priv; if (!acct->connected) return (-1); /* ** We've got to keep track of AIM buddies' idle time ** ourselves; the AIM server reports an idle time ** for them only when there's a change (i.e. they ** go idle, come back from idle or their client reports ** a new idle time). This routine will run every minute ** and increment the idle time of buddies where appropriate. */ priv = acct->data; if (time(NULL) >= priv->last_update + 60) { aim_keepalive(acct); buddy_update_idle(acct); aim_cleansnacs(&priv->aim_session, 59); time(&priv->last_update); } return (0); } static int aim_acct_init(struct pork_acct *acct) { char buf[NUSER_LEN]; struct aim_priv *priv; normalize(buf, acct->username, sizeof(buf)); /* ** You can't have the same screen name logged in more than ** once with AIM. */ if (pork_acct_find_name(buf, PROTO_AIM) != NULL) return (-1); free(acct->username); acct->username = xstrdup(buf); priv = xcalloc(1, sizeof(*priv)); acct->data = priv; if (aim_setup(acct) != 0) { free(priv); return (-1); } if (acct->profile == NULL) acct->profile = xstrdup(DEFAULT_AIM_PROFILE); return (0); } static int aim_acct_free(struct pork_acct *acct) { aim_kill_all_conn(acct); free(acct->data); return (0); } static int aim_connect(struct pork_acct *acct, char *args) { if (acct->passwd == NULL) { if (args != NULL && !blank_str(args)) { acct->passwd = xstrdup(args); memset(args, 0, strlen(args)); } else { char buf[128]; screen_prompt_user("Password: ", buf, sizeof(buf)); if (buf[0] == '\0') { screen_err_msg("There was an error reading your password"); return (-1); } acct->passwd = xstrdup(buf); memset(buf, 0, sizeof(buf)); } } return (aim_login(acct)); } static int aim_read_config(struct pork_acct *acct) { return (read_user_config(acct)); } static int aim_write_config(struct pork_acct *acct) { return (save_user_config(acct)); } static int aim_file_recv_data(struct file_transfer *xfer, char *buf, size_t len) { struct aim_oft_info *oft_info = xfer->data; oft_info->fh.recvcsum = aim_oft_checksum_chunk(buf, len, oft_info->fh.recvcsum); if (xfer->bytes_sent + xfer->start_offset >= xfer->file_len) transfer_recv_complete(xfer); return (0); } static int aim_file_recv_complete(struct file_transfer *xfer) { struct aim_oft_info *oft_info = xfer->data; oft_info->fh.nrecvd = xfer->bytes_sent; aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); aim_clearhandlers(oft_info->conn); aim_conn_kill(oft_info->sess, &oft_info->conn); aim_oft_destroyinfo(oft_info); pork_io_del(xfer); return (0); } static int aim_file_send_complete(struct file_transfer *xfer) { struct aim_oft_info *oft_info = xfer->data; aim_clearhandlers(oft_info->conn); aim_conn_kill(oft_info->sess, &oft_info->conn); aim_oft_destroyinfo(oft_info); pork_io_del(xfer); return (0); } static int aim_file_send(struct file_transfer *xfer) { struct aim_priv *priv = xfer->acct->data; struct aim_oft_info *oft_info; if (transfer_bind_listen_sock(xfer, priv->bos_conn->fd) == -1) return (-1); oft_info = aim_oft_createinfo(&priv->aim_session, NULL, xfer->peer_username, xfer->laddr_ip, xfer->lport, xfer->file_len, 0, xfer->fname_base); oft_info->fh.checksum = aim_oft_checksum_file(xfer->fname_local); oft_info->port = xfer->lport; aim_sendfile_listen(&priv->aim_session, oft_info, xfer->sock); if (oft_info->conn == NULL) { aim_oft_destroyinfo(oft_info); return (-1); } oft_info->conn->priv = xfer; xfer->data = oft_info; pork_io_add(xfer->sock, IO_COND_RW, oft_info->conn, oft_info->conn, aim_listen_conn_event); aim_im_sendch2_sendfile_ask(&priv->aim_session, oft_info); aim_conn_addhandler(&priv->aim_session, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, aim_file_send_accepted, 0); transfer_request_send(xfer); return (0); } static int aim_file_send_data( struct file_transfer *xfer, char *buf __notused, size_t len __notused) { if (xfer->status == TRANSFER_STATUS_COMPLETE) { pork_io_del(xfer); return (transfer_send_complete(xfer)); } return (0); } static int aim_file_abort(struct file_transfer *xfer) { struct aim_oft_info *oft_info = xfer->data; pork_io_del(xfer); if (oft_info != NULL) { pork_io_del(oft_info->conn); aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); aim_clearhandlers(oft_info->conn); if (!(xfer->protocol_flags & AIM_XFER_IN_HANDLER)) aim_conn_kill(oft_info->sess, &oft_info->conn); else aim_conn_close(oft_info->conn); aim_oft_destroyinfo(oft_info); } return (0); } static int aim_file_accept(struct file_transfer *xfer) { struct aim_oft_info *oft_info; struct aim_priv *priv = xfer->acct->data; char buf[512]; int ret; int sock; oft_info = xfer->data; ret = snprintf(buf, sizeof(buf), "%s:%d", oft_info->verifiedip, oft_info->port); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); oft_info->conn = aim_newconn(&priv->aim_session, AIM_CONN_TYPE_RENDEZVOUS, NULL); if (oft_info->conn == NULL) { screen_err_msg("Error connecting to %s@%s while receiving %s", xfer->peer_username, buf, xfer->fname_local); return (-1); } oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; oft_info->conn->priv = xfer; ret = aim_sock_connect(buf, &xfer->acct->laddr, &sock); if (ret == 0) { aim_connected(sock, 0, oft_info->conn); } else if (ret == -EINPROGRESS) { oft_info->conn->status |= AIM_CONN_STATUS_INPROGRESS; pork_io_add(sock, IO_COND_WRITE, oft_info->conn, oft_info->conn, aim_connected); } else { aim_conn_kill(&priv->aim_session, &oft_info->conn); screen_err_msg("Error connecting to %s@%s while receiving %s", xfer->peer_username, buf, xfer->fname_local); return (-1); } aim_conn_addhandler(&priv->aim_session, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, aim_file_recv_accept, 0); aim_conn_addhandler(&priv->aim_session, oft_info->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNDEAD, aim_file_transfer_dead, 0); transfer_recv_accepted(xfer); return (0); } static char *aim_filter_text_out(char *msg) { if (!strncasecmp(msg, "= len) return (-1); return (0); } static int aim_set_privacy_mode(struct pork_acct *acct, int mode) { struct aim_priv *priv = acct->data; if (mode >= 0 && mode <= 5) { acct->buddy_pref->privacy_mode = mode; aim_ssi_setpermdeny(&priv->aim_session, acct->buddy_pref->privacy_mode, 0xffffffff); } return (acct->buddy_pref->privacy_mode); } static int aim_send_msg_auto(struct pork_acct *acct, char *dest, char *msg) { struct aim_priv *priv = acct->data; char *msg_html = text_to_html(msg); return (aim_im_sendch1(&priv->aim_session, dest, 1, msg_html)); } static int aim_send_msg(struct pork_acct *acct, char *dest, char *msg) { struct aim_priv *priv = acct->data; char *msg_html = text_to_html(msg); return (aim_im_sendch1(&priv->aim_session, dest, 0, msg_html)); } static int aim_action(struct pork_acct *acct, char *dest, char *msg) { char buf[8192]; int ret; if (!strncasecmp(msg, "", 6)) ret = snprintf(buf, sizeof(buf), "/me %s", &msg[6]); else ret = snprintf(buf, sizeof(buf), "/me %s", msg); if (ret < 0 || (size_t) ret >= sizeof(buf)) { debug("snprintf failed"); return (-1); } return (aim_send_msg(acct, dest, buf)); } static int aim_warn(struct pork_acct *acct, char *target) { struct aim_priv *priv = acct->data; return (aim_im_warn(&priv->aim_session, priv->bos_conn, target, 0)); } static int aim_warn_anon(struct pork_acct *acct, char *target) { struct aim_priv *priv = acct->data; int ret; ret = aim_im_warn(&priv->aim_session, priv->bos_conn, target, AIM_WARN_ANON); return (ret); } static int aim_set_back(struct pork_acct *acct) { struct aim_priv *priv = acct->data; int ret; ret = aim_locate_setprofile(&priv->aim_session, NULL, NULL, 0, NULL, "", 0); return (ret); } static int aim_set_away(struct pork_acct *acct, char *away_msg) { size_t len; int ret; char *msg_html; struct aim_priv *priv = acct->data; msg_html = text_to_html(away_msg); len = strlen(msg_html); if (len > priv->rights.max_away_len) { screen_err_msg("%s's away message is too long. The maximum length is %u characters", acct->username, priv->rights.max_away_len); return (-1); } ret = aim_locate_setprofile(&priv->aim_session, NULL, NULL, 0, "us-ascii", msg_html, len); return (ret); } static int aim_set_idle(struct pork_acct *acct, u_int32_t idle_secs) { struct aim_priv *priv = acct->data; int ret; ret = aim_srv_setidle(&priv->aim_session, idle_secs); if (ret >= 0) { if (idle_secs > 0) acct->marked_idle = 1; else acct->marked_idle = 0; } return (ret); } static int aim_set_profile(struct pork_acct *acct, char *profile) { int ret; size_t len; char *profile_html; struct aim_priv *priv = acct->data; if (profile == NULL) { ret = aim_locate_setprofile(&priv->aim_session, NULL, "", 0, NULL, NULL, 0); return (ret); } profile_html = text_to_html(profile); len = strlen(profile_html); if (len > priv->rights.max_profile_len) { screen_err_msg("%s's profile is too long. The maximum length is %u characters", acct->username, priv->rights.max_profile_len); return (-1); } ret = aim_locate_setprofile(&priv->aim_session, "us-ascii", profile_html, len, NULL, NULL, 0); return (ret); } static int aim_get_away_msg(struct pork_acct *acct, char *buddy) { struct aim_priv *priv = acct->data; return (aim_locate_getinfoshort(&priv->aim_session, buddy, 0x00000002)); } static int aim_whois(struct pork_acct *acct, char *buddy) { struct aim_priv *priv = acct->data; return (aim_locate_getinfoshort(&priv->aim_session, buddy, 0x00000003)); } int aim_chat_print_users( struct pork_acct *acct __notused, struct chatroom *chat) { int ret; dlist_t *cur; char buf[2048]; size_t i = 0; size_t len = sizeof(buf); struct chat_user *chat_user; struct aim_chat *a_chat; struct imwindow *win = chat->win; a_chat = chat->data; cur = chat->user_list; if (cur == NULL) { screen_win_msg(win, 0, 0, 1, MSG_TYPE_CHAT_STATUS, "%%D--%%m--%%M--%%x No %%Cu%%csers%%x in %%C%s%%x (%%W%s%%x)", chat->title_quoted, chat->title_full_quoted); return (0); } screen_win_msg(win, 0, 0, 1, MSG_TYPE_CHAT_STATUS, "%%D--%%m--%%M--%%x %u %%Cu%%csers%%x in %%C%s%%x (%%W%s%%x)", chat->num_users, chat->title_quoted, chat->title_full_quoted); while (cur != NULL) { chat_user = cur->data; if (chat_user->ignore) ret = snprintf(&buf[i], len, "[%%R%s%%x] ", chat_user->name); else ret = snprintf(&buf[i], len, "[%%B%s%%x] ", chat_user->name); if (ret < 0 || (size_t) ret >= len) { screen_err_msg("The results were too long to display"); return (0); } len -= ret; i += ret; cur = cur->next; } if (i > 0 && buf[i - 1] == ' ') buf[--i] = '\0'; screen_win_msg(win, 0, 0, 1, MSG_TYPE_CHAT_STATUS, "%s", buf); return (0); } int aim_chat_free(struct pork_acct *acct, void *data) { struct aim_chat *a_chat = data; if (a_chat->conn != NULL) { struct aim_priv *priv = acct->data; pork_io_del(a_chat->conn); aim_conn_kill(&priv->aim_session, &a_chat->conn); } free(a_chat->fullname); free(a_chat->fullname_quoted); free(a_chat->title); free(a_chat); return (0); } int aim_report_idle(struct pork_acct *acct, int mode) { struct aim_priv *priv = acct->data; u_int32_t report_idle = aim_ssi_getpresence(priv->aim_session.ssi.local); int ret; if (mode != 0) report_idle |= 0x0000400; else report_idle &= ~0x0000400; acct->report_idle = ((report_idle & 0x0000400) != 0); ret = aim_ssi_setpresence(&priv->aim_session, report_idle); return (ret); } int aim_connect_abort(struct pork_acct *acct) { aim_kill_all_conn(acct); aim_setup(acct); return (0); } int aim_proto_init(struct pork_proto *proto) { proto->buddy_add = aim_buddy_add; proto->buddy_alias = aim_buddy_alias; proto->buddy_block = aim_add_block; proto->buddy_permit = aim_add_permit; proto->buddy_remove = aim_buddy_remove; proto->buddy_remove_permit = aim_remove_permit; proto->buddy_unblock = aim_unblock; proto->buddy_update = aim_update_buddy; proto->chat_free = aim_chat_free; proto->chat_find = aim_find_chat_name_data; proto->chat_action = aim_chat_action; proto->chat_invite = aim_chat_send_invite; proto->chat_join = aim_join_chatroom; proto->chat_leave = aim_leave_chatroom; proto->chat_name = aim_chat_get_name; proto->chat_send = aim_chat_send; proto->chat_users = aim_chat_print_users; proto->chat_who = aim_chat_print_users; proto->who = aim_search; proto->connect = aim_connect; proto->connect_abort = aim_connect_abort; proto->reconnect = aim_connect; proto->free = aim_acct_free; proto->get_away_msg = aim_get_away_msg; proto->get_profile = aim_whois; proto->init = aim_acct_init; proto->keepalive = aim_keepalive; proto->filter_text = strip_html; proto->filter_text_out = aim_filter_text_out; proto->normalize = normalize; proto->user_compare = aim_sncmp; proto->read_config = aim_read_config; proto->send_msg = aim_send_msg; proto->send_msg_auto = aim_send_msg_auto; proto->set_away = aim_set_away; proto->set_back = aim_set_back; proto->set_idle_time = aim_set_idle; proto->set_privacy_mode = aim_set_privacy_mode; proto->set_profile = aim_set_profile; proto->set_report_idle = aim_report_idle; proto->update = aim_acct_update; proto->warn = aim_warn; proto->send_action = aim_action; proto->warn_anon = aim_warn_anon; proto->write_config = aim_write_config; proto->file_send = aim_file_send; proto->file_send_data = aim_file_send_data; proto->file_accept = aim_file_accept; proto->file_abort = aim_file_abort; proto->file_recv_data = aim_file_recv_data; proto->file_recv_complete = aim_file_recv_complete; proto->file_send_complete = aim_file_send_complete; return (0); } pork-0.99.8.1/src/protocols/aim/pork_aim_proto.h0000644000175000017500000000172110234500667021461 0ustar ryanryan00000000000000 /* ** pork_aim_proto.h - AIM OSCAR protocol interface to pork. ** Copyright (C) 2005 Ryan McCabe ** ** This file is heavily based on src/protocols/oscar/oscar.c from gaim, ** which is more or less to say that chunks of code have been mostly ** copied from there. In turn, I think that oscar.c file was mostly lifted ** from faimtest. Any copyrights there apply here. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_AIM_PROTO_H #define __PORK_AIM_PROTO_H int aim_proto_init(struct pork_proto *proto); int aim_chat_free(struct pork_acct *acct, void *data); int aim_connect_abort(struct pork_acct *acct); int aim_report_idle(struct pork_acct *acct, int mode); int aim_login(struct pork_acct *acct); int aim_chat_print_users( struct pork_acct *acct __notused, struct chatroom *chat); #endif pork-0.99.8.1/src/protocols/aim/pork_aim.c0000644000175000017500000015714010234507453020240 0ustar ryanryan00000000000000/* ** pork_aim.c - Interface to libfaim. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This file is heavily based on src/protocols/oscar/oscar.c from gaim, ** which is more or less to say that chunks of code have been mostly ** copied from there. In turn, I think that oscar.c file was mostly lifted ** from faimtest. Any copyrights there apply here. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static u_int32_t pork_caps = AIM_CAPS_CHAT | AIM_CAPS_INTEROPERATE | AIM_CAPS_SENDFILE; static char *msgerrreason[] = { "Invalid error", "Invalid SNAC", "Rate to host", "Rate to client", "Not logged in", "Service unavailable", "Service not defined", "Obsolete SNAC", "Not supported by host", "Not supported by client", "Refused by client", "Reply too big", "Responses lost", "Request denied", "Busted SNAC payload", "Insufficient rights", "In local permit/deny", "Sender's warning level is too high", "Receiver's warning level is too high", "User temporarily unavailable", "No match", "List overflow", "Request ambiguous", "Queue full", "Not while on AOL" }; static FAIM_CB(aim_connerr); static FAIM_CB(aim_parse_login); static FAIM_CB(aim_parse_authresp); static void aim_debug( aim_session_t *session __notused, int level __notused, const char *format __notused, va_list va __notused) { #ifdef ENABLE_DEBUGGING char buf[8192]; vsnprintf(buf, sizeof(buf), format, va); debug("LIBFAIM DEBUG: lev: %d: %s", level, buf); #endif } int aim_sock_connect( const char *ip, struct sockaddr_storage *laddr, int *sock) { struct sockaddr_storage ss; char *addr; char *port; in_port_t port_num = FAIM_LOGIN_PORT; port = getenv("AIM_PORT"); if (port != NULL) { u_int32_t temp; if (str_to_uint(port, &temp) != -1) port_num = temp; } addr = xstrdup(ip); port = strchr(addr, ':'); if (port != NULL) { *port++ = '\0'; if (get_port(port, &port_num) != 0) { screen_err_msg("Error: Invalid port: %s", port); goto err_out; } } if (get_addr(addr, &ss) != 0) { screen_err_msg("Error: Invalid host: %s", addr); goto err_out; } free(addr); return (nb_connect(&ss, laddr, port_num, sock)); err_out: free(addr); return (-1); } static void aim_print_info( char *user, char *profile, char *away_msg, u_int32_t warn_level, u_int32_t idle_time, u_int32_t online_since, u_int32_t member_since, int print_all) { char buf[8192]; struct imwindow *win = cur_window(); if (print_all) { int ret; ret = fill_format_str(OPT_FORMAT_WHOIS_NAME, buf, sizeof(buf), user, warn_level, idle_time, online_since, member_since); if (ret > 0) screen_print_str(win, buf, (size_t) ret, MSG_TYPE_CMD_OUTPUT); if (idle_time > 0) { ret = fill_format_str(OPT_FORMAT_WHOIS_IDLE, buf, sizeof(buf), user, warn_level, idle_time, online_since, member_since); if (ret > 0) screen_print_str(win, buf, (size_t) ret, MSG_TYPE_CMD_OUTPUT); } if (warn_level > 0) { ret = fill_format_str(OPT_FORMAT_WHOIS_WARNLEVEL, buf, sizeof(buf), user, warn_level, idle_time, online_since, member_since); if (ret > 0) screen_print_str(win, buf, (size_t) ret, MSG_TYPE_CMD_OUTPUT); } if (online_since) { ret = fill_format_str(OPT_FORMAT_WHOIS_SIGNON, buf, sizeof(buf), user, warn_level, idle_time, online_since, member_since); if (ret > 0) screen_print_str(win, buf, (size_t) ret, MSG_TYPE_CMD_OUTPUT); } if (member_since) { ret = fill_format_str(OPT_FORMAT_WHOIS_MEMBER, buf, sizeof(buf), user, warn_level, idle_time, online_since, member_since); if (ret > 0) screen_print_str(win, buf, (size_t) ret, MSG_TYPE_CMD_OUTPUT); } if (profile) { ret = fill_format_str(OPT_FORMAT_WHOIS_USERINFO, buf, sizeof(buf), user, warn_level, idle_time, online_since, member_since, profile); if (ret > 0) screen_print_str(win, buf, (size_t) ret, MSG_TYPE_CMD_OUTPUT); } } if (away_msg) { int ret; ret = fill_format_str(OPT_FORMAT_WHOIS_AWAY, buf, sizeof(buf), user, warn_level, idle_time, online_since, member_since, away_msg); if (ret > 0) screen_print_str(win, buf, (size_t) ret, MSG_TYPE_CMD_OUTPUT); } } static inline void aim_disconnected_chat( struct pork_acct *acct, struct chatroom *chat) { chat_forced_leave(acct, chat->title, "the server", "disconnected"); } void aim_listen_conn_event(int sock, u_int32_t cond, void *data) { aim_conn_t *conn = (aim_conn_t *) data; aim_session_t *session = conn->sessv; struct pork_acct *acct = session->aux_data; struct aim_priv *priv = acct->data; if (cond == IO_COND_DEAD || aim_handlerendconnect(&priv->aim_session, conn) < 0) { struct file_transfer *xfer = conn->priv; pork_sock_err(acct, sock); close(sock); transfer_lost(xfer); } } static void aim_kill_pending_chats(struct pork_acct *acct) { struct aim_priv *priv = acct->data; dlist_t *cur; cur = priv->chat_create_list; while (cur != NULL) { struct chatroom_info *info = cur->data; dlist_t *next = cur->next; free(info->name); free(info); free(cur); cur = next; } } static void aim_conn_event(int sock, u_int32_t cond, void *data) { aim_conn_t *conn = (aim_conn_t *) data; aim_session_t *session = conn->sessv; struct pork_acct *acct = session->aux_data; struct aim_priv *priv = acct->data; if (cond == IO_COND_DEAD) { pork_sock_err(acct, sock); switch (conn->type) { case AIM_CONN_TYPE_BOS: debug("bos con for %s died", acct->username); aim_connect_abort(acct); pork_acct_disconnected(acct); break; case AIM_CONN_TYPE_CHAT: debug("chat con for %s died", acct->username); aim_disconnected_chat(acct, conn->priv); break; case AIM_CONN_TYPE_CHATNAV: debug("chatnav con for %s died", acct->username); pork_io_del(conn); aim_kill_pending_chats(acct); aim_conn_kill(session, &conn); priv->chatnav_conn = NULL; break; case AIM_CONN_TYPE_RENDEZVOUS: debug("rendezvous con for %s died", acct->username); if (conn->subtype == AIM_CONN_SUBTYPE_OFT_SENDFILE) transfer_lost(conn->priv); else { debug("rendezvous con for %s died (not sendfile)", acct->username); pork_io_del(conn); aim_conn_kill(session, &conn); } break; } return; } if (cond & IO_COND_READ) { if (aim_get_command(session, conn) >= 0) { aim_rxdispatch(session); /* ** If the whole session is terminated (e.g. after a failed ** login, we can't destroy the account inside the callback ** (before returning from aim_rxdispatch), or it will crash ** the client. Instead, this will have to do. */ if (session->connlist == NULL) { pork_acct_disconnected(acct); return; } } else { if (conn->type == AIM_CONN_TYPE_RENDEZVOUS && conn->subtype == AIM_CONN_SUBTYPE_OFT_SENDFILE) { aim_conn_kill(session, &conn); } } } if (cond & IO_COND_WRITE) aim_tx_flushqueue(session); } void aim_connected(int sock, u_int32_t cond __notused, void *data) { aim_conn_t *conn = data; aim_session_t *session = conn->sessv; struct pork_acct *acct = session->aux_data; int ret; pork_io_del(conn); ret = sock_is_error(sock); if (ret != 0) { close(sock); screen_err_msg("network error: %s: %s", acct->username, strerror(ret)); switch (conn->type) { case AIM_CONN_TYPE_CHATNAV: aim_kill_pending_chats(acct); aim_conn_kill(session, &conn); screen_err_msg("%s is unable to connect to the chatnav server", acct->username); break; case AIM_CONN_TYPE_CHAT: { struct chatroom *chat = conn->priv; chat_forced_leave(acct, chat->title, "the server", "can't connect"); break; } case AIM_CONN_TYPE_AUTH: case AIM_CONN_TYPE_BOS: screen_err_msg("Unable to login as %s", acct->username); pork_acct_disconnected(acct); break; case AIM_CONN_TYPE_RENDEZVOUS: if (conn->subtype == AIM_CONN_SUBTYPE_OFT_SENDFILE) transfer_lost(conn->priv); break; } } else { conn->fd = sock; sock_setflags(sock, 0); aim_conn_completeconnect(session, conn); pork_io_add(sock, IO_COND_RW, conn, conn, aim_conn_event); if (conn->type == AIM_CONN_TYPE_RENDEZVOUS && conn->subtype == AIM_CONN_SUBTYPE_OFT_SENDFILE) { struct file_transfer *xfer = conn->priv; struct aim_oft_info *oft_info = xfer->data; xfer->sock = sock; aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); } } } static int aim_send_buddy_list(aim_session_t *session, struct pork_acct *acct) { dlist_t *cur; cur = acct->buddy_pref->group_list; while (cur != NULL) { struct bgroup *group = cur->data; dlist_t *cur_buddy = group->member_list; while (cur_buddy != NULL) { struct buddy *buddy = cur_buddy->data; if (aim_ssi_itemlist_exists(session->ssi.local, buddy->nname)) { char *alias; alias = aim_ssi_getalias(session->ssi.local, group->name, buddy->nname); if (alias != NULL) { free(buddy->name); buddy->name = alias; } else { aim_ssi_aliasbuddy(session, group->name, buddy->nname, buddy->name); } } else { aim_ssi_addbuddy(session, buddy->nname, group->name, buddy->name, NULL, NULL, 0); } cur_buddy = cur_buddy->next; } cur = cur->next; } return (1); } static int aim_send_permit_list(aim_session_t *session, struct pork_acct *acct) { if (acct->buddy_pref->permit_list != NULL) { dlist_t *cur; cur = acct->buddy_pref->permit_list; while (cur != NULL) { aim_ssi_addpermit(session, (char *) cur->data); cur = cur->next; } } return (1); } static int aim_send_block_list(aim_session_t *session, struct pork_acct *acct) { if (acct->buddy_pref->block_list != NULL) { dlist_t *cur; cur = acct->buddy_pref->block_list; while (cur != NULL) { aim_ssi_adddeny(session, (char *) cur->data); cur = cur->next; } } return (1); } int aim_login(struct pork_acct *acct) { struct aim_priv *priv = acct->data; int ret; int sock; aim_conn_t *auth_conn; char *server; server = getenv("AIM_SERVER"); if (server == NULL) server = FAIM_LOGIN_SERVER; acct->connected = 0; screen_win_msg(cur_window(), 1, 1, 0, MSG_TYPE_STATUS, "Logging in as %s...", acct->username); auth_conn = aim_newconn(&priv->aim_session, AIM_CONN_TYPE_AUTH, NULL); if (auth_conn == NULL) { screen_err_msg("Connection error while logging in as %s", acct->username); return (-1); } ret = aim_sock_connect(server, &acct->laddr, &sock); if (ret == 0) { aim_connected(sock, 0, auth_conn); } else if (ret == -EINPROGRESS) { auth_conn->status |= AIM_CONN_STATUS_INPROGRESS; pork_io_add(sock, IO_COND_WRITE, auth_conn, auth_conn, aim_connected); } else { screen_err_msg("Error connecting to the authorizer server as %s", acct->username); aim_conn_kill(&priv->aim_session, &auth_conn); return (-1); } aim_conn_addhandler(&priv->aim_session, auth_conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, aim_connerr, 0); aim_conn_addhandler(&priv->aim_session, auth_conn, AIM_CB_FAM_ATH, AIM_CB_ATH_AUTHRESPONSE, aim_parse_login, 0); aim_conn_addhandler(&priv->aim_session, auth_conn, AIM_CB_FAM_ATH, AIM_CB_ATH_LOGINRESPONSE, aim_parse_authresp, 0); aim_request_login(&priv->aim_session, auth_conn, acct->username); return (1); } static dlist_t *aim_find_chat( struct pork_acct *acct, const char *name, int exchange) { dlist_t *cur; cur = acct->chat_list; while (cur != NULL) { struct chatroom *chat = cur->data; struct aim_chat *a_chat = chat->data; if (!strcasecmp(name, a_chat->title) && exchange == a_chat->exchange) return (cur); cur = cur->next; } return (NULL); } static char *get_chatname(const char *orig) { char *p; char *s; char *ret; if (orig == NULL) return (xstrdup(orig)); p = strrchr(orig, '-'); if (p == NULL) return (xstrdup(orig)); s = xstrdup(++p); ret = s; /* ** The length of s will always be less than or equal to the length of p. */ while (*p != '\0') { if (*p != '%') *s = *p++; else { char buf[4]; if (xstrncpy(buf, ++p, sizeof(buf)) == -1) { free(ret); return (NULL); } p += 2; *s = (char) strtol(buf, NULL, 16); } s++; } *s = '\0'; return (ret); } int aim_kill_all_conn(struct pork_acct *acct) { struct aim_priv *priv = acct->data; aim_conn_t *conn; dlist_t *cur; if (priv == NULL) return (-1); conn = priv->aim_session.connlist; if (acct->connected) { aim_rxdispatch(&priv->aim_session); aim_tx_flushqueue(&priv->aim_session); } while (conn != NULL) { pork_io_del(conn); conn = conn->next; } aim_kill_pending_chats(acct); cur = acct->chat_list; while (cur != NULL) { dlist_t *next = cur->next; struct chatroom *chat = cur->data; aim_chat_free(acct, chat->data); cur = next; } aim_session_kill(&priv->aim_session); return (0); } int aim_setup(struct pork_acct *acct) { struct aim_priv *priv = acct->data; aim_session_t *session = &priv->aim_session; memset(session, 0, sizeof(*session)); aim_session_init(session, 0, 0); aim_setdebuggingcb(session, aim_debug); aim_tx_setenqueue(session, AIM_TX_IMMEDIATE, NULL); session->aux_data = acct; return (0); } int aim_chat_parse_name(const char *name, struct chatroom_info *info) { int exchange; char *p; p = strchr(name, '/'); if (p != NULL) { p++; if (str_to_int(p, &exchange) != 0) return (-1); if (exchange < 4) exchange = 4; else if (exchange > 16) exchange = 16; info->name = xstrndup(name, p - name - 1); info->exchange = exchange; } else { info->name = xstrdup(name); info->exchange = AIM_DEFAULT_CHAT_EXCHANGE; } return (0); } dlist_t *aim_find_chat_name(struct pork_acct *acct, char *name) { dlist_t *ret; struct chatroom_info info; if (aim_chat_parse_name(name, &info) != 0) { debug("aim_chat_parse_name failed for %s", name); return (NULL); } ret = aim_find_chat(acct, info.name, info.exchange); free(info.name); return (ret); } /* ** libfaim callback handlers. */ static FAIM_CB(aim_conn_dead) { aim_conn_t *conn; va_list ap; va_start(ap, fr); conn = va_arg(ap, aim_conn_t *); va_end(ap); if (conn != NULL) { aim_session_t *session = aim_conn_getsess(conn); if (session != NULL && session->aux_data != NULL && conn->fd >= 0) pork_sock_err(session->aux_data, conn->fd); pork_io_dead(conn); } return (1); } static FAIM_CB(aim_connerr) { u_int16_t code; char *msg; va_list ap; va_start(ap, fr); code = (u_int16_t) va_arg(ap, int); msg = va_arg(ap, char *); va_end(ap); debug("aim_connerr: msg=%s code=%hu", msg, code); if (fr == NULL || fr->conn == NULL) return (1); debug("conn=%p, fd=%d, type=%d", fr->conn, fr->conn->fd, fr->conn->type); if (fr->conn->type == AIM_CONN_TYPE_BOS) { if (code == 0x01) { debug("somebody signed on from another location with this screenname."); } else { debug("Unknown error"); } } return (1); } FAIM_CB(aim_file_transfer_dead) { aim_conn_t *conn; va_list ap; struct file_transfer *xfer; va_start(ap, fr); conn = va_arg(ap, aim_conn_t *); va_end(ap); if (conn == NULL) { debug("file xfer conn null"); return (-1); } xfer = conn->priv; if (xfer != NULL) { pork_sock_err(xfer->acct, conn->fd); pork_io_del(xfer); } else { debug("xfer died with conn->priv NULL"); } pork_io_del(conn); xfer->protocol_flags |= AIM_XFER_IN_HANDLER; transfer_lost(xfer); return (-1); } static FAIM_CB(aim_recv_bos_rights) { va_list ap; struct pork_acct *acct = session->aux_data; struct aim_priv *priv = acct->data; priv->bos_conn = fr->conn; va_start(ap, fr); priv->rights.max_permit = va_arg(ap, unsigned int); priv->rights.max_deny = va_arg(ap, unsigned int); va_end(ap); aim_ssi_reqrights(session); aim_ssi_reqdata(session); return (1); } static FAIM_CB(aim_recv_buddy_rights) { va_list ap; struct pork_acct *acct = session->aux_data; struct aim_priv *priv = acct->data; va_start(ap, fr); priv->rights.max_buddies = va_arg(ap, unsigned int); priv->rights.max_watchers = va_arg(ap, unsigned int); va_end(ap); return (1); } static FAIM_CB(aim_recv_conn_complete) { pork_io_set_cond(fr->conn, IO_COND_READ); aim_reqpersonalinfo(session, fr->conn); aim_locate_reqrights(session); aim_buddylist_reqrights(session, fr->conn); aim_im_reqparams(session); aim_bos_reqrights(session, fr->conn); return (1); } static FAIM_CB(aim_recv_typing) { va_list ap; u_int16_t type1; u_int16_t type2; char *source; struct imwindow *conv_window; struct pork_acct *acct = session->aux_data; va_start(ap, fr); type1 = (u_int16_t) va_arg(ap, unsigned int); source = va_arg(ap, char *); type2 = (u_int16_t) va_arg(ap, unsigned int); va_end(ap); conv_window = imwindow_find(acct, source); if (conv_window == NULL) return (0); if (type2 > 2) return (0); conv_window->typing = type2; return (0); } static FAIM_CB(aim_recv_err_loc) { va_list ap; char *dest; char *err_str; u_int16_t code; va_start(ap, fr); code = (u_int16_t) va_arg(ap, unsigned int); dest = va_arg(ap, char *); va_end(ap); if (code < array_elem(msgerrreason)) err_str = msgerrreason[code]; else err_str = "Reason unknown"; screen_err_msg("User information for %s is unavailable: %s", dest, err_str); return (1); } static FAIM_CB(aim_recv_err_msg) { va_list ap; char *dest; char *err_str; u_int16_t code; struct pork_acct *acct = session->aux_data; va_start(ap, fr); code = (u_int16_t) va_arg(ap, unsigned int); dest = va_arg(ap, char *); va_end(ap); if (code < array_elem(msgerrreason)) err_str = msgerrreason[code]; else err_str = "Reason unknown"; if (dest != NULL) { struct imwindow *win; win = imwindow_find(acct, dest); if (win == NULL) win = cur_window(); screen_win_msg(win, 1, 1, 0, MSG_TYPE_ERROR, "%s's message to %s was not sent: %s", acct->username, dest, err_str); } else { screen_err_msg("The last message by %s was not sent: %s", acct->username, err_str); } return (1); } static FAIM_CB(aim_recv_err_other) { va_list ap; u_int16_t code; char *err_str; va_start(ap, fr); code = (u_int16_t) va_arg(ap, unsigned int); va_end(ap); if (code < array_elem(msgerrreason)) err_str = msgerrreason[code]; else err_str = "Reason unknown"; screen_err_msg("AIM Error: %s", err_str); return (1); } static FAIM_CB(aim_recv_evil) { va_list ap; u_int16_t warn_level; aim_userinfo_t *userinfo; struct pork_acct *acct = session->aux_data; char buf[4096]; va_start(ap, fr); warn_level = va_arg(ap, unsigned int); userinfo = va_arg(ap, aim_userinfo_t *); va_end(ap); warn_level = (float) warn_level / 10; if (warn_level <= acct->warn_level) { acct->warn_level = warn_level; return (1); } acct->warn_level = warn_level; if (event_generate(acct->events, EVENT_RECV_WARN, userinfo->sn, warn_level, acct->refnum)) { return (1); } if (blank_str(userinfo->sn)) { int ret; ret = fill_format_str(OPT_FORMAT_WARN, buf, sizeof(buf), acct->username, opt_get_str(OPT_TEXT_WARN_ANONYMOUS), warn_level); if (ret > 0) screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_STATUS); } else { int ret; ret = fill_format_str(OPT_FORMAT_WARN, buf, sizeof(buf), acct->username, buddy_name(acct, userinfo->sn), warn_level); if (ret > 0) { struct imwindow *win; win = imwindow_find(acct, userinfo->sn); if (win == NULL) win = cur_window(); screen_print_str(win, buf, (size_t) ret, MSG_TYPE_STATUS); } } return (1); } static FAIM_CB(aim_recv_icbm_param_info) { va_list ap; struct aim_icbmparameters *params; va_start(ap, fr); params = va_arg(ap, struct aim_icbmparameters *); va_end(ap); params->flags = 0x0000000b; params->maxmsglen = 8000; params->minmsginterval = 0; aim_im_setparams(session, params); return (1); } static int parse_im_chan1( aim_session_t *session __notused, aim_conn_t *conn __notused, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { char *buf; int autoresp = 0; int ret; struct pork_acct *acct = session->aux_data; char *p; if (args->msg == NULL || args->msglen == 0) return (-1); if (args->icbmflags & AIM_IMFLAGS_AWAY) autoresp = 1; if (args->charset == AIM_CHARSET_UNICODE) { int i; char *msg; buf = xmalloc(args->msglen + 1); msg = buf; for (i = 0 ; i < args->msglen ; i += 2) { u_int16_t uc_char; uc_char = ((args->msg[i] & 0xff) << 8) | (args->msg[i + 1] & 0xff); if (uc_char < 255) *msg++ = (char) uc_char; else *msg++ = '?'; } *msg = '\0'; } else buf = xstrdup(args->msg); if (!strncasecmp(buf, "/me ", 3)) { ret = pork_recv_action(acct, acct->username, userinfo->sn, NULL, &buf[4]); } else if ((p = strstr(buf, "/me ")) != NULL) { char *tmp = strip_html(buf); if (!strncasecmp(tmp, "/me ", 4)) { memmove(p, &p[4], strlen(p) - 4 + 1); ret = pork_recv_action(acct, acct->username, userinfo->sn, NULL, buf); } else { ret = pork_recv_msg(acct, acct->username, userinfo->sn, NULL, buf, autoresp); } free(tmp); } else { ret = pork_recv_msg(acct, acct->username, userinfo->sn, NULL, buf, autoresp); } free(buf); return (ret); } static int parse_im_chan2( aim_session_t *session, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { struct pork_acct *acct = session->aux_data; if (args->reqclass & AIM_CAPS_CHAT) { char *chat_name; char chat_fullname[512]; int ret; /* ** They accepted our invitation. */ if (args->info.chat.roominfo.name == NULL && args->msg == NULL) { struct chatroom *chat = conn->priv; if (chat != NULL) chat_user_joined(acct, chat, userinfo->sn, NULL, 0); return (1); } chat_name = get_chatname(args->info.chat.roominfo.name); if (chat_name == NULL) chat_name = xstrdup(args->info.chat.roominfo.name); ret = snprintf(chat_fullname, sizeof(chat_fullname), "%s/%d", chat_name, args->info.chat.roominfo.exchange); free(chat_name); if (ret > 0 && (size_t) ret < sizeof(chat_fullname)) { chat_got_invite(acct, chat_fullname, userinfo->sn, NULL, (char *) args->msg); } return (1); } else if (args->reqclass & AIM_CAPS_SENDFILE) { if (args->status == AIM_RENDEZVOUS_PROPOSE) { struct file_transfer *xfer; struct aim_oft_info *oft_info; char *p; if (!args->cookie || !VALID_PORT(args->port) || args->verifiedip == NULL || args->info.sendfile.filename == NULL || args->info.sendfile.totsize == 0|| args->info.sendfile.totfiles == 0) { screen_err_msg( "%s [%s:%d] has sent an invalid request to send a file", userinfo->sn, args->verifiedip, args->port); return (0); } p = strrchr(args->info.sendfile.filename, '\\'); if (p != NULL && p[1] == '*') { screen_err_msg("%s [%s:%d] has attempted to send you a directory (%s). This isn't supported yet.", userinfo->sn, args->verifiedip, args->port, args->info.sendfile.filename); oft_info = aim_oft_createinfo(session, args->cookie, userinfo->sn, args->clientip, args->port, 0, 0, NULL); oft_info->verifiedip = xstrdup(args->verifiedip); aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); aim_oft_destroyinfo(oft_info); return (0); } xfer = transfer_new(acct, userinfo->sn, TRANSFER_DIR_RECV, args->info.sendfile.filename, args->info.sendfile.totsize); if (xfer == NULL) { debug("transfer_new failed for %s from %s (size: %u)", args->info.sendfile.filename, userinfo->sn, args->info.sendfile.totsize); return (0); } xfer->fport = args->port; xstrncpy(xfer->faddr_ip, args->verifiedip, sizeof(xfer->faddr_ip)); if (get_addr(args->verifiedip, &xfer->faddr) != 0) { screen_err_msg( "%s [%s:%d] has sent an invalid request to send a file", userinfo->sn, args->verifiedip, args->port); } oft_info = aim_oft_createinfo(session, args->cookie, userinfo->sn, args->clientip, args->port, 0, 0, NULL); oft_info->verifiedip = xstrdup(args->verifiedip); xfer->data = oft_info; transfer_request_recv(xfer); } } return (0); } static FAIM_CB(aim_recv_msg) { va_list ap; int channel; aim_userinfo_t *userinfo; int ret = 0; va_start(ap, fr); channel = va_arg(ap, int); userinfo = va_arg(ap, aim_userinfo_t *); switch (channel) { case 1: { struct aim_incomingim_ch1_args *args; args = va_arg(ap, struct aim_incomingim_ch1_args *); ret = parse_im_chan1(session, fr->conn, userinfo, args); break; } case 2: { struct aim_incomingim_ch2_args *args; args = va_arg(ap, struct aim_incomingim_ch2_args *); ret = parse_im_chan2(session, fr->conn, userinfo, args); break; } default: debug("unhandled case in recv_msg: chan=%d", channel); break; } va_end(ap); return (ret); } static FAIM_CB(aim_recv_locrights) { va_list ap; u_int16_t max_len; struct pork_acct *acct = session->aux_data; struct aim_priv *priv = acct->data; va_start(ap, fr); max_len = va_arg(ap, int); va_end(ap); priv->rights.max_profile_len = max_len; priv->rights.max_away_len = max_len; if (acct->profile != NULL) { char *profile_html; size_t profile_len; profile_html = text_to_html(acct->profile); profile_len = strlen(profile_html); aim_locate_setprofile(session, "us-ascii", profile_html, profile_len, NULL, NULL, 0); } if (acct->away_msg != NULL) { char *away_html; size_t away_len; away_html = text_to_html(acct->away_msg); away_len = strlen(away_html); aim_locate_setprofile(session, NULL, NULL, 0, "us-ascii", away_html, away_len); } if (acct->marked_idle) aim_srv_setidle(&priv->aim_session, acct->idle_time); aim_locate_setcaps(session, pork_caps); return (1); } static FAIM_CB(aim_recv_missed) { va_list ap; u_int16_t chan; u_int16_t num_missed; u_int16_t reason; aim_userinfo_t *userinfo; char buf[1024]; struct pork_acct *acct = session->aux_data; int ret; va_start(ap, fr); chan = (u_int16_t) va_arg(ap, unsigned int); userinfo = va_arg(ap, aim_userinfo_t *); num_missed = (u_int16_t) va_arg(ap, unsigned int); reason = (u_int16_t) va_arg(ap, unsigned int); va_end(ap); switch(reason) { case 0: ret = snprintf(buf, sizeof(buf), num_missed == 1 ? "%s missed %u message from %s because it was invalid" : "%s missed %u messages from %s because they were invalid", acct->username, num_missed, userinfo->sn); break; case 1: ret = snprintf(buf, sizeof(buf), num_missed == 1 ? "%s missed %u message from %s because it was too large" : "%s missed %u messages from %s because they were too large", acct->username, num_missed, userinfo->sn); break; case 2: ret = snprintf(buf, sizeof(buf), num_missed == 1 ? "%s missed %u message from %s because the rate limit has been exceeded" : "%s missed %u messages from %s because the rate limit has been exceeded", acct->username, num_missed, userinfo->sn); break; case 3: ret = snprintf(buf, sizeof(buf), num_missed == 1 ? "%s missed %u message from %s because the sender's warning level is too high" : "%s missed %u messages from %s because the sender's warning level is too high", acct->username, num_missed, userinfo->sn); break; case 4: ret = snprintf(buf, sizeof(buf), num_missed == 1 ? "%s missed %u message from %s because your warning level is too high" : "%s missed %u messages from %s because your warning level is too high", acct->username, num_missed, userinfo->sn); break; default: ret = snprintf(buf, sizeof(buf), num_missed == 1 ? "%s missed %u message from %s for unknown reasons" : "%s missed %u messages from %s for unknown reasons", acct->username, num_missed, userinfo->sn); break; } screen_err_msg("Error: %s", buf); return (1); } static FAIM_CB(aim_recv_selfinfo) { va_list ap; aim_userinfo_t *info; struct pork_acct *acct = session->aux_data; va_start(ap, fr); info = va_arg(ap, aim_userinfo_t *); va_end(ap); acct->warn_level = (float) info->warnlevel / 10; acct->idle_time = info->idletime; return (1); } static FAIM_CB(aim_recv_motd) { char *msg; u_int16_t id; va_list ap; va_start(ap, fr); id = (u_int16_t) va_arg(ap, unsigned int); msg = va_arg(ap, char *); va_end(ap); if (msg != NULL) { screen_win_msg(cur_window(), 0, 1, 0, MSG_TYPE_STATUS, "AIM MOTD: %s", msg); } return (1); } static FAIM_CB(aim_recv_offgoing) { va_list ap; aim_userinfo_t *userinfo; struct pork_acct *acct = session->aux_data; va_start(ap, fr); userinfo = va_arg(ap, aim_userinfo_t *); va_end(ap); if (userinfo == NULL) { debug("recv offgoing is NULL"); return (-1); } return (buddy_went_offline(acct, userinfo->sn)); } static FAIM_CB(aim_recv_oncoming) { va_list ap; struct buddy *buddy; aim_userinfo_t *userinfo; struct pork_acct *acct = session->aux_data; va_start(ap, fr); userinfo = va_arg(ap, aim_userinfo_t *); va_end(ap); if (userinfo == NULL) { debug("recv oncoming is NULL"); return (-1); } buddy = buddy_find(acct, userinfo->sn); if (buddy == NULL) { debug("recv oncoming for unknown user: %s", userinfo->sn); return (-1); } if (buddy->status == STATUS_OFFLINE) buddy_came_online(acct, userinfo->sn, userinfo); else { int was_away = buddy->status == STATUS_AWAY; int is_away = (userinfo->flags & AIM_FLAG_AWAY) != 0; if (was_away != is_away) { if (was_away) buddy_went_unaway(acct, userinfo->sn); else buddy_went_away(acct, userinfo->sn); } else if (buddy->idle_time && !userinfo->idletime) buddy_went_unidle(acct, userinfo->sn); else if (!buddy->idle_time && userinfo->idletime) buddy_went_idle(acct, userinfo->sn, userinfo->idletime); buddy_update(acct, buddy, userinfo); } return (1); } static FAIM_CB(aim_recv_rate_change) { struct pork_acct *acct = session->aux_data; va_list ap; u_int16_t rate_code; u_int16_t rate_class; u_int32_t window_size; u_int32_t rate_clear; u_int32_t alert; u_int32_t limit; u_int32_t disconnect; u_int32_t current_avg; u_int32_t max_avg; va_start(ap, fr); rate_code = (u_int16_t) va_arg(ap, unsigned int); rate_class = (u_int16_t) va_arg(ap, unsigned int); window_size = (u_int32_t) va_arg(ap, u_int32_t); rate_clear = (u_int32_t) va_arg(ap, u_int32_t); alert = (u_int32_t) va_arg(ap, u_int32_t); limit = (u_int32_t) va_arg(ap, u_int32_t); disconnect = (u_int32_t) va_arg(ap, u_int32_t); current_avg = (u_int32_t) va_arg(ap, u_int32_t); max_avg = (u_int32_t) va_arg(ap, u_int32_t); va_end(ap); switch (rate_code) { case AIM_RATE_CODE_CHANGE: if (current_avg >= rate_clear) aim_conn_setlatency(fr->conn, 0); break; case AIM_RATE_CODE_WARNING: aim_conn_setlatency(fr->conn, window_size / 4); break; case AIM_RATE_CODE_LIMIT: aim_conn_setlatency(fr->conn, 10); screen_err_msg("The last message from %s was not sent because you are over the rate limit. Please wait 10 seconds, and then try again", acct->username); break; case AIM_RATE_CODE_CLEARLIMIT: aim_conn_setlatency(fr->conn, 0); break; default: debug("unknown rate change code: %hu", rate_code); break; } return (1); } static FAIM_CB(aim_recv_chatnav_info) { va_list ap; u_int16_t type; struct pork_acct *acct = session->aux_data; struct aim_priv *priv = acct->data; va_start(ap, fr); type = (u_int16_t) va_arg(ap, unsigned int); switch (type) { case 0x0002: { u_int8_t max_rooms; int exchange_count; struct aim_chat_exchangeinfo *exchanges; dlist_t *cur; max_rooms = (u_int8_t) va_arg(ap, unsigned int); exchange_count = va_arg(ap, int); exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); cur = priv->chat_create_list; while (cur != NULL) { struct chatroom_info *chat = cur->data; dlist_t *next = cur->next; aim_chatnav_createroom(session, fr->conn, chat->name, chat->exchange); priv->chat_create_list = dlist_remove(priv->chat_create_list, cur); free(chat->name); free(chat); cur = next; } break; } case 0x0008: { char *fqcn; char *name; char *ck; u_int16_t instance; u_int16_t flags; u_int16_t maxmsglen; u_int16_t maxoccupancy; u_int16_t unknown; u_int16_t exchange; u_int8_t createperms; u_int32_t createtime; fqcn = va_arg(ap, char *); instance = (u_int16_t) va_arg(ap, unsigned int); exchange = (u_int16_t) va_arg(ap, unsigned int); flags = (u_int16_t) va_arg(ap, unsigned int); createtime = va_arg(ap, u_int32_t); maxmsglen = (u_int16_t) va_arg(ap, unsigned int); maxoccupancy = (u_int16_t) va_arg(ap, unsigned int); createperms = (u_int8_t) va_arg(ap, unsigned int); unknown = (u_int16_t) va_arg(ap, unsigned int); name = va_arg(ap, char *); ck = va_arg(ap, char *); aim_chat_join(session, priv->bos_conn, exchange, ck, instance); break; } default: debug("unknown chatnav type: %x", type); break; } va_end(ap); return (1); } static FAIM_CB(aim_recv_chat_join) { struct pork_acct *acct = session->aux_data; struct chatroom *chat = fr->conn->priv; aim_userinfo_t *userinfo; va_list ap; u_int32_t num_users; u_int32_t old_num_users = chat->num_users; va_start(ap, fr); num_users = va_arg(ap, int); userinfo = va_arg(ap, aim_userinfo_t *); va_end(ap); if (old_num_users == 0) { if (num_users == 1) { chat_created(acct, chat); chat_user_joined(acct, chat, userinfo[0].sn, NULL, 1); } else { u_int32_t i; for (i = 0 ; i < num_users ; i++) { if (!aim_sncmp(userinfo[i].sn, acct->username)) chat_user_joined(acct, chat, userinfo[i].sn, NULL, 0); else chat_user_joined(acct, chat, userinfo[i].sn, NULL, 1); } aim_chat_print_users(acct, chat); } } else chat_user_joined(acct, chat, userinfo->sn, NULL, 0); return (1); } static FAIM_CB(aim_recv_chat_leave) { struct pork_acct *acct = session->aux_data; struct chatroom *chat = fr->conn->priv; va_list ap; int num_users; aim_userinfo_t *info; va_start(ap, fr); num_users = va_arg(ap, int); info = va_arg(ap, aim_userinfo_t *); va_end(ap); /* ** Sometimes we'll receive a notice that we're leaving ** a chat room. I don't know what makes this happen, but ** it means that we've been disconnected somehow. */ if (!aim_sncmp(info->sn, acct->username)) { debug("chat_recv_leave: user is us"); aim_disconnected_chat(acct, chat); return (1); } chat_user_left(acct, chat, info->sn, 0); return (1); } static FAIM_CB(aim_recv_chat_info_update) { va_list ap; aim_userinfo_t *userinfo; struct aim_chat_roominfo *roominfo; char *roomname; int usercount; char *roomdesc; u_int16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; u_int32_t creationtime; struct chatroom *chat = fr->conn->priv; struct aim_chat *a_chat = chat->data; va_start(ap, fr); roominfo = va_arg(ap, struct aim_chat_roominfo *); roomname = va_arg(ap, char *); usercount = va_arg(ap, int); userinfo = va_arg(ap, aim_userinfo_t *); roomdesc = va_arg(ap, char *); unknown_c9 = (u_int16_t) va_arg(ap, unsigned int); creationtime = (u_int32_t) va_arg(ap, u_int32_t); maxmsglen = (u_int16_t) va_arg(ap, unsigned int); unknown_d2 = (u_int16_t) va_arg(ap, unsigned int); unknown_d5 = (u_int16_t) va_arg(ap, unsigned int); maxvisiblemsglen = (u_int16_t) va_arg(ap, unsigned int); va_end(ap); a_chat->max_msg_len = maxmsglen; a_chat->max_visible_len = maxvisiblemsglen; a_chat->created = (time_t) creationtime; return (1); } static FAIM_CB(aim_recv_chat_msg) { va_list ap; aim_userinfo_t *info; char *msg; struct pork_acct *acct = session->aux_data; struct chatroom *chat = fr->conn->priv; int len; char *charset; char *p; va_start(ap, fr); info = va_arg(ap, aim_userinfo_t *); len = va_arg(ap, int); msg = va_arg(ap, char *); charset = va_arg(ap, char *); va_end(ap); if (!strncasecmp(msg, "/me ", 4)) { chat_recv_action(acct, chat, chat->title_quoted, info->sn, NULL, &msg[4]); } else if ((p = strstr(msg, "/me ")) != NULL) { char *tmp = strip_html(msg); if (!strncasecmp(tmp, "/me ", 4)) { memmove(p, &p[4], strlen(p) - 4 + 1); chat_recv_action(acct, chat, chat->title_quoted, info->sn, NULL, msg); } else chat_recv_msg(acct, chat, chat->title_quoted, info->sn, NULL, msg); free(tmp); } else chat_recv_msg(acct, chat, chat->title_quoted, info->sn, NULL, msg); return (1); } static FAIM_CB(recv_chat_conn) { pork_io_set_cond(fr->conn, IO_COND_READ); aim_conn_addhandler(session, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ERROR, aim_recv_err_other, 0); aim_conn_addhandler(session, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, aim_recv_chat_join, 0); aim_conn_addhandler(session, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, aim_recv_chat_leave, 0); aim_conn_addhandler(session, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, aim_recv_chat_info_update, 0); aim_conn_addhandler(session, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, aim_recv_chat_msg, 0); aim_clientready(session, fr->conn); return (1); } static FAIM_CB(recv_chatnav_conn) { struct pork_acct *acct = session->aux_data; struct aim_priv *priv = acct->data; pork_io_set_cond(fr->conn, IO_COND_READ); aim_conn_addhandler(session, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_ERROR, aim_recv_err_other, 0); aim_conn_addhandler(session, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, aim_recv_chatnav_info, 0); aim_clientready(session, fr->conn); aim_chatnav_reqrights(session, fr->conn); priv->chatnav_conn = fr->conn; return (1); } static FAIM_CB(aim_recv_redirect) { struct aim_redirect_data *redirect; va_list ap; struct pork_acct *acct = session->aux_data; va_start(ap, fr); redirect = va_arg(ap, struct aim_redirect_data *); va_end(ap); if (redirect->group == AIM_CONN_TYPE_CHATNAV) { aim_conn_t *chatnav; int sock; int ret; chatnav = aim_newconn(session, AIM_CONN_TYPE_CHATNAV, NULL); if (chatnav == NULL) { screen_err_msg("Unable to connect to the chatnav server: %s", strerror(errno)); return (0); } ret = aim_sock_connect(redirect->ip, &acct->laddr, &sock); if (ret == 0) { aim_connected(sock, 0, chatnav); } else if (ret == -EINPROGRESS) { chatnav->status |= AIM_CONN_STATUS_INPROGRESS; pork_io_add(sock, IO_COND_WRITE, chatnav, chatnav, aim_connected); } else { aim_conn_kill(session, &chatnav); screen_err_msg("Unable to connect to the chatnav server: %s", strerror(errno)); return (0); } aim_conn_addhandler(session, chatnav, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNDEAD, aim_conn_dead, 0); aim_conn_addhandler(session, chatnav, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, aim_connerr, 0); aim_conn_addhandler(session, chatnav, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, recv_chatnav_conn, 0); aim_sendcookie(session, chatnav, redirect->cookielen, redirect->cookie); } else if (redirect->group == AIM_CONN_TYPE_CHAT) { aim_conn_t *chat_conn; struct chatroom *chat; struct aim_chat *a_chat; struct imwindow *win; char buf[128]; int sock; int ret; char *chat_title; chat_conn = aim_newconn(session, AIM_CONN_TYPE_CHAT, NULL); if (chat_conn == NULL) { screen_err_msg("Unable to connect to the chat server"); return (0); } ret = aim_sock_connect(redirect->ip, &acct->laddr, &sock); if (ret == 0) { aim_connected(sock, 0, chat_conn); } else if (ret == -EINPROGRESS) { chat_conn->status |= AIM_CONN_STATUS_INPROGRESS; pork_io_add(sock, IO_COND_WRITE, chat_conn, chat_conn, aim_connected); } else { aim_conn_kill(session, &chat_conn); screen_err_msg("Unable to connect to the chat server"); return (0); } chat_title = get_chatname(redirect->chat.room); if (chat_title == NULL) chat_title = xstrdup(redirect->chat.room); ret = snprintf(buf, sizeof(buf), "%s/%d", chat_title, redirect->chat.exchange); if (ret < 0 || (size_t) ret >= sizeof(buf)) { free(chat_title); pork_io_del(chat_conn); aim_conn_kill(session, &chat_conn); return (-1); } win = imwindow_find_chat_target(acct, buf); if (win == NULL) { free(chat_title); pork_io_del(chat_conn); aim_conn_kill(session, &chat_conn); debug("unable to find chat window for %s (acct: %s)", buf, acct->username); return (-1); } chat = chat_new(acct, buf, (char *) redirect->chat.room, win); a_chat = xcalloc(1, sizeof(*a_chat)); a_chat->fullname = xstrdup(redirect->chat.room); a_chat->fullname_quoted = color_quote_codes(a_chat->fullname); a_chat->title = chat_title; a_chat->exchange = redirect->chat.exchange; a_chat->instance = redirect->chat.instance; a_chat->conn = chat_conn; chat->data = a_chat; chat_conn->priv = chat; aim_conn_addhandler(session, chat_conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNDEAD, aim_conn_dead, 0); aim_conn_addhandler(session, chat_conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, aim_connerr, 0); aim_conn_addhandler(session, chat_conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, recv_chat_conn, 0); aim_sendcookie(session, chat_conn, redirect->cookielen, redirect->cookie); } return (1); } static FAIM_CB(aim_recv_search_error) { va_list ap; char *address; struct pork_acct *acct = session->aux_data; va_start(ap, fr); address = va_arg(ap, char *); va_end(ap); if (event_generate(acct->events, EVENT_RECV_SEARCH_RESULT, address, NULL, acct->refnum)) { return (1); } screen_cmd_output("No results were found for %s", address); return (1); } static FAIM_CB(aim_recv_search_reply) { va_list ap; char *address; char *usernames; char buf[2048]; int i = 0; size_t len = sizeof(buf); int j; int num; int ret; struct pork_acct *acct = session->aux_data; va_start(ap, fr); address = va_arg(ap, char *); num = va_arg(ap, int); usernames = va_arg(ap, char *); va_end(ap); if (num < 1) { if (event_generate(acct->events, EVENT_RECV_SEARCH_RESULT, address, NULL, acct->refnum)) { return (1); } screen_cmd_output("No results were found for %s", address); return (1); } ret = snprintf(buf, len, "%s has registered the following screen names: %s", address, &usernames[0]); if (ret < 0 || (size_t) ret >= len) { screen_err_msg("The results for %s were too long to display", address); return (1); } len -= ret; i += ret; for (j = 1 ; j < num ; j++) { ret = snprintf(&buf[i], len, ", %s", &usernames[j * (MAXSNLEN + 1)]); if (ret < 0 || (size_t) ret >= len) { screen_err_msg("The results for %s were too long to display", address); return (1); } len -= ret; i += ret; } if (event_generate(acct->events, EVENT_RECV_SEARCH_RESULT, address, buf, acct->refnum)) { return (1); } screen_cmd_output("%s", buf); return (1); } static FAIM_CB(aim_ssi_recv_rights) { struct pork_acct *acct = session->aux_data; struct aim_priv *priv = acct->data; int num; u_int16_t *items; va_list ap; va_start(ap, fr); num = va_arg(ap, int); items = va_arg(ap, u_int16_t *); va_end(ap); if (num >= 0) priv->rights.max_buddies = items[0]; if (num >= 1) priv->rights.max_groups = items[1]; if (num >= 2) priv->rights.max_permit = items[2]; if (num >= 3) priv->rights.max_deny = items[3]; return (1); } static FAIM_CB(aim_ssi_recv_list) { struct aim_ssi_item *cur; struct pork_acct *acct = session->aux_data; aim_ssi_enable(session); aim_ssi_cleanlist(session); /* ** Merge the buddy list on the server with the locally ** stored buddy list. By this point, the local ** buddy list will have already been processed. */ for (cur = session->ssi.local ; cur != NULL ; cur = cur->next) { if (cur->type == 0) { char *group_name; struct buddy *buddy; struct bgroup *group; char *alias; if (cur->name == NULL) continue; group_name = aim_ssi_itemlist_findparentname(session->ssi.local, cur->name); alias = aim_ssi_getalias(session->ssi.local, group_name, cur->name); if (group_name == NULL) group_name = "orphans"; buddy = buddy_find(acct, cur->name); if (buddy != NULL) { if (alias != NULL) { free(buddy->name); buddy->name = alias; } continue; } group = group_add(acct, group_name); buddy = buddy_add(acct, cur->name, group, 0); if (alias != NULL) buddy_alias(acct, buddy, alias, 0); else buddy_alias(acct, buddy, cur->name, 0); free(alias); } else if (cur->type == 2) { if (cur->name == NULL) continue; buddy_add_permit(acct, cur->name, 0); } else if (cur->type == 3) { /* Deny */ if (cur->name == NULL) continue; buddy_add_block(acct, cur->name, 0); } else if (cur->type == 4) { u_int32_t privacy_mode = aim_ssi_getpermdeny(session->ssi.local); acct->buddy_pref->privacy_mode = privacy_mode; } else if (cur->type == 5) { u_int32_t report_idle = aim_ssi_getpresence(session->ssi.local); if (report_idle & 0x0000400) acct->report_idle = 1; else acct->report_idle = 0; } } if (!acct->connected) { aim_report_idle(acct, acct->report_idle); aim_ssi_setpermdeny(session, acct->buddy_pref->privacy_mode, 0xffffffff); } aim_send_buddy_list(session, acct); aim_send_permit_list(session, acct); aim_send_block_list(session, acct); if (!acct->connected) { struct aim_priv *priv = acct->data; aim_clientready(session, fr->conn); pork_acct_connected(acct); time(&priv->last_update); } return (1); } static FAIM_CB(aim_recv_userinfo) { struct pork_acct *acct = session->aux_data; aim_userinfo_t *userinfo; va_list ap; char *profile = NULL; char *away_msg = NULL; u_int32_t idle_time = 0; u_int32_t online_since = 0; u_int32_t member_since = 0; u_int32_t warn_level; int print_all = 1; va_start(ap, fr); userinfo = va_arg(ap, aim_userinfo_t *); va_end(ap); if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) online_since = userinfo->onlinesince; if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) member_since = userinfo->membersince; if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) idle_time = userinfo->idletime; warn_level = (float) userinfo->warnlevel / 10; if ((userinfo->flags & AIM_FLAG_AWAY) && userinfo->away_len > 0 && userinfo->away != NULL) { char *temp = NULL; if (*userinfo->away != '\0') { temp = xmalloc(userinfo->away_len + 1); /* ** libfaim isn't nul-terminating the string anymore, ** so we can't call xstrncpy. */ memcpy(temp, userinfo->away, userinfo->away_len); temp[userinfo->away_len] = '\0'; } if (event_generate(acct->events, EVENT_RECV_AWAYMSG, userinfo->sn, member_since, online_since, idle_time, warn_level, temp, acct->refnum)) { free(temp); return (1); } if (temp != NULL) { away_msg = strip_html(temp); free(temp); } } if (userinfo->info_len > 0 && userinfo->info != NULL) { char *temp = NULL; if (*userinfo->info != '\0') { temp = xmalloc(userinfo->info_len + 1); memcpy(temp, userinfo->info, userinfo->info_len); temp[userinfo->info_len] = '\0'; } if (event_generate(acct->events, EVENT_RECV_PROFILE, userinfo->sn, member_since, online_since, idle_time, warn_level, temp, acct->refnum)) { free(temp); return (1); } if (temp != NULL) { profile = strip_html(temp); free(temp); } } aim_print_info(userinfo->sn, profile, away_msg, warn_level, idle_time, online_since, member_since, print_all); free(away_msg); free(profile); return (1); } static FAIM_CB(aim_parse_login) { struct pork_acct *acct = session->aux_data; char *key; va_list ap; static struct client_info_s client_info = CLIENTINFO_AIM_KNOWNGOOD; va_start(ap, fr); key = va_arg(ap, char *); va_end(ap); aim_send_login(session, fr->conn, acct->username, acct->passwd, &client_info, key); return (1); } static FAIM_CB(aim_file_send_done) { va_list ap; aim_conn_t *conn; fu8_t *cookie; struct aim_fileheader_t *fh; struct file_transfer *xfer; va_start(ap, fr); conn = va_arg(ap, aim_conn_t *); cookie = va_arg(ap, fu8_t *); fh = va_arg(ap, struct aim_fileheader_t *); va_end(ap); xfer = conn->priv; pork_io_del(conn); return (transfer_send_complete(xfer)); } static FAIM_CB(aim_file_send_ready) { va_list ap; fu8_t *cookie; struct aim_fileheader_t *header; aim_conn_t *conn; struct file_transfer *xfer; va_start(ap, fr); conn = va_arg(ap, aim_conn_t *); cookie = va_arg(ap, fu8_t *); header = va_arg(ap, struct aim_fileheader_t *); va_end(ap); xfer = conn->priv; pork_io_del(conn); pork_io_add(xfer->sock, IO_COND_WRITE, xfer, xfer, transfer_send_data); return (0); } FAIM_CB(aim_file_send_accepted) { aim_conn_t *conn; aim_conn_t *listen_conn; va_list ap; struct file_transfer *xfer; struct aim_oft_info *oft_info; va_start(ap, fr); conn = va_arg(ap, aim_conn_t *); listen_conn = va_arg(ap, aim_conn_t *); va_end(ap); xfer = listen_conn->priv; xfer->sock = conn->fd; oft_info = xfer->data; oft_info->conn = conn; oft_info->conn->priv = xfer; xfer->data = oft_info; pork_io_del(listen_conn); aim_conn_kill(session, &listen_conn); if (get_peer_addr(xfer->sock, &xfer->faddr) != 0) { xfer->protocol_flags |= AIM_XFER_IN_HANDLER; transfer_abort(xfer); return (-1); } get_ip(&xfer->faddr, xfer->faddr_ip, sizeof(xfer->faddr_ip)); xfer->fport = sin_port(&xfer->faddr); pork_io_add(xfer->sock, IO_COND_READ, conn, conn, aim_conn_event); aim_clearhandlers(conn); aim_conn_addhandler(session, conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, aim_file_send_ready, 0); aim_conn_addhandler(session, conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, aim_file_send_done, 0); aim_conn_addhandler(session, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNDEAD, aim_file_transfer_dead, 0); aim_oft_sendheader(session, AIM_CB_OFT_PROMPT, oft_info); transfer_send_accepted(xfer); return (0); } FAIM_CB(aim_file_recv_accept) { fu8_t *cookie; aim_conn_t *conn; struct aim_fileheader_t *header; va_list ap; struct file_transfer *xfer; struct aim_oft_info *oft_info; va_start(ap, fr); conn = va_arg(ap, aim_conn_t *); cookie = va_arg(ap, fu8_t *); header = va_arg(ap, struct aim_fileheader_t *); va_end(ap); if (conn == NULL || cookie == NULL || header == NULL) return (1); xfer = conn->priv; oft_info = xfer->data; memcpy(&oft_info->fh, header, sizeof(oft_info->fh)); memcpy(&oft_info->fh.bcookie, oft_info->cookie, sizeof(oft_info->fh.bcookie)); aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); pork_io_del(conn); aim_clearhandlers(conn); if (get_local_addr(xfer->sock, &xfer->laddr) != 0) { xfer->protocol_flags |= AIM_XFER_IN_HANDLER; transfer_abort(xfer); return (-1); } xfer->lport = sin_port(&xfer->laddr); pork_io_add(xfer->sock, IO_COND_READ, xfer, xfer, transfer_recv_data); return (0); } static FAIM_CB(aim_parse_authresp) { va_list ap; struct aim_authresp_info *authresp; aim_conn_t *bos_conn; struct pork_acct *acct = session->aux_data; int ret; int sock; struct sockaddr_storage local; pork_io_del(fr->conn); aim_conn_kill(session, &fr->conn); va_start(ap, fr); authresp = va_arg(ap, struct aim_authresp_info *); va_end(ap); if (authresp->errorcode || !authresp->bosip || !authresp->cookie) { switch (authresp->errorcode) { case 0x05: screen_err_msg("Error logging in %s: Incorrect username or password", acct->username); break; case 0x11: screen_err_msg("Error logging in %s: This account has been suspended", acct->username); break; case 0x14: screen_err_msg("Error logging in %s: This service is temporarily unavailable", acct->username); break; case 0x18: screen_err_msg("Error logging in %s: This account has been connecting too frequently", acct->username); break; case 0x1c: screen_err_msg("Error logging in %s: Client is too old", acct->username); break; default: screen_err_msg("Error logging in %s: Authentication failed", acct->username); break; } return (1); } bos_conn = aim_newconn(session, AIM_CONN_TYPE_BOS, NULL); if (bos_conn == NULL) { aim_conn_kill(session, &bos_conn); screen_err_msg("Unable to connect to the AIM BOS server"); return (1); } memcpy(&local, &acct->laddr, sizeof(local)); sin_set_port(&local, acct->lport); ret = aim_sock_connect(authresp->bosip, &local, &sock); if (ret == 0) { aim_connected(sock, 0, bos_conn); } else if (ret == -EINPROGRESS) { bos_conn->status |= AIM_CONN_STATUS_INPROGRESS; pork_io_add(sock, IO_COND_WRITE, bos_conn, bos_conn, aim_connected); } else { aim_conn_kill(session, &bos_conn); screen_err_msg("Unable to connect to the BOS server"); return (0); } aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNDEAD, aim_conn_dead, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, aim_connerr, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, aim_recv_conn_complete, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_BOS, AIM_CB_BOS_RIGHTS, aim_recv_bos_rights, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, aim_recv_redirect, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, aim_recv_locrights, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, aim_recv_buddy_rights, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, aim_recv_oncoming, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, aim_recv_offgoing, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, aim_recv_msg, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, aim_recv_err_loc, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, aim_recv_missed, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, aim_recv_rate_change, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, aim_recv_evil, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, aim_recv_search_error, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_LOK, 0x0003, aim_recv_search_reply, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, aim_recv_err_msg, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, aim_recv_typing, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, aim_recv_userinfo, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_MSG, AIM_CB_MSG_PARAMINFO, aim_recv_icbm_param_info, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_GEN, AIM_CB_GEN_ERROR, aim_recv_err_other, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_BUD, AIM_CB_BUD_ERROR, aim_recv_err_other, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_BOS, AIM_CB_BOS_ERROR, aim_recv_err_other, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_GEN, AIM_CB_GEN_SELFINFO, aim_recv_selfinfo, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, aim_recv_motd, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, aim_ssi_recv_rights, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, aim_ssi_recv_list, 0); aim_conn_addhandler(session, bos_conn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, aim_ssi_recv_list, 0); aim_sendcookie(session, bos_conn, authresp->cookielen, authresp->cookie); return (1); } pork-0.99.8.1/src/protocols/aim/pork_aim.h0000644000175000017500000000345610234500667020245 0ustar ryanryan00000000000000/* ** pork_aim.h - pork's interface with libfaim ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_AIM_H #define __PORK_AIM_H #define AIM_DEFAULT_CHAT_EXCHANGE 4 #define AIM_XFER_IN_HANDLER 1 #define DEFAULT_AIM_PROFILE "i <3 pork" #define FAIM_CB(x) int x(aim_session_t *session __notused, aim_frame_t *fr __notused, ...) struct buddy; struct bgroup; struct aim_chat { char *title; char *fullname; char *fullname_quoted; char *description; u_int16_t exchange; u_int16_t instance; aim_conn_t *conn; int max_msg_len; int max_visible_len; time_t created; }; struct chatroom_info { char *name; u_int16_t exchange; }; struct aim_priv { u_int32_t marked_idle:1; time_t last_update; aim_session_t aim_session; struct aim_rights { u_int32_t max_buddies; u_int32_t max_groups; u_int32_t max_watchers; u_int32_t max_permit; u_int32_t max_deny; u_int32_t max_away_len; u_int32_t max_profile_len; } rights; aim_conn_t *bos_conn; aim_conn_t *chatnav_conn; dlist_t *chat_create_list; }; int aim_kill_all_conn(struct pork_acct *acct); int aim_chat_parse_name(const char *name, struct chatroom_info *info); dlist_t *aim_find_chat_name(struct pork_acct *acct, char *name); void aim_connected(int sock, u_int32_t cond __notused, void *data); void aim_listen_conn_event(int sock, u_int32_t cond, void *data); int aim_setup(struct pork_acct *acct); int aim_sock_connect( const char *ip, struct sockaddr_storage *laddr, int *sock); FAIM_CB(aim_file_send_accepted); FAIM_CB(aim_file_transfer_dead); FAIM_CB(aim_file_recv_accept); #endif pork-0.99.8.1/src/protocols/irc/0000755000175000017500000000000010236222746016273 5ustar ryanryan00000000000000pork-0.99.8.1/src/protocols/irc/pork_irc_input.c0000644000175000017500000013172110234217335021467 0ustar ryanryan00000000000000/* ** pork_irc_input.c ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static struct irc_input *irc_tokenize(char *buf) { struct irc_input *in = xcalloc(1, sizeof(*in)); size_t i = 0; size_t len = array_elem(in->tokens); char *p; int cmd_offset = 0; int numeric; in->orig = xstrdup(buf); if (*buf == ':') { cmd_offset = 1; buf++; } p = buf; while ((p = strchr(p, ':')) != NULL) { if (p[-1] == ' ') { *p++ = '\0'; in->args = p; break; } else p++; } while (i < len && (p = strsep(&buf, " ")) != NULL && *p != '\0') in->tokens[i++] = p; if (i < 1) { debug("invalid input from server: %s", in->orig); free(in->orig); free(in); return (NULL); } in->cmd = in->tokens[cmd_offset]; in->num_tokens = i; numeric = strtol(in->cmd, &p, 10); if (*p == '\0') in->numeric = numeric; else in->numeric = -1; return (in); } static int irc_get_chanmode(irc_session_t *session, struct irc_chan_data *data, char *buf, size_t len) { int ret; char *p; if (len < 2) { buf[0] = '\0'; return (-1); } ret = xstrncpy(buf, data->mode_str, len); if (ret < 0) { buf[0] = '\0'; return (-1); } buf += ret; len -= ret; p = data->mode_str; while (*p != '\0') { if (irc_chanmode_has_arg(session, *p)) { char *arg; arg = irc_get_chanmode_arg(data, *p); if (arg != NULL) { ret = snprintf(buf, len, " %s", arg); if (ret < 0 || (size_t) ret >= len) return (-1); buf += ret; len -= ret; } } p++; } return (0); } static int irc_callback_compare(void *l, void *r) { char *str = l; struct callback_handler *cb = r; return (strcasecmp(str, cb->str)); } static void irc_callback_cleanup(void *p __notused, void *data) { struct callback_handler *cb = data; free(cb->str); free(cb); } int irc_callback_init(irc_session_t *session) { int ret; ret = hash_init(&session->callbacks, 5, irc_callback_compare, irc_callback_cleanup); return (ret); } int irc_callback_clear(irc_session_t *session) { hash_destroy(&session->callbacks); return (0); } int irc_callback_add( irc_session_t *session, char *cmd, int (*handler)(struct pork_acct *, struct irc_input *)) { struct callback_handler *cb; u_int32_t hash; cb = xcalloc(1, sizeof(*cb)); cb->str = xstrdup(cmd); cb->handler = handler; hash = string_hash(cmd, session->callbacks.order); hash_add(&session->callbacks, cb, hash); return (0); } static int irc_handler_err_msg(struct pork_acct *acct, struct irc_input *in) { char *msg; char *str; if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } str = irc_text_filter(in->tokens[3]); if (in->args == NULL) msg = xstrdup("Unknown error"); else msg = irc_text_filter(in->args); screen_err_msg("%s: %s", str, msg); free(str); free(msg); return (0); } static int irc_handler_dcc(struct pork_acct *acct, struct irc_input *in) { char *cmd; char *p; int ret; p = in->args; cmd = strsep(&p, " "); if (cmd == NULL || p == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } in->args = p; if (!strcasecmp(cmd, "SEND")) { ret = irc_handler_dcc_send(acct, in); } else if (!strcasecmp(cmd, "RESUME")) { ret = irc_handler_dcc_resume(acct, in); } else if (!strcasecmp(cmd, "ACCEPT")) { ret = irc_handler_dcc_accept(acct, in); } else { /* add more later */ ret = -1; } return (ret); } static int irc_handler_ctcp_action( struct pork_acct *acct, struct irc_input *in) { char *host; if (in->args == NULL) in->args = ""; host = strchr(in->tokens[0], '!'); if (host != NULL) *host++ = '\0'; if (!strcasecmp(acct->username, in->tokens[2])) pork_recv_action(acct, in->tokens[2], in->tokens[0], host, in->args); else { struct chatroom *chat; char *p; p = in->tokens[2]; while (*p == '@' || *p == '+' || *p == '%') p++; chat = chat_find(acct, p); if (chat == NULL) { debug("action for unjoined chan %s \"%s\"", p, in->orig); return (-1); } chat_recv_action(acct, chat, in->tokens[2], in->tokens[0], host, in->args); } return (1); } static int irc_handler_ctcp_version(struct pork_acct *acct, struct irc_input *in) { char buf[256]; int ret; char *p; ret = snprintf(buf, sizeof(buf), "\x01%s %s %s - http://dev.ojnk.net\x01", in->cmd, PACKAGE_NAME, PACKAGE_VERSION); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); p = strchr(in->tokens[0], '!'); if (p != NULL) *p = '\0'; irc_send_notice(acct->data, in->tokens[0], buf); return (0); } static int irc_handler_ctcp_time( struct pork_acct *acct, struct irc_input *in) { char tbuf[256]; char buf[256]; int ret; time_t time_now = time(NULL); char *p; if (date_to_str(time_now, tbuf, sizeof(tbuf)) == -1) return (-1); ret = snprintf(buf, sizeof(buf), "\x01%s %s\x01", in->cmd, tbuf); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); p = strchr(in->tokens[0], '!'); if (p != NULL) *p = '\0'; irc_send_notice(acct->data, in->tokens[0], buf); return (0); } static int irc_handler_ctcp_echo( struct pork_acct *acct, struct irc_input *in) { char buf[2048]; int ret; char *p; if (in->args == NULL) return (-1); ret = snprintf(buf, sizeof(buf), "\x01" "%s %s\x01", in->cmd, in->args); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); p = strchr(in->tokens[0], '!'); if (p != NULL) *p = '\0'; irc_send_notice(acct->data, in->tokens[0], buf); return (0); } static int irc_handler_print_arg(struct pork_acct *acct, struct irc_input *in) { char *str; if (in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } if (!strncasecmp(in->args, "End of /", 8)) return (0); str = irc_text_filter(in->args); screen_win_msg(cur_window(), 0, 1, 1, MSG_TYPE_CMD_OUTPUT, "%s", str); free(str); return (0); } static int irc_callback_run(irc_session_t *session, struct irc_input *in, char *set) { dlist_t *node; u_int32_t hash; struct callback_handler *cb; if (set == NULL) { hash = string_hash(in->cmd, session->callbacks.order); node = hash_find(&session->callbacks, in->cmd, hash); } else { int ret; char buf[1024]; ret = snprintf(buf, sizeof(buf), "%s %s", set, in->cmd); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); hash = string_hash(buf, session->callbacks.order); node = hash_find(&session->callbacks, buf, hash); } if (node == NULL || node->data == NULL) { if (set == NULL) irc_handler_print_arg(session->data, in); return (0); } cb = node->data; return (cb->handler(session->data, in)); } static ssize_t irc_read_data(int sock, char *buf, size_t len) { int i; ssize_t ret = 0; for (i = 0 ; i < 5 ; i++) { ret = read(sock, buf, len - 1); if (ret == -1) { if (errno == EINTR) continue; debug("sock err: %d:%s", sock, strerror(errno)); return (-1); } if (ret == 0) { debug("sock err: %d:%s", sock, strerror(errno)); return (-1); } buf[ret] = '\0'; return (ret); } return (-1); } /* ** Returns -1 if the connection died, 0 otherwise. */ int irc_input_dispatch(irc_session_t *session) { int ret; char *p; char *cur; struct pork_acct *acct = session->data; ret = irc_read_data(session->sock, &session->input_buf[session->input_offset], sizeof(session->input_buf) - session->input_offset); if (ret < 1) { pork_sock_err(acct, session->sock); return (-1); } cur = session->input_buf; while ((p = strchr(cur, '\n')) != NULL) { struct irc_input *in; char *q; *p++ = '\0'; q = strchr(cur, '\r'); if (q != NULL) *q = '\0'; in = irc_tokenize(cur); if (in == NULL) { debug("invalid input from server: %s", cur); continue; } if (!event_generate(acct->events, EVENT_RECV_RAW, in->cmd, in->orig, acct->refnum)) { irc_callback_run(session, in, NULL); } cur = p; free(in->orig); free(in); } if (*cur != '\0') { size_t leftover; leftover = strlen(cur); /* Move the '\0', too */ memmove(session->input_buf, cur, leftover + 1); session->input_offset = leftover; } else session->input_offset = 0; return (0); } static int irc_handler_001(struct pork_acct *acct, struct irc_input *in) { if (in->num_tokens < 3) { debug("invalid input from server: %s", in->orig); return (-1); } free(acct->server); acct->server = xstrdup(in->tokens[0]); free(acct->username); acct->username = xstrdup(in->tokens[2]); pork_acct_connected(acct); /* Restore away message */ if (acct->away_msg != NULL) irc_set_away(acct->data, acct->away_msg); /* Reset user mode */ if (acct->umode[0] != '\0') { char mode[256]; snprintf(mode, sizeof(mode), "%s +%s", acct->username, acct->umode); irc_send_mode(acct->data, mode); } return (irc_handler_print_arg(acct, in)); } static int irc_handler_print_num(struct pork_acct *acct, struct irc_input *in) { char *str; if (in->args == NULL || in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } str = irc_text_filter(in->args); screen_win_msg(cur_window(), 0, 1, 1, MSG_TYPE_CMD_OUTPUT, "There are %s %s", in->tokens[3], str); free(str); return (0); } static int irc_handler_print_tok(struct pork_acct *acct, struct irc_input *in) { u_int32_t i; char buf[2048]; size_t len = sizeof(buf); u_int32_t off = 0; if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } for (i = 3 ; i < in->num_tokens ; i++) { int ret; ret = snprintf(&buf[off], len, "%s ", in->tokens[i]); if (ret < 0 || (size_t) ret >= len) return (-1); len -= ret; off += ret; } if (off > 0) { char *str; buf[off - 1] = '\0'; str = irc_text_filter(buf); screen_win_msg(cur_window(), 0, 1, 1, MSG_TYPE_CMD_OUTPUT, "%s", str); free(str); } return (0); } static int irc_handler_315(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; struct irc_chan_data *irc_data; if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[3]); if (chat != NULL) { irc_data = chat->data; irc_data->join_complete = 1; } return (0); } static int irc_handler_352(struct pork_acct *acct, struct irc_input *in) { int silent = 0; if (in->num_tokens < 9 || in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } /* Grab userhosts for users in channels we're in if we don't have them. */ if (strcmp(in->tokens[3], "*")) { struct chatroom *chat; chat = chat_find(acct, in->tokens[3]); if (chat != NULL) { struct chat_user *chat_user; struct irc_chan_data *irc_data = chat->data; if (!irc_data->join_complete) silent = 1; chat_user = chat_find_user(acct, chat, in->tokens[7]); if (chat_user != NULL && chat_user->host == NULL) { int ret; char buf[256]; ret = snprintf(buf, sizeof(buf), "%s@%s", in->tokens[4], in->tokens[5]); if (ret > 0 && (size_t) ret < sizeof(buf)) chat_user->host = xstrdup(buf); } } } if (!silent) { int ret; char *info; char buf[2048]; info = strchr(in->args, ' '); if (info != NULL) info++; else info = in->args; info = irc_text_filter(info); ret = snprintf(buf, sizeof(buf), "%s\t%-9s %-3s %s@%s (%s)", in->tokens[3], in->tokens[7], in->tokens[8], in->tokens[4], in->tokens[5], info); free(info); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); screen_win_msg(cur_window(), 0, 0, 0, MSG_TYPE_CMD_OUTPUT, "%s", buf); } return (0); } static int irc_handler_367(struct pork_acct *acct, struct irc_input *in) { char *str; if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } str = str_from_tok(in->orig, 4); if (str == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } screen_win_msg(cur_window(), 0, 0, 0, MSG_TYPE_CMD_OUTPUT, "%s", str); return (0); } static int irc_handler_433(struct pork_acct *acct, struct irc_input *in) { char buf[128]; int ret; irc_handler_err_msg(acct, in); if (acct->connected) { debug("acct not connected"); return (0); } if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } /* ** Try appending a '_' to the end of the nick if we haven't yet ** connected, as per the behavior of almost every other IRC ** client in existence. */ ret = snprintf(buf, sizeof(buf), "%s_", in->tokens[3]); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); pork_change_nick(acct, buf); return (0); } static int irc_handler_353(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; char *p = in->args; char *tok; char buf[2048]; size_t offset = 0; size_t len = sizeof(buf); int ret; int add = 1; char *chat_name; struct imwindow *win = cur_window(); if (in->num_tokens < 5 || in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[4]); if (chat == NULL) add = 0; else win = chat->win; tok = strsep(&p, " "); while (tok != NULL && tok[0] != '\0') { u_int32_t status = 0; while (tok[0] != '\0' && !isalpha(tok[0])) { ret = snprintf(&buf[offset], len, "%c", tok[0]); if (ret < 0 || (size_t) ret >= len) return (-1); switch (tok[0]) { case '@': status |= CHAT_STATUS_OP; break; case '+': status |= CHAT_STATUS_VOICE; break; case '%': status |= CHAT_STATUS_HALFOP; break; } offset += ret; len -= ret; tok++; } if (tok[0] == '\0') return (-1); if (add) { struct chat_user *user; user = chat_user_joined(acct, chat, tok, NULL, 1); if (user == NULL) { user = chat_find_user(acct, chat, tok); add = 0; } if (user != NULL) user->status = status; } ret = snprintf(&buf[offset], len, "%s ", tok); if (ret < 0 || (size_t) ret >= len) return (-1); offset += ret; len -= ret; tok = strsep(&p, " "); } if (offset <= 0) return (0); buf[offset - 1] = '\0'; p = irc_text_filter(buf); chat_name = irc_text_filter(in->tokens[4]); /* XXX */ screen_win_msg(win, 1, 0, 1, MSG_TYPE_CMD_OUTPUT, "Users on %%c%s%%W:%%x %s", chat_name, p); free(p); free(chat_name); return (0); } static int irc_chan_mode_comp(void *l, void *r) { int mode = POINTER_TO_INT(l); struct irc_chan_arg *chat_arg = r; return (mode - chat_arg->arg); } static void irc_chan_mode_cleanup(void *param __notused, void *data) { struct irc_chan_arg *chat_arg = data; free(chat_arg->val); free(chat_arg); } static int irc_handler_join(struct pork_acct *acct, struct irc_input *in) { char *p; char *channel_name; /* I love IRC */ if (in->args == NULL) channel_name = in->tokens[in->num_tokens - 1]; else channel_name = in->args; p = strchr(in->tokens[0], '!'); if (p != NULL) *p++ = '\0'; if (!acct->proto->user_compare(acct->username, in->tokens[0])) { struct imwindow *win; struct irc_chan_data *chat_data; win = imwindow_find_chat_target(acct, channel_name); if (win == NULL) { /* ** Support dircproxy and the like. ** This will result in another JOIN being sent to the server, but ** as far as I know, it's harmless. */ if (chat_join(acct, channel_name) == -1) return (-1); win = imwindow_find_chat_target(acct, channel_name); if (win == NULL) return (-1); } /* ** We don't want to create another one of these if we were ** disconnected and the join message is a result of a rejoin. */ if (win->data == NULL) { struct chatroom *chat; chat = chat_new(acct, channel_name, channel_name, win); if (chat == NULL) return (-1); chat_data = xcalloc(1, sizeof(struct irc_chan_data)); hash_init(&chat_data->mode_args, 2, irc_chan_mode_comp, irc_chan_mode_cleanup); chat->data = chat_data; } else chat_data = ((struct chatroom *) win->data)->data; chat_data->joined = 1; irc_send_mode(acct->data, channel_name); if (!chat_data->join_complete) irc_send_who(acct->data, channel_name); } else { struct chatroom *chat; chat = chat_find(acct, channel_name); if (chat == NULL) return (-1); chat_user_joined(acct, chat, in->tokens[0], p, 0); } return (0); } static int irc_handler_privmsg(struct pork_acct *acct, struct irc_input *in) { char *p; char *host; if (in->num_tokens < 3 || in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } p = strchr(in->tokens[0], '!'); if (p != NULL) *p++ = '\0'; host = p; /* ^A */ if (in->args[0] == 0x01) { char *dest; p = strrchr(&in->args[1], 0x01); if (p == NULL) goto no_ctcp; *p++ = '\0'; in->cmd = &in->args[1]; p = strchr(in->cmd, ' '); if (p != NULL) *p++ = '\0'; in->args = p; if (host != NULL) host[-1] = '!'; if (irc_callback_run(acct->data, in, "CTCP") == 1) return (0); else if (host != NULL) host[-1] = '\0'; /* XXX */ dest = irc_text_filter(in->tokens[2]); if (in->args != NULL) { char *msg; msg = irc_text_filter(in->args); screen_win_msg(cur_window(), 1, 0, 1, MSG_TYPE_CHAT_MSG_RECV, "%%WCTCP%%M %s %%D[%%x%s%%D]%%x from %%C%s%%D(%%c%s%%D)%%x to %%W%s", in->cmd, msg, in->tokens[0], host, dest); free(msg); } else { screen_win_msg(cur_window(), 1, 0, 1, MSG_TYPE_PRIVMSG_RECV, "%%WCTCP%%M %s%%x from %%C%s%%D(%%c%s%%D)%%x to %%W%s", in->cmd, in->tokens[0], host, dest); } free(dest); return (0); } no_ctcp: if (!acct->proto->user_compare(acct->username, in->tokens[2])) pork_recv_msg(acct, in->tokens[2], in->tokens[0], host, in->args, 0); else { struct chatroom *chat; char *p = in->tokens[2]; /* these should be displayed in a way that lets the user know they aren't ordinary privmsgs */ while (*p == '@' || *p == '+' || *p == '%') p++; chat = chat_find(acct, p); if (chat == NULL) { debug("receviced msg for unjoined chan %s \"%s\"", p, in->orig); return (-1); } chat_recv_msg(acct, chat, in->tokens[2], in->tokens[0], host, in->args); } return (0); } static int irc_handler_ping(struct pork_acct *acct, struct irc_input *in) { if (in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } return (irc_send_pong(acct->data, in->args)); } static int irc_handler_311(struct pork_acct *acct, struct irc_input *in) { struct imwindow *win = cur_window(); char *info; if (in->num_tokens < 6) { debug("invalid input from server: %s", in->orig); return (-1); } /* XXX */ screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%D-%%m-%%M-%%W%s%%M-%%D(%%c%s%%W@%%c%s%%D)%%M-%%m-%%D-", in->tokens[3], in->tokens[4], in->tokens[5]); info = irc_text_filter(in->args); screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%D-%%Ci%%crcname%%W:%%x %s", info); free(info); return (0); } static int irc_handler_319(struct pork_acct *acct, struct irc_input *in) { char *chans; if (in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } chans = irc_text_filter(in->args); /* XXX */ screen_win_msg(cur_window(), 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%Cc%%channels%%W:%%x %s", chans); free(chans); return (0); } static int irc_handler_312(struct pork_acct *acct, struct irc_input *in) { char *info; if (in->num_tokens < 5) { debug("invalid input from server: %s", in->orig); return (-1); } /* XXX */ info = irc_text_filter(in->args); screen_win_msg(cur_window(), 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%D-%%m-%%Cs%%cerver%%W:%%x %s %%D(%%x%s%%D)%%x", in->tokens[4], info); free(info); return (0); } static int irc_handler_317(struct pork_acct *acct, struct irc_input *in) { char timebuf[128]; u_int32_t idle_time; u_int32_t temp; struct imwindow *win = cur_window(); time_t signon; char *p; int ret; if (in->num_tokens < 6) { debug("invalid input from server: %s", in->orig); return (-1); } if (str_to_uint(in->tokens[4], &idle_time) != 0) { debug("invalid input from server: %s", in->orig); return (-1); } time_to_str_full(idle_time, timebuf, sizeof(timebuf)); /* XXX */ screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%D-%%m-%%M--%%Ci%%cdle%%W:%%x %s", timebuf); if (str_to_uint(in->tokens[5], &temp) != 0) { debug("invalid input from server: %s", in->orig); return (-1); } signon = (time_t) temp; ret = snprintf(timebuf, sizeof(timebuf), "%s", asctime(localtime(&signon))); if (ret < 0 || (size_t) ret >= sizeof(timebuf)) return (-1); p = strchr(timebuf, '\n'); if (p != NULL) *p = '\0'; screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%D-%%m-%%Cs%%cignon%%W:%%x %s", timebuf); return (0); } static int irc_handler_301(struct pork_acct *acct, struct irc_input *in) { char *msg; msg = irc_text_filter(in->args); /* XXX */ screen_win_msg(cur_window(), 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%D-%%m-%%M--%%Ca%%cway%%W:%%x %s", msg); free(msg); return (0); } static int irc_handler_313(struct pork_acct *acct, struct irc_input *in) { char *msg; if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } if (in->args == NULL) msg = xstrdup("is an IRC operator"); else msg = irc_text_filter(in->args); /* XXX */ screen_win_msg(cur_window(), 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%Co%%cperator%%W:%%x %s %s", in->tokens[3], msg); free(msg); return (0); } static int irc_handler_314(struct pork_acct *acct, struct irc_input *in) { char *info; struct imwindow *win = cur_window(); if (in->num_tokens < 6) { debug("invalid input from server: %s", in->orig); return (-1); } info = irc_text_filter(in->args); /* XXX */ screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%D-%%b-%%B-%%W%s%%B-%%D(%%c%s%%W@%%c%s%%D)%%B-%%D(%%Cw%%cho%%Cw%%cas%%D)%%b-%%D-", in->tokens[3], in->tokens[4], in->tokens[5]); screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%D-%%Ci%%crcname%%W:%%x %s", info); free(info); return (0); } static int irc_handler_nick(struct pork_acct *acct, struct irc_input *in) { char *p; if (in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } p = strchr(in->tokens[0], '!'); if (p != NULL) *p = '\0'; if (!acct->proto->user_compare(acct->username, in->tokens[0])) { free(acct->username); acct->username = xstrdup(in->args); } return (chat_nick_change(acct, in->tokens[0], in->args)); } static int irc_handler_332(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; struct imwindow *win; char *topic; char *chan; if (in->num_tokens < 4 || in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[3]); if (chat != NULL) win = chat->win; else win = cur_window(); chan = irc_text_filter(in->tokens[3]); topic = irc_text_filter(in->args); /* XXX */ screen_win_msg(win, 0, 1, 1, MSG_TYPE_CHAT_STATUS, "Topic for %%c%s%%W:%%x %s", chan, topic); free(chan); free(topic); return (0); } static int irc_handler_221(struct pork_acct *acct, struct irc_input *in) { char *p; if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } if (strcasecmp(acct->username, in->tokens[2])) { debug("umode for other user: %s", in->orig); return (-1); } p = str_from_tok(in->orig, 4); screen_win_msg(cur_window(), 1, 0, 1, MSG_TYPE_STATUS, "Mode for %%c%s%%W:%%x %s", acct->username, p); if (*p == '+') p++; xstrncpy(acct->umode, p, sizeof(acct->umode)); return (0); } static int irc_handler_324(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; struct imwindow *win; char *chan; char *p; if (in->num_tokens < 5) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[3]); if (chat != NULL) win = chat->win; else win = cur_window(); chan = irc_text_filter(in->tokens[3]); p = str_from_tok(in->orig, 5); str_trim(p); /* XXX */ screen_win_msg(win, 1, 0, 1, MSG_TYPE_CHAT_STATUS, "Mode for %%c%s%%W:%%x %s", chan, p); free(chan); if (chat != NULL) { struct irc_chan_data *data = chat->data; u_int32_t arg_num = 5; if (!data->joined) return (1); if (*p == '+') p++; xstrncpy(chat->mode, p, sizeof(chat->mode)); hash_clear(&data->mode_args); p = in->tokens[4]; if (*p == '+') p++; xstrncpy(data->mode_str, p, sizeof(data->mode_str)); while (*p != '\0') { if (irc_chanmode_has_arg(acct->data, *p) && arg_num < in->num_tokens) { struct irc_chan_arg *chat_arg; u_int32_t temp_hash; chat_arg = xcalloc(1, sizeof(*chat_arg)); chat_arg->arg = (u_int32_t) *p; chat_arg->val = xstrdup(in->tokens[arg_num++]); temp_hash = int_hash(chat_arg->arg, data->mode_args.order); hash_add(&data->mode_args, chat_arg, temp_hash); } p++; } } return (0); } static int irc_handler_329(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; struct imwindow *win; int time_set; char buf[64]; char *chan; if (in->num_tokens < 5) { debug("invalid input from server: %s", in->orig); return (-1); } if (str_to_int(in->tokens[4], &time_set) == -1) { debug("invalid input from server: %s", in->orig); return (-1); } if (date_to_str((time_t) time_set, buf, sizeof(buf)) == -1) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[3]); if (chat != NULL) win = chat->win; else win = cur_window(); chan = irc_text_filter(in->tokens[3]); /* XXX */ screen_win_msg(win, 1, 0, 1, MSG_TYPE_CHAT_STATUS, "%%c%s%%x created%%W:%%x %s", chan, buf); free(chan); return (0); } static int irc_handler_302(struct pork_acct *acct, struct irc_input *in) { char *str; char *tok; if (in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } str = in->args; while ((tok = strsep(&str, " ")) != NULL) { char *p; dlist_t *cur; p = strchr(tok, '='); if (p == NULL) continue; if (&p[-1] > tok && p[-1] == '*') p[-1] = '\0'; else *p = '\0'; if (p[1] != '+' && p[1] != '-') continue; if (tok[0] == '\0') continue; p += 2; cur = acct->chat_list; while (cur != NULL) { struct chat_user *user; user = chat_find_user(acct, cur->data, tok); if (user == NULL) continue; free(user->host); user->host = xstrdup(p); cur = cur->next; } } return (0); } static int irc_handler_321(struct pork_acct *acct, struct irc_input *in) { screen_win_msg(cur_window(), 0, 1, 0, MSG_TYPE_CHAT_STATUS, "Channel\t\t\tUsers\t\tTopic"); return (0); } static int irc_handler_322(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; struct imwindow *win; char *title_q; char *topic_q; if (in->num_tokens < 5) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[3]); if (chat != NULL) win = chat->win; else win = cur_window(); title_q = irc_text_filter(in->tokens[3]); topic_q = irc_text_filter(in->args); screen_win_msg(win, 0, 1, 1, MSG_TYPE_CHAT_STATUS, "%s\t\t\t%s\t\t%s", title_q, in->tokens[4], topic_q); free(title_q); free(topic_q); return (0); } static int irc_handler_333(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; struct imwindow *win; int time_set; char buf[64]; char *chan; if (in->num_tokens < 6) { debug("invalid input from server: %s", in->orig); return (-1); } if (str_to_int(in->tokens[5], &time_set) == -1) { debug("invalid input from server: %s", in->orig); return (-1); } if (date_to_str((time_t) time_set, buf, sizeof(buf)) == -1) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[3]); if (chat != NULL) win = chat->win; else win = cur_window(); chan = irc_text_filter(in->tokens[3]); /* XXX */ screen_win_msg(win, 0, 1, 1, MSG_TYPE_CHAT_STATUS, "Topic for %%c%s%%x set by %%c%s%%x on %s", chan, in->tokens[4], buf); free(chan); return (0); } static int irc_handler_005(struct pork_acct *acct, struct irc_input *in) { u_int32_t i; irc_session_t *irc = acct->data; irc_handler_print_tok(acct, in); for (i = 0 ; i < in->num_tokens ; i++) { if (!strcasecmp(in->tokens[i], "WALLCHOPS")) irc->wallchops = 1; else if (!strcasecmp(in->tokens[i], "CAPAB")) irc->capab = 1; else if (!strcasecmp(in->tokens[i], "KNOCK")) irc->knock = 1; else if (!strcasecmp(in->tokens[i], "INVEX")) irc->invex = 1; else if (!strcasecmp(in->tokens[i], "CALLERID")) irc->callerid = 1; else if (!strcasecmp(in->tokens[i], "ETRACE")) irc->etrace = 1; else if (!strcasecmp(in->tokens[i], "SAFELIST")) irc->safelist = 1; else if (!strcasecmp(in->tokens[i], "EXCEPTS")) irc->excepts = 1; else if (!strncasecmp(in->tokens[i], "PREFIX=", 7)) { char *p; char *args; p = in->tokens[i]; if (*p++ != '(') break; args = strchr(p, ')'); if (args == NULL) break; *args++ = '\0'; if (strlen(p) != strlen(args)) break; irc->prefix_types = xstrdup(p); irc->prefix_codes = xstrdup(args); } else if (!strncasecmp(in->tokens[i], "CHANTYPES=", 10)) irc->chantypes = xstrdup(&in->tokens[i][10]); else if (!strncasecmp(in->tokens[i], "NICKLEN=", 8)) str_to_uint(&in->tokens[i][8], &irc->nick_len); else if (!strncasecmp(in->tokens[i], "TOPICLEN=", 9)) str_to_uint(&in->tokens[i][9], &irc->topic_len); else if (!strncasecmp(in->tokens[i], "KICKLEN=", 8)) str_to_uint(&in->tokens[i][8], &irc->kick_len); else if (!strncasecmp(in->tokens[i], "CHANMODES=", 10)) irc->chanmodes = xstrdup(&in->tokens[i][10]); } return (0); } static int irc_handler_notice(struct pork_acct *acct, struct irc_input *in) { char *p; char *host; int ret = 0; if (in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } if (!strcasecmp(in->tokens[0], "NOTICE")) { in->args += 4; return (irc_handler_print_arg(acct, in)); } if (in->num_tokens < 3) { debug("invalid input from server: %s", in->orig); return (-1); } /* Server notice */ p = strchr(in->tokens[0], '!'); if (p == NULL) return (irc_handler_print_arg(acct, in)); *p++ = '\0'; host = p; /* CTCP REPLY */ if (in->args[0] == 0x01) { p = strrchr(&in->args[1], 0x01); if (p != NULL) { char *msg; *p++ = '\0'; in->cmd = &in->args[1]; p = strchr(in->cmd, ' '); if (p != NULL) *p++ = '\0'; in->args = p; if (host != NULL) host[-1] = '!'; if (irc_callback_run(acct->data, in, "CTCP REPLY") == 1) return (0); else if (host != NULL) host[-1] = '\0'; msg = irc_text_filter(in->args); screen_win_msg(cur_window(), 1, 0, 1, MSG_TYPE_NOTICE_RECV, "%%YCTCP REPLY %%G%s %%D[%%x%s %s%%D]%%x from %%C%s%%D(%%c%s%%D)%%x", acct->username, in->cmd, msg, in->tokens[0], host); free(msg); return (0); } } if (!strcasecmp(acct->username, in->tokens[2])) { ret = pork_recv_notice(acct, in->tokens[2], in->tokens[0], host, in->args); } else { struct chatroom *chat; char *p = in->tokens[2]; while (*p == '@' || *p == '+' || *p == '%') p++; chat = chat_find(acct, p); if (chat == NULL) { debug("notice to unjoined chat: %s \"%s\"", p, in->orig); return (-1); } ret = chat_recv_notice(acct, chat, in->tokens[2], in->tokens[0], host, in->args); } return (ret); } static int irc_handler_user_mode(struct pork_acct *acct, struct irc_input *in) { char *p = in->args; char c; int mode; if (in->args[0] != '+' && in->args[0] != '-') { debug("invalid input from server: %s", in->orig); return (-1); } mode = in->args[0]; while ((c = *++p) != '\0') { char *f; if (c == '+' || c == '-') { mode = c; continue; } f = strchr(acct->umode, c); if (mode == MODE_PLUS) { size_t len; if (f != NULL) continue; len = strlen(acct->umode); if (len < sizeof(acct->umode) - 1) { acct->umode[len] = c; acct->umode[len + 1] = '\0'; } } else { size_t len; if (f == NULL) continue; f++; len = strlen(f); memmove(f - 1, f, len + 1); } } /* XXX */ screen_win_msg(cur_window(), 1, 0, 1, MSG_TYPE_STATUS, "Mode %%c%s%%W:%%x %s", acct->username, in->args); return (0); } static int irc_handler_chan_mode(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; char *p; char *mode_str; char c; u_int32_t i; u_int32_t op = MODE_PLUS; struct irc_chan_data *data; chat = chat_find(acct, in->tokens[2]); if (chat == NULL) { debug("chan mode for unjoined chan: %s", in->tokens[2]); return (-1); } data = chat->data; p = strchr(in->tokens[0], '!'); if (p != NULL) *p = '\0'; mode_str = str_from_tok(in->orig, 4); str_trim(mode_str); chat_got_mode(acct, chat, in->tokens[0], mode_str); /* ** Mode arguments start at the 5th token. */ i = 4; p = in->tokens[3]; while ((c = *p++) != '\0') { switch (c) { case '+': case '-': op = c; break; /* ** Ban/ban exception/invite masks are ignored here. */ case 'b': case 'e': case 'I': i++; break; /* ** op/halfop/voice and arguments aren't part of the mode string. */ case 'o': case 'v': case 'h': { struct chat_user *chat_user; chat_user = chat_find_user(acct, chat, in->tokens[i++]); if (chat_user == NULL) break; if (c == 'o') { if (op == MODE_PLUS) chat_user->status |= CHAT_STATUS_OP; else chat_user->status &= ~CHAT_STATUS_OP; } else if (c == 'v') { if (op == MODE_PLUS) chat_user->status |= CHAT_STATUS_VOICE; else chat_user->status &= ~CHAT_STATUS_VOICE; } else { if (op == MODE_PLUS) chat_user->status |= CHAT_STATUS_HALFOP; else chat_user->status &= ~CHAT_STATUS_HALFOP; } break; } default: { char *f; int mode_has_arg = irc_chanmode_has_arg(acct->data, c); if (mode_has_arg) { u_int32_t temp_hash; temp_hash = int_hash((int) c, data->mode_args.order); if (op == MODE_PLUS) { struct irc_chan_arg *chat_arg; /* ** The channel is already +l and then another +l ** with a new limit is sent. */ if (c == 'l') { hash_remove(&data->mode_args, INT_TO_POINTER((int) 'l'),temp_hash); } chat_arg = xcalloc(1, sizeof(*chat_arg)); chat_arg->arg = (int) c; chat_arg->val = xstrdup(in->tokens[i++]); hash_add(&data->mode_args, chat_arg, temp_hash); } else { /* ** The server doesn't send the argument for -l. ** It does for everything else that gets here, ** though, as far as I know.. */ if (c != 'l') i++; hash_remove(&data->mode_args, INT_TO_POINTER((int) c), temp_hash); } } f = strchr(data->mode_str, c); if (op == MODE_PLUS) { if (f == NULL) { size_t len; len = strlen(data->mode_str); if (len < sizeof(data->mode_str) - 1) { data->mode_str[len] = c; data->mode_str[len + 1] = '\0'; } } } else { if (f != NULL) { size_t len; f++; len = strlen(f); memmove(f - 1, f, len + 1); } } } } } irc_get_chanmode(acct->data, chat->data, chat->mode, sizeof(chat->mode)); return (0); } static int irc_handler_mode(struct pork_acct *acct, struct irc_input *in) { if (in->num_tokens < 3) { debug("invalid input from server: %s", in->orig); return (-1); } if (!strcasecmp(in->tokens[2], acct->username)) { if (in->args != NULL) return (irc_handler_user_mode(acct, in)); else if (in->num_tokens > 3) { char *args; args = str_from_tok(in->orig, 4); if (args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } in->args = args; return (irc_handler_user_mode(acct, in)); } return (-1); } if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } return (irc_handler_chan_mode(acct, in)); } static int irc_handler_quit(struct pork_acct *acct, struct irc_input *in) { dlist_t *cur; char *p; if (in->num_tokens < 2) { debug("invalid input from server: %s", in->orig); return (-1); } p = strchr(in->tokens[0], '!'); if (p != NULL) *p = '\0'; for (cur = acct->chat_list ; cur != NULL ; cur = cur->next) { struct chat_user *chat_user; chat_user = chat_find_user(acct, cur->data, in->tokens[0]); if (chat_user != NULL) chat_user_quit(acct, cur->data, chat_user, in->args); } return (0); } static int irc_handler_part(struct pork_acct *acct, struct irc_input *in) { char *p; struct chatroom *chat; int ret = 0; if (in->num_tokens < 3) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[2]); if (chat == NULL) return (-1); p = strchr(in->tokens[0], '!'); if (p == NULL) return (-1); *p++ = '\0'; if (strcasecmp(acct->username, in->tokens[0])) ret = chat_user_left(acct, chat, in->tokens[0], 0); return (ret); } static int irc_handler_kick(struct pork_acct *acct, struct irc_input *in) { struct chatroom *chat; char *msg; char *p; int ret; if (in->num_tokens < 4) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[2]); if (chat == NULL) { debug("kick from unjoined channel: %s \"%s\"", in->tokens[2], in->orig); return (-1); } p = strchr(in->tokens[0], '!'); if (p == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } *p++ = '\0'; if (in->args == NULL) msg = "No reason given"; else msg = in->args; if (!strcasecmp(acct->username, in->tokens[3])) { struct irc_chan_data *data = chat->data; data->joined = 0; ret = chat_forced_leave(acct, chat->title, in->tokens[0], msg); } else ret = chat_user_kicked(acct, chat, in->tokens[3], in->tokens[0], msg); return (ret); } static int irc_handler_topic(struct pork_acct *acct, struct irc_input *in) { char *p; struct chatroom *chat; if (in->num_tokens < 3) { debug("invalid input from server: %s", in->orig); return (-1); } chat = chat_find(acct, in->tokens[2]); if (chat == NULL) { debug("topic for unjoined channel: %s \"%s\"", in->tokens[2], in->orig); return (-1); } p = strchr(in->tokens[0], '!'); if (p != NULL) *p++ = '\0'; return (chat_got_topic(acct, chat, in->tokens[0], in->args)); } static int irc_handler_kill(struct pork_acct *acct, struct irc_input *in) { char *reason; char *userhost; if (in->num_tokens < 3) { debug("invalid input from server: %s", in->orig); return (-1); } if (in->args == NULL) reason = xstrdup("No reason given"); else reason = irc_text_filter(in->args); userhost = strchr(in->tokens[0], '!'); if (userhost != NULL) { *userhost++ = '\0'; screen_win_msg(cur_window(), 1, 1, 1, MSG_TYPE_SIGNOFF, "You have been killed by %%c%s %%D(%%c%s%%D)%%x (%s)", in->tokens[0], userhost, reason); } else { screen_win_msg(cur_window(), 1, 1, 1, MSG_TYPE_SIGNOFF, "You have been killed by %%c%s%%x (%s)", in->tokens[0], reason); } free(reason); return (0); } static int irc_handler_invite(struct pork_acct *acct, struct irc_input *in) { char *p; if (in->num_tokens < 3 || in->args == NULL) { debug("invalid input from server: %s", in->orig); return (-1); } p = strchr(in->tokens[0], '!'); if (p != NULL) *p++ = '\0'; return (chat_got_invite(acct, in->args, in->tokens[0], p, NULL)); } static int irc_handler_ping_reply(struct pork_acct *acct, struct irc_input *in) { int32_t sec = 0; int32_t usec = 0; if (in->args != NULL && sscanf(in->args, "%d %d", &sec, &usec) > 0) { struct timeval tv; float timediff; gettimeofday(&tv, NULL); timediff = (tv.tv_sec - sec) + ((tv.tv_usec - usec) / 1000000.0); /* XXX */ if (timediff >= 0) { char *host; host = strchr(in->tokens[0], '!'); if (host == NULL) return (-1); *host++ = '\0'; screen_win_msg(cur_window(), 1, 0, 1, MSG_TYPE_NOTICE_RECV, "%%YCTCP REPLY %%G%s %%D[%%xPING %f seconds%%D]%%x from %%C%s%%D(%%c%s%%D)%%x", acct->username, timediff, in->tokens[0], host); return (1); } } return (-1); } static int irc_handler_dcc_reply(struct pork_acct *acct, struct irc_input *in) { char *cmd; char *p; int ret; if (in->args == NULL) return (-1); p = in->args; cmd = strsep(&p, " "); if (cmd == NULL || p == NULL) return (-1); in->args = p; if (!strcasecmp(cmd, "REJECT")) { ret = irc_handler_dcc_reject(acct, in); } else { ret = -1; } return (ret); } int irc_callback_add_defaults(irc_session_t *session) { irc_callback_add(session, "004", irc_handler_print_tok); irc_callback_add(session, "252", irc_handler_print_num); irc_callback_add(session, "254", irc_handler_print_num); irc_callback_add(session, "005", irc_handler_005); irc_callback_add(session, "353", irc_handler_353); irc_callback_add(session, "352", irc_handler_352); irc_callback_add(session, "315", irc_handler_315); irc_callback_add(session, "001", irc_handler_001); irc_callback_add(session, "324", irc_handler_324); irc_callback_add(session, "221", irc_handler_221); irc_callback_add(session, "329", irc_handler_329); irc_callback_add(session, "321", irc_handler_321); irc_callback_add(session, "322", irc_handler_322); irc_callback_add(session, "301", irc_handler_301); irc_callback_add(session, "311", irc_handler_311); irc_callback_add(session, "319", irc_handler_319); irc_callback_add(session, "312", irc_handler_312); irc_callback_add(session, "317", irc_handler_317); irc_callback_add(session, "313", irc_handler_313); irc_callback_add(session, "332", irc_handler_332); irc_callback_add(session, "333", irc_handler_333); irc_callback_add(session, "314", irc_handler_314); irc_callback_add(session, "302", irc_handler_302); irc_callback_add(session, "367", irc_handler_367); irc_callback_add(session, "433", irc_handler_433); irc_callback_add(session, "263", irc_handler_err_msg); irc_callback_add(session, "401", irc_handler_err_msg); irc_callback_add(session, "402", irc_handler_err_msg); irc_callback_add(session, "403", irc_handler_err_msg); irc_callback_add(session, "404", irc_handler_err_msg); irc_callback_add(session, "405", irc_handler_err_msg); irc_callback_add(session, "406", irc_handler_err_msg); irc_callback_add(session, "407", irc_handler_err_msg); irc_callback_add(session, "408", irc_handler_err_msg); irc_callback_add(session, "413", irc_handler_err_msg); irc_callback_add(session, "414", irc_handler_err_msg); irc_callback_add(session, "415", irc_handler_err_msg); irc_callback_add(session, "421", irc_handler_err_msg); irc_callback_add(session, "423", irc_handler_err_msg); irc_callback_add(session, "432", irc_handler_err_msg); irc_callback_add(session, "437", irc_handler_err_msg); irc_callback_add(session, "442", irc_handler_err_msg); irc_callback_add(session, "444", irc_handler_err_msg); irc_callback_add(session, "461", irc_handler_err_msg); irc_callback_add(session, "467", irc_handler_err_msg); irc_callback_add(session, "471", irc_handler_err_msg); irc_callback_add(session, "472", irc_handler_err_msg); irc_callback_add(session, "473", irc_handler_err_msg); irc_callback_add(session, "474", irc_handler_err_msg); irc_callback_add(session, "475", irc_handler_err_msg); irc_callback_add(session, "476", irc_handler_err_msg); irc_callback_add(session, "477", irc_handler_err_msg); irc_callback_add(session, "482", irc_handler_err_msg); irc_callback_add(session, "JOIN", irc_handler_join); irc_callback_add(session, "PRIVMSG", irc_handler_privmsg); irc_callback_add(session, "NOTICE", irc_handler_notice); irc_callback_add(session, "MODE", irc_handler_mode); irc_callback_add(session, "PING", irc_handler_ping); irc_callback_add(session, "NICK", irc_handler_nick); irc_callback_add(session, "QUIT", irc_handler_quit); irc_callback_add(session, "PART", irc_handler_part); irc_callback_add(session, "KICK", irc_handler_kick); irc_callback_add(session, "TOPIC", irc_handler_topic); irc_callback_add(session, "INVITE", irc_handler_invite); irc_callback_add(session, "KILL", irc_handler_kill); irc_callback_add(session, "CTCP FINGER", irc_handler_ctcp_version); irc_callback_add(session, "CTCP CLIENTINFO", irc_handler_ctcp_version); irc_callback_add(session, "CTCP USERINFO", irc_handler_ctcp_version); irc_callback_add(session, "CTCP VERSION", irc_handler_ctcp_version); irc_callback_add(session, "CTCP TIME", irc_handler_ctcp_time); irc_callback_add(session, "CTCP PING", irc_handler_ctcp_echo); irc_callback_add(session, "CTCP ECHO", irc_handler_ctcp_echo); irc_callback_add(session, "CTCP ACTION", irc_handler_ctcp_action); irc_callback_add(session, "CTCP DCC", irc_handler_dcc); irc_callback_add(session, "CTCP REPLY DCC", irc_handler_dcc_reply); irc_callback_add(session, "CTCP REPLY PING", irc_handler_ping_reply); return (0); } pork-0.99.8.1/src/protocols/irc/pork_irc_output.c0000644000175000017500000002471110234217335021670 0ustar ryanryan00000000000000/* ** pork_irc_output.c ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static int irc_send_server(int sock, char *cmd, size_t len) { return (sock_write(sock, cmd, len)); } static int irc_send(irc_session_t *session, char *command, size_t len) { int ret; if (session->sock < 0) { struct irc_cmd_q *cmd = xmalloc(sizeof(*cmd)); cmd->cmd = xstrdup(command); cmd->len = len; if (queue_add(session->outq, cmd) != 0) { screen_err_msg("Error: %s: Error adding IRC command to the outbound queue.", ((struct pork_acct *) session->data)->username); free(cmd->cmd); free(cmd); return (-1); } return (0); } ret = irc_send_server(session->sock, command, len); if (ret == -1) pork_sock_err(session->data, session->sock); return (ret); } int irc_flush_outq(irc_session_t *session) { struct irc_cmd_q *cmd; int ret = 0; while ((cmd = queue_get(session->outq)) != NULL) { if (irc_send_server(session->sock, cmd->cmd, cmd->len) > 0) { ret++; free(cmd->cmd); free(cmd); } else { debug("adding %s back to the queue", cmd->cmd); queue_putback_head(session->outq, cmd); } } return (ret); } int irc_connect(struct pork_acct *acct, const char *server, int *sock) { struct sockaddr_storage ss; struct sockaddr_storage local; in_port_t port_num; char *irchost = getenv("IRCHOST"); char *port; char buf[IRC_OUT_BUFLEN]; char *passwd = NULL; if (server == NULL || xstrncpy(buf, server, sizeof(buf)) == -1) return (-1); memset(&ss, 0, sizeof(ss)); memset(&local, 0, sizeof(local)); port = strchr(buf, ':'); if (port != NULL) { *port++ = '\0'; passwd = strchr(port, ':'); if (passwd != NULL) { *passwd++ = '\0'; } } else port = DEFAULT_IRC_PORT; if (get_port(port, &port_num) != 0) { screen_err_msg("Error: %s: Invalid IRC server port: %s", acct->username, port); memset(buf, 0, sizeof(buf)); return (-1); } if (get_addr(buf, &ss) != 0) { screen_err_msg("Error: %s: Invalid IRC server host: %s", acct->username, buf); memset(buf, 0, sizeof(buf)); return (-1); } if (irchost != NULL) { if (get_addr(irchost, &local) != 0) { screen_err_msg("Error: %s: Invalid local hostname: %s", acct->username, irchost); memcpy(&local, &acct->laddr, sizeof(local)); } } else memcpy(&local, &acct->laddr, sizeof(local)); free(acct->fport); acct->fport = xstrdup(port); free(acct->server); acct->server = xstrdup(buf); if (passwd != NULL && passwd[0] != '\0') { free_str_wipe(acct->passwd); acct->passwd = xstrdup(passwd); } sin_set_port(&local, acct->lport); memset(buf, 0, sizeof(buf)); return (nb_connect(&ss, &local, port_num, sock)); } int irc_send_raw(irc_session_t *session, char *str) { int ret; char *buf; size_t len; len = strlen(str) + 3; buf = xmalloc(len); snprintf(buf, len, "%s\r\n", str); ret = irc_send(session, buf, len - 1); free(buf); return (ret); } int irc_send_mode(irc_session_t *session, char *mode_str) { int ret; char buf[IRC_OUT_BUFLEN]; ret = snprintf(buf, sizeof(buf), "MODE %s\r\n", mode_str); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_pong(irc_session_t *session, char *dest) { char buf[IRC_OUT_BUFLEN]; int ret; ret = snprintf(buf, sizeof(buf), "PONG %s\r\n", dest); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_set_away(irc_session_t *session, char *msg) { char buf[IRC_OUT_BUFLEN]; int ret; if (msg != NULL) ret = snprintf(buf, sizeof(buf), "AWAY :%s\r\n", msg); else ret = snprintf(buf, sizeof(buf), "AWAY\r\n"); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_invite(irc_session_t *session, char *channel, char *user) { char buf[IRC_OUT_BUFLEN]; int ret; ret = snprintf(buf, sizeof(buf), "INVITE %s %s\r\n", user, channel); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_join(irc_session_t *session, char *channel, char *key) { char buf[IRC_OUT_BUFLEN]; int ret; if (key != NULL) ret = snprintf(buf, sizeof(buf), "JOIN %s %s\r\n", channel, key); else ret = snprintf(buf, sizeof(buf), "JOIN %s\r\n", channel); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_login(irc_session_t *session) { char buf[IRC_OUT_BUFLEN]; struct pork_acct *acct = session->data; int ret; if (acct->passwd != NULL) { ret = snprintf(buf, sizeof(buf), "PASS %s\r\n", acct->passwd); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); ret = irc_send(session, buf, ret); if (ret == -1) return (-1); } ret = snprintf(buf, sizeof(buf), "NICK %s\r\n", acct->username); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); ret = irc_send(session, buf, ret); if (ret == -1) return (-1); ret = snprintf(buf, sizeof(buf), "USER %s ojnk ojnk :%s\r\n", acct->username, acct->profile); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_privmsg(irc_session_t *session, char *dest, char *msg) { char buf[IRC_OUT_BUFLEN]; int ret; ret = snprintf(buf, sizeof(buf), "PRIVMSG %s :%s\r\n", dest, msg); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_ctcp(irc_session_t *session, char *dest, char *msg) { char buf[IRC_OUT_BUFLEN]; int ret; if (!strcmp(dest, "*")) dest = cur_window()->target; ret = snprintf(buf, sizeof(buf), "PRIVMSG %s :\x01%s\x01\r\n", dest, msg); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_ping(irc_session_t *session, char *str) { char buf[IRC_OUT_BUFLEN]; int ret; struct timeval tv; gettimeofday(&tv, NULL); ret = snprintf(buf, sizeof(buf), "PING %ld %ld", tv.tv_sec, tv.tv_usec); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send_ctcp(session, str, buf)); } int irc_send_ctcp_reply(irc_session_t *session, char *dest, char *msg) { char buf[IRC_OUT_BUFLEN]; int ret; ret = snprintf(buf, sizeof(buf), "NOTICE %s :\x01%s\x01\r\n", dest, msg); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_names(irc_session_t *session, char *chan) { char buf[IRC_OUT_BUFLEN]; int ret; if (chan != NULL) ret = snprintf(buf, sizeof(buf), "NAMES :%s\r\n", chan); else ret = snprintf(buf, sizeof(buf), "NAMES\r\n"); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_who(irc_session_t *session, char *dest) { char buf[IRC_OUT_BUFLEN]; int ret; if (dest != NULL) ret = snprintf(buf, sizeof(buf), "WHO :%s\r\n", dest); else ret = snprintf(buf, sizeof(buf), "WHO\r\n"); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_whois(irc_session_t *session, char *dest) { char buf[IRC_OUT_BUFLEN]; int ret; struct pork_acct *acct = session->data; if (dest == NULL) dest = acct->username; ret = snprintf(buf, sizeof(buf), "WHOIS %s\r\n", dest); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_whowas(irc_session_t *session, char *dest) { char buf[IRC_OUT_BUFLEN]; int ret; struct pork_acct *acct = session->data; if (dest == NULL) dest = acct->username; ret = snprintf(buf, sizeof(buf), "WHOWAS %s\r\n", dest); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_nick(irc_session_t *session, char *nick) { char buf[IRC_OUT_BUFLEN]; int ret; if (nick == NULL) return (-1); ret = snprintf(buf, sizeof(buf), "NICK :%s\r\n", nick); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_part(irc_session_t *session, char *chan) { char buf[IRC_OUT_BUFLEN]; int ret; if (chan == NULL) return (-1); ret = snprintf(buf, sizeof(buf), "PART %s\r\n", chan); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_quit(irc_session_t *session, char *reason) { char buf[IRC_OUT_BUFLEN]; int ret; if (reason == NULL) reason = DEFAULT_IRC_QUITMSG; ret = snprintf(buf, sizeof(buf), "QUIT :%s\r\n", reason); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); pork_io_del(session); return (irc_send(session, buf, ret)); } int irc_send_notice(irc_session_t *session, char *dest, char *msg) { char buf[IRC_OUT_BUFLEN]; int ret; ret = snprintf(buf, sizeof(buf), "NOTICE %s :%s\r\n", dest, msg); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_kick(irc_session_t *session, char *chan, char *nick, char *msg) { char buf[IRC_OUT_BUFLEN]; int ret; ret = snprintf(buf, sizeof(buf), "KICK %s %s :%s\r\n", chan, nick, msg); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_topic(irc_session_t *session, char *chan, char *topic) { char buf[IRC_OUT_BUFLEN]; int ret; if (topic != NULL) ret = snprintf(buf, sizeof(buf), "TOPIC %s :%s\r\n", chan, topic); else ret = snprintf(buf, sizeof(buf), "TOPIC %s\r\n", chan); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send(session, buf, ret)); } int irc_send_action(irc_session_t *session, char *dest, char *msg) { char buf[IRC_OUT_BUFLEN]; int ret; if (dest == NULL || msg == NULL) return (-1); ret = snprintf(buf, sizeof(buf), "ACTION %s", msg); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send_ctcp(session, dest, buf)); } pork-0.99.8.1/src/protocols/irc/Makefile.am0000644000175000017500000000042310234217335020322 0ustar ryanryan00000000000000INCLUDES = -I. -I.. -I../.. -I../../.. -I../../missing AM_CFLAGS = $(DEBUG_CFLAGS) $(PERL_CFLAGS) noinst_LIBRARIES = libirc.a libirc_a_SOURCES = \ pork_irc.c \ pork_irc_dcc.c \ pork_irc_input.c \ pork_irc_output.c noinst_HEADERS = \ pork_irc.h \ pork_irc_dcc.h pork-0.99.8.1/src/protocols/irc/Makefile.in0000644000175000017500000003064410236222654020345 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SOURCES = $(libirc_a_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = src/protocols/irc DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libirc_a_AR = $(AR) $(ARFLAGS) libirc_a_LIBADD = am_libirc_a_OBJECTS = pork_irc.$(OBJEXT) pork_irc_dcc.$(OBJEXT) \ pork_irc_input.$(OBJEXT) pork_irc_output.$(OBJEXT) libirc_a_OBJECTS = $(am_libirc_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/pork_irc.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_irc_dcc.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_irc_input.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pork_irc_output.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libirc_a_SOURCES) DIST_SOURCES = $(libirc_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ INCLUDES = -I. -I.. -I../.. -I../../.. -I../../missing AM_CFLAGS = $(DEBUG_CFLAGS) $(PERL_CFLAGS) noinst_LIBRARIES = libirc.a libirc_a_SOURCES = \ pork_irc.c \ pork_irc_dcc.c \ pork_irc_input.c \ pork_irc_output.c noinst_HEADERS = \ pork_irc.h \ pork_irc_dcc.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/protocols/irc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/protocols/irc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libirc.a: $(libirc_a_OBJECTS) $(libirc_a_DEPENDENCIES) -rm -f libirc.a $(libirc_a_AR) libirc.a $(libirc_a_OBJECTS) $(libirc_a_LIBADD) $(RANLIB) libirc.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_irc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_irc_dcc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_irc_input.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pork_irc_output.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/src/protocols/irc/pork_irc_dcc.c0000644000175000017500000002215010234217335021054 0ustar ryanryan00000000000000/* ** pork_irc_dcc.c ** Copyright (C) 2004-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void irc_dcc_send_handler_connected(int fd, u_int32_t cond, void *data) { struct file_transfer *xfer = data; pork_io_del(data); pork_io_add(fd, IO_COND_READ, xfer, xfer, transfer_recv_data); transfer_recv_accepted(xfer); } static void irc_file_send_ready(int fd, u_int32_t cond, void *data) { struct file_transfer *xfer = data; struct dcc *dcc = xfer->data; if (cond & IO_COND_READ) { u_int32_t offset; if (read(fd, &offset, 4) != 4) { pork_io_del(xfer); close(fd); transfer_lost(xfer); return; } else { dcc->ack = ntohl(offset); time(&dcc->last_active); } } if (cond & IO_COND_WRITE) { if (xfer->bytes_sent + xfer->start_offset < xfer->file_len) transfer_send_data(fd, cond, xfer); /* ** Close the connection only after they've acked everything. ** If our peer messes up and acks it all before it has it all, ** it's its own fault. */ if (dcc->ack >= xfer->file_len) { pork_io_del(xfer); close(fd); transfer_send_complete(xfer); } } if (cond & IO_COND_DEAD) { pork_io_del(xfer); close(fd); transfer_lost(xfer); } } static void irc_file_send_peer_connected(int fd, u_int32_t cond, void *data) { struct file_transfer *xfer = data; int sock; socklen_t len = sin_len(&xfer->laddr); pork_io_del(xfer); sock = accept(fd, (struct sockaddr *) &xfer->faddr, &len); close(fd); if (sock == -1) { screen_err_msg("Error accepting connection: %s", strerror(errno)); transfer_abort(xfer); } /* ** Let the user figure out whether the connection is from the right person. */ get_ip(&xfer->faddr, xfer->faddr_ip, sizeof(xfer->faddr_ip)); xfer->fport = ntohs(sin_port(&xfer->faddr)); xfer->sock = sock; pork_io_add(xfer->sock, IO_COND_RW, xfer, xfer, irc_file_send_ready); transfer_send_accepted(xfer); } int irc_file_abort(struct file_transfer *xfer) { if (!(xfer->protocol_flags & IRC_DCC_REJECTED) && xfer->status == TRANSFER_STATUS_WAITING) { int ret; char buf[4096]; if (xfer->type == TRANSFER_DIR_SEND) { ret = snprintf(buf, sizeof(buf), (xfer->quote_fname ? "DCC REJECT GET \"%s\"" : "DCC REJECT GET %s"), xfer->fname_base); } else { ret = snprintf(buf, sizeof(buf), (xfer->quote_fname ? "DCC REJECT SEND \"%s\"" : "DCC REJECT SEND %s"), xfer->fname_base); } if (ret > 0 && (size_t) ret < sizeof(buf)) irc_send_ctcp_reply(xfer->acct->data, xfer->peer_username, buf); } pork_io_del(xfer); close(xfer->sock); free(xfer->data); return (0); } int irc_file_accept(struct file_transfer *xfer) { int ret; int sock = -1; struct dcc *dcc; ret = nb_connect(&xfer->faddr, &xfer->laddr, xfer->fport, &sock); xfer->sock = sock; if (ret == 0) { close(sock); transfer_lost(xfer); return (-1); } else if (ret == -EINPROGRESS) { pork_io_add(sock, IO_COND_WRITE, xfer, xfer, irc_dcc_send_handler_connected); } else { screen_err_msg("Error connecting to %s:%d (%s)", xfer->faddr_ip, xfer->fport, strerror(errno)); transfer_abort(xfer); return (-1); } dcc = xcalloc(1, sizeof(*dcc)); xfer->data = dcc; return (0); } int irc_file_send(struct file_transfer *xfer) { char buf[4096]; struct dcc *dcc; irc_session_t *session = xfer->acct->data; if (transfer_bind_listen_sock(xfer, session->sock) == -1) { screen_err_msg("Unable to bind a listening socket -- aborting transfer"); transfer_abort(xfer); return (-1); } pork_io_add(xfer->sock, IO_COND_RW, xfer, xfer, irc_file_send_peer_connected); /* Only ipv4 support for now. */ snprintf(buf, sizeof(buf), (xfer->quote_fname ? "DCC SEND \"%s\" %u %hu %llu" : "DCC SEND %s %u %hu %llu"), xfer->fname_base, htonl(SIN4(&xfer->laddr)->sin_addr.s_addr), xfer->lport, xfer->file_len); dcc = xcalloc(1, sizeof(*dcc)); xfer->data = dcc; irc_send_ctcp(session, xfer->peer_username, buf); transfer_request_send(xfer); return (0); } int irc_recv_data(struct file_transfer *xfer, char *buf, size_t len) { u_int32_t offset; struct dcc *dcc = xfer->data; time(&dcc->last_active); offset = htonl(xfer->bytes_sent); if (sock_write(xfer->sock, &offset, 4) != 4) { close(xfer->sock); transfer_lost(xfer); return (-1); } if (xfer->bytes_sent + xfer->start_offset >= xfer->file_len) { pork_io_del(xfer); close(xfer->sock); transfer_recv_complete(xfer); } return (0); } int irc_handler_dcc_send(struct pork_acct *acct, struct irc_input *in) { char *p; char *filename; char *addr; char *temp; u_int32_t fport; u_int32_t filelen; struct file_transfer *xfer; char *host; host = strchr(in->tokens[0], '!'); if (host != NULL) *host++ = '\0'; if (in->args[0] == '\"') { p = terminate_quote(&in->args[1]); if (p == NULL || p[0] != ' ') return (-1); p++; filename = &in->args[1]; } else { p = in->args; filename = strsep(&p, " "); if (filename == NULL) return (-1); } if (filename[0] == '\0') return (-1); addr = strsep(&p, " "); if (addr == NULL) return (-1); temp = strsep(&p, " "); if (temp == NULL) return (-1); if (str_to_uint(temp, &fport) == -1) return (-1); temp = strsep(&p, " "); if (temp == NULL) return (-1); if (str_to_uint(temp, &filelen) == -1) return (-1); /* ** If p is not null or not empty, it points to ** a an optional checksum. Ignore it for now. */ xfer = transfer_new(acct, in->tokens[0], TRANSFER_DIR_RECV, filename, filelen); if (xfer == NULL) return (-1); xfer->fport = fport; if (get_addr(addr, &xfer->faddr) == -1) { debug("aborting xfer %u", xfer->refnum); transfer_abort(xfer); return (-1); } else { get_ip(&xfer->faddr, xfer->faddr_ip, sizeof(xfer->faddr_ip)); sin_set_port(&xfer->faddr, htons(fport)); } memcpy(&xfer->laddr, &acct->laddr, sizeof(xfer->laddr)); get_ip(&xfer->laddr, xfer->laddr_ip, sizeof(xfer->laddr_ip)); transfer_request_recv(xfer); return (1); } int irc_handler_dcc_resume(struct pork_acct *acct, struct irc_input *in) { char *p; char *filename; char *q; int temp; in_port_t port; off_t position; struct file_transfer *xfer = NULL; char buf[1024]; dlist_t *cur; int ret; char *host; host = strchr(in->tokens[0], '!'); if (host != NULL) *host++ = '\0'; if (in->args[0] == '\"') { p = terminate_quote(&in->args[1]); if (p == NULL || p[0] != ' ') return (-1); p++; filename = &in->args[1]; } else { p = in->args; filename = strsep(&p, " "); if (filename == NULL) return (-1); } q = strsep(&p, " "); if (q == NULL || p == NULL) return (-1); if (str_to_int(q, &temp) == -1) return (-1); if (temp < 0) return (-1); port = temp; if (str_to_int(p, &temp) == -1) return (-1); if (temp < 0) return (-1); position = temp; for (cur = acct->transfer_list ; cur != NULL ; cur = cur->next) { struct file_transfer *txfer = cur->data; if (!strcasecmp(txfer->peer_username, in->tokens[0]) && txfer->lport == port) { xfer = txfer; break; } } if (xfer == NULL) return (-1); if (transfer_resume(xfer, position) == -1) { debug("aborting xfer %u", xfer->refnum); transfer_abort(xfer); return (-1); } ret = snprintf(buf, sizeof(buf), (xfer->quote_fname ? "DCC ACCEPT \"%s\" %hu %lld" : "DCC ACCEPT %s %hu %lld"), filename, port, position); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); irc_send_ctcp(acct->data, xfer->peer_username, buf); return (1); } int irc_handler_dcc_accept(struct pork_acct *acct, struct irc_input *in) { /* PRIVMSG User2 :DCC ACCEPT filename port position */ return (-1); } int irc_handler_dcc_reject(struct pork_acct *acct, struct irc_input *in) { char *type; char *p; char *host; host = strchr(in->tokens[0], '!'); if (host != NULL) *host++ = '\0'; p = in->args; type = strsep(&p, " "); if (type == NULL || p == NULL || p[0] == '\0') return (-1); if (!strcasecmp(type, "GET") || !strcasecmp(type, "SEND")) { struct file_transfer *xfer; if (p[0] == '\"') { if (terminate_quote(&p[1]) == NULL) return (-1); } else { char *end; end = strchr(p, ' '); if (end != NULL) *end = '\0'; } if (p[0] == '\0') return (-1); xfer = transfer_find(acct, in->tokens[0], p); if (xfer == NULL) { debug("unknown transfer %s/%s", in->tokens[0], p); return (-1); } xfer->protocol_flags |= IRC_DCC_REJECTED; if (transfer_cancel_remote(xfer) == 0) return (1); return (-1); } return (-1); } pork-0.99.8.1/src/protocols/irc/pork_irc_dcc.h0000644000175000017500000000163110234217335021062 0ustar ryanryan00000000000000/* ** pork_irc_dcc.h ** Copyright (C) 2004-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_IRC_DCC_H #define __PORK_IRC_DCC_H #define IRC_DCC_REJECTED 0x01 int irc_file_accept(struct file_transfer *xfer); int irc_file_abort(struct file_transfer *xfer); int irc_recv_data(struct file_transfer *xfer, char *buf, size_t len); int irc_file_send(struct file_transfer *xfer); int irc_handler_dcc_send(struct pork_acct *acct, struct irc_input *in); int irc_handler_dcc_reject(struct pork_acct *acct, struct irc_input *in); int irc_handler_dcc_resume(struct pork_acct *acct, struct irc_input *in); int irc_handler_dcc_accept(struct pork_acct *acct, struct irc_input *in); struct dcc { time_t last_active; off_t ack; }; #endif pork-0.99.8.1/src/protocols/irc/pork_irc.c0000644000175000017500000004360210234217336020251 0ustar ryanryan00000000000000/* ** pork_irc.c ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define HIGHLIGHT_BOLD 0x01 #define HIGHLIGHT_UNDERLINE 0x02 #define HIGHLIGHT_INVERSE 0x04 static void irc_event(int sock, u_int32_t cond, void *data) { if (cond & IO_COND_READ) { if (irc_input_dispatch(data) == -1) { irc_session_t *session = data; struct pork_acct *acct = session->data; pork_sock_err(acct, sock); pork_io_del(data); pork_acct_disconnected(acct); return; } } irc_flush_outq(data); } static void irc_connected(int sock, u_int32_t cond, void *data) { int ret; irc_session_t *session = data; pork_io_del(data); ret = sock_is_error(sock); if (ret != 0) { struct pork_acct *acct = session->data; char *errstr = strerror(ret); screen_err_msg("network error: %s: %s", acct->username, errstr); close(sock); pork_acct_disconnected(acct); } else { session->sock = sock; sock_setflags(sock, 0); pork_io_add(sock, IO_COND_READ, data, data, irc_event); irc_callback_add_defaults(session); irc_send_login(session); } } static int irc_init(struct pork_acct *acct) { irc_session_t *session = xcalloc(1, sizeof(*session)); char *ircname; ircname = getenv("IRCNAME"); if (ircname != NULL) acct->profile = xstrdup(ircname); else { if (acct->profile == NULL) acct->profile = xstrdup(DEFAULT_IRC_PROFILE); } irc_callback_init(session); session->outq = queue_new(0); session->inq = queue_new(0); session->sock = -1; session->data = acct; acct->data = session; return (0); } static int irc_free(struct pork_acct *acct) { irc_session_t *session = acct->data; u_int32_t i; for (i = 0 ; i < session->num_servers ; i++) free_str_wipe(session->servers[i]); free(session->chanmodes); free(session->chantypes); free(session->prefix_types); free(session->prefix_codes); irc_callback_clear(session); queue_destroy(session->inq, free); queue_destroy(session->outq, free); pork_io_del(session); free(session); return (0); } static inline int irc_is_chan_type(irc_session_t *session, char c) { return (strchr(session->chantypes, c) != NULL); } static inline int irc_is_chan_prefix(irc_session_t *session, char c) { return (session->prefix_codes != NULL && strchr(session->prefix_codes, c) != NULL); } static int irc_update(struct pork_acct *acct) { irc_session_t *session = acct->data; time_t time_now; if (session == NULL) return (-1); time(&time_now); if (session->last_update + 120 <= time_now && acct->connected) { irc_send_pong(session, acct->server); session->last_update = time_now; } return (0); } static int irc_read_config(struct pork_acct *acct) { return (0); } static int irc_write_config(struct pork_acct *acct) { return (0); } static u_int32_t irc_add_servers(struct pork_acct *acct, char *str) { char *server; irc_session_t *session = acct->data; while ((server = strsep(&str, " ")) != NULL && session->num_servers < array_elem(session->servers)) { session->servers[session->num_servers++] = xstrdup(server); } return (session->num_servers); } static int irc_do_connect(struct pork_acct *acct, char *args) { irc_session_t *session = acct->data; int sock; int ret; if (args == NULL) { screen_err_msg("Error: IRC: Syntax is /connect -irc [:[:]] ... [:[:]]"); return (-1); } if (irc_add_servers(acct, args) < 1) { screen_err_msg("Error: %s: No server specified", acct->username); return (-1); } ret = irc_connect(acct, session->servers[0], &sock); if (ret == 0) irc_connected(sock, 0, session); else if (ret == -EINPROGRESS) pork_io_add(sock, IO_COND_WRITE, session, session, irc_connected); else return (-1); return (0); } static int irc_connect_abort(struct pork_acct *acct) { irc_session_t *session = acct->data; close(session->sock); pork_io_del(session); return (0); } static int irc_reconnect(struct pork_acct *acct, char *args __notused) { int sock; int ret; irc_session_t *session = acct->data; u_int32_t server_num; server_num = (acct->reconnect_tries - 1) % session->num_servers; ret = irc_connect(acct, session->servers[server_num], &sock); if (ret == 0) { irc_connected(sock, 0, session); } else if (ret == -EINPROGRESS) pork_io_add(sock, IO_COND_WRITE, session, session, irc_connected); else return (-1); return (0); } static int irc_join(struct pork_acct *acct, char *chan, char *args) { return (irc_send_join(acct->data, chan, args)); } static int irc_privmsg(struct pork_acct *acct, char *dest, char *msg) { char *p; /* XXX - fix this */ p = strchr(dest, ','); if (p != NULL) *p = '\0'; return (irc_send_privmsg(acct->data, dest, msg)); } static int irc_mode(struct pork_acct *acct, char *str) { return (irc_send_mode(acct->data, str)); } static int irc_ctcp(struct pork_acct *acct, char *dest, char *msg) { return (irc_send_ctcp(acct->data, dest, msg)); } static int irc_chan_send( struct pork_acct *acct, struct chatroom *chat, char *target, char *msg) { return (irc_send_privmsg(acct->data, target, msg)); } static int chat_find_compare_cb(void *l, void *r) { char *str = l; struct chatroom *chat = r; return (strcasecmp(str, chat->title)); } static struct chatroom *irc_find_chat(struct pork_acct *acct, char *chat) { dlist_t *node; irc_session_t *session = acct->data; while (irc_is_chan_prefix(session, *chat)) chat++; if (session->chantypes != NULL && !irc_is_chan_type(session, *chat)) return (NULL); node = dlist_find(acct->chat_list, chat, chat_find_compare_cb); if (node == NULL) return (NULL); return (node->data); } static int irc_whois(struct pork_acct *acct, char *dest) { char *p; while ((p = strsep(&dest, ",")) != NULL) irc_send_whois(acct->data, p); return (0); } static int irc_whowas(struct pork_acct *acct, char *dest) { char *p; while ((p = strsep(&dest, ",")) != NULL) irc_send_whowas(acct->data, p); return (0); } static int irc_chan_get_name( const char *str, char *buf, size_t len, char *arg_buf, size_t arg_len) { char *p; if (xstrncpy(buf, str, len) == -1) { debug("xstrncpy failed: %s", str); return (-1); } p = strchr(buf, ','); if (p != NULL) *p = '\0'; p = strchr(buf, ' '); if (p != NULL) *p++ = '\0'; if (p != NULL) { if (xstrncpy(arg_buf, p, arg_len) == -1) return (-1); } else arg_buf[0] = '\0'; return (0); } static int irc_change_nick(struct pork_acct *acct, char *nick) { irc_session_t *irc = acct->data; if (irc->nick_len) { if (strlen(nick) > irc->nick_len) { screen_err_msg("Error: Nick is too long. Maximum length is %d", irc->nick_len); return (-1); } } if (!acct->connected) { free(acct->username); acct->username = xstrdup(nick); } return (irc_send_nick(acct->data, nick)); } static int irc_part(struct pork_acct *acct, struct chatroom *chat) { return (irc_send_part(acct->data, chat->title)); } static int irc_chan_users(struct pork_acct *acct, struct chatroom *chat) { return (irc_send_names(acct->data, chat->title)); } static int irc_chan_kick( struct pork_acct *acct, struct chatroom *chat, char *user, char *reason) { if (reason == NULL) reason = "No reason given"; return (irc_send_kick(acct->data, chat->title, user, reason)); } static int irc_chan_ban( struct pork_acct *acct, struct chatroom *chat, char *user) { struct chat_user *chat_user; char buf[1024]; int ret = -1; chat_user = chat_find_user(acct, chat, user); if (chat_user != NULL && chat_user->host != NULL) { ret = snprintf(buf, sizeof(buf), "%s +b *!%s", chat->title, chat_user->host); } else ret = snprintf(buf, sizeof(buf), "%s +b %s", chat->title, user); if (ret < 0 || (size_t) ret >= sizeof(buf)) return (-1); return (irc_send_mode(acct->data, buf)); } static int irc_chan_notice( struct pork_acct *acct, struct chatroom *chat, char *target, char *msg) { return (irc_send_notice(acct->data, target, msg)); } static int irc_chan_who(struct pork_acct *acct, struct chatroom *chat) { return (irc_send_who(acct->data, chat->title)); } static int irc_notice(struct pork_acct *acct, char *dest, char *msg) { return (irc_send_notice(acct->data, dest, msg)); } static int irc_who(struct pork_acct *acct, char *str) { return (irc_send_who(acct->data, str)); } static int irc_ping(struct pork_acct *acct, char *str) { return (irc_send_ping(acct->data, str)); } static int irc_quit(struct pork_acct *acct, char *reason) { if (acct->connected) return (irc_send_quit(acct->data, reason)); return (-1); } static int irc_is_chat(struct pork_acct *acct, char *str) { irc_session_t *irc = acct->data; if (irc->chantypes != NULL) return (irc_is_chan_type(irc, *str)); else if (*str == '#' || *str == '&') return (1); return (0); } static int irc_quote(struct pork_acct *acct, char *str) { char *p = str; if (str == NULL) return (-1); while (*p == ' ') p++; if (!strncasecmp(p, "NICK ", 5)) { screen_err_msg("Use the /nick command."); return (-1); } return (irc_send_raw(acct->data, str)); } static int irc_action(struct pork_acct *acct, char *dest, char *msg) { return (irc_send_action(acct->data, dest, msg)); } static int irc_chan_action( struct pork_acct *acct, struct chatroom *chat, char *target, char *msg) { return (irc_send_action(acct->data, target, msg)); } static int irc_away(struct pork_acct *acct, char *msg) { return (irc_set_away(acct->data, msg)); } static int irc_back(struct pork_acct *acct) { return (irc_set_away(acct->data, NULL)); } static int irc_topic( struct pork_acct *acct, struct chatroom *chat, char *topic) { return (irc_send_topic(acct->data, chat->title, topic)); } static int irc_invite( struct pork_acct *acct, struct chatroom *chat, char *user, char *msg __notused) { return (irc_send_invite(acct->data, chat->title, user)); } char *irc_text_filter(char *str) { static const char *mirc_fg_col = "wwbgrymyYGcCBMDW"; static const char *mirc_bg_col = "ddbgrymyygccbmww"; static const char *ansi_esc_col = "drgybmcwDRGYBMCW"; size_t len; char *ret; size_t i; int fgcol = 7; int bgcol = -1; u_int32_t highlighting = 0; if (str == NULL) return (xstrdup("")); len = strlen(str) + 1024; ret = xmalloc(len); len--; for (i = 0 ; i < len && *str != '\0' ;) { switch (*str) { case '%': if (i + 2 >= len) goto out; memcpy(&ret[i], "%%", 2); i += 2; str++; break; /* ^B - bold */ case 0x02: if (!(highlighting & HIGHLIGHT_BOLD)) { if (i + 2 >= len) goto out; memcpy(&ret[i], "%1", 2); i += 2; highlighting |= HIGHLIGHT_BOLD; } else { if (i + 3 >= len) goto out; memcpy(&ret[i], "%-1", 3); i += 3; highlighting &= ~HIGHLIGHT_BOLD; } str++; break; /* ^O - clear everything */ case 0x0f: if (i + 2 >= len) goto out; memcpy(&ret[i], "%x", 2); i += 2; highlighting = 0; str++; break; /* ^V - inverse */ case 0x16: if (!(highlighting & HIGHLIGHT_INVERSE)) { if (i + 2 >= len) goto out; memcpy(&ret[i], "%2", 2); i += 2; highlighting |= HIGHLIGHT_INVERSE; } else { if (i + 3 >= len) goto out; memcpy(&ret[i], "%-2", 3); i += 3; highlighting &= ~HIGHLIGHT_INVERSE; } str++; break; /* ^_ - underline */ case 0x1f: if (!(highlighting & HIGHLIGHT_UNDERLINE)) { if (i + 2 >= len) goto out; memcpy(&ret[i], "%3", 2); i += 2; highlighting |= HIGHLIGHT_UNDERLINE; } else { if (i + 3 >= len) goto out; memcpy(&ret[i], "%-3", 3); i += 3; highlighting &= ~HIGHLIGHT_UNDERLINE; } str++; break; /* ^C - mirc color code */ case 0x03: { int fgcol = -1; int bgcol = -1; char colbuf[4]; if (!isdigit(str[1])) { if (i + 2 >= len) goto out; memcpy(&ret[i], "%x", 2); str++; i += 2; break; } str++; memcpy(colbuf, str, 2); colbuf[2] = '\0'; if (isdigit(colbuf[1])) str += 2; else str++; fgcol = strtol(colbuf, NULL, 10) % 16; if (*str == ',') { memcpy(colbuf, &str[1], 2); colbuf[2] = '\0'; if (isdigit(colbuf[0])) { if (isdigit(str[2])) str += 3; else str += 2; bgcol = strtol(colbuf, NULL, 10) % 16; } } if (i + 2 >= len) goto out; ret[i++] = '%'; ret[i++] = mirc_fg_col[fgcol]; if (bgcol >= 0) { if (i + 2 >= len) goto out; ret[i++] = ','; ret[i++] = mirc_bg_col[bgcol]; } break; } /* ^[ - ANSI escape sequence */ case 0x1b: { char *end; char *p; int bold = 0; char buf[64]; int slen; buf[0] = '\0'; if (str[1] != '[') goto add; end = strchr(&str[2], 'm'); if (end == NULL) goto add; *end++ = '\0'; str += 2; while ((p = strsep(&str, ";")) != NULL) { char *n; int num; num = strtoul(p, &n, 10); if (*n != '\0') continue; switch (num) { /* foreground color */ case 30 ... 39: fgcol = num - 30; break; /* background color */ case 40 ... 49: bgcol = num - 40; break; /* bold */ case 1: bold = 8; break; /* underscore */ case 4: if (xstrncat(buf, "%3", sizeof(buf)) == -1) goto out; break; /* blink */ case 5: if (xstrncat(buf, "%4", sizeof(buf)) == -1) goto out; break; /* reverse */ case 7: if (xstrncat(buf, "%2", sizeof(buf)) == -1) goto out; break; /* clear all attributes */ case 0: if (p[1] != 'm') break; if (xstrncat(buf, "%x", sizeof(buf)) == -1) goto out; fgcol = -1; bgcol = -1; bold = 0; break; } } if (fgcol >= 0 || bgcol >= 0) { if (fgcol < 0) fgcol = 7; if (i + 2 >= len) goto out; ret[i++] = '%'; ret[i++] = ansi_esc_col[fgcol + bold]; if (bgcol >= 0) { if (i + 2 >= len) goto out; ret[i++] = ','; ret[i++] = ansi_esc_col[bgcol]; } } else if (bold) { if (xstrncat(buf, "%1", sizeof(buf)) == -1) goto out; } ret[i] = '\0'; slen = xstrncat(ret, buf, len - i); if (slen == -1) goto out; i += slen; str = end; break; } default: add: ret[i++] = *str++; break; } } out: ret[i] = '\0'; return (ret); } int irc_chan_free(struct pork_acct *acct, void *data) { struct irc_chan_data *chat_data = data; hash_destroy(&chat_data->mode_args); free(data); return (0); } int irc_chanmode_has_arg(irc_session_t *session, char mode) { char *p; if (session->chanmodes == NULL) { switch (mode) { case 'k': case 'l': case 'e': case 'b': case 'o': case 'h': case 'v': case 'I': return (1); } return (0); } p = strchr(session->chanmodes, mode); if (p == NULL || p[1] != ',') return (0); return (1); } char *irc_get_chanmode_arg(struct irc_chan_data *chat, char mode) { dlist_t *cur; u_int32_t temp_hash; struct irc_chan_arg *arg; temp_hash = int_hash((int) mode, chat->mode_args.order); cur = hash_find(&chat->mode_args, INT_TO_POINTER((int) mode), temp_hash); if (cur == NULL) return (NULL); arg = cur->data; if (arg == NULL) return (NULL); return (arg->val); } static int irc_rejoin(struct pork_acct *acct, struct chatroom *chat) { struct irc_chan_data *irc_data = chat->data; char *chan_key; chan_key = irc_get_chanmode_arg(irc_data, 'k'); return (irc_send_join(acct->data, chat->title, chan_key)); } int irc_proto_init(struct pork_proto *proto) { proto->chat_action = irc_chan_action; proto->chat_join = irc_join; proto->chat_rejoin = irc_rejoin; proto->chat_send = irc_chan_send; proto->chat_find = irc_find_chat; proto->chat_name = irc_chan_get_name; proto->chat_leave = irc_part; proto->chat_users = irc_chan_users; proto->chat_kick = irc_chan_kick; proto->chat_ban = irc_chan_ban; proto->chat_free = irc_chan_free; proto->chat_send_notice = irc_chan_notice; proto->chat_who = irc_chan_who; proto->chat_set_topic = irc_topic; proto->chat_invite = irc_invite; proto->send_action = irc_action; proto->get_profile = irc_whois; proto->connect = irc_do_connect; proto->connect_abort = irc_connect_abort; proto->reconnect = irc_reconnect; proto->free = irc_free; proto->mode = irc_mode; proto->init = irc_init; proto->who = irc_who; proto->ping = irc_ping; proto->whowas = irc_whowas; proto->send_notice = irc_notice; proto->signoff = irc_quit; proto->normalize = xstrncpy; proto->read_config = irc_read_config; proto->send_msg = irc_privmsg; proto->update = irc_update; proto->write_config = irc_write_config; proto->user_compare = strcasecmp; proto->change_nick = irc_change_nick; proto->filter_text = irc_text_filter; proto->filter_text_out = irc_text_filter; proto->quote = irc_quote; proto->is_chat = irc_is_chat; proto->set_away = irc_away; proto->set_back = irc_back; proto->ctcp = irc_ctcp; proto->file_accept = irc_file_accept; proto->file_recv_data = irc_recv_data; proto->file_abort = irc_file_abort; proto->file_send = irc_file_send; return (0); } pork-0.99.8.1/src/protocols/irc/pork_irc.h0000644000175000017500000000737210234217336020262 0ustar ryanryan00000000000000/* ** pork_irc.h ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_IRC_H #define __PORK_IRC_H #define IRC_OUT_BUFLEN 2048 #define IRC_IN_BUFLEN 8192 #define DEFAULT_IRC_PROFILE "i <3 pork" #define DEFAULT_IRC_QUITMSG "i <3 pork (http://dev.ojnk.net)" #define DEFAULT_IRC_PORT "6667" #include #define IRC_CHAN_OP 0x01 #define IRC_CHAN_VOICE 0x02 #define IRC_CHAN_HALFOP 0x04 struct chatroom; enum { MODE_PLUS = '+', MODE_MINUS = '-' }; typedef struct { int sock; pork_queue_t *inq; pork_queue_t *outq; char *servers[24]; char *chanmodes; char *chantypes; char *prefix_types; char *prefix_codes; u_int32_t wallchops:1; u_int32_t excepts:1; u_int32_t capab:1; u_int32_t knock:1; u_int32_t invex:1; u_int32_t callerid:1; u_int32_t etrace:1; u_int32_t safelist:1; u_int32_t nick_len; u_int32_t kick_len; u_int32_t topic_len; u_int32_t num_servers; hash_t callbacks; time_t last_update; size_t input_offset; char input_buf[IRC_IN_BUFLEN]; void *data; } irc_session_t; struct irc_chan_data { char mode_str[128]; hash_t mode_args; /* This is such a stupid hack. */ u_int32_t join_complete:1; u_int32_t joined:1; }; struct irc_cmd_q { char *cmd; size_t len; }; struct irc_chan_arg { int arg; char *val; }; struct irc_input { char *tokens[20]; char *args; char *cmd; char *orig; int numeric; u_int32_t num_tokens; }; struct callback_handler { char *str; int (*handler)(struct pork_acct *acct, struct irc_input *in); }; int irc_proto_init(struct pork_proto *proto); int irc_flush_outq(irc_session_t *session); int irc_connect(struct pork_acct *a, const char *server, int *sock); int irc_send_raw(irc_session_t *session, char *str); int irc_send_pong(irc_session_t *session, char *dest); int irc_send_join(irc_session_t *session, char *channel, char *key); int irc_send_login(irc_session_t *session); int irc_send_privmsg(irc_session_t *session, char *dest, char *msg); int irc_send_mode(irc_session_t *session, char *mode_str); int irc_send_ctcp(irc_session_t *session, char *dest, char *msg); int irc_send_ctcp_reply(irc_session_t *session, char *dest, char *msg); int irc_send_names(irc_session_t *session, char *chan); int irc_send_who(irc_session_t *session, char *dest); int irc_send_whois(irc_session_t *session, char *dest); int irc_send_whowas(irc_session_t *session, char *dest); int irc_send_nick(irc_session_t *session, char *nick); int irc_send_kick(irc_session_t *session, char *chan, char *nick, char *reason); int irc_send_part(irc_session_t *session, char *chan); int irc_send_ping(irc_session_t *session, char *str); int irc_send_quit(irc_session_t *session, char *reason); int irc_send_topic(irc_session_t *session, char *chan, char *topic); int irc_send_notice(irc_session_t *session, char *dest, char *msg); int irc_kick(irc_session_t *session, char *chan, char *user, char *msg); int irc_set_away(irc_session_t *session, char *msg); int irc_send_action(irc_session_t *session, char *dest, char *msg); int irc_chan_free(struct pork_acct *acct, void *data); int irc_send_invite(irc_session_t *session, char *channel, char *user); char *irc_get_chanmode_arg(struct irc_chan_data *chat, char mode); int irc_chanmode_has_arg(irc_session_t *session, char mode); int irc_input_dispatch(irc_session_t *session); char *irc_text_filter(char *str); int irc_callback_init(irc_session_t *session); int irc_callback_clear(irc_session_t *session); int irc_callback_add_defaults(irc_session_t *session); int irc_callback_add( irc_session_t *session, char *str, int (*handler)(struct pork_acct *, struct irc_input *)); #endif pork-0.99.8.1/src/protocols/Makefile.am0000644000175000017500000000022210234217330017535 0ustar ryanryan00000000000000if IRC_SUPPORT irc_dir = irc endif INCLUDES = -I. -I.. -I../.. -I../missing AM_CFLAGS = $(DEBUG_CFLAGS) $(PERL_CFLAGS) SUBDIRS = $(irc_dir) aim pork-0.99.8.1/src/protocols/Makefile.in0000644000175000017500000003211010236222653017555 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = src/protocols DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = irc aim DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ @IRC_SUPPORT_TRUE@irc_dir = irc INCLUDES = -I. -I.. -I../.. -I../missing AM_CFLAGS = $(DEBUG_CFLAGS) $(PERL_CFLAGS) SUBDIRS = $(irc_dir) aim all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/protocols/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/protocols/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="../$(top_distdir)" \ distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-recursive ctags ctags-recursive \ distclean distclean-generic distclean-recursive distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/src/pork_chat.c0000644000175000017500000004670410234217327015620 0ustar ryanryan00000000000000/* ** pork_chat.c ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void chat_destroy_user_list_cb(void *param, void *data) { struct pork_acct *acct = (struct pork_acct *) param; struct chat_user *chat_user = (struct chat_user *) data; if (acct->proto->chat_user_free != NULL) acct->proto->chat_user_free(acct, chat_user); free(chat_user->host); free(chat_user->nname); free(chat_user->name); free(chat_user); } struct chatroom *chat_new( struct pork_acct *acct, char *chat_title, char *chat_title_full, struct imwindow *win) { struct chatroom *chat; chat = xcalloc(1, sizeof(*chat)); chat->title = xstrdup(chat_title); chat->title_quoted = acct->proto->filter_text(chat_title); chat->title_full = xstrdup(chat_title_full); chat->title_full_quoted = acct->proto->filter_text(chat_title_full); chat->win = win; win->data = chat; acct->chat_list = dlist_add_head(acct->chat_list, chat); return (chat); } int chat_send_msg( struct pork_acct *acct, struct chatroom *chat, char *target, char *msg) { if (acct->proto->chat_send == NULL || msg == NULL) return (-1); if (!event_generate(acct->events, EVENT_SEND_CHAT_MSG, chat->title, msg, acct->refnum)) { if (acct->proto->chat_send(acct, chat, target, msg) != -1) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_SEND, buf, sizeof(buf), acct, chat, target, msg); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_MSG_SEND); imwindow_send_msg(chat->win); } } return (0); } int chat_send_notice( struct pork_acct *acct, struct chatroom *chat, char *target, char *msg) { if (acct->proto->chat_send == NULL || msg == NULL) return (-1); if (!event_generate(acct->events, EVENT_SEND_CHAT_NOTICE, chat->title, msg, acct->refnum)) { if (acct->proto->chat_send_notice(acct, chat, target, msg) != -1) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_SEND_NOTICE, buf, sizeof(buf), acct, chat, target, msg); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_NOTICE_SEND); imwindow_send_msg(chat->win); } } return (0); } int chat_send_action( struct pork_acct *acct, struct chatroom *chat, char *target, char *msg) { if (acct->proto->chat_action == NULL || chat == NULL) return (-1); if (!event_generate(acct->events, EVENT_SEND_CHAT_ACTION, chat->title, msg, acct->refnum)) { if (acct->proto->chat_action(acct, chat, target, msg) != -1) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_SEND_ACTION, buf, sizeof(buf), acct, chat, target, msg); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_ACTION_SEND); imwindow_send_msg(chat->win); } else return (-1); } return (0); } int chat_recv_action( struct pork_acct *acct, struct chatroom *chat, char *dest, char *user, char *userhost, char *msg) { if (!event_generate(acct->events, EVENT_RECV_CHAT_ACTION, chat->title, dest, user, userhost, msg, acct->refnum)) { if (!chat_user_is_ignored(acct, chat, user)) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_RECV_ACTION, buf, sizeof(buf), acct, chat, dest, user, userhost, msg); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_ACTION_RECV); imwindow_recv_msg(chat->win); } } return (0); } int chat_recv_msg( struct pork_acct *acct, struct chatroom *chat, char *dest, char *user, char *userhost, char *msg) { if (!event_generate(acct->events, EVENT_RECV_CHAT_MSG, chat->title, dest, user, userhost, msg, acct->refnum)) { if (!chat_user_is_ignored(acct, chat, user)) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_RECV, buf, sizeof(buf), acct, chat, dest, user, userhost, msg); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_MSG_RECV); imwindow_recv_msg(chat->win); } } return (0); } int chat_recv_notice( struct pork_acct *acct, struct chatroom *chat, char *dest, char *user, char *userhost, char *msg) { if (!event_generate(acct->events, EVENT_RECV_CHAT_NOTICE, chat->title, dest, user, userhost, msg, acct->refnum)) { if (!chat_user_is_ignored(acct, chat, user)) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_RECV_NOTICE, buf, sizeof(buf), acct, chat, dest, user, userhost, msg); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_NOTICE_RECV); imwindow_recv_msg(chat->win); } } return (0); } int chat_ignore(struct pork_acct *acct, char *chat_name, char *user) { struct chat_user *chat_user; struct chatroom *chat; char buf[4096]; int ret; chat = chat_find(acct, chat_name); if (chat == NULL) return (-1); chat_user = chat_find_user(acct, chat, user); if (chat_user == NULL) { screen_err_msg("%s is not a member of %s", user, chat->title_quoted); return (-1); } chat_user->ignore = 1; if (acct->proto->chat_ignore != NULL) { if (acct->proto->chat_ignore(acct, chat, user) == -1) return (-1); } ret = fill_format_str(OPT_FORMAT_CHAT_IGNORE, buf, sizeof(buf), acct, chat, chat->title, acct->username, user, NULL); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); return (0); } int chat_unignore(struct pork_acct *acct, char *chat_name, char *user) { struct chat_user *chat_user; struct chatroom *chat; char buf[4096]; int ret; chat = chat_find(acct, chat_name); if (chat == NULL) return (-1); chat_user = chat_find_user(acct, chat, user); if (chat_user == NULL) { screen_err_msg("%s is not a member of %s", user, chat->title_quoted); return (-1); } chat_user->ignore = 0; if (acct->proto->chat_unignore != NULL) { if (acct->proto->chat_unignore(acct, chat, user) == -1) return (-1); } ret = fill_format_str(OPT_FORMAT_CHAT_UNIGNORE, buf, sizeof(buf), acct, chat, chat->title, acct->username, user, NULL); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); return (0); } int chat_user_is_ignored( struct pork_acct *acct, struct chatroom *chat, char *user) { struct chat_user *chat_user; chat_user = chat_find_user(acct, chat, user); if (chat_user == NULL) return (0); return (chat_user->ignore); } int chat_users(struct pork_acct *acct, char *chat_name) { struct chatroom *chat; if (acct->proto->chat_users == NULL) return (-1); chat = chat_find(acct, chat_name); if (chat == NULL) return (-1); return (acct->proto->chat_users(acct, chat)); } int chat_who(struct pork_acct *acct, char *chat_name) { struct chatroom *chat; if (acct->proto->chat_who == NULL) return (-1); chat = chat_find(acct, chat_name); if (chat == NULL) return (-1); return (acct->proto->chat_who(acct, chat)); } int chat_join(struct pork_acct *acct, char *args) { struct imwindow *imwindow = NULL; char buf[512]; char arg_buf[512]; int ret = 0; if (acct->proto->chat_join == NULL || acct->proto->chat_name == NULL) return (-1); if (args == NULL) { imwindow = cur_window(); if (imwindow->type == WIN_TYPE_CHAT) args = imwindow->target; else return (-1); } if (acct->proto->chat_name(args, buf, sizeof(buf), arg_buf, sizeof(arg_buf)) == -1) { screen_err_msg("Invalid chat name: %s", args); return (-1); } imwindow = imwindow_find_chat_target(acct, buf); if (imwindow == NULL) { imwindow = screen_new_chat_window(acct, buf); if (imwindow == NULL) { screen_err_msg("Unable to create a new window for %s", buf); return (-1); } } if (!event_generate(acct->events, EVENT_SEND_CHAT_JOIN, buf, acct->refnum)) { ret = acct->proto->chat_join(acct, buf, arg_buf); } screen_goto_window(imwindow->refnum); return (ret); } int chat_leave(struct pork_acct *acct, char *chat_name, int close_window) { struct chatroom *chat; struct imwindow *win; chat = chat_find(acct, chat_name); if (chat == NULL) return (-1); if (event_generate(acct->events, EVENT_SEND_CHAT_LEAVE, chat->title, acct->refnum)) { return (0); } if (acct->proto->chat_leave != NULL) { if (acct->proto->chat_leave(acct, chat) == -1) { screen_err_msg("Error leaving chat room %s for %s", chat->title_quoted, acct->username); return (-1); } } win = chat->win; win->data = NULL; chat->win = NULL; if (close_window) screen_close_window(win); return (chat_free(acct, chat, 0)); } int chat_leave_all(struct pork_acct *acct) { dlist_t *cur; cur = acct->chat_list; while (cur != NULL) { struct chatroom *chat = cur->data; dlist_t *next = cur->next; chat_leave(acct, chat->title, 0); cur = next; } return (0); } int chat_user_kicked( struct pork_acct *acct, struct chatroom *chat, char *kicked, char *kicker, char *reason) { if (!event_generate(acct->events, EVENT_RECV_CHAT_KICK, chat->title, kicked, kicker, reason, acct->refnum)) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_KICK, buf, sizeof(buf), acct, chat, chat->title, kicker, kicked, reason); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } chat_user_left(acct, chat, kicked, 1); return (0); } int chat_forced_leave( struct pork_acct *acct, char *chat_name, char *target, char *reason) { struct chatroom *chat; chat = chat_find(acct, chat_name); if (chat == NULL) { debug("forced leave of unjoined chat: %s", chat_name); return (-1); } chat_user_kicked(acct, chat, acct->username, target, reason); if (opt_get_bool(OPT_AUTO_REJOIN)) return (chat_rejoin(acct, chat)); return (chat_free(acct, chat, 1)); } int chat_invite(struct pork_acct *acct, char *chat_name, char *user, char *msg) { struct chatroom *chat; if (acct->proto->chat_invite == NULL) return (-1); chat = chat_find(acct, chat_name); if (chat == NULL) return (-1); if (!event_generate(acct->events, EVENT_SEND_CHAT_INVITE, chat->title, user, msg, acct->refnum)) { char buf[4096]; int ret; if (acct->proto->chat_invite(acct, chat, user, msg) == -1) return (-1); ret = fill_format_str(OPT_FORMAT_CHAT_INVITE, buf, sizeof(buf), acct, chat, chat->title, acct->username, user, msg); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } return (0); } struct chatroom *chat_find(struct pork_acct *acct, char *chat_name) { if (acct->proto->chat_find == NULL) return (NULL); return (acct->proto->chat_find(acct, chat_name)); } void chat_list(struct pork_acct *acct) { dlist_t *cur; cur = acct->chat_list; if (cur == NULL) { screen_cmd_output("%s is not a member of any chat rooms", acct->username); return; } screen_cmd_output("%s is joined to the following chat rooms", acct->username); do { struct chatroom *chat = cur->data; screen_cmd_output(" %s in window refnum %u", chat->title_quoted, chat->win->refnum); cur = cur->next; } while (cur != NULL); } int chat_free(struct pork_acct *acct, struct chatroom *chat, int silent) { dlist_t *cur; cur = dlist_find(acct->chat_list, chat, NULL); if (cur == NULL) { debug("tried to free unknown chat: %s", chat->title_quoted); return (-1); } acct->chat_list = dlist_remove(acct->chat_list, cur); if (chat->win != NULL) { if (!silent) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_LEAVE, buf, sizeof(buf), acct, chat, chat->title, acct->username, NULL, NULL); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } chat->win->data = NULL; chat->win = NULL; } if (acct->proto->chat_free != NULL) acct->proto->chat_free(acct, chat->data); dlist_destroy(chat->user_list, acct, chat_destroy_user_list_cb); free(chat->title); free(chat->title_quoted); free(chat->title_full); free(chat->title_full_quoted); free(chat->topic); free(chat); return (0); } int chat_got_invite(struct pork_acct *acct, char *chat_name, char *user, char *userhost, char *message) { if (!event_generate(acct->events, EVENT_RECV_CHAT_INVITE, chat_name, user, userhost, message, acct->refnum)) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_INVITE, buf, sizeof(buf), acct, NULL, chat_name, user, acct->username, message); if (ret < 1) return (-1); screen_print_str(cur_window(), buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } return (0); } int chat_created(struct pork_acct *acct, struct chatroom *chat) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_CREATE, buf, sizeof(buf), acct, chat, chat->title, acct->username, NULL, NULL); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); return (0); } struct chat_user *chat_user_joined( struct pork_acct *acct, struct chatroom *chat, char *user, char *host, int silent) { char buf[4096]; struct chat_user *chat_user; if (chat_find_user(acct, chat, user) != NULL) { debug("chat user %s already joined to %s", user, chat->title); return (NULL); } chat->num_users++; acct->proto->normalize(buf, user, sizeof(buf)); chat_user = xcalloc(1, sizeof(*chat_user)); chat_user->name = xstrdup(user); chat_user->nname = xstrdup(buf); if (host != NULL) chat_user->host = xstrdup(host); chat->user_list = dlist_add_head(chat->user_list, chat_user); if (event_generate(acct->events, EVENT_RECV_CHAT_JOIN, chat->title, user, host, acct->refnum)) { return (chat_user); } if (!silent) { int ret; ret = fill_format_str(OPT_FORMAT_CHAT_JOIN, buf, sizeof(buf), acct, chat, chat->title, user, NULL, NULL); if (ret > 0) { screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } } return (chat_user); } static dlist_t *chat_find_user_node(struct pork_acct *acct, struct chatroom *chat, char *user) { dlist_t *cur; cur = chat->user_list; while (cur != NULL) { struct chat_user *chat_user = cur->data; if (!acct->proto->user_compare(user, chat_user->nname)) break; cur = cur->next; } return (cur); } inline struct chat_user *chat_find_user(struct pork_acct *acct, struct chatroom *chat, char *user) { dlist_t *cur = chat_find_user_node(acct, chat, user); if (cur == NULL) return (NULL); return (cur->data); } int chat_user_left( struct pork_acct *acct, struct chatroom *chat, char *user, int silent) { dlist_t *node; struct chat_user *chat_user = NULL; int ret = 0; node = chat_find_user_node(acct, chat, user); if (event_generate(acct->events, EVENT_RECV_CHAT_LEAVE, chat->title, user, acct->refnum)) { ret = silent = 1; } if (!silent) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_LEAVE, buf, sizeof(buf), acct, chat, chat->title, user, NULL, NULL); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } if (node != NULL) { chat->num_users--; chat_user = node->data; chat->user_list = dlist_remove(chat->user_list, node); chat_destroy_user_list_cb(acct, chat_user); } else { debug("unknown user %s left %s", user, chat->title_quoted); } return (ret); } int chat_user_quit( struct pork_acct *acct, struct chatroom *chat, struct chat_user *user, char *msg) { if (!event_generate(acct->events, EVENT_RECV_CHAT_QUIT, chat->title, user->name, msg, acct->refnum)) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_QUIT, buf, sizeof(buf), acct, chat, chat->title, user->name, NULL, msg); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } return (chat_user_left(acct, chat, user->name, 1)); } int chat_set_topic(struct pork_acct *acct, struct chatroom *chat, char *topic) { int ret = 0; if (acct->proto->chat_set_topic == NULL) return (-1); if (!event_generate(acct->events, EVENT_SEND_CHAT_TOPIC, chat->title, topic, acct->refnum)) { ret = acct->proto->chat_set_topic(acct, chat, topic); } return (ret); } int chat_got_topic( struct pork_acct *acct, struct chatroom *chat, char *set_by, char *topic) { free(chat->topic); chat->topic = xstrdup(topic); if (!event_generate(acct->events, EVENT_RECV_CHAT_TOPIC, chat->title, set_by, topic, acct->refnum)) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_TOPIC, buf, sizeof(buf), acct, chat, chat->title, set_by, NULL, topic); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } return (0); } int chat_got_mode( struct pork_acct *acct, struct chatroom *chat, char *user, char *mode) { if (!event_generate(acct->events, EVENT_RECV_CHAT_MODE, chat->title, user, mode, acct->refnum)) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_MODE, buf, sizeof(buf), acct, chat, chat->title, user, NULL, mode); if (ret < 1) return (-1); screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } return (0); } int chat_kick( struct pork_acct *acct, struct chatroom *chat, char *user, char *reason) { if (acct->proto->chat_kick == NULL) return (-1); if (event_generate(acct->events, EVENT_SEND_CHAT_KICK, chat->title, user, reason, acct->refnum)) { return (0); } return (acct->proto->chat_kick(acct, chat, user, reason)); } int chat_ban( struct pork_acct *acct, struct chatroom *chat, char *user) { if (acct->proto->chat_ban == NULL) return (-1); return (acct->proto->chat_ban(acct, chat, user)); } int chat_rejoin(struct pork_acct *acct, struct chatroom *chat) { if (acct->proto->chat_rejoin == NULL) return (-1); return (acct->proto->chat_rejoin(acct, chat)); } int chat_rejoin_all(struct pork_acct *acct) { dlist_t *cur; if (acct->proto->chat_rejoin == NULL) return (-1); for (cur = acct->chat_list ; cur != NULL ; cur = cur->next) chat_rejoin(acct, cur->data); return (0); } int chat_nick_change(struct pork_acct *acct, char *old, char *new_nick) { dlist_t *cur; cur = acct->chat_list; while (cur != NULL) { struct chat_user *user; struct chatroom *chat = cur->data; user = chat_find_user(acct, chat, old); if (user != NULL) { char buf[4096]; int ret; ret = fill_format_str(OPT_FORMAT_CHAT_NICK, buf, sizeof(buf), acct, chat, chat->title, old, new_nick, NULL); if (ret > 0) { screen_print_str(chat->win, buf, (size_t) ret, MSG_TYPE_CHAT_STATUS); } free(user->name); free(user->nname); user->name = xstrdup(new_nick); acct->proto->normalize(buf, new_nick, sizeof(buf)); user->nname = xstrdup(buf); } cur = cur->next; } return (0); } pork-0.99.8.1/src/pork_chat.h0000644000175000017500000000773610234217327015627 0ustar ryanryan00000000000000/* ** pork_chat.h ** Copyright (C) 2003-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_CHAT_H #define __PORK_CHAT_H #define CHAT_STATUS_OP 0x01 #define CHAT_STATUS_HALFOP 0x02 #define CHAT_STATUS_VOICE 0x04 struct imwindow; struct pork_acct; struct chatroom { char *title; char *title_quoted; char *title_full; char *title_full_quoted; char *topic; void *data; char mode[128]; u_int32_t num_users; dlist_t *user_list; struct imwindow *win; }; struct chat_user { char *name; char *nname; char *host; u_int32_t status; u_int32_t ignore:1; void *data; }; struct chatroom *chat_new( struct pork_acct *acct, char *chat_title, char *chat_title_full, struct imwindow *win); int chat_recv_msg( struct pork_acct *acct, struct chatroom *chat, char *dest, char *user, char *userhost, char *msg); int chat_recv_notice( struct pork_acct *acct, struct chatroom *chat, char *dest, char *user, char *userhost, char *msg); int chat_send_msg(struct pork_acct *acct, struct chatroom *chat, char *target, char *msg); int chat_send_notice(struct pork_acct *acct, struct chatroom *chat, char *target, char *msg); int chat_ignore(struct pork_acct *acct, char *chat_name, char *user); int chat_unignore(struct pork_acct *acct, char *chat_name, char *user); int chat_users(struct pork_acct *acct, char *chat_name); int chat_who(struct pork_acct *acct, char *chat_name); int chat_join(struct pork_acct *acct, char *args); int chat_leave(struct pork_acct *acct, char *chat_name, int close_window); int chat_leave_all(struct pork_acct *acct); int chat_invite(struct pork_acct *acct, char *chat_name, char *user, char *msg); int chat_created(struct pork_acct *acct, struct chatroom *chat); struct chatroom *chat_find(struct pork_acct *acct, char *chat_name); void chat_list(struct pork_acct *acct); int chat_free(struct pork_acct *acct, struct chatroom *chat, int silent); int chat_set_topic(struct pork_acct *acct, struct chatroom *chat, char *topic); int chat_rejoin(struct pork_acct *acct, struct chatroom *chat); int chat_rejoin_all(struct pork_acct *acct); int chat_nick_change(struct pork_acct *acct, char *old, char *new_nick); int chat_user_is_ignored( struct pork_acct *acct, struct chatroom *chat, char *user); int chat_forced_leave( struct pork_acct *acct, char *chat_name, char *person, char *reason); int chat_user_kicked( struct pork_acct *acct, struct chatroom *chat, char *kicked, char *kicker, char *reason); int chat_got_invite(struct pork_acct *acct, char *chat_name, char *user, char *userhost, char *message); struct chat_user *chat_user_joined( struct pork_acct *acct, struct chatroom *chat, char *user, char *host, int silent); int chat_user_left( struct pork_acct *acct, struct chatroom *chat, char *user, int silent); int chat_got_topic( struct pork_acct *acct, struct chatroom *chat, char *set_by, char *topic); int chat_kick( struct pork_acct *acct, struct chatroom *chat, char *user, char *reason); int chat_ban( struct pork_acct *acct, struct chatroom *chat, char *user); int chat_send_action( struct pork_acct *acct, struct chatroom *chat, char *target, char *msg); int chat_recv_action( struct pork_acct *acct, struct chatroom *chat, char *dest, char *user, char *userhost, char *msg); int chat_user_quit( struct pork_acct *acct, struct chatroom *chat, struct chat_user *user, char *msg); int chat_got_mode( struct pork_acct *acct, struct chatroom *chat, char *user, char *mode); inline struct chat_user *chat_find_user(struct pork_acct *acct, struct chatroom *chat, char *user); #endif pork-0.99.8.1/src/pork_conf.c0000644000175000017500000002702610234217327015622 0ustar ryanryan00000000000000/* ** pork_conf.c - pork's configuration parser. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static int pork_mkdir(const char *path) { struct stat st; if (stat(path, &st) != 0) { if (mkdir(path, 0700) != 0) { screen_err_msg("Error: mkdir %s: %s", path, strerror(errno)); return (-1); } } else { if (!S_ISDIR(st.st_mode)) { screen_err_msg("Error: %s is not a directory", path); return (-1); } } return (0); } int read_conf(const char *path) { FILE *fp; char buf[4096]; u_int32_t line = 0; fp = fopen(path, "r"); if (fp == NULL) { if (errno != -ENOENT) debug("fopen: %s: %s", path, strerror(errno)); return (-1); } while (fgets(buf, sizeof(buf), fp) != NULL) { char *p; ++line; p = strchr(buf, '\n'); if (p == NULL) { debug("line %u too long", line); fclose(fp); return (-1); } *p = '\0'; while ((p = strchr(p, '\t')) != NULL) *p++ = ' '; p = buf; if (*p == '#') continue; if (*p == opt_get_char(OPT_CMDCHARS)) p++; if (!blank_str(p)) run_command(p); } fclose(fp); return (0); } static int read_acct_conf(struct pork_acct *acct, const char *filename) { FILE *fp; char buf[2048]; int line = 0; fp = fopen(filename, "r"); if (fp == NULL) { if (errno != ENOENT) { debug("fopen: %s: %s", filename, strerror(errno)); return (-1); } return (0); } while (fgets(buf, sizeof(buf), fp) != NULL) { char *p; ++line; p = strchr(buf, '\n'); if (p == NULL) { debug("line %u too long", line); fclose(fp); return (-1); } *p = '\0'; while ((p = strchr(p, '\t')) != NULL) *p++ = ' '; p = buf; if (*p == '#') continue; p = strchr(buf, ':'); if (p == NULL) continue; *p++ = '\0'; while (*p == ' ') p++; if (!strcasecmp(buf, "username")) { free(acct->username); acct->username = xstrdup(p); } else if (!strcasecmp(buf, "password")) { if (acct->passwd != NULL) { memset(acct->passwd, 0, strlen(acct->passwd)); free(acct->passwd); } acct->passwd = xstrdup(p); } else if (!strcasecmp(buf, "profile")) { free(acct->profile); acct->profile = xstrdup(p); } else { screen_err_msg("Error: account config line %d: bad setting: %s", line, buf); } } fclose(fp); return (0); } static int read_buddy_list(struct pork_acct *acct, const char *filename) { FILE *fp; char buf[1024]; u_int32_t line = 0; struct bgroup *cur_group = NULL; struct buddy *cur_buddy = NULL; struct buddy_pref *pref = acct->buddy_pref; fp = fopen(filename, "r"); if (fp == NULL) { if (errno != ENOENT) { screen_err_msg("Can't open buddy list: %s: %s", filename, strerror(errno)); return (-1); } return (0); } acct->report_idle = opt_get_bool(OPT_REPORT_IDLE); pref->privacy_mode = 1; while (fgets(buf, sizeof(buf), fp) != NULL) { char *p; char type; ++line; p = strchr(buf, '\n'); if (p == NULL) { screen_err_msg("Invalid buddy list data at line %u", line); fclose(fp); return (-1); } *p = '\0'; p = buf; type = *p++; while (*p == ' ' || *p == '\t') p++; if (type == 'g') { cur_buddy = NULL; cur_group = group_add(acct, p); } else if (type == 'b') { char *alias; struct buddy *buddy; if (cur_group == NULL) { screen_err_msg("Invalid buddy list data at line %u", line); fclose(fp); return (-1); } alias = strchr(p, ':'); if (alias != NULL) *alias++ = '\0'; buddy = buddy_add(acct, p, cur_group, 0); if (alias != NULL) buddy_alias(acct, buddy, alias, 0); cur_buddy = buddy; } else if (type == 'l') { u_int32_t last_seen; if (str_to_uint(p, &last_seen) != 0 || cur_buddy == NULL) { screen_err_msg("Invalid buddy list data at line %u", line); fclose(fp); return (-1); } cur_buddy->last_seen = last_seen; } else if (type == 'p') { buddy_add_permit(acct, p, 0); cur_buddy = NULL; cur_group = NULL; } else if (type == 'd') { buddy_add_block(acct, p, 0); cur_buddy = NULL; cur_group = NULL; } else if (type == 'm') { u_int32_t privacy_mode; if (str_to_uint(p, &privacy_mode) != 0 || privacy_mode > 5) { screen_err_msg( "%s: Invalid value for permit/deny mode at line %u", p, line); fclose(fp); return (-1); } pref->privacy_mode = privacy_mode; cur_buddy = NULL; cur_group = NULL; } else if (type == 'i') { u_int32_t report_idle_val; if (str_to_uint(p, &report_idle_val) != 0 || report_idle_val > 1) { screen_err_msg( "Invalid value for report idle mode at line %u", line); fclose(fp); return (-1); } acct->report_idle = report_idle_val; cur_buddy = NULL; cur_group = NULL; } else { screen_err_msg("Invalid buddy list data at line %u", line); fclose(fp); return (-1); } } fclose(fp); return (0); } int read_user_config(struct pork_acct *acct) { char nname[NUSER_LEN]; char buf[PATH_MAX]; char *pork_dir = opt_get_str(OPT_PORK_DIR); if (acct == NULL || pork_dir == NULL) return (-1); normalize(nname, acct->username, sizeof(nname)); snprintf(buf, sizeof(buf), "%s/%s", pork_dir, nname); if (pork_mkdir(buf) != 0) return (-1); snprintf(buf, sizeof(buf), "%s/%s/logs", pork_dir, nname); if (pork_mkdir(buf) != 0) return (-1); snprintf(buf, sizeof(buf), "%s/%s/buddy_list", pork_dir, nname); if (read_buddy_list(acct, buf) != 0) screen_err_msg("There was an error reading your buddy list"); snprintf(buf, sizeof(buf), "%s/%s/porkrc", pork_dir, nname); if (read_conf(buf) != 0 && errno != ENOENT) screen_err_msg("There was an error reading your porkrc file"); snprintf(buf, sizeof(buf), "%s/%s/account", pork_dir, nname); if (read_acct_conf(acct, buf) != 0) screen_err_msg("Error: Can't read account config file, %s", buf); return (0); } static int save_buddy_list(struct pork_acct *acct, const char *filename) { char *fn; size_t len; FILE *fp; dlist_t *gcur; struct buddy_pref *pref = acct->buddy_pref; len = strlen(filename) + sizeof("-TEMP"); fn = xmalloc(len); snprintf(fn, len, "%s-TEMP", filename); fp = fopen(fn, "w"); if (fp == NULL) { screen_err_msg("Can't open buddy list file for writing: %s", strerror(errno)); free(fn); return (-1); } fprintf(fp, "m %u\n", pref->privacy_mode); fprintf(fp, "i %u\n", acct->report_idle); for (gcur = pref->group_list ; gcur != NULL ; gcur = gcur->next) { struct bgroup *gr = gcur->data; dlist_t *bcur; fprintf(fp, "g %s\n", gr->name); for (bcur = gr->member_list ; bcur != NULL ; bcur = bcur->next) { struct buddy *buddy = bcur->data; fprintf(fp, "b %s:%s\n", buddy->nname, buddy->name); if (buddy->last_seen != 0) fprintf(fp, "l %u\n", buddy->last_seen); } } for (gcur = pref->permit_list ; gcur != NULL ; gcur = gcur->next) fprintf(fp, "p %s\n", (char *) gcur->data); for (gcur = pref->block_list ; gcur != NULL ; gcur = gcur->next) fprintf(fp, "d %s\n", (char *) gcur->data); fchmod(fileno(fp), 0600); fclose(fp); if (rename(fn, filename) != 0) { debug("rename: %s<=>%s: %s", fn, filename, strerror(errno)); unlink(fn); free(fn); return (-1); } free(fn); return (0); } static int save_acct_conf(struct pork_acct *acct, char *filename) { char *fn; size_t len; FILE *fp; len = strlen(filename) + sizeof("-TEMP"); fn = xmalloc(len); snprintf(fn, len, "%s-TEMP", filename); fp = fopen(fn, "w"); if (fp == NULL) { debug("fopen: %s: %s", fn, strerror(errno)); free(fn); return (-1); } if (acct->username != NULL) fprintf(fp, "username: %s\n", acct->username); if (acct->profile != NULL) fprintf(fp, "profile: %s\n", acct->profile); if (opt_get_bool(OPT_SAVE_PASSWD) && acct->passwd != NULL) fprintf(fp, "password: %s\n", acct->passwd); fchmod(fileno(fp), 0600); fclose(fp); if (rename(fn, filename) != 0) { debug("rename: %s<=>%s: %s", fn, filename, strerror(errno)); unlink(fn); free(fn); return (-1); } free(fn); return (0); } int save_user_config(struct pork_acct *acct) { char nname[NUSER_LEN]; char buf[PATH_MAX]; char *pork_dir = opt_get_str(OPT_PORK_DIR); if (acct == NULL || pork_dir == NULL) { debug("acct=%p port_dir=%p", acct, pork_dir); return (-1); } normalize(nname, acct->username, sizeof(nname)); snprintf(buf, sizeof(buf), "%s/%s/buddy_list", pork_dir, nname); if (save_buddy_list(acct, buf) != 0) screen_err_msg("There was an error writing your buddy list."); snprintf(buf, sizeof(buf), "%s/%s/account", pork_dir, nname); if (save_acct_conf(acct, buf) != 0) screen_err_msg("Error: Can't write account config file, %s.", buf); return (0); } int read_global_config(void) { struct passwd *pw; char *pork_dir; char buf[PATH_MAX]; if (read_conf(SYSTEM_PORKRC) != 0) screen_err_msg("Error reading the system-wide porkrc file"); pw = getpwuid(getuid()); if (pw == NULL) { debug("getpwuid: %s", strerror(errno)); return (-1); } pork_dir = opt_get_str(OPT_PORK_DIR); if (pork_dir == NULL) { snprintf(buf, sizeof(buf), "%s/.pork", pw->pw_dir); opt_set(OPT_PORK_DIR, buf); pork_dir = opt_get_str(OPT_PORK_DIR); } else xstrncpy(buf, pork_dir, sizeof(buf)); if (pork_mkdir(buf) != 0) return (-1); pork_dir = opt_get_str(OPT_PORK_DIR); snprintf(buf, sizeof(buf), "%s/porkrc", pork_dir); if (read_conf(buf) != 0 && errno != ENOENT) return (-1); return (0); } static void write_alias_line(void *data, void *filep) { struct alias *alias = data; FILE *fp = filep; fprintf(fp, "alias %s %s%s\n", alias->alias, alias->orig, (alias->args ? alias->args : "")); } static void write_bind_line(void *data, void *filep) { struct binding *binding = data; FILE *fp = filep; char key_name[32]; bind_get_keyname(binding->key, key_name, sizeof(key_name)); fprintf(fp, "bind %s %s\n", key_name, binding->binding); } static void write_bind_blist_line(void *data, void *filep) { struct binding *binding = data; FILE *fp = filep; char key_name[32]; bind_get_keyname(binding->key, key_name, sizeof(key_name)); fprintf(fp, "bind -buddy %s %s\n", key_name, binding->binding); } int save_global_config(void) { char porkrc[PATH_MAX]; char *fn; size_t len; FILE *fp; char *pork_dir = opt_get_str(OPT_PORK_DIR); if (pork_dir == NULL) return (-1); snprintf(porkrc, sizeof(porkrc), "%s/porkrc", pork_dir); len = strlen(porkrc) + sizeof("-TEMP"); fn = xmalloc(len); snprintf(fn, len, "%s-TEMP", porkrc); fp = fopen(fn, "w"); if (fp == NULL) { debug("fopen: %s: %s", fn, strerror(errno)); return (-1); } opt_write(fp); fprintf(fp, "\n"); hash_iterate(&screen.alias_hash, write_alias_line, fp); fprintf(fp, "\n"); hash_iterate(&screen.binds.main.hash, write_bind_line, fp); fprintf(fp, "\n"); hash_iterate(&screen.binds.blist.hash, write_bind_blist_line, fp); fclose(fp); if (rename(fn, porkrc) != 0) { debug("rename: %s<=>%s: %s", fn, porkrc, strerror(errno)); unlink(fn); free(fn); return (-1); } free(fn); return (0); } pork-0.99.8.1/src/pork_conf.h0000644000175000017500000000105610234217327015622 0ustar ryanryan00000000000000/* ** pork_conf.h - pork's configuration parser. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_CONF_H #define __PORK_CONF_H struct pork_acct; int read_conf(const char *path); int read_global_config(void); int save_global_config(void); int read_user_config(struct pork_acct *acct); int save_user_config(struct pork_acct *acct); #endif pork-0.99.8.1/src/pork_cstr.c0000644000175000017500000001223610234217327015645 0ustar ryanryan00000000000000/* ** pork_cstr.c - routines for dealing with strings of type chtype *. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* ** I define what I call "cstrings" for ** use in this program. ** ** ncurses uses a data type called "chtype" to hold ** a character with attribute set (f.e. having color, being bold, ** underlined, etc). ** ** I define an array of these characters that's terminated with a chtype ** character having the value of zero as a "cstr" */ /* ** Return the length of the cstring pointed ** by "ch" */ inline size_t cstrlen(chtype *ch) { size_t i = 0; while (*ch++ != 0) ++i; return (i); } /* ** Convert the cstring specified by "cstr" ** to its ASCII representation. This will result ** in the loss of all attributes of the characters ** that comprise it. */ char *cstr_to_plaintext(chtype *cstr, size_t len) { char *str = xmalloc(len + 1); size_t i; for (i = 0 ; i < len && cstr[i] != 0 ; i++) str[i] = chtype_get(cstr[i]); str[i] = '\0'; return (str); } /* ** The reverse of above. The characters that comprise the cstring to ** be constructed will have their attributes set according to a format ** string starting with % and then containing color information in the ** form [,]. See the function color_parse_code() for ** more information. ** ** Returns the length of the string. */ int plaintext_to_cstr(chtype *ch, size_t len, ...) { char *str; u_int32_t i = 0; va_list ap; va_start(ap, len); len--; while ((str = va_arg(ap, char *)) != NULL) { u_int32_t spos = 0; attr_t color_attr = 0; for (; i < len && str[spos] != '\0' ; i++) { if (str[spos] == '%') { if (str[spos + 1] != '\0' && str[++spos] != '%') { int ret = color_parse_code(&str[spos], &color_attr); if (ret == -1) ch[i] = str[--spos]; else { i--; spos += ret; continue; } } else ch[i] = str[spos]; } else if (str[spos] == '\t') { size_t pad = PORK_TABSTOP - i % PORK_TABSTOP; size_t j; for (j = 0 ; j < pad && i < len ; j++) ch[i++] = ' ' | color_attr; i--; } else ch[i] = str[spos]; ch[i] |= color_attr; spos++; } } va_end(ap); ch[i] = 0; return (i); } /* ** The same as above, only color attributes are ignored. ** Returns the length of the string. */ int plaintext_to_cstr_nocolor(chtype *ch, size_t len, ...) { char *str; u_int32_t i = 0; va_list ap; len--; va_start(ap, len); while ((str = va_arg(ap, char *)) != NULL) { for (; i < len && *str != '\0' ; i++) { if (*str == '\t') { size_t pad = PORK_TABSTOP - i % PORK_TABSTOP; size_t j; for (j = 0 ; j < pad && i < len ; j++) ch[i++] = ' '; i--; } else ch[i] = *str; str++; } } va_end(ap); ch[i] = 0; return (i); } /* ** Duplicate a chtype * string of length "len". */ chtype *cstrndup(chtype *ch, size_t len) { size_t i; chtype *result; if (len < 1) return (NULL); result = xmalloc((len + 1) * sizeof(chtype)); for (i = 0 ; i < len ; i++) result[i] = ch[i]; result[i] = 0; return (result); } /* ** Write the cstring pointed to by "ch" ** to the screen at the current cursor position. */ inline size_t wputstr(WINDOW *win, chtype *ch) { size_t i = 0; u_int32_t beeps = 0; u_int32_t beeps_max = opt_get_int(OPT_BEEP_MAX); while (ch[i] != 0) { int c = chtype_get(ch[i]); if (iscntrl(c)) { if (c == 0x07 && opt_get_bool(OPT_BEEP) && beeps < beeps_max) { beep(); beeps++; } waddch(win, chtype_ctrl(c)); } else waddch(win, ch[i]); i++; } return (i); } /* ** Write the cstring pointed to by "ch" ** to the screen at the position (x, y). */ inline size_t mvwputstr(WINDOW *win, int y, int x, chtype *ch) { wmove(win, y, x); return (wputstr(win, ch)); } /* ** Write the first n chtype chars of the cstring pointed to by "ch" ** to the screen at the current cursor position. */ inline size_t wputnstr(WINDOW *win, chtype *ch, size_t n) { size_t i; u_int32_t beeps = 0; u_int32_t beeps_max = opt_get_int(OPT_BEEP_MAX); for (i = 0 ; i < n && ch[i] != 0 ; i++) { int c = chtype_get(ch[i]); if (iscntrl(c)) { if (c == 0x07 && opt_get_bool(OPT_BEEP) && beeps < beeps_max) { beep(); beeps++; } waddch(win, chtype_ctrl(c)); } else waddch(win, ch[i]); } return (i); } inline size_t wputncstr(WINDOW *win, char *str, size_t n) { size_t i; for (i = 0 ; i < n && *str != '\0' ; i++) { if (iscntrl(*str)) waddch(win, chtype_ctrl(*str)); else waddch(win, *str); str++; } return (i); } /* ** Write the first n chtype chars of the cstring pointed to by "ch" ** to the screen at position (x, y). */ inline size_t mvwputnstr(WINDOW *win, int y, int x, chtype *ch, size_t n) { wmove(win, y, x); return (wputnstr(win, ch, n)); } pork-0.99.8.1/src/pork_cstr.h0000644000175000017500000000204410234217327015646 0ustar ryanryan00000000000000/* ** pork_cstr.h - routines for dealing with strings of type chtype *. ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_CSTR_H #define __PORK_CSTR_H #define PORK_TABSTOP 4 #define chtype_set(x, c) ((x) = ((x) & ~A_CHARTEXT) | (c)) #define chtype_get(x) ((x) & A_CHARTEXT) #define chtype_ctrl(x) (((x) + 'A' - 1) | A_REVERSE) size_t cstrlen(chtype *ch); chtype *cstrndup(chtype *ch, size_t len); char *cstr_to_plaintext(chtype *cstr, size_t n); int plaintext_to_cstr(chtype *ch, size_t len, ...); int plaintext_to_cstr_nocolor(chtype *ch, size_t len, ...); size_t wputstr(WINDOW *win, chtype *ch); size_t wputnstr(WINDOW *win, chtype *ch, size_t n); size_t wputncstr(WINDOW *win, char *str, size_t n); size_t mvwputstr(WINDOW *win, int y, int x, chtype *ch); size_t mvwputnstr(WINDOW *win, int y, int x, chtype *ch, size_t n); #endif pork-0.99.8.1/src/pork_command.c0000644000175000017500000017734310234217327016323 0ustar ryanryan00000000000000/* ** pork_command.c - interface to commands typed by the user ** Copyright (C) 2002-2005 Ryan McCabe ** Copyright (C) 2002-2004 Amber Adams ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern struct sockaddr_storage local_addr; extern in_port_t local_port; static void print_binding(void *data, void *nothing); static void print_alias(void *data, void *nothing); static int cmd_compare(const void *l, const void *r); static void print_timer(void *data, void *nothing); static int run_one_command(char *str, u_int32_t set); /* ** Note that the "struct command" arrays are arranged in alphabetical ** order. They have to be like that. */ /* ** The / command set. */ static struct command command[] = { { "", cmd_send }, { "acct", cmd_acct }, { "alias", cmd_alias }, { "auto", cmd_auto }, { "away", cmd_away }, { "bind", cmd_bind }, { "blist", cmd_blist }, { "buddy", cmd_buddy }, { "chat", cmd_chat }, { "connect", cmd_connect }, { "ctcp", cmd_ctcp }, { "disconnect", cmd_disconnect }, { "echo", cmd_echo }, { "event", cmd_event }, { "file", cmd_file }, { "help", cmd_help }, { "history", cmd_history }, { "idle", cmd_idle }, { "input", cmd_input }, { "laddr", cmd_laddr }, { "lastlog", cmd_lastlog }, { "load", cmd_load }, { "lport", cmd_lport }, { "me", cmd_me }, { "mode", cmd_mode }, { "msg", cmd_msg }, { "nick", cmd_nick }, { "notice", cmd_notice }, { "perl", cmd_perl }, { "perl_dump", cmd_perl_dump }, { "perl_load", cmd_perl_load }, { "ping", cmd_ping }, { "profile", cmd_profile, }, { "query", cmd_query }, { "quit", cmd_quit }, { "quote", cmd_quote }, { "refresh", cmd_refresh }, { "save", cmd_save }, { "scroll", cmd_scroll }, { "set", cmd_set }, { "timer", cmd_timer }, { "unalias", cmd_unalias }, { "unbind", cmd_unbind }, { "who", cmd_who }, { "whowas", cmd_whowas }, { "win", cmd_win }, }; /* ** /input commands */ static struct command input_command[] = { { "backspace", cmd_input_bkspace }, { "clear", cmd_input_clear }, { "clear_next_word", cmd_input_clear_next }, { "clear_prev_word", cmd_input_clear_prev }, { "clear_to_end", cmd_input_clear_to_end }, { "clear_to_start", cmd_input_clear_to_start }, { "delete", cmd_input_delete }, { "end", cmd_input_end }, { "find_next_cmd", cmd_input_find_next_cmd }, { "focus_next", cmd_input_focus_next }, { "insert", cmd_input_insert }, { "left", cmd_input_left }, { "next_word", cmd_input_next_word }, { "prev_word", cmd_input_prev_word }, { "prompt", cmd_input_prompt }, { "right", cmd_input_right }, { "send", cmd_input_send }, { "start", cmd_input_start }, }; USER_COMMAND(cmd_input_bkspace) { input_bkspace(cur_window()->input); } USER_COMMAND(cmd_input_clear) { input_clear_line(cur_window()->input); } USER_COMMAND(cmd_input_clear_prev) { input_clear_prev_word(cur_window()->input); } USER_COMMAND(cmd_input_clear_next) { input_clear_next_word(cur_window()->input); } USER_COMMAND(cmd_input_clear_to_end) { input_clear_to_end(cur_window()->input); } USER_COMMAND(cmd_input_focus_next) { struct imwindow *win = cur_window(); imwindow_switch_focus(win); imwindow_blist_draw(win); } USER_COMMAND(cmd_input_clear_to_start) { input_clear_to_start(cur_window()->input); } USER_COMMAND(cmd_input_delete) { input_delete(cur_window()->input); } USER_COMMAND(cmd_input_end) { input_end(cur_window()->input); } USER_COMMAND(cmd_input_insert) { if (args != NULL) input_insert_str(cur_window()->input, args); } USER_COMMAND(cmd_input_left) { input_move_left(cur_window()->input); } USER_COMMAND(cmd_input_prev_word) { input_prev_word(cur_window()->input); } USER_COMMAND(cmd_input_prompt) { if (args == NULL) { input_set_prompt(cur_window()->input, NULL); screen_cmd_output("Input prompt cleared"); } else { if (input_set_prompt(cur_window()->input, args) == -1) screen_err_msg("The requested prompt is too long for the screen"); else { screen_cmd_output("Input prompt set to %s", args); } } } USER_COMMAND(cmd_input_next_word) { input_next_word(cur_window()->input); } USER_COMMAND(cmd_input_right) { input_move_right(cur_window()->input); } USER_COMMAND(cmd_input_send) { struct imwindow *imwindow = cur_window(); struct input *input = imwindow->input; struct pork_acct *acct = imwindow->owner; static int recursion; /* ** This is kind of a hack, but it's necessary if the client ** isn't to crash when someone types "/input send" */ if (recursion == 1 && args == NULL) return; recursion = 1; if (args != NULL) input_set_buf(input, args); if (input->len > 0) { char *input_str = xstrdup(input_get_buf_str(input)); if (args == NULL) input_history_add(input); input_clear_line(input); if (event_generate(acct->events, EVENT_SEND_LINE, input_str, acct->refnum)) { goto out; } if (input_str[0] == opt_get_char(OPT_CMDCHARS)) run_command(&input_str[1]); else cmd_send(input_str); out: free(input_str); } recursion = 0; } USER_COMMAND(cmd_input_start) { input_home(cur_window()->input); } /* ** /scroll commands */ static struct command scroll_command[] = { { "by", cmd_scroll_by }, { "down", cmd_scroll_down }, { "end", cmd_scroll_end }, { "page_down", cmd_scroll_pgdown }, { "page_up", cmd_scroll_pgup }, { "start", cmd_scroll_start }, { "up", cmd_scroll_up }, }; USER_COMMAND(cmd_scroll_by) { int lines; if (args == NULL) return; if (str_to_int(args, &lines) != 0) { screen_err_msg("Invalid number of lines: %s", args); return; } imwindow_scroll_by(cur_window(), lines); } USER_COMMAND(cmd_scroll_down) { imwindow_scroll_down(cur_window()); } USER_COMMAND(cmd_scroll_end) { imwindow_scroll_end(cur_window()); } USER_COMMAND(cmd_scroll_pgdown) { imwindow_scroll_page_down(cur_window()); } USER_COMMAND(cmd_scroll_pgup) { imwindow_scroll_page_up(cur_window()); } USER_COMMAND(cmd_scroll_start) { imwindow_scroll_start(cur_window()); } USER_COMMAND(cmd_scroll_up) { imwindow_scroll_up(cur_window()); } /* ** /file commands. */ static struct command file_command[] = { { "abort", cmd_file_cancel }, { "cancel", cmd_file_cancel }, { "get", cmd_file_get }, { "list", cmd_file_list }, { "resume", cmd_file_resume }, { "send", cmd_file_send }, }; USER_COMMAND(cmd_file_cancel) { struct pork_acct *acct = cur_window()->owner; u_int32_t refnum; struct file_transfer *xfer; char *refnum_str; if (args == NULL || blank_str(args)) return; refnum_str = strsep(&args, " "); if (refnum_str == NULL) return; if (!strcasecmp(refnum_str, "all")) { transfer_abort_all(acct, TRANSFER_DIR_ANY); return; } if (!strcasecmp(refnum_str, "send")) { transfer_abort_all(acct, TRANSFER_DIR_SEND); return; } if (!strcasecmp(refnum_str, "recv") || !strcasecmp(refnum_str, "receive")) { transfer_abort_all(acct, TRANSFER_DIR_RECV); return; } if (str_to_uint(args, &refnum) != 0) { screen_err_msg("Invalid file transfer refnum: %s", args); return; } xfer = transfer_find_refnum(acct, refnum); if (xfer == NULL) { screen_err_msg("Invalid file transfer refnum: %s", args); return; } if (transfer_cancel_local(xfer) != 0) screen_err_msg("Error canceling file transfer %s", args); } USER_COMMAND(cmd_file_list) { struct pork_acct *acct = cur_window()->owner; if (acct->transfer_list != NULL) { dlist_t *cur = acct->transfer_list; while (cur != NULL) { struct file_transfer *xfer = cur->data; screen_cmd_output("%u: %s %s [%s: %u/%u (%.02f%%) - %.04f KB/s]", xfer->refnum, xfer->peer_username, xfer->fname_local, transfer_status_str(xfer), (u_int32_t) xfer->bytes_sent, (u_int32_t) xfer->file_len, (float) xfer->bytes_sent / xfer->file_len * 100, transfer_avg_speed(xfer)); cur = cur->next; } } } USER_COMMAND(cmd_file_get) { char *refnum_str; u_int32_t refnum; struct pork_acct *acct = cur_window()->owner; struct file_transfer *xfer; if (args == NULL || blank_str(args)) return; refnum_str = strsep(&args, " "); if (refnum_str == NULL) return; if (!strcasecmp(refnum_str, "all")) { transfer_get_all(acct); return; } if (str_to_uint(refnum_str, &refnum) != 0) { screen_err_msg("Invalid file transfer refnum: %s", refnum_str); return; } xfer = transfer_find_refnum(acct, refnum); if (xfer == NULL) { screen_err_msg("Invalid file transfer refnum: %s", refnum_str); return; } if (args != NULL && blank_str(args)) args = NULL; transfer_get(xfer, args); } USER_COMMAND(cmd_file_resume) { } USER_COMMAND(cmd_file_send) { char *dest; if (args == NULL) return; dest = strsep(&args, " "); if (dest == NULL || args == NULL) { screen_err_msg("You must specify a user and a filename"); return; } transfer_send(cur_window()->owner, dest, args); } /* ** /win commands. */ static struct command window_command[] = { { "bind", cmd_win_bind }, { "bind_next", cmd_win_bind_next }, { "clear", cmd_win_clear }, { "close", cmd_win_close }, { "dump", cmd_win_dump }, { "erase", cmd_win_erase }, { "ignore", cmd_win_ignore }, { "list", cmd_win_list }, { "next", cmd_win_next }, { "prev", cmd_win_prev }, { "rename", cmd_win_rename }, { "renumber", cmd_win_renumber }, { "set", cmd_win_set }, { "skip", cmd_win_skip }, { "swap", cmd_win_swap }, { "unignore", cmd_win_unignore }, { "unskip", cmd_win_unskip }, }; USER_COMMAND(cmd_win_bind) { struct imwindow *imwindow = cur_window(); u_int32_t refnum; int ret; if (args == NULL || blank_str(args)) { if (imwindow->owner != NULL && imwindow->owner->username != NULL) { screen_cmd_output("This window is bound to account %s [refnum %u]", imwindow->owner->username, imwindow->owner->refnum); } else screen_cmd_output("This window is bound to no account"); return; } if (str_to_uint(args, &refnum) == -1) { screen_err_msg("Bad account refnum: %s", args); return; } ret = imwindow_bind_acct(imwindow, refnum); if (ret == -1) { if (imwindow->type == WIN_TYPE_CHAT) screen_err_msg("You can't rebind chat windows"); else screen_err_msg("Account %s isn't signed on", args); } else { screen_cmd_output("This window is now bound to account %s [refnum %u]", imwindow->owner->username, imwindow->owner->refnum); } } USER_COMMAND(cmd_win_bind_next) { if (imwindow_bind_next_acct(cur_window()) != -1) screen_refresh(); } USER_COMMAND(cmd_win_clear) { imwindow_clear(cur_window()); } USER_COMMAND(cmd_win_close) { screen_close_window(cur_window()); } USER_COMMAND(cmd_win_dump) { if (args == NULL || blank_str(args)) { screen_err_msg("No output file specified"); } else { char buf[4096]; expand_path(args, buf, sizeof(buf)); imwindow_dump_buffer(cur_window(), buf); } } USER_COMMAND(cmd_win_erase) { imwindow_erase(cur_window()); } USER_COMMAND(cmd_win_ignore) { struct imwindow *win; if (args != NULL && !blank_str(args)) { u_int32_t refnum; if (str_to_uint(args, &refnum) != 0) { screen_err_msg("Bad window refnum: %s", args); return; } win = imwindow_find_refnum(refnum); if (win == NULL) { screen_err_msg("No window with refnum %u", refnum); return; } } else win = cur_window(); imwindow_ignore(win); } USER_COMMAND(cmd_win_list) { dlist_t *cur; static const char *win_types[] = { "Status", "Conv", "Chat" }; screen_cmd_output("Window List:"); screen_cmd_output("REFNUM\t\tNAME\t\tTYPE\t\tTARGET"); cur = screen.window_list; do { struct imwindow *imwindow = cur->data; screen_cmd_output("%u\t\t\t%s\t\t%s\t\t%s", imwindow->refnum, imwindow->name, win_types[imwindow->type], imwindow->target); cur = cur->next; } while (cur != screen.window_list); } USER_COMMAND(cmd_win_next) { screen_cycle_fwd(); } USER_COMMAND(cmd_win_prev) { screen_cycle_bak(); } USER_COMMAND(cmd_win_rename) { struct imwindow *win = cur_window(); if (args == NULL) screen_cmd_output("Window %u has name \"%s\"", win->refnum, win->name); else imwindow_rename(win, args); } USER_COMMAND(cmd_win_renumber) { u_int32_t num; if (args == NULL || blank_str(args)) { screen_cmd_output("This is window %u", cur_window()->refnum); return; } if (str_to_uint(args, &num) != 0) { screen_err_msg("Bad window number: %s", args); return; } screen_renumber(cur_window(), num); } USER_COMMAND(cmd_win_set) { char *variable; char *value; int opt; variable = strsep(&args, " "); if (variable == NULL || blank_str(variable)) { wopt_print(cur_window()); return; } opt = wopt_find(variable); strtoupper(variable); if (opt == -1) { screen_err_msg("Unknown variable: %s", variable); return; } value = args; if (value == NULL || blank_str(value)) { wopt_print_var(cur_window(), opt, "is set to"); return; } if (wopt_set(cur_window(), opt, value) == -1) screen_nocolor_msg("Bad argument for %s: %s", variable, value); else wopt_print_var(cur_window(), opt, "set to"); } USER_COMMAND(cmd_win_skip) { struct imwindow *win; if (args != NULL && !blank_str(args)) { u_int32_t refnum; if (str_to_uint(args, &refnum) != 0) { screen_err_msg("Bad window refnum: %s", args); return; } win = imwindow_find_refnum(refnum); if (win == NULL) { screen_err_msg("No window with refnum %u", refnum); return; } } else win = cur_window(); imwindow_skip(win); } USER_COMMAND(cmd_win_swap) { u_int32_t num; if (args == NULL || blank_str(args)) return; if (str_to_uint(args, &num) != 0) { screen_err_msg("Invalid window refnum: %s", args); return; } if (screen_goto_window(num) != 0) screen_err_msg("No such window: %s", args); } USER_COMMAND(cmd_win_unignore) { struct imwindow *win; if (args != NULL && !blank_str(args)) { u_int32_t refnum; if (str_to_uint(args, &refnum) != 0) { screen_err_msg("Bad window refnum: %s", args); return; } win = imwindow_find_refnum(refnum); if (win == NULL) { screen_err_msg("No window with refnum %u", refnum); return; } } else win = cur_window(); imwindow_unignore(win); } USER_COMMAND(cmd_win_unskip) { struct imwindow *win; if (args != NULL && !blank_str(args)) { u_int32_t refnum; if (str_to_uint(args, &refnum) != 0) { screen_err_msg("Bad window refnum: %s", args); return; } win = imwindow_find_refnum(refnum); if (win == NULL) { screen_err_msg("No window with refnum %u", refnum); return; } } else win = cur_window(); imwindow_unskip(win); } /* ** History Manipulation. */ static struct command history_command[] = { { "clear", cmd_history_clear }, { "list", cmd_history_list }, { "next", cmd_history_next }, { "prev", cmd_history_prev }, }; USER_COMMAND(cmd_history_clear) { input_history_clear(cur_window()->input); } USER_COMMAND(cmd_history_list) { struct imwindow *win = cur_window(); struct input *input = win->input; dlist_t *cur = input->history_end; u_int32_t i = 0; if (cur == NULL) return; screen_win_msg(win, 0, 0, 0, MSG_TYPE_CMD_OUTPUT, "Command history:"); do { screen_win_msg(win, 0, 0, 0, MSG_TYPE_CMD_OUTPUT, "%u: %s", i++, (char *) cur->data); cur = cur->prev; } while (cur != NULL); } USER_COMMAND(cmd_history_next) { input_history_next(cur_window()->input); } USER_COMMAND(cmd_history_prev) { input_history_prev(cur_window()->input); } /* ** /buddy commands */ static struct command buddy_command[] = { { "add", cmd_buddy_add }, { "add_group", cmd_buddy_add_group }, { "alias", cmd_buddy_alias }, { "awaymsg", cmd_buddy_awaymsg }, { "block", cmd_buddy_block }, { "clear_block", cmd_buddy_clear_block }, { "clear_permit", cmd_buddy_clear_permit }, { "list", cmd_buddy_list }, { "list_block", cmd_buddy_list_block }, { "list_permit", cmd_buddy_list_permit }, { "permit", cmd_buddy_permit }, { "privacy_mode", cmd_buddy_privacy_mode }, { "profile", cmd_buddy_profile }, { "remove", cmd_buddy_remove }, { "remove_group", cmd_buddy_remove_group }, { "remove_permit", cmd_buddy_remove_permit }, { "report_idle", cmd_buddy_report_idle }, { "search", cmd_who }, { "seen", cmd_buddy_seen }, { "unblock", cmd_buddy_unblock }, { "warn", cmd_buddy_warn }, { "warn_anon", cmd_buddy_warn_anon }, }; USER_COMMAND(cmd_buddy_add) { char *screen_name; char *group_name; struct bgroup *group; struct buddy *buddy; struct pork_acct *acct = cur_window()->owner; screen_name = strsep(&args, " "); if (screen_name == NULL || blank_str(screen_name)) { screen_err_msg("syntax is /buddy add "); return; } buddy = buddy_find(acct, screen_name); if (buddy != NULL) { screen_err_msg("%s is already a member of the group %s", screen_name, buddy->group->name); return; } group_name = args; if (group_name == NULL || blank_str(group_name)) { screen_err_msg("syntax is /buddy add "); return; } group = group_find(acct, group_name); if (group == NULL) { screen_err_msg("The group %s does not exist", group_name); return; } buddy_add(acct, screen_name, group, 1); } USER_COMMAND(cmd_buddy_block) { struct pork_acct *acct = cur_window()->owner; if (args == NULL || blank_str(args)) return; if (buddy_add_block(acct, args, 1) == -1) screen_err_msg("%s is already on your block list", args); else screen_cmd_output("%s added to block list", args); } USER_COMMAND(cmd_buddy_permit) { struct pork_acct *acct = cur_window()->owner; if (args == NULL || blank_str(args)) return; if (buddy_add_permit(acct, args, 1) == -1) screen_err_msg("%s is already on your permit list", args); else screen_cmd_output("%s added to permit list", args); } USER_COMMAND(cmd_buddy_add_group) { struct pork_acct *acct = cur_window()->owner; if (args == NULL || blank_str(args)) return; group_add(acct, args); } USER_COMMAND(cmd_buddy_alias) { struct buddy *buddy; char *buddy_name; char *alias; struct pork_acct *acct = cur_window()->owner; struct imwindow *win; buddy_name = strsep(&args, " "); if (buddy_name == NULL) return; alias = args; if (alias == NULL || blank_str(alias)) return; buddy = buddy_find(acct, buddy_name); if (buddy == NULL) { screen_err_msg("%s is not on your buddy list", buddy_name); return; } screen_cmd_output("alias: %s -> %s", buddy_name, alias); buddy_alias(acct, buddy, alias, 1); /* ** If there's a conversation window with this user open, we ** should change its title. */ win = imwindow_find(acct, buddy->nname); if (win != NULL) imwindow_rename(win, buddy->name); } USER_COMMAND(cmd_buddy_awaymsg) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; if (acct->proto->get_away_msg == NULL) return; if (args == NULL || blank_str(args)) { if (win->type == WIN_TYPE_PRIVMSG) args = win->target; else args = acct->username; } acct->proto->get_away_msg(acct, args); } USER_COMMAND(cmd_buddy_clear_block) { buddy_clear_block(cur_window()->owner); } USER_COMMAND(cmd_buddy_clear_permit) { buddy_clear_permit(cur_window()->owner); } USER_COMMAND(cmd_buddy_privacy_mode) { struct pork_acct *acct = cur_window()->owner; int mode = -1; if (acct->proto->set_privacy_mode == NULL) return; if (args != NULL) str_to_int(args, &mode); mode = acct->proto->set_privacy_mode(acct, mode); screen_cmd_output("Privacy mode for %s is %d", acct->username, mode); } USER_COMMAND(cmd_buddy_list) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; struct buddy_pref *pref = acct->buddy_pref; dlist_t *gcur; gcur = pref->group_list; if (gcur != NULL) { screen_win_msg(win, 0, 1, 1, MSG_TYPE_CMD_OUTPUT, "%s's buddy list: ", acct->username); } while (gcur != NULL) { struct bgroup *gr = gcur->data; dlist_t *bcur = gr->member_list; screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "+ %s (%u/%u)", gr->name, gr->num_online, gr->num_members); while (bcur != NULL) { struct buddy *buddy = bcur->data; if (buddy->status != STATUS_OFFLINE) { char buddy_status[128]; size_t i = 0; size_t len = sizeof(buddy_status); char *color_attr = "%G"; buddy_status[0] = '\0'; if (buddy->idle_time > 0) { char time_buf[64]; int ret; color_attr = "%Y"; time_to_str(buddy->idle_time, time_buf, sizeof(time_buf)); ret = snprintf(buddy_status, len, "idle: %s ", time_buf); if (ret < 0 || (size_t) ret >= len) { screen_err_msg("Output was too long to display"); return; } i += ret; len -= ret; } if (buddy->warn_level > 0) { snprintf(&buddy_status[i], len, "warn level: %d%%", buddy->warn_level); } screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, " %so%%x %s %s", color_attr, buddy->name, buddy_status); } else { screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, " %%Ro%%x %s", buddy->name); } bcur = bcur->next; } gcur = gcur->next; } } USER_COMMAND(cmd_buddy_list_permit) { struct pork_acct *acct = cur_window()->owner; struct buddy_pref *pref = acct->buddy_pref; dlist_t *cur; cur = pref->permit_list; if (cur == NULL) { screen_cmd_output("%s's permitted users list is empty", acct->username); return; } screen_cmd_output("%s's permitted users list:", acct->username); while (cur != NULL) { screen_cmd_output(" - %s", (char *) cur->data); cur = cur->next; } } USER_COMMAND(cmd_buddy_list_block) { struct pork_acct *acct = cur_window()->owner; struct buddy_pref *pref = acct->buddy_pref; dlist_t *cur; cur = pref->block_list; if (cur == NULL) { screen_cmd_output("%s's blocked users list is empty", acct->username); return; } screen_cmd_output("%s's blocked users list:", acct->username); while (cur != NULL) { screen_cmd_output(" - %s", (char *) cur->data); cur = cur->next; } } USER_COMMAND(cmd_buddy_profile) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; if (acct->proto->get_profile == NULL) return; if (args == NULL || blank_str(args)) { if (win->type == WIN_TYPE_PRIVMSG) args = win->target; else args = acct->username; } acct->proto->get_profile(acct, args); } USER_COMMAND(cmd_buddy_remove_permit) { struct pork_acct *acct = cur_window()->owner; if (args == NULL || blank_str(args)) return; if (buddy_remove_permit(acct, args, 1) != 0) screen_err_msg("%s isn't on %s's permit list", args, acct->username); else { screen_cmd_output("%s removed from %s's permit list", args, acct->username); } } USER_COMMAND(cmd_buddy_unblock) { struct pork_acct *acct = cur_window()->owner; if (args == NULL || blank_str(args)) return; if (buddy_remove_block(acct, args, 1) != 0) screen_err_msg("%s isn't on %s's block list", args, acct->username); else { screen_cmd_output("%s removed from %s's block list", args, acct->username); } } USER_COMMAND(cmd_buddy_remove) { struct pork_acct *acct = cur_window()->owner; if (args == NULL || blank_str(args)) return; if (buddy_remove(acct, args, 1) != 0) screen_err_msg("%s isn't on %s's buddy list", args, acct->username); else { screen_cmd_output("%s removed from %s's buddy list", args, acct->username); } } USER_COMMAND(cmd_buddy_remove_group) { struct pork_acct *acct = cur_window()->owner; if (args == NULL || blank_str(args)) return; if (group_remove(acct, args, 1) != 0) { screen_err_msg("The group %s does not exist on %s's buddy list", args, acct->username); } else { screen_cmd_output("The group %s was removed from %s's buddy list", args, acct->username); } } USER_COMMAND(cmd_buddy_report_idle) { struct pork_acct *acct = cur_window()->owner; if (acct->proto->set_report_idle == NULL) return; if (args != NULL && !blank_str(args)) { u_int32_t mode; if (str_to_uint(args, &mode) != 0) { screen_err_msg("Invalid number: %s", args); return; } acct->proto->set_report_idle(acct, mode); } screen_cmd_output("The reporting of idle time for %s is %s", acct->username, (acct->report_idle ? "enabled" : "disabled")); } USER_COMMAND(cmd_buddy_seen) { struct pork_acct *acct = cur_window()->owner; struct buddy *buddy; if (args == NULL || blank_str(args)) return; buddy = buddy_find(acct, args); if (buddy == NULL) { screen_err_msg("%s is not on %s's buddy list", args, acct->username); return; } if (buddy->status != STATUS_OFFLINE) { screen_cmd_output("%s is currently online", buddy->name); return; } if (!buddy->last_seen) { screen_cmd_output("%s has never been seen online by %s", args, acct->username); } else { char *p; char timebuf[64]; char timestr[64]; u_int32_t time_diff = (u_int32_t) time(NULL) - buddy->last_seen; time_to_str(time_diff / 60 , timebuf, sizeof(timebuf)); xstrncpy(timestr, asctime(localtime((time_t *) &buddy->last_seen)), sizeof(timestr)); p = strchr(timestr, '\n'); if (p != NULL) *p = '\0'; screen_cmd_output("%s last saw %s online %s (%s ago)", acct->username, buddy->name, timestr, timebuf); } } USER_COMMAND(cmd_buddy_warn) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; if (acct->proto->warn == NULL) return; if (args == NULL || blank_str(args)) { if (win->type == WIN_TYPE_PRIVMSG) args = win->target; else return; } pork_send_warn(acct, args); } USER_COMMAND(cmd_buddy_warn_anon) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; if (acct->proto->warn_anon == NULL) return; if (args == NULL || blank_str(args)) { if (win->type == WIN_TYPE_PRIVMSG) args = win->target; else return; } pork_send_warn_anon(acct, args); } /* ** /blist commands */ static struct command blist_command[] = { { "add_block", cmd_blist_add_block }, { "add_permit", cmd_blist_add_permit }, { "away", cmd_blist_away }, { "collapse", cmd_blist_collapse }, { "down", cmd_blist_down }, { "end", cmd_blist_end }, { "goto", cmd_blist_goto }, { "hide", cmd_blist_hide }, { "page_down", cmd_blist_pgdown }, { "page_up", cmd_blist_pgup }, { "profile", cmd_blist_profile }, { "refresh", cmd_blist_refresh }, { "remove", cmd_blist_remove }, { "remove_block", cmd_blist_remove_block }, { "remove_permit", cmd_blist_remove_permit }, { "select", cmd_blist_select }, { "show", cmd_blist_show }, { "start", cmd_blist_start }, { "toggle", cmd_blist_toggle }, { "up", cmd_blist_up }, { "warn", cmd_blist_warn }, { "warn_anon", cmd_blist_warn_anon }, { "width", cmd_blist_width }, }; USER_COMMAND(cmd_blist_add_block) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_block(buddy->nname); } USER_COMMAND(cmd_blist_add_permit) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_permit(buddy->nname); } USER_COMMAND(cmd_blist_away) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_awaymsg(buddy->nname); } USER_COMMAND(cmd_blist_collapse) { struct slist_cell *cell; struct pork_acct *acct = cur_window()->owner; struct blist *blist = acct->blist; if (args == NULL) cell = blist_get_cursor(blist); else { dlist_t *node; struct bgroup *gr = group_find(acct, args); if (gr == NULL) return; node = gr->blist_line; if (node == NULL || node->data == NULL) return; cell = node->data; } if (cell == NULL || cell->type != TYPE_LIST_CELL) return; blist_collapse_group(blist, cell->data); } USER_COMMAND(cmd_blist_down) { blist_cursor_down(cur_window()->owner->blist); } USER_COMMAND(cmd_blist_end) { blist_cursor_end(cur_window()->owner->blist); } USER_COMMAND(cmd_blist_goto) { if (args != NULL) cmd_query(args); else { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL) return; if (cell->type != TYPE_LIST_CELL) return; buddy = cell->data; cmd_query(buddy->nname); } } USER_COMMAND(cmd_blist_hide) { imwindow_blist_hide(cur_window()); } USER_COMMAND(cmd_blist_pgdown) { blist_cursor_pgdown(cur_window()->owner->blist); } USER_COMMAND(cmd_blist_pgup) { blist_cursor_pgup(cur_window()->owner->blist); } USER_COMMAND(cmd_blist_profile) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_profile(buddy->nname); } USER_COMMAND(cmd_blist_refresh) { imwindow_blist_draw(cur_window()); } USER_COMMAND(cmd_blist_remove) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_remove(buddy->nname); } USER_COMMAND(cmd_blist_remove_block) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_unblock(buddy->nname); } USER_COMMAND(cmd_blist_remove_permit) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_remove_permit(buddy->nname); } USER_COMMAND(cmd_blist_select) { struct slist_cell *cell; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL) return; if (cell->type == TYPE_LIST_CELL) cmd_blist_collapse(NULL); else { struct buddy *buddy = cell->data; cmd_blist_goto(buddy->nname); } } USER_COMMAND(cmd_blist_show) { imwindow_blist_show(cur_window()); } USER_COMMAND(cmd_blist_start) { blist_cursor_start(cur_window()->owner->blist); } USER_COMMAND(cmd_blist_toggle) { imwindow_blist_toggle(cur_window()); } USER_COMMAND(cmd_blist_up) { blist_cursor_up(cur_window()->owner->blist); } USER_COMMAND(cmd_blist_warn) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_warn(buddy->nname); } USER_COMMAND(cmd_blist_warn_anon) { struct slist_cell *cell; struct buddy *buddy; struct blist *blist = cur_window()->owner->blist; cell = blist_get_cursor(blist); if (cell == NULL || cell->type == TYPE_LIST_CELL) return; buddy = cell->data; cmd_buddy_warn_anon(buddy->nname); } USER_COMMAND(cmd_blist_width) { u_int32_t new_len; struct blist *blist = cur_window()->owner->blist; if (args == NULL) return; if (str_to_uint(args, &new_len) != 0) { screen_err_msg("Error: invalid width: %s", args); return; } screen_blist_width(blist, new_len); } /* ** /timer commands */ static struct command timer_command[] = { { "add", cmd_timer_add }, { "del", cmd_timer_del }, { "del_refnum", cmd_timer_del_refnum }, { "list", cmd_timer_list }, { "purge", cmd_timer_purge }, }; USER_COMMAND(cmd_timer_add) { char *p; u_int32_t interval; u_int32_t times; if (args == NULL) return; p = strsep(&args, " "); if (p == NULL) return; if (str_to_uint(p, &interval) != 0) { screen_err_msg("Invalid timer interval: %s", p); return; } p = strsep(&args, " "); if (p == NULL) return; if (str_to_uint(p, ×) != 0) { screen_err_msg("Invalid number of times to run: %s", p); return; } if (args == NULL || blank_str(args)) return; timer_add(&screen.timer_list, args, interval, times); } USER_COMMAND(cmd_timer_del) { int ret; if (args == NULL) return; ret = timer_del(&screen.timer_list, args); if (ret == -1) screen_err_msg("No timer for \"%s\" was found", args); else screen_cmd_output("Timer for \"%s\" was removed", args); } USER_COMMAND(cmd_timer_del_refnum) { u_int32_t refnum; int ret; if (args == NULL) return; if (str_to_uint(args, &refnum) != 0) { screen_err_msg("Bad timer refnum: %s", args); return; } ret = timer_del_refnum(&screen.timer_list, refnum); if (ret == -1) screen_err_msg("No timer with refnum %u was found", refnum); else screen_cmd_output("Timer with refnum %u was removed", refnum); } USER_COMMAND(cmd_timer_list) { dlist_iterate(screen.timer_list, print_timer, NULL); } USER_COMMAND(cmd_timer_purge) { if (screen.timer_list != NULL) { timer_destroy(&screen.timer_list); screen_cmd_output("All timers have been removed"); } } /* ** /event commands */ static struct command event_command[] = { { "add", cmd_event_add }, { "del", cmd_event_del }, { "del_refnum", cmd_event_del_refnum }, { "list", cmd_event_list }, { "purge", cmd_event_purge }, }; USER_COMMAND(cmd_event_add) { char *event_type; u_int32_t refnum; struct event *events = cur_window()->owner->events; if (args == NULL || *args == '\0') { event_list(events, NULL); return; } event_type = strsep(&args, " "); if (event_type == NULL) { event_list(events, NULL); return; } strtoupper(event_type); if (args == NULL) { event_list(events, event_type); return; } if (event_add(events, event_type, args, &refnum) != 0) screen_err_msg("Error adding handler for %s", event_type); else { screen_cmd_output("Event handler %s installed for %s (refnum %u)", args, event_type, refnum); } } USER_COMMAND(cmd_event_del) { char *event_type; int ret; if (args == NULL) return; event_type = strsep(&args, " "); if (event_type == NULL) return; ret = event_del_type(cur_window()->owner->events, event_type, args); if (ret == 0) { if (args == NULL) { screen_cmd_output("Successfully removed handler %s for %s", event_type, args); } else screen_cmd_output("Successfully removed all handlers for %s", args); } else { if (args == NULL) { screen_err_msg("Error removing handler %s for %s", event_type, args); } else screen_err_msg("Error removing all handlers for %s", args); } } USER_COMMAND(cmd_event_del_refnum) { u_int32_t refnum; if (args == NULL) return; if (str_to_uint(args, &refnum) != 0) { screen_err_msg("Invalid event refnum: %s", args); return; } if (event_del_refnum(cur_window()->owner->events, refnum) != 0) screen_err_msg("Error deleting event refnum %s", args); else screen_cmd_output("Event refnum %s was removed", args); } USER_COMMAND(cmd_event_list) { event_list(cur_window()->owner->events, args); } USER_COMMAND(cmd_event_purge) { event_purge(cur_window()->owner->events); } /* ** acct commands */ static struct command acct_command[] = { { "list", cmd_acct_list }, { "save", cmd_acct_save }, { "set", cmd_acct_set }, }; USER_COMMAND(cmd_acct_list) { pork_acct_print_list(); } USER_COMMAND(cmd_acct_save) { pork_acct_save(cur_window()->owner); } USER_COMMAND(cmd_acct_set) { } /* ** /chat commands */ static struct command chat_command[] = { { "ban", cmd_chat_ban }, { "ignore", cmd_chat_ignore }, { "invite", cmd_chat_invite }, { "join", cmd_chat_join }, { "kick", cmd_chat_kick }, { "leave", cmd_chat_leave }, { "list", cmd_chat_list }, { "send", cmd_chat_send }, { "topic", cmd_chat_topic }, { "unignore", cmd_chat_unignore }, { "who", cmd_chat_who }, }; USER_COMMAND(cmd_chat_ban) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; struct chatroom *chat; char *arg1; char *arg2; if (args == NULL) return; arg1 = strsep(&args, " "); chat = chat_find(acct, arg1); if (chat == NULL) { if (win->type == WIN_TYPE_CHAT && win->data != NULL) chat_ban(acct, win->data, arg1); else screen_err_msg("%s is not a member of %s", acct->username, arg1); return; } arg2 = strsep(&args, " "); if (arg2 != NULL) chat_ban(acct, chat, arg2); } USER_COMMAND(cmd_chat_ignore) { struct imwindow *imwindow = cur_window(); struct pork_acct *acct = imwindow->owner; char *chat_name; char *user_name; if (args == NULL) return; chat_name = strsep(&args, " "); user_name = args; if (user_name == NULL) { struct chatroom *chat = imwindow->data; if (imwindow->type != WIN_TYPE_CHAT || chat == NULL) { screen_err_msg("You must specify a chat room if the current window is not a chat window"); return; } user_name = chat_name; chat_name = chat->title; } chat_ignore(acct, chat_name, user_name); } USER_COMMAND(cmd_chat_invite) { struct imwindow *imwindow = cur_window(); struct pork_acct *acct = imwindow->owner; char *chat_name; char *user_name; char *invite_msg; if (args == NULL) return; chat_name = strsep(&args, " "); user_name = strsep(&args, " "); invite_msg = args; if (user_name == NULL) { struct chatroom *chat = imwindow->data; if (imwindow->type != WIN_TYPE_CHAT || chat == NULL) { screen_err_msg("You must specify a chat room if the current window is not a chat window"); return; } user_name = chat_name; chat_name = chat->title; } chat_invite(acct, chat_name, user_name, invite_msg); } USER_COMMAND(cmd_chat_join) { chat_join(cur_window()->owner, args); } USER_COMMAND(cmd_chat_kick) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; struct chatroom *chat; char *arg1; char *arg2; if (args == NULL) return; arg1 = strsep(&args, " "); chat = chat_find(acct, arg1); if (chat == NULL) { if (win->type == WIN_TYPE_CHAT && win->data != NULL) chat_kick(acct, win->data, arg1, args); else screen_err_msg("%s is not a member of %s", acct->username, arg1); return; } arg2 = strsep(&args, " "); if (arg2 != NULL) chat_kick(acct, chat, arg2, args); } USER_COMMAND(cmd_chat_leave) { struct imwindow *win = cur_window(); char *name = args; if (name == NULL || blank_str(name)) { struct chatroom *chat; if (win->type != WIN_TYPE_CHAT) { screen_err_msg("You must specify a chat room if the current window is not a chat window"); return; } if (win->data == NULL) return; chat = win->data; name = chat->title; } chat_leave(win->owner, name, 1); } USER_COMMAND(cmd_chat_list) { chat_list(cur_window()->owner); } USER_COMMAND(cmd_chat_send) { struct pork_acct *acct = cur_window()->owner; struct imwindow *win; char *chat_name; if (args == NULL) return; chat_name = strsep(&args, " "); if (chat_name == NULL || args == NULL) { screen_err_msg("You must specify a chatroom and a message"); return; } win = imwindow_find_chat_target(acct, chat_name); if (win == NULL || win->data == NULL) { screen_err_msg("%s is not joined to %s", acct->username, chat_name); return; } chat_send_msg(acct, win->data, chat_name, args); } USER_COMMAND(cmd_chat_topic) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; char *topic = NULL; struct chatroom *chat = NULL; if (acct->proto->chat_set_topic == NULL) return; if (args != NULL) { topic = strchr(args, ' '); if (topic != NULL) *topic++ = '\0'; chat = chat_find(acct, args); } if (chat == NULL) { if (topic != NULL) topic[-1] = ' '; topic = args; if (win->type == WIN_TYPE_CHAT) chat = win->data; else { screen_err_msg("You must specify a chat room if the current window isn't a chat window"); return; } } acct->proto->chat_set_topic(acct, chat, topic); } USER_COMMAND(cmd_chat_unignore) { struct imwindow *imwindow = cur_window(); struct pork_acct *acct = imwindow->owner; char *chat_name; char *user_name; if (args == NULL) return; chat_name = strsep(&args, " "); user_name = args; if (user_name == NULL) { struct chatroom *chat = imwindow->data; if (imwindow->type != WIN_TYPE_CHAT || chat == NULL) { screen_err_msg("You must specify a chat room if the current window is not a chat window"); return; } user_name = chat_name; chat_name = chat->title; } chat_unignore(acct, chat_name, user_name); } USER_COMMAND(cmd_chat_who) { struct imwindow *imwindow = cur_window(); struct pork_acct *acct = imwindow->owner; if (args == NULL || blank_str(args)) { struct chatroom *chat; if (imwindow->type != WIN_TYPE_CHAT) { screen_err_msg("You must specify a chat room if the current window is not a chat window"); return; } chat = imwindow->data; args = chat->title; } chat_who(acct, args); } static struct command_set { struct command *set; size_t elem; char *type; } command_set[] = { { command, array_elem(command), "" }, { window_command, array_elem(window_command), "win " }, { history_command, array_elem(history_command), "history " }, { input_command, array_elem(input_command), "input " }, { scroll_command, array_elem(scroll_command), "scroll " }, { buddy_command, array_elem(buddy_command), "buddy " }, { blist_command, array_elem(blist_command), "blist " }, { timer_command, array_elem(timer_command), "timer " }, { event_command, array_elem(event_command), "event " }, { chat_command, array_elem(chat_command), "chat " }, { file_command, array_elem(file_command), "file " }, { acct_command, array_elem(acct_command), "acct " }, }; /* ** Main command set. */ USER_COMMAND(cmd_alias) { char *alias; char *str; alias = strsep(&args, " "); if (alias == NULL || blank_str(alias)) { hash_iterate(&screen.alias_hash, print_alias, NULL); return; } str = args; if (str == NULL || blank_str(str)) { struct alias *lalias = alias_find(&screen.alias_hash, alias); if (lalias != NULL) { screen_cmd_output("%s is aliased to %s%s", lalias->alias, lalias->orig, (lalias->args != NULL ? lalias->args : "")); } else screen_err_msg("There is no alias for %s", alias); return; } if (alias_add(&screen.alias_hash, alias, str) == 0) { struct alias *lalias = alias_find(&screen.alias_hash, alias); if (lalias != NULL) { screen_cmd_output("%s is aliased to %s%s", lalias->alias, lalias->orig, (lalias->args != NULL ? lalias->args : "")); return; } } screen_err_msg("Error adding alias for %s", alias); } USER_COMMAND(cmd_auto) { struct pork_acct *acct = cur_window()->owner; char *target; if (args == NULL || !acct->connected) return; target = strsep(&args, " "); if (target == NULL || args == NULL) return; pork_msg_autoreply(acct, target, args); } USER_COMMAND(cmd_away) { struct pork_acct *acct = cur_window()->owner; if (args == NULL) pork_set_back(acct); else pork_set_away(acct, args); } USER_COMMAND(cmd_bind) { int key; char *func; char *key_str; struct key_binds *target_binds = cur_window()->active_binds; struct binding *binding; key_str = strsep(&args, " "); if (key_str == NULL || blank_str(key_str)) { hash_iterate(&target_binds->hash, print_binding, NULL); return; } if (key_str[0] == '-' && key_str[1] != '\0') { if (!strcasecmp(key_str, "-b") || !strcasecmp(key_str, "-buddy")) target_binds = &screen.binds.blist; else if (!strcasecmp(key_str, "-m") || !strcasecmp(key_str, "-main")) target_binds = &screen.binds.main; else { screen_err_msg("Bad bind flag: %s", key_str); return; } key_str = strsep(&args, " "); if (key_str == NULL || blank_str(key_str)) { hash_iterate(&target_binds->hash, print_binding, NULL); return; } } key = bind_get_keycode(key_str); if (key == -1) { screen_err_msg("Bad keycode: %s", key_str); return; } func = args; if (func != NULL) { if (*func == opt_get_char(OPT_CMDCHARS) && *(func + 1) != '\0') func++; if (blank_str(func)) func = NULL; } if (func == NULL) { binding = bind_find(target_binds, key); if (binding != NULL) screen_cmd_output("%s is bound to %s", key_str, binding->binding); else screen_cmd_output("%s is not bound", key_str); return; } bind_add(target_binds, key, func); binding = bind_find(target_binds, key); if (binding != NULL) { screen_cmd_output("%s is bound to %s", key_str, binding->binding); return; } screen_err_msg("Error binding %s", key_str); } USER_COMMAND(cmd_connect) { int protocol = PROTO_AIM; char *user; if (args == NULL || blank_str(args)) return; if (*args == '-') { char *p = strchr(++args, ' '); if (p != NULL) *p++ = '\0'; protocol = proto_get_num(args); if (protocol == -1) { screen_err_msg("Invalid protocol: %s", args); return; } args = p; } user = strsep(&args, " "); pork_acct_connect(user, args, protocol); } USER_COMMAND(cmd_ctcp) { struct pork_acct *acct = cur_window()->owner; char *dest; if (acct->proto->ctcp == NULL) return; dest = strsep(&args, " "); if (dest == NULL || args == NULL) return; acct->proto->ctcp(acct, dest, args); } USER_COMMAND(cmd_echo) { if (args != NULL) screen_win_msg(cur_window(), 0, 0, 1, MSG_TYPE_CMD_OUTPUT, args); } USER_COMMAND(cmd_disconnect) { struct pork_acct *acct = cur_window()->owner; u_int32_t dest; dlist_t *node; if (!acct->can_connect) return; if (args == NULL || blank_str(args)) dest = acct->refnum; else { char *refnum = strsep(&args, " "); if (str_to_uint(refnum, &dest) == -1) { screen_err_msg("Bad account refnum: %s", refnum); return; } if (args != NULL && blank_str(args)) args = NULL; } node = pork_acct_find(dest); if (node == NULL) { screen_err_msg("Account refnum %u is not logged in", dest); return; } acct = node->data; if (!acct->can_connect) { screen_err_msg("You cannot sign %s off", acct->username); return; } pork_acct_del(node, args); if (screen.status_win->owner == screen.null_acct) imwindow_bind_next_acct(screen.status_win); } USER_COMMAND(cmd_help) { char *section; if (args == NULL) { char buf[8192]; if (pork_help_get_cmds("main", buf, sizeof(buf)) != -1) { screen_cmd_output("Help for the following commands is available:"); screen_win_msg(cur_window(), 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "\t%s", buf); } else screen_err_msg("Error: Can't find the help files"); return; } section = strsep(&args, " "); if (section == NULL) { screen_err_msg("Error: Can't find the help files"); return; } if (args == NULL) { char buf[8192]; if (pork_help_print("main", section) == -1) { screen_err_msg("Help: Error: No such command or section: %s", section); } else { struct imwindow *win = cur_window(); if (pork_help_get_cmds(section, buf, sizeof(buf)) != -1) { screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, " "); strtoupper(section); screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "%%W%s COMMANDS", section); screen_win_msg(win, 0, 0, 1, MSG_TYPE_CMD_OUTPUT, "\t%s", buf); screen_cmd_output("Type /help %s for the help text for a particular %s command.", section, section); } } } else { if (pork_help_print(section, args) == -1) { screen_err_msg("Help: Error: No such command in section %s", section); } } } USER_COMMAND(cmd_idle) { u_int32_t idle_secs = 0; if (args != NULL && !blank_str(args)) { if (str_to_uint(args, &idle_secs) != 0) { screen_err_msg("Invalid time specification: %s", args); return; } } pork_set_idle_time(cur_window()->owner, idle_secs); } USER_COMMAND(cmd_laddr) { if (args == NULL) { char buf[2048]; if (get_hostname(&local_addr, buf, sizeof(buf)) != 0) xstrncpy(buf, "0.0.0.0", sizeof(buf)); screen_cmd_output("New connections will use the local address %s", buf); return; } if (get_addr(args, &local_addr) != 0) { screen_err_msg("Invalid local address: %s", args); return; } screen_cmd_output("New connections will use the local address %s", args); } USER_COMMAND(cmd_lastlog) { int opts = 0; if (args == NULL) return; if (*args == '-') { if (args[1] == ' ' || args[1] == '\0') goto done; args++; if (*args == '-' && args[1] == ' ') { args += 2; goto done; } do { switch (*args) { case 'b': opts |= SWINDOW_FIND_BASIC; break; case 'i': opts |= SWINDOW_FIND_ICASE; break; } if (*++args == ' ') { args++; break; } } while (*args != '\0'); } done: if (*args != '\0') imwindow_buffer_find(cur_window(), args, opts); } USER_COMMAND(cmd_load) { int quiet; char buf[PATH_MAX]; if (args == NULL) return; quiet = screen_set_quiet(1); expand_path(args, buf, sizeof(buf)); if (read_conf(buf) != 0) screen_err_msg("Error reading %s: %s", buf, strerror(errno)); screen_set_quiet(quiet); } USER_COMMAND(cmd_lport) { if (args == NULL) { screen_cmd_output("New connections will use local port %u", ntohs(local_port)); return; } if (get_port(args, &local_port) != 0) { screen_err_msg("Error: Invalid local port: %s", args); return; } local_port = htons(local_port); screen_cmd_output("New connections will use local port %s", args); } USER_COMMAND(cmd_me) { struct imwindow *win = cur_window(); if (args == NULL) return; if (win->type == WIN_TYPE_PRIVMSG) pork_action_send(win->owner, cur_window()->target, args); else if (win->type == WIN_TYPE_CHAT) { struct chatroom *chat; chat = win->data; if (chat != NULL) chat_send_action(win->owner, win->data, chat->title, args); } } USER_COMMAND(cmd_msg) { struct pork_acct *acct = cur_window()->owner; char *target; struct chatroom *chat; if (args == NULL || !acct->connected) return; target = strsep(&args, " "); if (target == NULL || args == NULL) return; chat = chat_find(acct, target); if (chat != NULL) chat_send_msg(acct, chat, target, args); else pork_msg_send(acct, target, args); } USER_COMMAND(cmd_mode) { struct pork_acct *acct = cur_window()->owner; if (args == NULL || !acct->connected) return; if (acct->proto->mode != NULL) acct->proto->mode(acct, args); } USER_COMMAND(cmd_query) { struct imwindow *imwindow = cur_window(); if (args != NULL && !blank_str(args)) { struct imwindow *conv_window; screen_make_query_window(imwindow->owner, args, &conv_window); screen_goto_window(conv_window->refnum); } else screen_close_window(imwindow); } USER_COMMAND(cmd_quit) { if (!event_generate(cur_window()->owner->events, EVENT_QUIT, args)) pork_exit(0, args, NULL); } USER_COMMAND(cmd_quote) { if (args != NULL) { struct pork_acct *acct = cur_window()->owner; if (acct->proto->quote != NULL) acct->proto->quote(acct, args); } } USER_COMMAND(cmd_refresh) { screen_refresh(); } USER_COMMAND(cmd_save) { if (save_global_config() == 0) screen_cmd_output("Your configuration has been saved"); else screen_err_msg("There was an error saving your configuration"); } USER_COMMAND(cmd_send) { struct imwindow *imwindow = cur_window(); struct pork_acct *acct = imwindow->owner; if (args == NULL || !acct->connected) return; if (imwindow->type == WIN_TYPE_PRIVMSG) pork_msg_send(acct, imwindow->target, args); else if (imwindow->type == WIN_TYPE_CHAT) { struct chatroom *chat = imwindow->data; if (chat == NULL) { screen_err_msg("%s is not a member of %s", acct->username, imwindow->target); } else chat_send_msg(acct, chat, chat->title, args); } } USER_COMMAND(cmd_unbind) { char *binding; struct imwindow *imwindow = cur_window(); struct key_binds *target_binds = imwindow->active_binds; int c; binding = strsep(&args, " "); if (binding == NULL || blank_str(binding)) return; if (binding[0] == '-' && binding[1] != '\0') { if (!strcasecmp(binding, "-b") || !strcasecmp(binding, "-buddy")) target_binds = &screen.binds.blist; else if (!strcasecmp(binding, "-m") || !strcasecmp(binding, "-main")) target_binds = &screen.binds.main; else { screen_err_msg("Bad unbind flag: %s", binding); return; } binding = strsep(&args, " "); if (binding == NULL || blank_str(binding)) return; } c = bind_get_keycode(binding); if (c == -1) { screen_err_msg("Bad keycode: %s", binding); return; } if (bind_remove(target_binds, c) == -1) screen_cmd_output("There is no binding for %s", binding); else screen_cmd_output("Binding for %s removed", binding); } USER_COMMAND(cmd_unalias) { if (args == NULL) return; if (alias_remove(&screen.alias_hash, args) == -1) screen_cmd_output("No such alias: %s", args); else screen_cmd_output("Alias %s removed", args); } USER_COMMAND(cmd_nick) { if (args == NULL || blank_str(args)) return; pork_change_nick(cur_window()->owner, args); } USER_COMMAND(cmd_notice) { struct pork_acct *acct = cur_window()->owner; char *target; struct chatroom *chat; if (args == NULL || !acct->connected) return; target = strsep(&args, " "); if (target == NULL || args == NULL) return; chat = chat_find(acct, target); if (chat != NULL) chat_send_notice(acct, chat, target, args); else pork_notice_send(acct, target, args); } USER_COMMAND(cmd_who) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; if (acct->proto->who != NULL && args != NULL) acct->proto->who(acct, args); if (args == NULL && win->type == WIN_TYPE_CHAT) { if (win->data != NULL) { struct chatroom *chat = win->data; chat_who(acct, chat->title); } } } USER_COMMAND(cmd_whowas) { struct pork_acct *acct = cur_window()->owner; if (acct->proto->whowas != NULL && args != NULL) acct->proto->whowas(acct, args); } USER_COMMAND(cmd_perl) { size_t num_args = 0; char *p = args; char **perl_args; char *function; char *orig; size_t i = 0; if (args == NULL || blank_str(args)) return; p = args; while (*p == ' ') p++; if (*p == '$') p++; args = p; orig = p; function = args; p = strchr(function, '('); if (p != NULL) { *p++ = '\0'; args = p; } p = strchr(function, ' '); if (p != NULL) { *p = '\0'; args = p + 1; } if (args == orig) { execute_perl(function, NULL); return; } p = args; while ((p = strchr(p, ',')) != NULL) { ++num_args; ++p; } num_args += 2; p = strchr(args, ')'); if (p != NULL) *p = '\0'; perl_args = xcalloc(num_args, sizeof(char *)); while ((p = strsep(&args, ",")) != NULL) { char *s; while (*p == ' ' || *p == '\t') p++; s = strrchr(p, ' '); if (s != NULL && blank_str(s)) { while (*s == ' ') s--; s[1] = '\0'; } perl_args[i++] = p; } perl_args[i] = NULL; execute_perl(function, perl_args); free(perl_args); } /* ** This destroys the perl state. ** It has the effect of unloads all scripts. All scripts should ** be catching the EVENT_UNLOAD event and doing any necessary cleanup ** when it happens. */ USER_COMMAND(cmd_perl_dump) { struct pork_acct *acct = cur_window()->owner; /* ** If events are ever made per-account this will have to change. */ event_generate(acct->events, EVENT_UNLOAD); perl_destroy(); perl_init(); } USER_COMMAND(cmd_perl_load) { int ret; char buf[PATH_MAX]; if (args == NULL) return; expand_path(args, buf, sizeof(buf)); ret = perl_load_file(buf); if (ret != 0) screen_err_msg("Error: The file %s couldn't be loaded", buf); } USER_COMMAND(cmd_ping) { struct imwindow *win = cur_window(); struct pork_acct *acct = win->owner; if (acct->proto->ping != NULL) acct->proto->ping(acct, args); } USER_COMMAND(cmd_profile) { pork_set_profile(cur_window()->owner, args); } USER_COMMAND(cmd_event) { if (args != NULL) run_one_command(args, CMDSET_EVENT); else run_one_command("list", CMDSET_EVENT); } USER_COMMAND(cmd_acct) { if (args != NULL) run_one_command(args, CMDSET_ACCT); else run_one_command("list", CMDSET_ACCT); } USER_COMMAND(cmd_chat) { if (!cur_window()->owner->connected) return; if (args != NULL) run_one_command(args, CMDSET_CHAT); else run_one_command("list", CMDSET_CHAT); } USER_COMMAND(cmd_win) { if (args != NULL) run_one_command(args, CMDSET_WIN); else run_one_command("list", CMDSET_WIN); } USER_COMMAND(cmd_file) { if (!cur_window()->owner->can_connect) return; if (args != NULL) run_one_command(args, CMDSET_FILE); else run_one_command("list", CMDSET_FILE); } USER_COMMAND(cmd_buddy) { if (!cur_window()->owner->connected) return; if (args != NULL) run_one_command(args, CMDSET_BUDDY); else run_one_command("list", CMDSET_BUDDY); } USER_COMMAND(cmd_blist) { struct pork_acct *acct = cur_window()->owner; if (!acct->connected || acct->blist == NULL) return; if (args != NULL) run_one_command(args, CMDSET_BLIST); } USER_COMMAND(cmd_input) { if (args != NULL) run_one_command(args, CMDSET_INPUT); } USER_COMMAND(cmd_history) { if (args != NULL) run_one_command(args, CMDSET_HISTORY); else run_one_command("list", CMDSET_HISTORY); } USER_COMMAND(cmd_scroll) { if (args != NULL) run_one_command(args, CMDSET_SCROLL); } USER_COMMAND(cmd_timer) { if (args != NULL) run_one_command(args, CMDSET_TIMER); else run_one_command("list", CMDSET_TIMER); } USER_COMMAND(cmd_set) { char *variable; char *value; int opt; variable = strsep(&args, " "); if (variable == NULL || blank_str(variable)) { opt_print(); return; } strtoupper(variable); opt = opt_find(variable); if (opt == -1) { screen_err_msg("Unknown variable: %s", variable); return; } value = args; if (value == NULL || blank_str(value)) { opt_print_var(opt, "is set to"); return; } if (opt_set(opt, value) == -1) { screen_nocolor_msg("Bad argument for %s: %s", variable, value); } else { opt_print_var(opt, "set to"); } } inline int run_command(char *str) { return (run_one_command(str, CMDSET_MAIN)); } int run_mcommand(char *str) { int i = 0; char *copystr = xstrdup(str); char *cmdstr = copystr; char *curcmd; curcmd = strsep(&cmdstr, ";"); if (curcmd == NULL) i = run_one_command(cmdstr, CMDSET_MAIN); else { while (curcmd != NULL && i != -1) { char cmdchars = opt_get_char(OPT_CMDCHARS); while (*curcmd == ' ') curcmd++; while (*curcmd == cmdchars) curcmd++; i = run_one_command(curcmd, CMDSET_MAIN); curcmd = strsep(&cmdstr, ";"); } } free(copystr); return (i); } static int run_one_command(char *str, u_int32_t set) { char *cmd_str; struct command *cmd; if (set == CMDSET_MAIN) { int ret; char *alias_str; ret = alias_resolve(&screen.alias_hash, str, &alias_str); if (ret == 0) str = alias_str; else if (ret == 1) { screen_err_msg("The alias chain is too long"); return (-1); } } cmd_str = strsep(&str, " \t"); cmd = bsearch(cmd_str, command_set[set].set, command_set[set].elem, sizeof(struct command), cmd_compare); if (cmd == NULL) { struct pork_proto *proto; if (set == CMDSET_MAIN && (proto = proto_get_name(cmd_str)) != NULL) { cmd_str = strsep(&str, " \t"); cmd = bsearch(cmd_str, proto->cmd, proto->num_cmds, sizeof(struct command), cmd_compare); if (cmd == NULL) screen_err_msg("Unknown %s command: %s", proto->name, cmd_str); } else { screen_err_msg("Unknown %scommand: %s", command_set[set].type, cmd_str); } return (-1); } cmd->cmd(str); return (0); } static void print_binding(void *data, void *nothing __notused) { struct binding *binding = data; char key_name[32]; bind_get_keyname(binding->key, key_name, sizeof(key_name)); screen_cmd_output("%s is bound to %s", key_name, binding->binding); } static void print_alias(void *data, void *nothing __notused) { struct alias *alias = data; screen_cmd_output("%s is aliased to %s%s", alias->alias, alias->orig, (alias->args != NULL ? alias->args : "")); } static int cmd_compare(const void *l, const void *r) { char *key = (char *) l; struct command *cmd = (struct command *) r; return (strcasecmp(key, cmd->name)); } static void print_timer(void *data, void *nothing __notused) { struct timer_entry *timer = data; screen_cmd_output("[refnum: %u] %d %u %s", timer->refnum, (int) timer->interval, timer->times, timer->command); } USER_COMMAND(cmd_input_find_next_cmd) { u_int32_t cur_pos; u_int32_t begin_completion_pos; u_int32_t word_begin = 0; u_int32_t end_word; size_t elements = 0; char *input_buf; struct input *input; struct command *cmd = NULL; input = cur_window()->input; cur_pos = input->cur - input->prompt_len; input_buf = input_get_buf_str(input); if (input->begin_completion <= input->prompt_len || input->begin_completion >= input->cur) { if (cur_pos == 0) { /* ** If you complete from the very beginning of the line, ** insert a '/' because we only complete commands. */ input_insert(input, '/'); input_buf = input_get_buf_str(input); cur_pos++; } else input->begin_completion = input->cur; } begin_completion_pos = input->begin_completion - input->prompt_len; /* Only complete if the line is a command. */ if (input_buf[0] != '/') return; end_word = strcspn(&input_buf[1], " \t") + 1; if (end_word < begin_completion_pos) { size_t i; for (i = 1 ; i < array_elem(command_set) ; i++) { if (!strncasecmp(command_set[i].type, &input_buf[1], end_word)) { elements = command_set[i].elem; cmd = command_set[i].set; word_begin = end_word; break; } } if (word_begin == 0) { struct pork_proto *proto = cur_window()->owner->proto; if (!strncasecmp(proto->name, &input_buf[1], end_word)) { elements = proto->num_cmds; cmd = proto->cmd; word_begin = end_word; } else return; } while ( input_buf[word_begin] == ' ' || input_buf[word_begin] == '\t') { word_begin++; } } else { word_begin = 1; elements = command_set[CMDSET_MAIN].elem; cmd = command_set[CMDSET_MAIN].set; } if (word_begin > 0) { int chosen = -1; size_t i; for (i = 0 ; i < elements ; i++) { const struct command *cmd_ptr; cmd_ptr = &cmd[i]; if (!strcmp(cmd_ptr->name, "")) continue; if (input->cur == input->begin_completion) { if (!strncasecmp(cmd_ptr->name, &input_buf[word_begin], cur_pos - word_begin)) { /* Don't choose this one if it's already an exact match. */ if (strlen(cmd_ptr->name) == cur_pos - word_begin) continue; /* Match */ chosen = i; i = elements; continue; } } else { /* ** We've _already_ matched one. Now get ** the next in the list, if possible. */ if (!strncasecmp(cmd_ptr->name, &input_buf[word_begin], cur_pos - word_begin)) { /* ** We've found the one we've matched already. If there ** will be another possible, it will be the very next ** one in the list. Let's check that. If it doesn't ** match, none will. */ i++; if (i < elements) { cmd_ptr = &cmd[i]; if (!strncasecmp(cmd_ptr->name, &input_buf[word_begin], begin_completion_pos - word_begin)) { chosen = i; } i = elements; continue; } } } } if (input->begin_completion != input->cur) { /* ** Remove characters added by last match. In ** other words, remove characters from input->cur ** until input->begin_completion == input->cur. */ size_t num_to_remove; num_to_remove = input->cur - input->begin_completion; for (i = 0 ; i < num_to_remove ; i++) input_bkspace(input); } if (chosen != -1) { /* We've found a match. */ const struct command *cmd_ptr; u_int16_t remember_begin = input->begin_completion; cmd_ptr = &cmd[chosen]; input_insert_str(input, &cmd_ptr->name[begin_completion_pos - word_begin]); input->begin_completion = remember_begin; } } } pork-0.99.8.1/src/pork_command.h0000644000175000017500000000135710234217327016317 0ustar ryanryan00000000000000/* ** pork_command.h - interface to commands typed by the user ** Copyright (C) 2002-2005 Ryan McCabe ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License, version 2, ** as published by the Free Software Foundation. */ #ifndef __PORK_COMMAND_H #define __PORK_COMMAND_H #define USER_COMMAND(x) void x (char *args __notused) enum { CMDSET_MAIN, CMDSET_WIN, CMDSET_HISTORY, CMDSET_INPUT, CMDSET_SCROLL, CMDSET_BUDDY, CMDSET_BLIST, CMDSET_TIMER, CMDSET_EVENT, CMDSET_CHAT, CMDSET_FILE, CMDSET_ACCT, CMDSET_PROTO, }; struct command { char *name; void (*cmd)(char *); }; int run_mcommand(char *str); inline int run_command(char *str); #endif pork-0.99.8.1/NEWS0000644000175000017500000000012310236222243013366 0ustar ryanryan00000000000000NEWS FOR 0.99.8.1 ----------------- * Fixed a stupid NULL pointer bug. * Cleanups. pork-0.99.8.1/TODO0000644000175000017500000000263110234301510013356 0ustar ryanryan00000000000000As of 0.98: -------------------------- Plans for the next release -------------------------- - The /set system needs a complete overhaul. There ought to be protocol and account settings in addition to global and window. There needs to be an option to make things like /set wordwrap and its ilk retroactive to windows that have already been created. - I also need to add something like /acct save to save account specific settings (once I had them). Maybe / save to support protocol specific settings (also once i add them). - Add protocol-specific commands (e.g. /irc kline). - Add much better /save support. - Add missing events (mostly file transfer stuff, but probably more). ---------- The future ---------- - The perl stuff needs to be rewritten (in XS instead of straight C). - Allow expanding perl variables on the input line (maybe with /eval). - Support making perl and IM protocols loadable plugins (or at least add a configure option to allow them to be compiled that way, if desired). - Support per-account events. ---------------------------------------- The stuff I really don't feel like doing ---------------------------------------- - The documentation is in pretty rough shape. I'd rather write code than documentation, though, so.. I know nobody likes writing documentation, but I'd really be thrilled if someone were willing to do some work on this. pork-0.99.8.1/depcomp0000755000175000017500000003541010236222650014255 0ustar ryanryan00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2004-04-25.13 # Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit 0 ;; -v | --v*) echo "depcomp $scriptversion" exit 0 ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # Dependencies are output in .lo.d with libtool 1.4. # They are output in .o.d with libtool 1.5. tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.o.d" tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" else tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: pork-0.99.8.1/CONTRIBUTERS0000644000175000017500000000007710234217323014546 0ustar ryanryan00000000000000Ben Love Pez Mohr pork-0.99.8.1/STYLE0000644000175000017500000002422110234217323013520 0ustar ryanryan00000000000000By Ryan McCabe Last Updated: January 6, 2005 L'enfer, c'est le code des Autres. Please follow the style of coding used throughout the program. Below I attempt to explain what that style is, but I'm sure there will be a lot of questions that aren't answered by this document. Look at the source to answer those questions. If you're using some bizarre construction that's not used at all in the source, I probably wouldn't have used it. This document isn't an exposition of how one ought to write C code. It's an explanation of how I write C code. I like it when the source code for my programs is consistent. If it makes you want to barf, fine, but if you're submitting patches for this program, please follow the guidelines. If you send me patches in some wildly different style (especially that wretched GNU indenting style), unless it's a really great patch, I'll probably ignore it. Even if it's a really great patch, I might ignore it. I know this is all very pedantic, but I think keeping the code looking consistent is valuable: it makes for code that's easier to read and maintain. And it's prettier to me. -------------------------------------------------------------------------------- TABS -------------------------------------------------------------------------------- Tabs should be tabs, not spaces (i.e., do not expand tabs). -------------------------------------------------------------------------------- SPACING AND LINE LENGTH -------------------------------------------------------------------------------- Lines shouldn't be longer than 80 characters if it can be avoided. Sometimes it can't. That's fine. Spacing should be employed generously. It makes code easier to read. Insert spaces after all punctuation (i.e., after ',', before and after ';' in for statements, before and after '=' and comparison operators). For example: variable = function(param1, param2, param3); if (variable == 9) if (variable <= 10) for (i = 0 ; i < 100 ; i++) Insert spaces before and after built-in operators. For example; int i = j + 5; function(i % 5, param2); -------------------------------------------------------------------------------- VARIABLES -------------------------------------------------------------------------------- No variables named as such: 'thisIsItsName'. Call it 'this_is_its_name' instead. No variables having names that begin with "my". For example, 'my_value'. Please try to declare meaningful variable names. Try to make variables' names descriptive of their functional role. When declaring variables, declare one variable per line; don't write: int i, j, k; instead write: int i; int j; int k; Declare variables in the innermost scope possible. In a block, after variable declarations, insert a blank line. For example, ... { int i; int j; int k; start_doing_other_things(); } -------------------------------------------------------------------------------- BRACES -------------------------------------------------------------------------------- Braces go on the same line as the keyword, unless the line had to be wrapped. For example, don't write: if (condition_statement) { actions; } Instead write: if (condition_statement) { actions; } If a conditional ends up being longer than 80 characters, break it up as follows: if (this_very_long_condition == 1 && another_long_one == 1 && a_third_long_one == 1) { actions; } -------------------------------------------------------------------------------- FUNCTION DECLARATIONS AND PROTOTYPES -------------------------------------------------------------------------------- [] () { } for example: static inline int add_numbers(int param1, int param2) { const char *return_str(char *str) { void nothing(void) { If the function header is longer than 80 chars, wrap it as follows: static inline add_numbers( int param1, int param2, int param3) { } Note the spacing after each parameter. I don't like things like: static int add_numbers(int param1,int param2) Declare functions static unless there's a reason not to. -------------------------------------------------------------------------------- KEYWORDS: -------------------------------------------------------------------------------- Please write keywords as follows: keyword (expression). Note the spacing. For example, if (condition) for (init ; condition ; action) return (value) switch (value); while (condition) The one exception is sizeof (and offsetof). Write sizeof(variable) I realize that it's a keyword, but it behaves a lot like a function, so I tend to treat as such, so far as style goes. For the keywords if, for, and while, write: keyword (condition) action; Don't write: keyword (condition) action; When the action for a conditional runs more than one line (because it exceeded 80 chars), even though the action consists of only one statement, please use braces. For example: if (condition) { some_func("here are the values that are passed to the function: %d, %d", arg1, arg2); } The same goes for things like nested for or while loops. For example: for (i = 0 ; i < 100 ; i++) { for (j = 0 ; j < 100 ; j++) statement; } -------------------------------------------------------------------------------- THE TERNARY OPERATOR, "?:" -------------------------------------------------------------------------------- Please don't use this operator gratuitously. Use it only in places such that not using it would force you to declare a new variable to hold a temporary value. For example things like the following are fine: printf("The value of the integer is %s 812", (integer_val > 812 ? "greater than" : "less than or equal to"); Do not do things like: int func(int param1) { char *str = (param1 != NULL ? "not null" : "null"); } instead write: int func(int param1) { char str; if (param1 != NULL) str = "not null"; else str = "null"; } -------------------------------------------------------------------------------- COMPARISONS -------------------------------------------------------------------------------- When you're checking whether a pointer is or isn't NULL, please write if (pointer == NULL) or if (pointer != NULL) instead of if (!pointer) or if (pointer) If you're checking whether an integer value is equal to zero, please use if (integer_val == 0) instead of if (!integer_val) The same goes for character values. If you testing whether a character is equal to ascii 0, write: if (char == '\0') I'm a-ok with using if (boolean_variable) and if (!boolean_variable) to test whether a boolean is true or false, respectively, though. I am also ok with using things like (!strcmp()), (and others like it) that are standard C idiom. Don't write things like the following: if ((var = func(param1, param2)) == 1) { stuff; } instead write: var = func(param1, param2); if (var == 1) { stuff; } The second form is easier to read than the first. Constructions like this are often helpful in loops, though, so I'm ok with things like while ((p = strchr(string, ' ')) != NULL) { ...; } where they're appropriate. -------------------------------------------------------------------------------- SWITCH STATEMENTS -------------------------------------------------------------------------------- Inside switch statements, please insert a blank line after each case block. For example: switch (integer_var) { case 1: do_some_stuff(); break; case 2: do_some_other_stuff(); break; default: print_error("error string"); break; } If you need to declare variables (open a block) inside a case statement, do: case 1: { int var1; var1 = some_func(); break; } -------------------------------------------------------------------------------- COMMENTS -------------------------------------------------------------------------------- I tend to write my comments as follows: For one-line comments, I write: /* This is the comment. */ For multi-line comments, I write: /* ** This is a multi-line comment. ** Here's the second line. */ No C++ style comments, please. Commenting large chunks of code out by inserting #if 0/#endif around it, is ok. -------------------------------------------------------------------------------- TYPES -------------------------------------------------------------------------------- In general don't typedef structs. If you want an 8-bit integer, use int8_t, and u_int8_t for an unsigned 8-bit integers. (not char) int16_t for 16-bit integers, u_int16_t for unsigned 16-bit integers. (not short) int64_t for 64-bit integers, u_int64_t for unsigned 64-bit integers. (not long) u_int32_t for unsigned 32-bit integers. I'm ok with 'int' for general stuff. - If it really matters that it be a 32-bit value and not something else, use 'int32_t'. The char type is fine when you're dealing with ASCII character values and strings. In general, don't hide types behind typedefs. I know the above seems to contradict this, but I think, for example, 'int16_t' is more descriptive of what kind of values the variable can hold than, for example, 'short'. This is especially true as it relates to the 'long' type, which will be a different size on different architectures. I break this rule myself in a few places, but in general, I try to follow it. -------------------------------------------------------------------------------- SAFETY (SECURITY) -------------------------------------------------------------------------------- In this program, never use sprintf. Always use snprintf instead. Never use str(n?)cpy, use xstrncpy instead. Never use str(n?)cat, use xstrncat instead. No exceptions. Don't improperly use format strings in functions that take a variable number of arguments. In particular, never do things like: char buffer[size]; fill_buffer(buffer, sizeof(buffer)); *printf(buffer); The above is wrong and leads to security problems. Do: char buffer[size]; fill_buffer(buffer, sizeof(buffer)); *printf("%s", buffer); These are just two of classes of sources of errors that tend to become security problems. If I notice you making mistakes like these (or making other mistakes that could lead to security holes), I'll delete your patch right off. pork-0.99.8.1/aclocal.m40000644000175000017500000010503010236222642014535 0ustar ryanryan00000000000000# generated automatically by aclocal 1.8.5 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # -*- Autoconf -*- # Copyright (C) 2002, 2003 Free Software Foundation, Inc. # Generated from amversion.in; do not edit by hand. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.8.5])]) # AM_AUX_DIR_EXPAND # Copyright (C) 2001, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 6 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]) fi])]) # serial 7 -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. #serial 2 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 7 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # This macro actually does too much some checks are only needed if # your package does certain things. But this isn't really a big deal. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 11 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. # Copyright (C) 2001, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # -*- Autoconf -*- # Copyright (C) 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 1 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # Copyright (C) 2003, 2004 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # Keeping the `.' argument allows $(mkdir_p) to be used without # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more # expensive solution, as it forces Make to start a sub-shell.) mkdir_p='mkdir -p -- .' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # # Check to make sure that the build environment is sane. # # Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # AM_PROG_INSTALL_STRIP # Copyright (C) 2001, 2003 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) pork-0.99.8.1/QUICK_START0000644000175000017500000000531110234217323014450 0ustar ryanryan00000000000000To log into AIM, type /connect , where is your AIM screen name. If you don't have an AIM screen name, you can get one at http://aim.aol.com. When you're inside the client, type /help to find out what commands are supported. Type /help to get help on a particular command. Below are the default key bindings. All keys can have their bindings changed or removed completely. Enter the commands '/help bind' and '/help keys' for more information. Default main key bindings: CTRL+A Move the input cursor to the start of the line. CTRL+B Move the input cursor to the start of the previous word. CTRL+E Move the input cursor to the end of the line. CTRL+F Move the input cursor to the start of the next word. CTRL+H Backspace. META+BACKSPACE Delete the previous word on the input line. CTRL+K Close the current window. CTRL+L Refresh the display. CTRL+T Toggle timestamps on messages. CTRL+U Clear the input line. CTRL+X Switch to the next window in the window list. CTRL+Y Switch to the previous window in the window list. TAB Switch the input focus to the buddy list. META+/ Command auto-completion. META+<1-9> Switch to the window having the specified number. HOME Scroll to the top of the display. END Scroll to the bottom of the display. PAGE UP Scroll the display up one page. PAGE DOWN Scroll the display down one page. UP ARROW Scroll the input history list up. DOWN ARROW Scroll the input history list down. CTRL+META+X Bind the next account to the current window. Default buddy list key bindings: END Move the buddy list cursor to the bottom of the buddy list. HOME Move the buddy list cursor to the top of the buddy list. PAGE UP Move the buddy list cursor one page up. PAGE DOWN Move the buddy list cursor one page down. UP ARROW Move the buddy list cursor up. DOWN ARROW Move the buddy list cursor down. ENTER Collapse the group the cursor is on, or if the cursor is on a user, open a conversation window with that user (or go to the conversation window, if one already exists). TAB Switch to main input focus. CTRL+L Refresh the buddy list display. META+p Remove the user the cursor is on from the permit list. META+P Add the user the cursor is on to the permit list. META+b Remove the user the cursor is on from the block list. META+B Add the user the cursor is on to the block list. META+w Warn the user the cursor is on. META+W Warn the user the cursor is on anonymously. a Get the away message of the user the cursor is on. i Get the profile and away message of the user the cursor is on. CTRL+X Switch to the next window in the window list. CTRL+Y Switch to the previous window in the window list. pork-0.99.8.1/README0000644000175000017500000000423610234217323013561 0ustar ryanryan00000000000000WHAT IS PORK? ------------- pork is an ncurses-based AOL instant messenger client. It uses the OSCAR protocol (the one the windows client uses) to access AIM. Pork features Perl scripting; an online help system; the ability to configure nearly all aspects of the program's look-and-feel; an alias system; and a powerful, fully-configurable key binding system. It supports being logged in with more than one screen name at the same time. The default look-and-feel of the client is modeled after the ircII IRC client. Anyone comfortable using ircII (or any clients derived from it -- e.g., epic, BitchX, etc.) will feel comfortable using pork. pork now supports IRC. The syntax for connecting to an IRC server is /connect -irc [:[:]] [... [:[:]]] The look-and-feel of pork is pretty much a complete ripoff of the the look-and-feel of the excellent mw4.irc script for the epic IRC client by Amber Adams . All credit for it goes to her. WHAT'S IT GOOD FOR? ------------------- Before I wrote pork, I had wanted a console mode AIM client that I could run inside of screen (http://www.gnu.org/software/screen/screen.html) so that I would be able to access it from anywhere. I tried a few other console AIM clients, but none of them was very good at all, so I wrote my own. GETTING STARTED --------------- If you've never used pork, you should probably read the 'QUICK_START' document. Even if you have used it, it might be useful. A sample buddy list is provided in the 'examples' directory. You can edit it and copy it to ~/.pork//buddy_list to use it. Note that any alphabetic characters in must be lowercase and that there should be no space characters in . If you've signed on to AIM in the past with the account with which you'll be connecting, pork will download the buddy list that's been stored on the server; you won't have to provide a buddy list, pork will bring your buddies to you. Type /help inside of the client to get a list of the topics for which help is available. Read the TODO file (I have actually updated this file). Send me patches. Ryan McCabe pork-0.99.8.1/configure0000755000175000017500000101120510236222655014611 0ustar ryanryan00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for pork 0.99.8.1. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='pork' PACKAGE_TARNAME='pork' PACKAGE_VERSION='0.99.8.1' PACKAGE_STRING='pork 0.99.8.1' PACKAGE_BUGREPORT='ryan@numb.org' # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP RANLIB ac_ct_RANLIB sedpath EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os DEBUG_CFLAGS DEBUG_LIBS perlpath PERL_CFLAGS PERL_LIBS COMPILE_PERL_TRUE COMPILE_PERL_FALSE IRC_SUPPORT_TRUE IRC_SUPPORT_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures pork 0.99.8.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of pork 0.99.8.1:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-debug Enable debugging --enable-warn Enable a bunch of compiler warnings --disable-perl Disable use of perl scripting Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-irc Include IRC support --with-efence=PREFIX Use electric fence --with-ncurses-libs=DIR Specify location of the ncurses libraries --with-ncurses-includes=DIR Specify location of the ncurses header files --with-dmalloc=PREFIX Use the dmalloc library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF pork configure 0.99.8.1 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by pork $as_me 0.99.8.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version="1.8" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # Keeping the `.' argument allows $(mkdir_p) to be used without # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more # expensive solution, as it forces Make to start a sub-shell.) mkdir_p='mkdir -p -- .' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=pork VERSION=0.99.8.1 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. cat >>confdefs.h <<\_ACEOF #define PACKAGE_EXTRAVERSION "\"I'm an idiot\" edition" _ACEOF cat >>confdefs.h <<\_ACEOF #define PACKAGE_WEBSITE "http://dev.ojnk.net" _ACEOF cat >>confdefs.h <<\_ACEOF #define PACKAGE_AUTHOR "Ryan McCabe" _ACEOF ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_sedpath+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $sedpath in [\\/]* | ?:[\\/]*) ac_cv_path_sedpath="$sedpath" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_sedpath="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi sedpath=$ac_cv_path_sedpath if test -n "$sedpath"; then echo "$as_me:$LINENO: result: $sedpath" >&5 echo "${ECHO_T}$sedpath" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6 case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((pid_t *) 0) return 0; if (sizeof (pid_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6 if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((size_t *) 0) return 0; if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned _ACEOF fi echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` DEBUG_CFLAGS="" DEBUG_LIBS="" enableval="" # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" fi; if test "$enableval" = "yes"; then cat >>confdefs.h <<\_ACEOF #define ENABLE_DEBUGGING 1 _ACEOF DEBUG_CFLAGS="$DEBUG_CFLAGS -O0 -g3" fi enableval="" # Check whether --enable-warn or --disable-warn was given. if test "${enable_warn+set}" = set; then enableval="$enable_warn" fi; if test "$enableval" = "yes"; then DEBUG_CFLAGS="$DEBUG_CFLAGS -W -Wall -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" fi withval="" irc="yes" # Check whether --with-irc or --without-irc was given. if test "${with_irc+set}" = set; then withval="$with_irc" fi; if test "$withval" = "no"; then irc="no" else cat >>confdefs.h <<\_ACEOF #define IRC_SUPPORT 1 _ACEOF fi withval="" # Check whether --with-efence or --without-efence was given. if test "${with_efence+set}" = set; then withval="$with_efence" fi; if test "$withval" = "yes"; then have_efence="" echo "$as_me:$LINENO: checking for malloc in -lefence" >&5 echo $ECHO_N "checking for malloc in -lefence... $ECHO_C" >&6 if test "${ac_cv_lib_efence_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lefence $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char malloc (); int main () { malloc (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_efence_malloc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_efence_malloc=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_efence_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_efence_malloc" >&6 if test $ac_cv_lib_efence_malloc = yes; then have_efence="yes" fi if test "$have_efence" = "yes"; then DEBUG_LIBS="-lefence" fi fi # Check whether --with-ncurses-libs or --without-ncurses-libs was given. if test "${with_ncurses_libs+set}" = set; then withval="$with_ncurses_libs" LDFLAGS="$LDFLAGS -L$withval" fi; # Check whether --with-ncurses-includes or --without-ncurses-includes was given. if test "${with_ncurses_includes+set}" = set; then withval="$with_ncurses_includes" CPPFLAGS="$CPPFLAGS -I$withval" fi; withval="" # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then withval="$with_dmalloc" fi; if test "$withval" = "yes"; then have_dmalloc="" echo "$as_me:$LINENO: checking for malloc in -ldmalloc" >&5 echo $ECHO_N "checking for malloc in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char malloc (); int main () { malloc (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_malloc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dmalloc_malloc=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dmalloc_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_malloc" >&6 if test $ac_cv_lib_dmalloc_malloc = yes; then have_dmalloc="yes" fi if test "$have_dmalloc" = "yes"; then DEBUG_CFLAGS="$DEBUG_CFLAGS -DDEBUG_DMALLOC -DDMALLOC_FUNC_CHECK" DEBUG_LIBS="-ldmalloc" fi fi if test "$have_efence" = "yes" -a "$have_dmalloc" = "yes"; then { { echo "$as_me:$LINENO: error: *** You've requested support for both dmalloc and electric fence, however *** only one may be linked in at one time. " >&5 echo "$as_me: error: *** You've requested support for both dmalloc and electric fence, however *** only one may be linked in at one time. " >&2;} { (exit 1); exit 1; }; } exit -1 fi # Check whether --enable-perl or --disable-perl was given. if test "${enable_perl+set}" = set; then enableval="$enable_perl" perl=$enableval else perl=yes fi; for ac_header in fcntl.h sys/time.h unistd.h ncurses.h termios.h sys/termios.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------- ## ## Report this to ryan@numb.org ## ## ---------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done have_ncurses="no" echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5 echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6 if test "${ac_cv_lib_ncurses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char initscr (); int main () { initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ncurses_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_initscr=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6 if test $ac_cv_lib_ncurses_initscr = yes; then have_ncurses="yes" fi if test "$have_ncurses" = "no"; then echo "ncurses is required to build this program." echo "install it and try again." echo "try passing configure --with-ncurses-libs= --with-ncurses-includes= if you believe ncurses is installed." exit -1 fi echo "$as_me:$LINENO: checking for resizeterm in -lncurses" >&5 echo $ECHO_N "checking for resizeterm in -lncurses... $ECHO_C" >&6 if test "${ac_cv_lib_ncurses_resizeterm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char resizeterm (); int main () { resizeterm (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ncurses_resizeterm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_resizeterm=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_resizeterm" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_resizeterm" >&6 if test $ac_cv_lib_ncurses_resizeterm = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RESIZETERM 1 _ACEOF fi echo "$as_me:$LINENO: checking for u_int32_t" >&5 echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 if test "${ac_cv_type_u_int32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((u_int32_t *) 0) return 0; if (sizeof (u_int32_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_int32_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_u_int32_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6 if test $ac_cv_type_u_int32_t = yes; then : else cat >>confdefs.h <<_ACEOF #define u_int32_t uint32_t _ACEOF fi if test "$ac_cv_type_u_int32_t" = "no"; then echo "$as_me:$LINENO: checking for uint32_t" >&5 echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6 if test "${ac_cv_type_uint32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((uint32_t *) 0) return 0; if (sizeof (uint32_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_uint32_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_uint32_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 echo "${ECHO_T}$ac_cv_type_uint32_t" >&6 if test $ac_cv_type_uint32_t = yes; then : else cat >>confdefs.h <<_ACEOF #define uint32_t unsigned int _ACEOF fi fi echo "$as_me:$LINENO: checking for u_int16_t" >&5 echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6 if test "${ac_cv_type_u_int16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((u_int16_t *) 0) return 0; if (sizeof (u_int16_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_int16_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_u_int16_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5 echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6 if test $ac_cv_type_u_int16_t = yes; then : else cat >>confdefs.h <<_ACEOF #define u_int16_t uint16_t _ACEOF fi if test "$ac_cv_type_u_int16_t" = "no"; then echo "$as_me:$LINENO: checking for uint16_t" >&5 echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6 if test "${ac_cv_type_uint16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((uint16_t *) 0) return 0; if (sizeof (uint16_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_uint16_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_uint16_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5 echo "${ECHO_T}$ac_cv_type_uint16_t" >&6 if test $ac_cv_type_uint16_t = yes; then : else cat >>confdefs.h <<_ACEOF #define uint16_t unsigned short _ACEOF fi fi echo "$as_me:$LINENO: checking for u_int8_t" >&5 echo $ECHO_N "checking for u_int8_t... $ECHO_C" >&6 if test "${ac_cv_type_u_int8_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((u_int8_t *) 0) return 0; if (sizeof (u_int8_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_u_int8_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_u_int8_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_u_int8_t" >&5 echo "${ECHO_T}$ac_cv_type_u_int8_t" >&6 if test $ac_cv_type_u_int8_t = yes; then : else cat >>confdefs.h <<_ACEOF #define u_int8_t uint8_t _ACEOF fi if test "$ac_cv_type_u_int8_t" = "no"; then echo "$as_me:$LINENO: checking for uint8_t" >&5 echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6 if test "${ac_cv_type_uint8_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((uint8_t *) 0) return 0; if (sizeof (uint8_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_uint8_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_uint8_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5 echo "${ECHO_T}$ac_cv_type_uint8_t" >&6 if test $ac_cv_type_uint8_t = yes; then : else cat >>confdefs.h <<_ACEOF #define uint8_t unsigned char _ACEOF fi fi echo "$as_me:$LINENO: checking for AF_INET6" >&5 echo $ECHO_N "checking for AF_INET6... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include #include #include int main () { AF_INET6+1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF #define AF_INET6 10 _ACEOF echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { sizeof(socklen_t); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF #define socklen_t int _ACEOF echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for in_addr_t" >&5 echo $ECHO_N "checking for in_addr_t... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include #include #include int main () { sizeof(in_addr_t); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF #define in_addr_t unsigned int _ACEOF echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for in_port_t" >&5 echo $ECHO_N "checking for in_port_t... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include #include #include int main () { sizeof(in_port_t); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF #define in_port_t unsigned short _ACEOF echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for void *" >&5 echo $ECHO_N "checking for void *... $ECHO_C" >&6 if test "${ac_cv_type_void_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((void * *) 0) return 0; if (sizeof (void *)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_void_p=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_void_p=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 echo "${ECHO_T}$ac_cv_type_void_p" >&6 echo "$as_me:$LINENO: checking size of void *" >&5 echo $ECHO_N "checking size of void *... $ECHO_C" >&6 if test "${ac_cv_sizeof_void_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_void_p" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_void_p=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (void *), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (void *)); } unsigned long ulongval () { return (long) (sizeof (void *)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (void *))) < 0) { long i = longval (); if (i != ((long) (sizeof (void *)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (void *)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_void_p=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (void *), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_void_p=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF cat >>confdefs.h <<_ACEOF #define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF echo "$as_me:$LINENO: checking for __attribute__" >&5 echo $ECHO_N "checking for __attribute__... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static void foo(void) __attribute__ ((unused)); static void foo(void) { exit(1); } ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF #define HAVE___ATTRIBUTE__ 1 _ACEOF echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifdef signal # undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=int fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF PERL_CFLAGS="" PERL_LDFLAGS="" if test "$perl" = "yes"; then # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_perlpath+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $perlpath in [\\/]* | ?:[\\/]*) ac_cv_path_perlpath="$perlpath" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_perlpath="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi perlpath=$ac_cv_path_perlpath if test -n "$perlpath"; then echo "$as_me:$LINENO: result: $perlpath" >&5 echo "${ECHO_T}$perlpath" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking for Perl compile flags" >&5 echo $ECHO_N "checking for Perl compile flags... $ECHO_C" >&6 PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null` if test "_$PERL_CFLAGS" = _ ; then echo "$as_me:$LINENO: result: not found, building without Perl." >&5 echo "${ECHO_T}not found, building without Perl." >&6 perl=no else PERL_LIBS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null |$sedpath 's/-lgdbm //'` PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-ldb //'` PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lndbm //'` if test "$system" = "Linux"; then PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lnsl //'` PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lposix //'` fi PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lc //'` echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 TEMPCPP="$CPPFLAGS" TEMPLDF="$LDFLAGS" CPPFLAGS="$CPPFLAGS $PERL_CFLAGS" LDFLAGS="$LDFLAGS $PERL_LIBS" for ac_func in Perl_eval_pv do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done CPPFLAGS="$TEMPCPP" LDFLAGS="$TEMPLDF" echo "$as_me:$LINENO: checking for old perl" >&5 echo $ECHO_N "checking for old perl... $ECHO_C" >&6 PERL_OLD=`$perlpath -e 'if($]<5.006){printf"yes\n";}else{printf"no\n";}'` if test "$PERL_OLD" = "yes"; then cat >>confdefs.h <<\_ACEOF #define OLD_PERL 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi fi for ac_func in snprintf vsnprintf getopt_long strsep vasprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in gettimeofday select strdup strstr strtol uname do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in memcmp strftime vprintf gethostbyname do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for library containing socket" >&5 echo $ECHO_N "checking for library containing socket... $ECHO_C" >&6 if test "${ac_cv_search_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_socket=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char socket (); int main () { socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_socket="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_socket" = no; then for ac_lib in socket; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char socket (); int main () { socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_socket="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_socket" >&5 echo "${ECHO_T}$ac_cv_search_socket" >&6 if test "$ac_cv_search_socket" != no; then test "$ac_cv_search_socket" = "none required" || LIBS="$ac_cv_search_socket $LIBS" else echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket -lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char socket (); int main () { socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_socket=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_socket=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 if test $ac_cv_lib_socket_socket = yes; then LIBS="$LIBS -lsocket -lnsl" fi fi echo "$as_me:$LINENO: checking for getaddrinfo" >&5 echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6 if test "${ac_cv_func_getaddrinfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define getaddrinfo to an innocuous variant, in case declares getaddrinfo. For example, HP-UX 11i declares gettimeofday. */ #define getaddrinfo innocuous_getaddrinfo /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getaddrinfo (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef getaddrinfo /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getaddrinfo (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getaddrinfo) || defined (__stub___getaddrinfo) choke me #else char (*f) () = getaddrinfo; #endif #ifdef __cplusplus } #endif int main () { return f != getaddrinfo; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_getaddrinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getaddrinfo=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_getaddrinfo" >&5 echo "${ECHO_T}$ac_cv_func_getaddrinfo" >&6 if test $ac_cv_func_getaddrinfo = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETADDRINFO 1 _ACEOF else echo "$as_me:$LINENO: checking for getaddrinfo in -lsocket" >&5 echo $ECHO_N "checking for getaddrinfo in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_getaddrinfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getaddrinfo (); int main () { getaddrinfo (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_getaddrinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_getaddrinfo=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_getaddrinfo" >&5 echo "${ECHO_T}$ac_cv_lib_socket_getaddrinfo" >&6 if test $ac_cv_lib_socket_getaddrinfo = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETADDRINFO 1 _ACEOF fi fi echo "$as_me:$LINENO: checking for freeaddrinfo" >&5 echo $ECHO_N "checking for freeaddrinfo... $ECHO_C" >&6 if test "${ac_cv_func_freeaddrinfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define freeaddrinfo to an innocuous variant, in case declares freeaddrinfo. For example, HP-UX 11i declares gettimeofday. */ #define freeaddrinfo innocuous_freeaddrinfo /* System header to define __stub macros and hopefully few prototypes, which can conflict with char freeaddrinfo (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef freeaddrinfo /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char freeaddrinfo (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_freeaddrinfo) || defined (__stub___freeaddrinfo) choke me #else char (*f) () = freeaddrinfo; #endif #ifdef __cplusplus } #endif int main () { return f != freeaddrinfo; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_freeaddrinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_freeaddrinfo=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_freeaddrinfo" >&5 echo "${ECHO_T}$ac_cv_func_freeaddrinfo" >&6 if test $ac_cv_func_freeaddrinfo = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_FREEADDRINFO 1 _ACEOF else echo "$as_me:$LINENO: checking for freeaddrinfo in -lsocket" >&5 echo $ECHO_N "checking for freeaddrinfo in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_freeaddrinfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char freeaddrinfo (); int main () { freeaddrinfo (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_freeaddrinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_freeaddrinfo=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_freeaddrinfo" >&5 echo "${ECHO_T}$ac_cv_lib_socket_freeaddrinfo" >&6 if test $ac_cv_lib_socket_freeaddrinfo = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi fi echo "$as_me:$LINENO: checking for gai_strerror" >&5 echo $ECHO_N "checking for gai_strerror... $ECHO_C" >&6 if test "${ac_cv_func_gai_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gai_strerror to an innocuous variant, in case declares gai_strerror. For example, HP-UX 11i declares gettimeofday. */ #define gai_strerror innocuous_gai_strerror /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gai_strerror (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gai_strerror /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gai_strerror (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gai_strerror) || defined (__stub___gai_strerror) choke me #else char (*f) () = gai_strerror; #endif #ifdef __cplusplus } #endif int main () { return f != gai_strerror; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gai_strerror=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gai_strerror=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gai_strerror" >&5 echo "${ECHO_T}$ac_cv_func_gai_strerror" >&6 if test $ac_cv_func_gai_strerror = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GAI_STRERROR 1 _ACEOF else echo "$as_me:$LINENO: checking for gai_strerror in -lsocket" >&5 echo $ECHO_N "checking for gai_strerror in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_gai_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gai_strerror (); int main () { gai_strerror (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_gai_strerror=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_gai_strerror=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_gai_strerror" >&5 echo "${ECHO_T}$ac_cv_lib_socket_gai_strerror" >&6 if test $ac_cv_lib_socket_gai_strerror = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GAI_STRERROR 1 _ACEOF fi fi echo "$as_me:$LINENO: checking for getnameinfo" >&5 echo $ECHO_N "checking for getnameinfo... $ECHO_C" >&6 if test "${ac_cv_func_getnameinfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define getnameinfo to an innocuous variant, in case declares getnameinfo. For example, HP-UX 11i declares gettimeofday. */ #define getnameinfo innocuous_getnameinfo /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getnameinfo (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef getnameinfo /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getnameinfo (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getnameinfo) || defined (__stub___getnameinfo) choke me #else char (*f) () = getnameinfo; #endif #ifdef __cplusplus } #endif int main () { return f != getnameinfo; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_getnameinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getnameinfo=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_getnameinfo" >&5 echo "${ECHO_T}$ac_cv_func_getnameinfo" >&6 if test $ac_cv_func_getnameinfo = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF else echo "$as_me:$LINENO: checking for gai_strerror in -lsocket" >&5 echo $ECHO_N "checking for gai_strerror in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_gai_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gai_strerror (); int main () { gai_strerror (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_gai_strerror=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_gai_strerror=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_gai_strerror" >&5 echo "${ECHO_T}$ac_cv_lib_socket_gai_strerror" >&6 if test $ac_cv_lib_socket_gai_strerror = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF fi fi echo "$as_me:$LINENO: checking for inet_ntop" >&5 echo $ECHO_N "checking for inet_ntop... $ECHO_C" >&6 if test "${ac_cv_func_inet_ntop+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define inet_ntop to an innocuous variant, in case declares inet_ntop. For example, HP-UX 11i declares gettimeofday. */ #define inet_ntop innocuous_inet_ntop /* System header to define __stub macros and hopefully few prototypes, which can conflict with char inet_ntop (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef inet_ntop /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_ntop (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_inet_ntop) || defined (__stub___inet_ntop) choke me #else char (*f) () = inet_ntop; #endif #ifdef __cplusplus } #endif int main () { return f != inet_ntop; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_inet_ntop=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_inet_ntop=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_inet_ntop" >&5 echo "${ECHO_T}$ac_cv_func_inet_ntop" >&6 if test $ac_cv_func_inet_ntop = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_INET_NTOP 1 _ACEOF else echo "$as_me:$LINENO: checking for inet_ntop in -lnsl" >&5 echo $ECHO_N "checking for inet_ntop in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_inet_ntop+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_ntop (); int main () { inet_ntop (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_inet_ntop=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_inet_ntop=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_inet_ntop" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_inet_ntop" >&6 if test $ac_cv_lib_nsl_inet_ntop = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_INET_NTOP 1 _ACEOF fi fi echo "$as_me:$LINENO: checking for struct sockaddr_storage" >&5 echo $ECHO_N "checking for struct sockaddr_storage... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct sockaddr_storage ss; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then have_sockaddr_storage=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_sockaddr_storage=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $have_sockaddr_storage" >&5 echo "${ECHO_T}$have_sockaddr_storage" >&6 if test "$have_sockaddr_storage" = "yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_SOCKADDR_STORAGE 1 _ACEOF echo "$as_me:$LINENO: checking for ss_family member in struct sockaddr_storage" >&5 echo $ECHO_N "checking for ss_family member in struct sockaddr_storage... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { size_t test = sizeof(((struct sockaddr_storage *)0)->ss_family); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then have_ss_family=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_ss_family=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $have_ss_family" >&5 echo "${ECHO_T}$have_ss_family" >&6 if test "$have_ss_family" = "no"; then echo "$as_me:$LINENO: checking for __ss_family member in struct sockaddr_storage" >&5 echo $ECHO_N "checking for __ss_family member in struct sockaddr_storage... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { size_t test = sizeof(((struct sockaddr_storage *)0)->__ss_family); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then have_ss_family=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_ss_family=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $have_ss_family" >&5 echo "${ECHO_T}$have_ss_family" >&6 if test "$have_ss_family" = "yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE___SS_FAMILY 1 _ACEOF fi fi fi echo "$as_me:$LINENO: checking for struct sockaddr_in6" >&5 echo $ECHO_N "checking for struct sockaddr_in6... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct sockaddr_in6 s; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then have_sockaddr_in6=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_sockaddr_in6=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $have_sockaddr_in6" >&5 echo "${ECHO_T}$have_sockaddr_in6" >&6 if test "$have_sockaddr_in6" = "yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_SOCKADDR_IN6 1 _ACEOF fi echo "$as_me:$LINENO: checking for struct in6_addr" >&5 echo $ECHO_N "checking for struct in6_addr... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct in6_addr s; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then have_in6_addr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_in6_addr=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $have_in6_addr" >&5 echo "${ECHO_T}$have_in6_addr" >&6 if test "$have_in6_addr" = "yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_IN6_ADDR 1 _ACEOF fi echo "$as_me:$LINENO: checking for struct addrinfo" >&5 echo $ECHO_N "checking for struct addrinfo... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { size_t test = sizeof(((struct addrinfo *)0)->ai_flags); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then have_struct_addrinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_struct_addrinfo=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $have_struct_addrinfo" >&5 echo "${ECHO_T}$have_struct_addrinfo" >&6 if test "$have_struct_addrinfo" = "yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_ADDRINFO 1 _ACEOF fi if test "$perl" = "yes"; then COMPILE_PERL_TRUE= COMPILE_PERL_FALSE='#' else COMPILE_PERL_TRUE='#' COMPILE_PERL_FALSE= fi if test "$irc" = "yes"; then IRC_SUPPORT_TRUE= IRC_SUPPORT_FALSE='#' else IRC_SUPPORT_TRUE='#' IRC_SUPPORT_FALSE= fi ac_config_files="$ac_config_files Makefile src/Makefile src/missing/Makefile src/protocols/Makefile src/protocols/aim/Makefile src/protocols/irc/Makefile doc/Makefile doc/help/Makefile doc/help/blist/Makefile doc/help/buddy/Makefile doc/help/chat/Makefile doc/help/event/Makefile doc/help/file/Makefile doc/help/history/Makefile doc/help/input/Makefile doc/help/main/Makefile doc/help/perl/Makefile doc/help/scroll/Makefile doc/help/timer/Makefile doc/help/win/Makefile examples/Makefile examples/perl/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COMPILE_PERL_TRUE}" && test -z "${COMPILE_PERL_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COMPILE_PERL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COMPILE_PERL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${IRC_SUPPORT_TRUE}" && test -z "${IRC_SUPPORT_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"IRC_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"IRC_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by pork $as_me 0.99.8.1, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ pork config.status 0.99.8.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/missing/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/missing/Makefile" ;; "src/protocols/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/protocols/Makefile" ;; "src/protocols/aim/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/protocols/aim/Makefile" ;; "src/protocols/irc/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/protocols/irc/Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/help/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/Makefile" ;; "doc/help/blist/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/blist/Makefile" ;; "doc/help/buddy/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/buddy/Makefile" ;; "doc/help/chat/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/chat/Makefile" ;; "doc/help/event/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/event/Makefile" ;; "doc/help/file/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/file/Makefile" ;; "doc/help/history/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/history/Makefile" ;; "doc/help/input/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/input/Makefile" ;; "doc/help/main/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/main/Makefile" ;; "doc/help/perl/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/perl/Makefile" ;; "doc/help/scroll/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/scroll/Makefile" ;; "doc/help/timer/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/timer/Makefile" ;; "doc/help/win/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/help/win/Makefile" ;; "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "examples/perl/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/perl/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@CPP@,$CPP,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@sedpath@,$sedpath,;t t s,@EGREP@,$EGREP,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@DEBUG_CFLAGS@,$DEBUG_CFLAGS,;t t s,@DEBUG_LIBS@,$DEBUG_LIBS,;t t s,@perlpath@,$perlpath,;t t s,@PERL_CFLAGS@,$PERL_CFLAGS,;t t s,@PERL_LIBS@,$PERL_LIBS,;t t s,@COMPILE_PERL_TRUE@,$COMPILE_PERL_TRUE,;t t s,@COMPILE_PERL_FALSE@,$COMPILE_PERL_FALSE,;t t s,@IRC_SUPPORT_TRUE@,$IRC_SUPPORT_TRUE,;t t s,@IRC_SUPPORT_FALSE@,$IRC_SUPPORT_FALSE,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi pork-0.99.8.1/configure.ac0000644000175000017500000002540110236222243015163 0ustar ryanryan00000000000000dnl Copyright (C) 2002-2005 Ryan McCabe (GPL v2) AC_INIT(pork, 0.99.8.1, ryan@numb.org) AM_INIT_AUTOMAKE(pork, 0.99.8.1) AC_DEFINE(PACKAGE_EXTRAVERSION, "\"I'm an idiot\" edition", [extraversion]) AC_DEFINE(PACKAGE_WEBSITE, ["http://dev.ojnk.net"], [website]) AC_DEFINE(PACKAGE_AUTHOR, ["Ryan McCabe"], [author]) AM_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_CPP AC_PROG_RANLIB AC_PROG_INSTALL AC_PATH_PROG(sedpath, sed) AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_C_CONST AC_C_INLINE AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_CANONICAL_HOST DEBUG_CFLAGS="" DEBUG_LIBS="" enableval="" AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging]) if test "$enableval" = "yes"; then AC_DEFINE(ENABLE_DEBUGGING, 1, [Define to enable debugging]) DEBUG_CFLAGS="$DEBUG_CFLAGS -O0 -g3" fi enableval="" AC_ARG_ENABLE(warn, [ --enable-warn Enable a bunch of compiler warnings]) if test "$enableval" = "yes"; then DEBUG_CFLAGS="$DEBUG_CFLAGS -W -Wall -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" fi withval="" irc="yes" AC_ARG_WITH(irc, [ --with-irc Include IRC support]) if test "$withval" = "no"; then irc="no" else AC_DEFINE(IRC_SUPPORT, 1, [Define to enable IRC support]) fi withval="" AC_ARG_WITH(efence, [ --with-efence=PREFIX Use electric fence]) if test "$withval" = "yes"; then have_efence="" AC_CHECK_LIB(efence, malloc, have_efence="yes") if test "$have_efence" = "yes"; then DEBUG_LIBS="-lefence" fi fi AC_ARG_WITH(ncurses-libs, [ --with-ncurses-libs=DIR Specify location of the ncurses libraries],[ LDFLAGS="$LDFLAGS -L$withval" ]) AC_ARG_WITH(ncurses-includes, [ --with-ncurses-includes=DIR Specify location of the ncurses header files],[ CPPFLAGS="$CPPFLAGS -I$withval" ]) withval="" AC_ARG_WITH(dmalloc, [ --with-dmalloc=PREFIX Use the dmalloc library]) if test "$withval" = "yes"; then have_dmalloc="" AC_CHECK_LIB(dmalloc, malloc, have_dmalloc="yes") if test "$have_dmalloc" = "yes"; then DEBUG_CFLAGS="$DEBUG_CFLAGS -DDEBUG_DMALLOC -DDMALLOC_FUNC_CHECK" DEBUG_LIBS="-ldmalloc" fi fi if test "$have_efence" = "yes" -a "$have_dmalloc" = "yes"; then AC_MSG_ERROR([ *** You've requested support for both dmalloc and electric fence, however *** only one may be linked in at one time. ]) exit -1 fi AC_ARG_ENABLE(perl, [ --disable-perl Disable use of perl scripting], perl=$enableval, perl=yes) AC_SUBST(DEBUG_CFLAGS) AC_SUBST(DEBUG_LIBS) AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h ncurses.h termios.h sys/termios.h) have_ncurses="no" AC_CHECK_LIB(ncurses, initscr, have_ncurses="yes") if test "$have_ncurses" = "no"; then echo "ncurses is required to build this program." echo "install it and try again." echo "try passing configure --with-ncurses-libs= --with-ncurses-includes= if you believe ncurses is installed." exit -1 fi AC_CHECK_LIB(ncurses, resizeterm, AC_DEFINE(HAVE_RESIZETERM, 1, [Define to 1 if you have the 'resizeterm' function in -lncurses.])) AC_CHECK_TYPE(u_int32_t, uint32_t) if test "$ac_cv_type_u_int32_t" = "no"; then AC_CHECK_TYPE(uint32_t, unsigned int) fi AC_CHECK_TYPE(u_int16_t, uint16_t) if test "$ac_cv_type_u_int16_t" = "no"; then AC_CHECK_TYPE(uint16_t, unsigned short) fi AC_CHECK_TYPE(u_int8_t, uint8_t) if test "$ac_cv_type_u_int8_t" = "no"; then AC_CHECK_TYPE(uint8_t, unsigned char) fi AC_MSG_CHECKING(for AF_INET6) AC_TRY_COMPILE([#include #include #include #include #include #include ], [AF_INET6+1;], [AC_MSG_RESULT(yes)], [AC_DEFINE(AF_INET6, 10, [Define if AF_INET6 is missing]) AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for socklen_t) AC_TRY_COMPILE([#include #include #include ], [sizeof(socklen_t);], [AC_MSG_RESULT(yes)], [AC_DEFINE(socklen_t, int, [Define if socklen_t is missing]) AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for in_addr_t) AC_TRY_COMPILE([#include #include #include #include #include #include ], [sizeof(in_addr_t);], [AC_MSG_RESULT(yes)], [AC_DEFINE(in_addr_t, unsigned int, [Define if in_addr_t is missing]) AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for in_port_t) AC_TRY_COMPILE([#include #include #include #include #include #include ], [sizeof(in_port_t);], [AC_MSG_RESULT(yes)], [AC_DEFINE(in_port_t, unsigned short, [Define if in_port_t is missing]) AC_MSG_RESULT(no)]) AC_CHECK_SIZEOF(void *) AC_DEFINE_UNQUOTED(SIZEOF_VOID_P, $ac_cv_sizeof_void_p, [Size of the 'void *' type]) AC_MSG_CHECKING(for __attribute__) AC_TRY_COMPILE([#include ], [static void foo(void) __attribute__ ((unused)); static void foo(void) { exit(1); }], [AC_MSG_RESULT(yes)], [AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define if your compiler has __attribute__]) AC_MSG_RESULT(no)]) AC_TYPE_SIGNAL PERL_CFLAGS="" PERL_LDFLAGS="" dnl dnl This (Perl test) was taken from gaim. dnl if test "$perl" = "yes"; then AC_PATH_PROG(perlpath, perl) AC_MSG_CHECKING(for Perl compile flags) PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null` if test "_$PERL_CFLAGS" = _ ; then AC_MSG_RESULT([not found, building without Perl.]) perl=no else PERL_LIBS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null |$sedpath 's/-lgdbm //'` PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-ldb //'` PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lndbm //'` if test "$system" = "Linux"; then PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lnsl //'` PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lposix //'` fi PERL_LIBS=`echo $PERL_LIBS |$sedpath 's/-lc //'` AC_MSG_RESULT(ok) TEMPCPP="$CPPFLAGS" TEMPLDF="$LDFLAGS" CPPFLAGS="$CPPFLAGS $PERL_CFLAGS" LDFLAGS="$LDFLAGS $PERL_LIBS" AC_CHECK_FUNCS(Perl_eval_pv) CPPFLAGS="$TEMPCPP" LDFLAGS="$TEMPLDF" AC_MSG_CHECKING(for old perl) PERL_OLD=`$perlpath -e 'if($]<5.006){printf"yes\n";}else{printf"no\n";}'` if test "$PERL_OLD" = "yes"; then AC_DEFINE(OLD_PERL, 1, [Define if Perl's version is < 5.006]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi fi AC_CHECK_FUNCS(snprintf vsnprintf getopt_long strsep vasprintf) AC_CHECK_FUNCS(gettimeofday select strdup strstr strtol uname) AC_CHECK_FUNCS(memcmp strftime vprintf gethostbyname) AC_SEARCH_LIBS(socket, socket, , [AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)]) AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if you have the 'getaddrinfo' function.]), AC_CHECK_LIB(socket, getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if you have the 'getaddrinfo' function.]))) AC_CHECK_FUNC(freeaddrinfo, AC_DEFINE(HAVE_FREEADDRINFO, 1, [Define to 1 if you have the 'freeaddrinfo' function.]), AC_CHECK_LIB(socket, freeaddrinfo), AC_DEFINE(HAVE_FREEADDRINFO, 1, [Define to 1 if you have the 'freeaddrinfo' function.])) AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAI_STRERROR, 1, [Define to 1 if you have the 'gai_strerror' function.]), AC_CHECK_LIB(socket, gai_strerror, AC_DEFINE(HAVE_GAI_STRERROR, 1, [Define to 1 if you have the 'gai_strerror' function.]))) AC_CHECK_FUNC(getnameinfo, AC_DEFINE(HAVE_GETNAMEINFO, 1, [Define to 1 if you have the 'getnameinfo' function.]), AC_CHECK_LIB(socket, gai_strerror, AC_DEFINE(HAVE_GETNAMEINFO, 1, [Define to 1 if you have the 'getnameinfo' function.]))) AC_CHECK_FUNC(inet_ntop, AC_DEFINE(HAVE_INET_NTOP, 1, [Define to 1 if you have the 'inet_ntop' function.]), AC_CHECK_LIB(nsl, inet_ntop, AC_DEFINE(HAVE_INET_NTOP, 1, [Define to 1 if you have the 'inet_ntop' function.]))) AC_MSG_CHECKING(for struct sockaddr_storage) AC_TRY_COMPILE( [ #include #include ], [ struct sockaddr_storage ss; ], [ have_sockaddr_storage=yes ], [ have_sockaddr_storage=no ]) AC_MSG_RESULT($have_sockaddr_storage) if test "$have_sockaddr_storage" = "yes"; then AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, [Define to 1 if you have struct sockaddr_storage]) AC_MSG_CHECKING(for ss_family member in struct sockaddr_storage) AC_TRY_COMPILE( [ #include #include ], [ size_t test = sizeof(((struct sockaddr_storage *)0)->ss_family);], [ have_ss_family=yes ], [ have_ss_family=no ]) AC_MSG_RESULT($have_ss_family) if test "$have_ss_family" = "no"; then AC_MSG_CHECKING(for __ss_family member in struct sockaddr_storage) AC_TRY_COMPILE( [ #include #include ], [ size_t test = sizeof(((struct sockaddr_storage *)0)->__ss_family);], [ have_ss_family=yes ], [ have_ss_family=no ]) AC_MSG_RESULT($have_ss_family) if test "$have_ss_family" = "yes"; then AC_DEFINE(HAVE___SS_FAMILY, 1, [Define if the sockaddr storage struct has the ss_family member]) fi fi fi AC_MSG_CHECKING(for struct sockaddr_in6) AC_TRY_COMPILE( [ #include #include ], [ struct sockaddr_in6 s; ], [ have_sockaddr_in6=yes ], [ have_sockaddr_in6=no ]) AC_MSG_RESULT($have_sockaddr_in6) if test "$have_sockaddr_in6" = "yes"; then AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1, [Define to 1 if you have struct sockaddr_in6]) fi AC_MSG_CHECKING(for struct in6_addr) AC_TRY_COMPILE( [ #include #include ], [ struct in6_addr s; ], [ have_in6_addr=yes ], [ have_in6_addr=no ]) AC_MSG_RESULT($have_in6_addr) if test "$have_in6_addr" = "yes"; then AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1, [Define to 1 if you have struct in6_addr]) fi AC_MSG_CHECKING(for struct addrinfo) AC_TRY_COMPILE( [ #include #include #include ], [ size_t test = sizeof(((struct addrinfo *)0)->ai_flags);], [ have_struct_addrinfo=yes ], [ have_struct_addrinfo=no ]) AC_MSG_RESULT($have_struct_addrinfo) if test "$have_struct_addrinfo" = "yes"; then AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [Define to 1 if you have struct addrinfo]) fi AC_SUBST(LIBS) AC_SUBST(PERL_CFLAGS) AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(PERL_LIBS) AM_CONDITIONAL(COMPILE_PERL, test "$perl" = "yes") AM_CONDITIONAL(IRC_SUPPORT, test "$irc" = "yes") AC_OUTPUT([ Makefile src/Makefile src/missing/Makefile src/protocols/Makefile src/protocols/aim/Makefile src/protocols/irc/Makefile doc/Makefile doc/help/Makefile doc/help/blist/Makefile doc/help/buddy/Makefile doc/help/chat/Makefile doc/help/event/Makefile doc/help/file/Makefile doc/help/history/Makefile doc/help/input/Makefile doc/help/main/Makefile doc/help/perl/Makefile doc/help/scroll/Makefile doc/help/timer/Makefile doc/help/win/Makefile examples/Makefile examples/perl/Makefile]) pork-0.99.8.1/config.guess0000755000175000017500000012546610236222646015240 0ustar ryanryan00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-04-22' # This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amd64:OpenBSD:*:*) echo x86_64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; luna88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit 0 ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; amd64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms && exit 0 ;; I*) echo ia64-dec-vms && exit 0 ;; V*) echo vax-dec-vms && exit 0 ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: pork-0.99.8.1/install-sh0000755000175000017500000002244110236222646014711 0ustar ryanryan00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2004-04-01.17 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename= transform_arg= instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= usage="Usage: $0 [OPTION]... SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 -d DIRECTORIES... In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. In the second, create the directory path DIR. Options: -b=TRANSFORMBASENAME -c copy source (using $cpprog) instead of moving (using $mvprog). -d create directories instead of installing files. -g GROUP $chgrp installed files to GROUP. -m MODE $chmod installed files to MODE. -o USER $chown installed files to USER. -s strip installed files (using $stripprog). -t=TRANSFORM --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit 0;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. test -n "$dir_arg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then instcmd=: chmodcmd= else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" || lasterr=$? # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $instcmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else # If we're going to rename the final executable, determine the name now. if test -z "$transformarg"; then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename \ | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename. test -z "$dstfile" && dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: pork-0.99.8.1/config.sub0000755000175000017500000007547010236222646014702 0ustar ryanryan00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-04-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | msp430-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: pork-0.99.8.1/missing0000755000175000017500000002466610236222646014317 0ustar ryanryan00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2003-09-02.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: pork-0.99.8.1/Makefile.am0000644000175000017500000000020410234217323014724 0ustar ryanryan00000000000000SUBDIRS = \ src \ doc \ examples pork_DATA = \ QUICK_START EXTRA_DIST = \ CONTRIBUTERS \ STYLE porkdir = $(pkgdatadir) pork-0.99.8.1/Makefile.in0000644000175000017500000004546610236222651014762 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ TODO config.guess config.sub depcomp install-sh missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(mkdir_p) CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__installdirs = "$(DESTDIR)$(porkdir)" porkDATA_INSTALL = $(INSTALL_DATA) DATA = $(pork_DATA) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = \ src \ doc \ examples pork_DATA = \ QUICK_START EXTRA_DIST = \ CONTRIBUTERS \ STYLE porkdir = $(pkgdatadir) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 uninstall-info-am: install-porkDATA: $(pork_DATA) @$(NORMAL_INSTALL) test -z "$(porkdir)" || $(mkdir_p) "$(DESTDIR)$(porkdir)" @list='$(pork_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(porkDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(porkdir)/$$f'"; \ $(porkDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(porkdir)/$$f"; \ done uninstall-porkDATA: @$(NORMAL_UNINSTALL) @list='$(pork_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(porkdir)/$$f'"; \ rm -f "$(DESTDIR)$(porkdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="../$(top_distdir)" \ distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(porkdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-porkDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-porkDATA uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-recursive ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ dist-tarZ dist-zip distcheck distclean distclean-generic \ distclean-hdr distclean-recursive distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-porkDATA install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-info-am uninstall-porkDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/config.h.in0000644000175000017500000001346210236222644014731 0ustar ryanryan00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if AF_INET6 is missing */ #undef AF_INET6 /* Define to enable debugging */ #undef ENABLE_DEBUGGING /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the 'freeaddrinfo' function. */ #undef HAVE_FREEADDRINFO /* Define to 1 if you have the 'gai_strerror' function. */ #undef HAVE_GAI_STRERROR /* Define to 1 if you have the 'getaddrinfo' function. */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `gethostbyname' function. */ #undef HAVE_GETHOSTBYNAME /* Define to 1 if you have the 'getnameinfo' function. */ #undef HAVE_GETNAMEINFO /* Define to 1 if you have the `getopt_long' function. */ #undef HAVE_GETOPT_LONG /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the 'inet_ntop' function. */ #undef HAVE_INET_NTOP /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the `memcmp' function. */ #undef HAVE_MEMCMP /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_H /* Define to 1 if you have the `Perl_eval_pv' function. */ #undef HAVE_PERL_EVAL_PV /* Define to 1 if you have the 'resizeterm' function in -lncurses. */ #undef HAVE_RESIZETERM /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strsep' function. */ #undef HAVE_STRSEP /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have struct addrinfo */ #undef HAVE_STRUCT_ADDRINFO /* Define to 1 if you have struct in6_addr */ #undef HAVE_STRUCT_IN6_ADDR /* Define to 1 if you have struct sockaddr_in6 */ #undef HAVE_STRUCT_SOCKADDR_IN6 /* Define to 1 if you have struct sockaddr_storage */ #undef HAVE_STRUCT_SOCKADDR_STORAGE /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the `uname' function. */ #undef HAVE_UNAME /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define if your compiler has __attribute__ */ #undef HAVE___ATTRIBUTE__ /* Define if the sockaddr storage struct has the ss_family member */ #undef HAVE___SS_FAMILY /* Define to enable IRC support */ #undef IRC_SUPPORT /* Define if Perl's version is < 5.006 */ #undef OLD_PERL /* Name of package */ #undef PACKAGE /* author */ #undef PACKAGE_AUTHOR /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* extraversion */ #undef PACKAGE_EXTRAVERSION /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* website */ #undef PACKAGE_WEBSITE /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Size of the 'void *' type */ #undef SIZEOF_VOID_P /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define if in_addr_t is missing */ #undef in_addr_t /* Define if in_port_t is missing */ #undef in_port_t /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned' if does not define. */ #undef size_t /* Define if socklen_t is missing */ #undef socklen_t /* Define to `uint16_t' if does not define. */ #undef u_int16_t /* Define to `uint32_t' if does not define. */ #undef u_int32_t /* Define to `uint8_t' if does not define. */ #undef u_int8_t /* Define to `unsigned short' if does not define. */ #undef uint16_t /* Define to `unsigned int' if does not define. */ #undef uint32_t /* Define to `unsigned char' if does not define. */ #undef uint8_t pork-0.99.8.1/AUTHORS0000644000175000017500000000007110234217323013742 0ustar ryanryan00000000000000Ryan McCabe Amber Adams pork-0.99.8.1/INSTALL0000644000175000017500000001722710234217323013736 0ustar ryanryan00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. pork-0.99.8.1/examples/0000755000175000017500000000000010236222745014520 5ustar ryanryan00000000000000pork-0.99.8.1/examples/perl/0000755000175000017500000000000010236222745015462 5ustar ryanryan00000000000000pork-0.99.8.1/examples/perl/spellcheck.pl0000644000175000017500000000146010234301511020120 0ustar ryanryan00000000000000# # spellcheck.pl - spell checking module for pork (http://ojnk.sourceforge.net/) # # Author: Justin Chouinard # AIM: jvcEFNet # use Text::Aspell; my $binding = 'meta-s'; my $unload_refnum; sub setup { PORK::bind($binding, 'perl spell_check'); $unload_refnum = PORK::event_add("UNLOAD", "unload_handler"); if (!defined $unload_refnum) { PORK::err_msg("Error setting up unload handler."); return (-1); } return(0); } sub unload_handler { PORK::unbind($binding); } sub spell_check { local $_ = PORK::input_get_data(); # Create a new instance of ASPell my $speller = Text::Aspell->new; # Set each mispelled word to red @results = map { $speller->check($_) ? $_ : "%R$_%x"; } split(/\s+/); PORK::echo("spell-check: @results"); return(0); } setup(); pork-0.99.8.1/examples/perl/calendar.pl0000644000175000017500000001306610234217336017574 0ustar ryanryan00000000000000# ----------------------------------------------------------------------------- # PorkCal -- a calendar for pork. # # This script sets up an alias that prints out a calendar to your pork # window. The calendar can start weeks with either Sunday or Monday, # and can be printed with, or without color. For more info, call # /cal help # # Copyright (C) 2005 Ammon Riley # ----------------------------------------------------------------------------- package Calendar; use Date::Calc qw( Calendar ); # ----------------------------------------------------------------------------- # User variables # ----------------------------------------------------------------------------- my $alias = 'cal'; # What to call the user alias my %color_defaults = ( title => '%G', # Month and year weekday_title => '%g', # Mon - Fri weekend_title => '%C', # Sat and Sun weekday => undef, # Weekday dates weekend => '%c', # Weekend dates today => '%r', # Today (if it's showing) error => '%r', # Error message header help => '%g', # Help ); my $sunday_first = 1; # Format of calander my $colorized = 1; # Use color or not # ----------------------------------------------------------------------------- # Main Function. No need to edit below this line. # ----------------------------------------------------------------------------- sub print_calendar { # Be forgiving if the user forgets to use a comma (or is too lazy). my ($m, $y); if (@_ == 1) { ($m, $y) = split /\s+/, shift; } else { ($m, $y) = @_ } # Make sure that all colors are defined, in case user decided to # use 'undef' to mean 'no color'. my %color = (); for $color (keys %color_defaults) { if (!defined $color_defaults{$color} || $colorized == 0) { $color{$color} = ''; } else { $color{$color} = $color_defaults{$color}; } } # Get month/year default values. my ($cd, $cm, $cy) = (localtime)[3..5]; $cm++; $cy += 1900; $m = $cm unless $m; $y = $cy unless $y; ($m, $y) = (lc $m, lc $y); # In case it's a command. # Take care of extra functions -- help, setting color, and format. if ($m eq 'help') { PORK::echo("$color{help}Usage:\%x"); PORK::echo(" $color{help}/$alias []\%x"); PORK::echo(" is an integer from 1 through 12."); PORK::echo(" is a 4 digit year."); PORK::echo(" and default to the current date."); PORK::echo(" $color{help}/$alias color \%x"); PORK::echo(" set use of color"); PORK::echo(" $color{help}/$alias format \%x"); PORK::echo(" which day starts week"); return -1; } elsif ($m eq 'color') { # We want to accept all the values that pork does. my %valid_color = ( (map { $_ => 1 } qw( on 1 true )), (map { $_ => 0 } qw( off 0 false )), ); if (exists $valid_color{$y}) { $colorized = $valid_color{$y}; } elsif ($y eq 'toggle') { $colorized = !$colorized; } else { PORK::echo("$color{error}$alias error:\%x bad color value ($y)"); return -1; } return 0; } elsif ($m eq 'format') { if ($y eq 'toggle') { $sunday_first = !$sunday_first; } elsif ($y eq 'monday') { $sunday_first = 0; } elsif ($y eq 'sunday') { $sunday_first = 1; } else { PORK::echo("$color{error}$alias error:\%x bad format value ($y)"); return -1; } return 0; } # Make sure month and year are valid. if ($m =~ /\D/ || $m < 1 || $m > 12) { PORK::echo("$color{error}$alias error:\%x bad month ($m)"); return -1; } if ($y =~ /\D/) { PORK::echo("$color{error}$alias error:\%x bad year ($m)"); return -1; } # Okay, we're off to the races! my @calendar = grep /\S/, split /\n/, Calendar($y, $m, $sunday_first); chomp @calendar; # Colorize the lines! PORK::echo($color{title} . shift(@calendar) . "%x"); # Next up is the header. Since there's only one space between # columns in the header, it's easy to split off the weekend from the # weekday. my @header = split / /, shift @calendar; if ($sunday_first) { $header[0] = "$color{weekend_title}$header[0]\%x$color{weekday_title}"; $header[6] = "\%x$color{weekend_title}$header[6]\%x"; } else { $header[0] = "$color{weekday_title}$header[0]"; $header[5] = "\%x$color{weekend_title}$header[5]"; $header[6] = "$header[6]\%x"; } PORK::echo(join ' ', @header); # Next, we have the dates. Since the row of dates can change depending # on the length, we'll make sure that length is always the same, so # we don't have to guess where we're supposed to put color codes. for (@calendar) { @line = split //, sprintf "%-27s", $_; if ($sunday_first) { splice @line, -3, 0, "\%x$color{weekend}"; splice @line, 3, 0, "\%x$color{weekday}"; unshift @line, $color{weekend}; } else { splice @line, -7, 0, "\%x$color{weekend}"; unshift @line, $color{weekday}; } # If today's date is in here, then we need to mark that, too. # That'll be easier if we put the line back together. my $line = join '', @line, '%x'; if ($m == $cm && $y == $cy) { # We'll need to make sure that if we change the color, # while marking today, that we put it back. Note that # if the user doesn't have any color for weekdays, then # there may not be a color code, if Monday is the first # day. $line =~ s/(\%.)?([^%]*)\b$cd\b/$1$2$color{today}$cd\%x$1/; } PORK::echo($line); } return 0; } PORK::alias($alias, 'perl Calendar::print_calendar'); 1; pork-0.99.8.1/examples/perl/np.pl0000644000175000017500000000473110234217336016437 0ustar ryanryan00000000000000# # Copyright (C) 2003 Ryan McCabe # # Works with the xmms-infopipe plugin (search google for it) # # Appends a line displaying what's playing in xmms to your profile # every 30 seconds, and whenever the profile is changed. # # I'm a C programmer, not a Perl programmer, and it probably shows. # my $xmms_info = "/tmp/xmms-info"; my $timer_refnum; my $sp_refnum; my $unload_refnum; my $last_stored; # # Update the profile every 30 seconds. # my $interval = 30; sub np_init { $sp_refnum = PORK::event_add("SEND_PROFILE", "np_send_profile_handler"); if (!defined $sp_refnum) { return (-1); } $unload_refnum = PORK::event_add("UNLOAD", "np_unload"); if (!defined $unload_refnum) { PORK::event_del_refnum($sp_refnum); return (-1); } $timer_refnum = PORK::timer_add($interval, 0, "perl np_run"); if (!defined $timer_refnum) { PORK::event_del_refnum($sp_refnum); PORK::event_del_refnum($unload_refnum); } $last_stored = PORK::get_profile(); np_run(); } sub np_get_info { my $info_hash = shift; local *FILE; open(FILE, "<$xmms_info") || return (0); while () { my $left; my $right; ($left, $right) = split(/: /, $_, 2); if ($left && $right) { chop($right); $info_hash->{$left} = $right; } } close(FILE); return (1); } # # Pork events always pass the reference number of the account # that triggered the event as the last parameter of event # handlers. # sub np_send_profile_handler { my $cur_profile = shift; my $user = shift; my %info_hash = (); my $np_str = "nothing"; $last_stored = $cur_profile; if (np_get_info(\%info_hash)) { if (defined $info_hash{'Title'} && defined $info_hash{'Status'} && $info_hash{'Status'} eq "Playing") { $np_str = $info_hash{'Title'}; } } # # Prepend "" so that the string won't be converted to HTML # when it's sent -- it's already HTML, make sure the program leaves # it alone. # $np_str =~ s/&/&/g; $np_str =~ s//>/g; $cur_profile = "$cur_profile

np: $np_str"; if ($cur_profile !~ /^/i) { $cur_profile = "" . $cur_profile; } PORK::send_profile($cur_profile); return (1); } sub np_run { # # Do it for the current user. # np_send_profile_handler($last_stored, undef); } sub np_unload { PORK::timer_del_refnum($timer_refnum); PORK::event_del_refnum($sp_refnum); PORK::event_del_refnum($unload_refnum); PORK::set_profile($last_stored); return (0); } # This will run when the script is loaded. np_init(); pork-0.99.8.1/examples/perl/wh.pl0000644000175000017500000000054310234217336016435 0ustar ryanryan00000000000000# Copyright (C) 2004-2005 Ryan McCabe (GPL v2) sub wh { my $maxlen = 0; my @toks = split(/ /, shift); foreach my $i (@toks) { my $len = length($i); $maxlen = $len if ($len > $maxlen); } foreach my $i (@toks) { PORK::input_send(" " x ($maxlen - length($i)) . join(' ', split(//, uc($i)))); } } PORK::alias("wh", "perl wh"); pork-0.99.8.1/examples/perl/Makefile.am0000644000175000017500000000023010234301511017474 0ustar ryanryan00000000000000perl_DATA = \ acro.pl \ calendar.pl \ event_test.pl \ irc.pl \ np.pl \ signon.pl \ spellcheck.pl \ wh.pl perldir = $(pkgdatadir)/examples/perl pork-0.99.8.1/examples/perl/Makefile.in0000644000175000017500000002156410236222653017535 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = examples/perl DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__installdirs = "$(DESTDIR)$(perldir)" perlDATA_INSTALL = $(INSTALL_DATA) DATA = $(perl_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ perl_DATA = \ acro.pl \ calendar.pl \ event_test.pl \ irc.pl \ np.pl \ signon.pl \ spellcheck.pl \ wh.pl perldir = $(pkgdatadir)/examples/perl all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/perl/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu examples/perl/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-perlDATA: $(perl_DATA) @$(NORMAL_INSTALL) test -z "$(perldir)" || $(mkdir_p) "$(DESTDIR)$(perldir)" @list='$(perl_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(perlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(perldir)/$$f'"; \ $(perlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(perldir)/$$f"; \ done uninstall-perlDATA: @$(NORMAL_UNINSTALL) @list='$(perl_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(perldir)/$$f'"; \ rm -f "$(DESTDIR)$(perldir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(perldir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-perlDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-perlDATA .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-perlDATA install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-info-am uninstall-perlDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/examples/perl/irc.pl0000644000175000017500000001115210234217336016572 0ustar ryanryan00000000000000# # Copyright (C) 2004-2005 Ryan McCabe (GPLv2) # use strict; my $chat_status_op = 0x01; my $chat_status_halfop = 0x02; my $chat_status_voice = 0x04; sub op { my $target = PORK::chat_target(); my $i = 0; my @users = (); if (!$target) { return (-1); } @users = split(/ +/, shift); if (!@users) { return (-1); } while ($i < scalar(@users)) { PORK::quote("MODE $target +oooo @users[$i .. $i + 3]"); $i += 4; } return (0); } sub cmdswitch { my $newc = "/"; if (PORK::get_opt("CMDCHARS") eq "/") { $newc = ""; } PORK::set_opt("CMDCHARS", $newc); PORK::err_msg("CMDCHARS is now $newc"); } sub chanmode { my $target = PORK::chat_target(); my $modestr = shift; if (!$target) { return (-1); } PORK::quote("MODE $target $modestr"); return (0); } sub mop { my $target = PORK::chat_target(); my @users = (); my $i = 0; if (!$target) { return (-1); } @users = PORK::chat_get_users($target, $chat_status_op, 1); while ($i < scalar(@users)) { PORK::quote("MODE $target +oooo @users[$i .. $i + 3]"); $i += 4; } return (0); } sub dop { my $target = PORK::chat_target(); my $i = 0; my @users = (); if (!$target) { return (-1); } @users = split(/ +/, shift); if (!@users) { return (-1); } while ($i < scalar(@users)) { PORK::quote("MODE $target -oooo @users[$i .. $i + 3]"); $i += 4; } return (0); } sub mdop { my $target = PORK::chat_target(); my @users = (); my $i = 0; my $me = PORK::cur_user(); if (!$target) { return (-1); } @users = PORK::chat_get_users($target, $chat_status_op, 0); @users = grep(!/^$me$/, @users); while ($i < scalar(@users)) { PORK::quote("MODE $target -oooo @users[$i .. $i + 3]"); $i += 4; } return (0); } sub chops { my $target = PORK::chat_target(); if (!$target) { return (-1); } my @users = PORK::chat_get_users($target, $chat_status_op, 0); if (@users) { my $str = ""; PORK::echo("%D--%m--%M--%C c%chanops%x on %G$target"); foreach my $i (@users) { $str .= "%D[%g$i" . "%D] "; } PORK::echo($str); my @a = PORK::chat_get_users($target, 0, 0); PORK::echo("%D--%m--%M--%C c%chanops%W: %g" . scalar(@users) . "%W/%G" . scalar(@a)); } return (0); } sub nops { my $target = PORK::chat_target(); if (!$target) { return (-1); } my @users = PORK::chat_get_users($target, $chat_status_op, 1); if (@users) { my $str = ""; PORK::echo("%D--%m--%M--%C n%conops%x on %G$target"); foreach my $i (@users) { $str .= "%D[%b$i" . "%D] "; } PORK::echo($str); my @a = PORK::chat_get_users($target, 0, 0); PORK::echo("%D--%m--%M--%C n%conops%W: %b" . scalar(@users) . "%W/%B" . scalar(@a)); } return (0); } sub wii { my @users = split(/ +/, shift); if (!@users) { return (-1); } foreach my $i (@users) { PORK::quote("WHOIS $i $i"); } return (0); } sub kb { my $target = PORK::chat_target(); my $i = 0; my @args = (); if (!$target) { return (-1); } @args = split(/ +/, shift, 2); if (!@args) { return (-1); } PORK::chat_ban($target, $args[0]); PORK::chat_kick($target, $args[0], $args[1]); return (0); } sub oper { my $user; my $passwd; my @args = split(/ /, shift, 2); if (!@args || scalar(@args) < 2) { $user = PORK::get_cur_user() if (!$args[0]); $passwd = PORK::prompt_user("Password: "); if (!$passwd) { PORK::err_msg("Unable to read password."); return (-1); } } $user = $args[0] if (scalar(@args) >= 1); $passwd = $args[1] if (scalar(@args) == 2); PORK::quote("OPER $user $passwd"); } sub umode { my $me = PORK::cur_user(); my $mode = shift; PORK::quote("MODE $me $mode"); } sub irc_cmd { my ($cmd, $args) = @_; my @toks; my $dest; @toks = split(/ +/, $args, 2); if (!@toks) { return (-1); } return (PORK::quote("$cmd $toks[0] :$toks[1]")); } sub kill { return (irc_cmd("KILL", shift)); } sub kline { return (irc_cmd("KLINE", shift)); } PORK::bind("^\\", "perl cmdswitch"); PORK::alias("kb", "perl kb"); PORK::alias("bk", "perl kb"); PORK::alias("op", "perl op"); PORK::alias("mop", "perl mop"); PORK::alias("dop", "perl dop"); PORK::alias("mdop", "perl mdop"); PORK::alias("c", "perl chanmode"); PORK::alias("chops", "perl chops"); PORK::alias("nops", "perl nops"); PORK::alias("wii", "perl wii"); PORK::alias("oper", "perl oper"); PORK::alias("umode", "perl umode"); PORK::alias("kill", "perl kill"); PORK::alias("kline", "perl kline"); PORK::alias("list", "quote list"); PORK::alias("unkline", "quote unkline"); PORK::alias("stats", "quote stats"); PORK::alias("knock", "quote knock"); PORK::alias("links", "quote links"); PORK::alias("trace", "quote trace"); PORK::alias("lusers", "quote lusers"); PORK::alias("topic", "chat topic"); pork-0.99.8.1/examples/perl/acro.pl0000644000175000017500000002333710234217336016751 0ustar ryanryan00000000000000# # Copyright (C) 2003 Ryan McCabe # # Load this to play acro in acro/4. The rules are easy to figure out. # my $rounds = 10; my $chatroom = "acro/4"; my $letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; my @weights = (68, 59, 87, 56, 38, 37, 25, 26, 41, 9, 10, 24, 40, 15, 19, 67, 6, 56, 100, 37, 17, 12, 19, 3, 7, 5); my $max_len = 7; my $min_len = 4; my $voting_time = 60; my $pause_time = 30; # # 0 - no game # 1 - acro round # 2 - voting round # my $game_state = 0; my $cur_round_tl = 0; my $cur_round_num = 0; my $cur_round_acro = ""; my $num_players; my $num_voted; my @players; my %players_round = (); my %players_game = (); my $not_enough_players = 0; my $unload_refnum; my $chat_refnum; my $im_refnum; my $warn_refnum; my $timer_refnum = -1; sub acro_init { if (PORK::chat_join($chatroom) != 0) { PORK::err_msg("Error joining $chatroom"); return; } $unload_refnum = PORK::event_add("UNLOAD", "acro_unload"); if (!defined $unload_refnum) { PORK::err_msg("Error setting things up (unload)."); return; } $warn_refnum = PORK::event_add("RECV_WARN", "warn_handler"); if (!defined $warn_refnum) { PORK::event_del_refnum($unload_refnum); PORK::err_msg("Error setting things up (warn listener)."); return; } $chat_refnum = PORK::event_add("RECV_CHAT_MSG", "acro_chat_handler"); if (!defined $chat_refnum) { PORK::event_del_refnum($unload_refnum); PORK::event_del_refnum($warn_refnum); PORK::err_msg("Error setting things up (chat listener)."); return; } $im_refnum = PORK::event_add("RECV_IM", "acro_im_handler"); if (!defined $im_refnum) { PORK::event_del_refnum($unload_refnum); PORK::event_del_refnum($warn_refnum); PORK::event_del_refnum($chat_refnum); PORK::err_msg("Error setting things up (IM listener)"); return; } # So blocking people works. PORK::privacy_mode(4); } sub warn_handler { my ($idiot, $new_level, $sn) = @_; PORK::buddy_add_block($idiot, $sn); return (0); } sub acro_unload { PORK::event_del_refnum($chat_refnum); PORK::event_del_refnum($im_refnum); PORK::event_del_refnum($unload_refnum); PORK::event_del_refnum($warn_refnum); if ($timer_refnum >= 0) { PORK::timer_del_refnum($timer_refnum); } } sub acro_chat_handler { my ($name, $user, $msg, $acct) = @_; if ($game_state == 0 && $name eq $chatroom && $msg eq "acro2 start") { PORK::chat_send($name, "[acro] New game started by $user"); acro_new_round(); } return (0); } sub acro_im_handler { my ($ouser, $auto, $msg, $acct) = @_; my $user; $user = acro_normalize($ouser); if (substr($msg, 0, 5) eq "acro ") { if ($game_state == 1) { my $acro = substr($msg, 5); if (acro_ok($acro)) { if (defined $players_round{$user}) { $players_round{$user}{'acro'} = $acro; PORK::send_msg($user, "Your acro was changed to: $acro"); } else { $players_round{$user} = { "name" => $ouser, "acro" => $acro, "num" => $num_players + 1, "voted" => 0, "votes" => 0 }; $players[$num_players++] = \$players_round{$user}; PORK::send_msg($user, "Your acro is set to: $acro. You are player number $num_players."); } } else { PORK::send_msg($user, "Invalid acro: $acro."); } } elsif ($game_state == 2) { if (defined $players_round{$user}) { my $vote = int(substr($msg, 5)); if ($vote > 0 && $vote <= $num_players) { if ($vote == $players_round{$user}{'num'}) { PORK::send_msg($user, "Don't try it, bin Laden, you can't vote for yourself."); } else { if ($players_round{$user}{'voted'} > 0) { my $old_vote = $players_round{$user}{'voted'}; ${$players[$old_vote - 1]}->{'votes'}--; ${$players[$vote - 1]}->{'votes'}++; $players_round{$user}{'voted'} = $vote; PORK::send_msg($user, "Your vote was changed to $vote"); } else { ${$players[$vote - 1]}->{'votes'}++; $players_round{$user}{'voted'} = $vote; PORK::send_msg($user, "Your vote is set to $vote"); $num_voted++; if ($num_voted == $num_players) { PORK::timer_del_refnum($timer_refnum); acro_timeup_vote(); } } } } else { PORK::send_msg($user, "Invalid vote: $vote"); } } } } return (0); } sub acro_normalize { my $name = lc(shift); $name =~ s/ //g; return ($name); } sub acro_generate { my $acro_len = 0; my $i = 0; my $acro = ""; while ($acro_len < $min_len) { $acro_len = rand($max_len); } while ($i < $acro_len) { my $pos = rand(length($letters)); my $letter = substr($letters, $pos, 1); if ($weights[$pos] >= int(rand(100))) { $acro .= $letter; $i++; } } return ($acro); } sub acro_ok { my $acro = shift; my @tokens = (); my $i; my $acrolen = length($cur_round_acro); $acro =~ s/^\s+//; @tokens = split /[ \t]+/,$acro; if (!@tokens || scalar(@tokens) != $acrolen) { return (0); } for ($i = 0 ; $i < $acrolen ; $i++) { my $token_letter = uc(substr($tokens[$i], 0, 1)); my $acro_letter = substr($cur_round_acro, $i, 1); if ($token_letter ne $acro_letter) { if ($token_letter eq "\"" || $token_letter eq "'" || $token_letter eq "(") { $token_letter = uc(substr($tokens[$i], 1, 1)); if ($token_letter eq $acro_letter) { next; } } return (0); } } return (1); } sub acro_halftime_vote { my $time_left = $voting_time / 2; PORK::chat_send($chatroom, "[acro] $time_left seconds left to vote."); $timer_refnum = PORK::timer_add($time_left, 1, "perl acro_timeup_vote"); } sub acro_timeup_vote { my $i; my $msg; my @standings; PORK::chat_send($chatroom, "[acro] TIME UP! Results for $cur_round_num"); for ($i = 1 ; $i <= $num_players ; $i++) { my $num_votes = ${$players[$i - 1]}->{'votes'}; my $cur_name = ${$players[$i - 1]}->{'name'}; my $nname = acro_normalize($cur_name); select(undef, undef, undef, 0.70); $msg = "[acro] #$i by $cur_name got $num_votes vote"; if ($num_votes != 1) { $msg .= "s"; } if (${$players[$i - 1]}->{'voted'} < 1) { $msg .= ", but $cur_name didn't vote, and thus, gets ZERO points."; PORK::chat_send($chatroom, $msg); next; } $msg .= "."; PORK::chat_send($chatroom, $msg); if ($num_votes < 1) { next; } if (defined $players_game{$nname}) { $players_game{$nname}{'votes'} += $num_votes; } else { $players_game{$nname} = { "name" => $cur_name, "votes" => $num_votes }; } } @standings = reverse sort { $players_game{$a}{'votes'} <=> $players_game{$b}{'votes'} } keys %players_game; if (@standings) { $msg = "[acro] Current scores:"; foreach $i (@standings) { $msg .= " $players_game{$i}{'name'}: $players_game{$i}{'votes'},"; } chop($msg); select(undef, undef, undef, 0.80); PORK::chat_send($chatroom, $msg); } select(undef, undef, undef, 0.80); if ($cur_round_num >= $rounds) { acro_game_over(); } else { PORK::chat_send($chatroom, "[acro] $pause_time seconds until the next round begins."); $timer_refnum = PORK::timer_add($pause_time, 1, "perl acro_new_round"); } } sub acro_timeup { my $i; if ($num_players < 2) { if ($not_enough_players > 0) { PORK::chat_send($chatroom, "[acro] Nobody wants to play. GAME OVER."); acro_game_over(); return; } PORK::chat_send($chatroom, "[acro] Not enough players. Extending $cur_round_tl seconds."); $not_enough_players++; $timer_refnum = PORK::timer_add($cur_round_tl, 1, "perl acro_halftime"); return; } PORK::chat_send($chatroom, "[acro] TIME UP! Submissions for Round $cur_round_num"); for ($i = 1 ; $i <= $num_players ; $i++) { select(undef, undef, undef, 0.70); PORK::chat_send($chatroom, " #$i: ${$players[$i - 1]}->{'acro'}"); } select(undef, undef, undef, 0.60); PORK::chat_send($chatroom, "[acro] You have $voting_time seconds to vote. Send me an IM of the form 'acro < 1 - $num_players >' to vote."); $game_state++; $timer_refnum = PORK::timer_add($voting_time / 2, 1, "perl acro_halftime_vote"); } sub acro_halftime { my $time_left = $cur_round_tl / 2; PORK::chat_send($chatroom, "[acro] $time_left seconds left!"); $timer_refnum = PORK::timer_add($time_left, 1, "perl acro_timeup"); } sub acro_game_over { my @standings = reverse sort { $players_game{$a}{'votes'} <=> $players_game{$b}{'votes'} } keys %players_game; if (@standings) { my $msg = "[acro] Final scores: "; my $winning_votes; my $winners = ""; my $num_winners = 0; my $s = ""; my $i; foreach $i (@standings) { $msg .= " $players_game{$i}{'name'}: $players_game{$i}{'votes'},"; } chop($msg); PORK::chat_send($chatroom, $msg); $winning_votes = $players_game{$standings[0]}{'votes'}; for ($i = 0 ; $i < $num_players ; $i++) { if ($players_game{$standings[$i]}{'votes'} == $winning_votes) { $num_winners++; $winners .= " $players_game{$standings[$i]}{'name'},"; } } chop($winners); if ($num_winners > 1) { $s = "s"; $winners .= " (tie)" } select(undef, undef, undef, 0.60); PORK::chat_send($chatroom, "[acro] Winner$s:$winners with $winning_votes votes."); } $timer_refnum = -1; $not_enough_players = 0; $game_state = 0; $cur_round_acro = ""; $cur_round_num = 0; $cur_round_tl = 0; $num_voted = 0; $num_players = 0; @players = (); %players_game = (); %players_round = (); } sub acro_new_round { my $time_limit; $not_enough_players = 0; $num_voted = 0; $num_players = 0; @players = (); %players_round = (); $game_state = 1; $cur_round_acro = acro_generate(); $cur_round_tl = 60 + 10 * (length($cur_round_acro) - 4); $cur_round_num++; PORK::chat_send($chatroom, "[$cur_round_num/$rounds] The acro for this round is $cur_round_acro. You have $cur_round_tl seconds. Send me an IM of the form 'acro < YOUR ACRO >' to play."); $timer_refnum = PORK::timer_add($cur_round_tl / 2, 1, "perl acro_halftime"); } acro_init(); pork-0.99.8.1/examples/perl/event_test.pl0000644000175000017500000000777110234217336020211 0ustar ryanryan00000000000000# # Copyright (C) 2003 Ryan McCabe # # Demonstrates how to setup event handlers using Perl. # # This doesn't handle all the events that pork supports; # more have been added since I wrote this, but you'll get the # idea. # sub setup { PORK::event_add("BUDDY_AWAY", "buddy_away_handler"); PORK::event_add("BUDDY_BACK", "buddy_back_handler"); PORK::event_add("BUDDY_IDLE", "buddy_idle_handler"); PORK::event_add("BUDDY_SIGNOFF", "buddy_signoff_handler"); PORK::event_add("BUDDY_SIGNON", "buddy_signon_handler"); PORK::event_add("BUDDY_UNIDLE", "buddy_unidle_handler"); PORK::event_add("QUIT", "quit_handler"); PORK::event_add("RECV_AWAYMSG", "recv_awaymsg_handler"); PORK::event_add("RECV_IM", "recv_im_handler"); PORK::event_add("RECV_PROFILE", "recv_profile_handler"); PORK::event_add("RECV_SEARCH_RESULT", "recv_search_result_handler"); PORK::event_add("RECV_WARN", "recv_warn_handler"); PORK::event_add("SEND_AWAY", "send_away_handler"); PORK::event_add("SEND_IDLE", "send_idle_handler"); PORK::event_add("SEND_IM", "send_im_handler"); PORK::event_add("SEND_LINE", "send_line_handler"); PORK::event_add("SEND_PROFILE", "send_profile_handler"); PORK::event_add("SEND_WARN", "send_warn_handler"); PORK::event_add("SIGNOFF", "signoff_handler"); PORK::event_add("SIGNON", "signon_handler"); return (0); } # # All of the handler functions (except quit) receive the screen name # the event happened on as their last parameter (i.e. 'account'). # sub buddy_away_handler { my ($buddy, $account) = @_; PORK::echo("called buddy_away_handler args: @_"); return(0); } sub buddy_back_handler { my ($buddy, $account) = @_; PORK::echo("called buddy_back_handler args: @_"); return(0); } sub buddy_idle_handler { my ($buddy, $idle_time, $account) = @_; PORK::echo("called buddy_idle_handler args: @_"); return(0); } sub buddy_signoff_handler { my ($buddy, $account) = @_; PORK::echo("called buddy_signoff_handler args: @_"); return(0); } sub buddy_signon_handler { my ($buddy, $account) = @_; PORK::echo("called buddy_signon_handler args: @_"); return(0); } sub buddy_unidle_handler { my ($buddy, $account) = @_; PORK::echo("called buddy_unidle_handler args: @_"); return(0); } sub quit_handler { PORK::echo("called quit_handler"); return(0); } sub recv_awaymsg_handler { my ($buddy, $is_part_of_whois, $member_since, $online_since, $idle_time, $warn_level, $awaymsg, $account) = @_; PORK::echo("called recv_awaymsg_handler args: @_"); return(0); } sub recv_im_handler { my ($buddy, $msg, $account) = @_; PORK::echo("called recv_im_handler args: @_"); return(0); } sub recv_profile_handler { my ($buddy, $member_since, $online_since, $idle_time, $warn_level, $profile, $account) = @_; PORK::echo("called recv_profile_handler args: @_"); return(0); } sub recv_search_result_handler { my ($search_str, $results, $account) = @_; PORK::echo("called recv_search_result_handler args: @_"); return(0); } sub recv_warn_handler { my ($buddy, $new_warn_level, $account) = @_; PORK::echo("called recv_warn_handler args: @_"); return(0); } sub send_away_handler { my ($away_msg, $account) = @_; PORK::echo("called send_away_handler args: @_"); return(0); } sub send_idle_handler { my ($idle_seconds, $account) = @_; PORK::echo("called send_idle_handler args: @_"); return(0); } sub send_im_handler { my ($buddy, $msg, $account) = @_; PORK::echo("called send_im_handler args: @_"); return(0); } sub send_line_handler { my ($line, $account) = @_; PORK::echo("called send_line_handler args: @_"); return(0); } sub send_profile_handler { my ($profile, $account) = @_; PORK::echo("called send_profile_handler args: @_"); return(0); } sub send_warn_handler { my ($buddy, $is_anonymous, $account) = @_; PORK::echo("called send_warn_handler args: @_"); return(0); } sub signoff_handler { my $account = shift; PORK::echo("called signoff_handler args: @_"); return(0); } sub signon_handler { my $account = shift; PORK::echo("called signon_handler args: @_"); return(0); } setup(); pork-0.99.8.1/examples/perl/signon.pl0000644000175000017500000000212610234217336017313 0ustar ryanryan00000000000000# Copyright (C) 2004 Ryan McCabe # # Demonstrates signon handler # You will send $signon_msg to $msg_user when $signon_user signs on. # Edit these next three variables my $signon_user = "signon_user"; my $msg_user = "msg_user"; my $signon_msg = "This is a test message"; my $signon_refnum; my $unload_refnum; sub normalize { my $name = lc(shift); $name =~ s/ //g; return ($name); } sub setup { $signon_refnum = PORK::event_add("BUDDY_SIGNON", "buddy_signon_handler"); if (!defined $signon_refnum) { PORK::err_msg("Error setting up signon notifier."); return (-1); } $unload_refnum = PORK::event_add("UNLOAD", "unload_handler"); if (!defined $unload_refnum) { PORK::err_msg("Error setting up unload handler."); return (-1); } return (0); } sub unload_handler { PORK::event_del_refnum($signon_refnum); PORK::event_del_refnum($unload_refnum); } sub buddy_signon_handler { my ($buddy, $account) = @_; if (normalize($buddy) eq $signon_user) { PORK::send_msg($msg_user, $signon_msg, $account); } return(0); } $signon_user = normalize($signon_user); setup(); pork-0.99.8.1/examples/blist.txt0000644000175000017500000000056110234217336016376 0ustar ryanryan00000000000000## permit/deny mode (1-5) m 1 ## report idle time (boolean) i 1 ## groups start with g, are followed by the ## users in the group. g test group1 ## "buddies" start with b. b is for buddy. b test g1b1 b test g1b2 g test group2 b test g2b1 b test g2b2 ## permitted users an be added like this: p permit1 p permit2 ## users can be blocked like this: d deny1 d deny2 pork-0.99.8.1/examples/Makefile.am0000644000175000017500000000001710234217336016550 0ustar ryanryan00000000000000SUBDIRS = perl pork-0.99.8.1/examples/Makefile.in0000644000175000017500000003166610236222653016577 0ustar ryanryan00000000000000# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ subdir = examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_PERL_FALSE = @COMPILE_PERL_FALSE@ COMPILE_PERL_TRUE = @COMPILE_PERL_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ DEBUG_LIBS = @DEBUG_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IRC_SUPPORT_FALSE = @IRC_SUPPORT_FALSE@ IRC_SUPPORT_TRUE = @IRC_SUPPORT_TRUE@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_LIBS = @PERL_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ perlpath = @perlpath@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sedpath = @sedpath@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = perl all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu examples/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="../$(top_distdir)" \ distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-recursive ctags ctags-recursive \ distclean distclean-generic distclean-recursive distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: pork-0.99.8.1/ChangeLog0000644000175000017500000000000010234217323014434 0ustar ryanryan00000000000000pork-0.99.8.1/COPYING0000644000175000017500000004311010234217323013726 0ustar ryanryan00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.