From 47172dbb5f4b908c8b831ca90493c5dd78c52c0c Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Thu, 26 Jun 2008 11:39:49 +0000 Subject: [PATCH] added pgsql-queue into build process --- mbuni/ChangeLog | 2 + mbuni/Makefile.am | 2 +- mbuni/configure.ac | 58 +++- mbuni/extras/pgsql-queue/Makefile | 481 ++++++++++++++++++++++++++++-- mbuni/mmlib/mms_util.c | 38 +++ mbuni/mmlib/mms_util.h | 10 + mbuni/mmsbox/mmsbox.c | 15 +- mbuni/mmsbox/mmsbox_cfg.c | 2 +- mbuni/mmsbox/mmsbox_mmsc.h | 4 +- 9 files changed, 576 insertions(+), 36 deletions(-) diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index c63f858..80f2091 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2008-06-26 P. A. Bagyenda + * Added pgsql-queue into build process (configure.ac) 2008-06-24 P. A. Bagyenda * Improved queue information: Included source interface * Extra identifying headers on MMS2Email interface diff --git a/mbuni/Makefile.am b/mbuni/Makefile.am index 06a1b20..adca949 100644 --- a/mbuni/Makefile.am +++ b/mbuni/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = autotools doc mmlib mmsc mmsbox +SUBDIRS = autotools doc mmlib mmsc mmsbox extras EXTRA_DIST = VERSION GnuLICENSE KannelLICENSE bootstrap Notes diff --git a/mbuni/configure.ac b/mbuni/configure.ac index b6dea8b..5d4e8b4 100644 --- a/mbuni/configure.ac +++ b/mbuni/configure.ac @@ -266,6 +266,62 @@ fi AC_CHECK_LIB([gwlib], [cfg_create], [], AC_MSG_ERROR([Kannel gwlib is required!])) AC_CHECK_LIB([wap], [wsp_headers_pack], [], AC_MSG_ERROR([Kannel WAP lib is required!])) + +dnl Implement the --with-pgsql-dir option. +pgsqlloc="/usr/local/pgsql" +AC_ARG_WITH(pgsql-dir, +[ --with-pgsql-dir=DIR where to look for PostgreSQL libs and header files + DIR points to the installation [/usr/local/pgsql] ], +[ +pgsqlloc="" +if test -d "$withval" ; then + pgsqlloc="$withval" +fi +]) + +AC_PATH_PROG(PGSQL_CONFIG, pg_config, no, [$pgsqlloc/bin:$pgsqlloc:/usr/lib/postgresql/bin:${PATH}]) +dnl check for PgSQL >= 7.2 style pg_config information +if test "$PGSQL_CONFIG" = "no"; then +found="" + for loc in $pgsqlloc /usr /usr/local ; do + if test "x$found" = "x" ; then + AC_MSG_CHECKING([for PostgresSQL include files in]) + AC_MSG_RESULT($loc) + AC_CHECK_FILE("$loc/include/postgresql/libpq-fe.h", + [CFLAGS="$CFLAGS -I$loc/include/postgresql"; LIBS="-L$loc/lib/postgresql -lpq $LIBS"]; found=1, + [AC_CHECK_FILE("$loc/include/pgsql/libpq-fe.h", + [CFLAGS="$CFLAGS -I$loc/include/pgsql"; LIBS=" -L$loc/lib/pgsql $LIBS -lpq"]; found=1, + [AC_CHECK_FILE("$loc/pgsql/include/libpq-fe.h", + [CFLAGS="-I$loc/pgsql/include $CFLAGS"; LIBS="-L$loc/pgsql/lib $LIBS -lpq"]; found=1, + )] + )] + ) + fi + done + +else + dnl pg_config found + AC_MSG_CHECKING([PostgreSQL version]) + pgsql_version=`$PGSQL_CONFIG --version` + AC_MSG_RESULT([$pgsql_version]) + AC_MSG_CHECKING([PostgreSQL libs]) + if $PGSQL_CONFIG --libdir &>/dev/null ; then + LIBS="-L`$PGSQL_CONFIG --libdir` $LIBS -lpq " + pg_libdir="`$PGSQL_CONFIG --libdir`" + AC_MSG_RESULT([$pg_libdir]) + fi + AC_MSG_CHECKING([PostgreSQL includes]) + if $PGSQL_CONFIG --includedir &>/dev/null ; then + CFLAGS="-I`$PGSQL_CONFIG --includedir` $CFLAGS" + pg_incdir=`$PGSQL_CONFIG --includedir` + AC_MSG_RESULT([$pg_incdir]) + fi +fi +# set HAVE_LIBpq if we have libpq +AC_CHECK_LIB([pq], [PQexec], [has_pgsql=true]) + +AM_CONDITIONAL([BUILD_PGSQLQ], [test x$has_pgsql = xtrue]) + dnl Add mbuni version to Cflags # CFLAGS="$CFLAGS -DMBUNI_VERSION=\"$M_VERSION\"" AC_DEFINE_UNQUOTED(MBUNI_VERSION, "$M_VERSION", "Mbuni Version") @@ -273,7 +329,7 @@ AC_DEFINE_UNQUOTED(MBUNI_VERSION, "$M_VERSION", "Mbuni Version") dnl May be we need to check for media conversion tools (imagemagick, etc)? -AC_CONFIG_FILES([Makefile autotools/Makefile doc/Makefile doc/examples/Makefile doc/images/Makefile mmlib/Makefile mmsc/Makefile mmsbox/Makefile]) +AC_CONFIG_FILES([Makefile autotools/Makefile doc/Makefile doc/examples/Makefile doc/images/Makefile mmlib/Makefile mmsc/Makefile mmsbox/Makefile extras/Makefile extras/pgsql-queue/Makefile]) AC_OUTPUT diff --git a/mbuni/extras/pgsql-queue/Makefile b/mbuni/extras/pgsql-queue/Makefile index b0a759f..8632c75 100644 --- a/mbuni/extras/pgsql-queue/Makefile +++ b/mbuni/extras/pgsql-queue/Makefile @@ -1,30 +1,463 @@ -# PGSQL queue handler for Mbuni Makefile (c) 2007 Digital Solutions -# Licence: See http://mbuni.org/license.shtml -KANNELCONF = gw-config -PGCONF = pg_config +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# extras/pgsql-queue/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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. + + + +srcdir = . +top_srcdir = ../.. + +pkgdatadir = $(datadir)/mbuni +pkglibdir = $(libdir)/mbuni +pkgincludedir = $(includedir)/mbuni +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +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 = : +build_triplet = i386-apple-darwin9.3.0 +host_triplet = i386-apple-darwin9.3.0 +subdir = extras/pgsql-queue +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 = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/mbuni-config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libmms_pgsql_queue_la_LIBADD = +am_libmms_pgsql_queue_la_OBJECTS = mms_pgsql_queue.lo +libmms_pgsql_queue_la_OBJECTS = $(am_libmms_pgsql_queue_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libmms_pgsql_queue_la_SOURCES) +DIST_SOURCES = $(libmms_pgsql_queue_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /Users/bagyenda/src/mbuni/autotools/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /Users/bagyenda/src/mbuni/autotools/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /Users/bagyenda/src/mbuni/autotools/missing --run autoconf +AUTOHEADER = ${SHELL} /Users/bagyenda/src/mbuni/autotools/missing --run autoheader +AUTOMAKE = ${SHELL} /Users/bagyenda/src/mbuni/autotools/missing --run automake-1.9 +AWK = gawk +BUILD_PGSQLQ_FALSE = # +BUILD_PGSQLQ_TRUE = CC = gcc -MBUNIDIR = ../.. -LIBTOOL = libtool -ARCH = $(shell uname -s) -CFLAGS = -Wall -g -fPIC -I$(MBUNIDIR) -g -I$(MBUNIDIR)/mmlib `$(KANNELCONF) --cflags | sed 's/-O2//g'` -I`$(PGCONF) --includedir` +CCDEPMODE = depmode=gcc3 +CFLAGS = -I/usr/local/pgsql/include -g -O2 -DDARWIN=1 -O4 -Wall -I/usr/include/openssl -I/usr/local/include/kannel -g -DDARWIN=1 -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -I/Developer/SDKs/MacOSX10.4u.sdk/usr/include -I/sw/include/libxml2 -I/sw/include -I/usr/include/openssl +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +ECHO = /bin/echo +ECHO_C = \c +ECHO_N = +ECHO_T = +EGREP = /usr/bin/grep -E +EXEEXT = +F77 = +FFLAGS = +GREP = /usr/bin/grep +GW_CONFIG = /usr/local/bin/gw-config +INCLUDES = -I$(top_srcdir)/mmlib -I$(top_builddir)/mmlib +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = -L/usr/local/lib/kannel -lgw -lwap -lgwlib -lssl -lresolv -lm -lpthread -liconv -L/sw/lib -lxml2 -lz -lpthread -L/sw/lib -liconv -lm -L/usr/lib -lcrypto -lssl +LIBOBJS = ${LIBOBJDIR}error$U.o ${LIBOBJDIR}lstat$U.o +LIBS = -L/usr/local/pgsql/lib -lwap -lgwlib -lssl -lpthread -ldl -L/usr/lib -lcrypto -lssl -L/usr/local/lib/kannel -lgw -lwap -lgwlib -lssl -lresolv -lm -lpthread -liconv -L/sw/lib -lxml2 -lz -lpthread -L/sw/lib -liconv -lm -L/usr/lib -lcrypto -lssl -lpq +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIBOBJS = ${LIBOBJDIR}error$U.lo ${LIBOBJDIR}lstat$U.lo +MAINT = # +MAINTAINER_MODE_FALSE = +MAINTAINER_MODE_TRUE = # +MAKEINFO = ${SHELL} /Users/bagyenda/src/mbuni/autotools/missing --run makeinfo +OBJEXT = o +OPENSSL = /sw/bin/openssl +PACKAGE = mbuni +PACKAGE_BUGREPORT = devel@mbuni.org +PACKAGE_NAME = mbuni +PACKAGE_STRING = mbuni cvs +PACKAGE_TARNAME = mbuni +PACKAGE_VERSION = cvs +PATH_SEPARATOR = : +PGSQL_CONFIG = /usr/local/pgsql/bin/pg_config +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/sh +STRIP = strip +VERSION = cvs +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_F77 = +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = i386-apple-darwin9.3.0 +build_alias = +build_cpu = i386 +build_os = darwin9.3.0 +build_vendor = apple +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = i386-apple-darwin9.3.0 +host_alias = +host_cpu = i386 +host_os = darwin9.3.0 +host_vendor = apple +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = /Users/bagyenda/src/mbuni/autotools/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(install_sh) -d +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = +lib_LTLIBRARIES = libmms_pgsql_queue.la +libmms_pgsql_queue_la_SOURCES = mms_pgsql_queue.c +libmms_pgsql_queue_la_LDFLAGS = -module +all: all-am -ifeq ($(ARCH),Darwin) - XLDFLAGS=-dynamiclib -Wl,-flat_namespace,-undefined,suppress -arch i386 -arch ppc - LIB_EXT=dylib - CFLAGS+=-DDARWIN=1 -arch ppc -arch i386 -else - XLDFLAGS=-shared -Wl,-undefined,suppress - LIB_EXT=so -endif +.SUFFIXES: +.SUFFIXES: .c .lo .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 extras/pgsql-queue/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu extras/pgsql-queue/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; -LIB = libmms_pgsql_queue.$(LIB_EXT) +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -ALL: $(LIB) +$(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-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done -$(LIB): mms_pgsql_queue.o - $(CC) $(XLDFLAGS) -o $@ $? -L$(MBUNIDIR)/mmlib -L`$(PGCONF) --libdir` -lpq +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done -clean: - rm -f *.o *~ -clobber: clean - rm -f $(LIB) +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libmms_pgsql_queue.la: $(libmms_pgsql_queue_la_OBJECTS) $(libmms_pgsql_queue_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libmms_pgsql_queue_la_LDFLAGS) $(libmms_pgsql_queue_la_OBJECTS) $(libmms_pgsql_queue_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/mms_pgsql_queue.Plo + +.c.o: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c $< + +.c.obj: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +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 $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; 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: + -test -z "$(CONFIG_CLEAN_FILES)" || 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-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +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 \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + 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-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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: diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index edafa71..b527864 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -1821,3 +1821,41 @@ void strip_quoted_string(Octstr *s) octstr_delete(s, octstr_len(s)-1, 1); } } + +MIMEEntity *make_multipart_formdata(void) +{ + MIMEEntity *x = mime_entity_create(); + List *rh = http_create_empty_headers(); + + http_header_add(rh, "Content-Type", "multipart/form-data"); + mime_replace_headers(x, rh); + http_destroy_headers(rh); + + return x; +} + +void add_multipart_form_field(MIMEEntity *multipart, char *field_name, char *ctype, char *content_loc, + Octstr *data) +{ + MIMEEntity *p = mime_entity_create(); + List *xh = http_create_empty_headers(); + Octstr *cd = octstr_format("form-data; name=\"%s\"", field_name); + + if (content_loc) + octstr_format_append(cd, "; filename=\"%s\"", content_loc); + + http_header_add(xh, "Content-Disposition", octstr_get_cstr(cd)); + if (ctype) /* This header must come after the above it seems. */ + http_header_add(xh, "Content-Type", ctype); + + mime_replace_headers(p, xh); + + mime_entity_set_body(p, data); + + mime_entity_add_part(multipart, p); /* add it to list so far. */ + + mime_entity_destroy(p); + http_destroy_headers(xh); + octstr_destroy(cd); + +} diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h index 4180be5..3c63250 100644 --- a/mbuni/mmlib/mms_util.h +++ b/mbuni/mmlib/mms_util.h @@ -208,9 +208,19 @@ Octstr *extract_phonenum(Octstr *num, Octstr *unified_prefix); /* strip quotes off a quoted string. */ void strip_quoted_string(Octstr *s); +/* Make a mime entity representing a multipart/form-data HTTP request. */ +MIMEEntity *make_multipart_formdata(void); + +/* Add a form field to the multipart/form-data entity. */ +void add_multipart_form_field(MIMEEntity *multipart, char *field_name, + char *ctype, char *content_loc, + Octstr *data); + /* load a shared object, then load a symbol from it. */ void *_mms_load_module(mCfgGrp *grp, char *config_key, char *symbolname, void *shell_builtin); + + #define MAXQTRIES 100 #define BACKOFF_FACTOR 5*60 /* In seconds */ #define QUEUERUN_INTERVAL 1*60 /* 1 minutes. */ diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 23d4a93..5a3aef4 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -271,18 +271,17 @@ done: ctype = octstr_format("%S; %S", c, v); else ctype = octstr_duplicate(c); - if (v) - octstr_destroy(v); + + octstr_destroy(v); http_destroy_headers(ph); - if (q) - octstr_destroy(q); + + octstr_destroy(q); } - if (c) - octstr_destroy(c); - if (cloc) - octstr_destroy(cloc); + + octstr_destroy(c); + octstr_destroy(cloc); } xh = http_create_empty_headers(); diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index ee63de2..d662d4b 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -294,7 +294,7 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func) /* finally start the thingie. */ if (m->type == CUSTOM_MMSC) { - if (m->fns->start_conn(m, qfs, &m->data) != 0) { + if (m->fns->start_conn(m, qfs, unified_prefix, strip_prefixes, &m->data) != 0) { warning(0, "MMSBox: Failed to start custom MMSC [%s]", octstr_get_cstr(m->id)); m->custom_started = 0; } else diff --git a/mbuni/mmsbox/mmsbox_mmsc.h b/mbuni/mmsbox/mmsbox_mmsc.h index 49f7f5c..3c68c36 100644 --- a/mbuni/mmsbox/mmsbox_mmsc.h +++ b/mbuni/mmsbox/mmsbox_mmsc.h @@ -20,7 +20,9 @@ typedef struct MmsBoxMmscFuncs { * and a pointer where to store module specific info. * should return 0 on success, -1 on error. */ - int (*start_conn)(struct MmscGrp *mmc, MmsQueueHandlerFuncs *qfs, void **data); + int (*start_conn)(struct MmscGrp *mmc, MmsQueueHandlerFuncs *qfs, + Octstr *unified_prefix, List *strip_prefixes, + void **data); /* stop_conn: Called to stop the MMC connection. */ int (*stop_conn)(void *data);