From 6441db396f58e65ae6240cf3a8504012b2937ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 28 Mar 2017 18:36:46 +0200 Subject: New upstream version 1.38.2 --- .travis.yml | 4 -- CMakeLists.txt | 9 ++- ChangeLog | 9 +++ INSTALL.fr | 5 ++ admin/install_opencppcoverage.ps1 | 2 +- admin/locales-update | 2 +- cmake/MSVCRuntime.cmake | 41 +++++++++++ cmake/templates/gammu-smsd.pc.cmake | 2 +- cmake/templates/gammu.spec.in | 9 ++- contrib/smsd-scripts/receive-python | 15 ++-- description-pak | 2 +- docs/man/gammu-backup.5 | 2 +- docs/man/gammu-config.1 | 2 +- docs/man/gammu-detect.1 | 2 +- docs/man/gammu-smsbackup.5 | 2 +- docs/man/gammu-smsd-dbi.7 | 2 +- docs/man/gammu-smsd-files.7 | 2 +- docs/man/gammu-smsd-inject.1 | 2 +- docs/man/gammu-smsd-monitor.1 | 2 +- docs/man/gammu-smsd-mysql.7 | 2 +- docs/man/gammu-smsd-null.7 | 2 +- docs/man/gammu-smsd-odbc.7 | 2 +- docs/man/gammu-smsd-pgsql.7 | 2 +- docs/man/gammu-smsd-run.7 | 26 ++++--- docs/man/gammu-smsd-sql.7 | 2 +- docs/man/gammu-smsd-tables.7 | 2 +- docs/man/gammu-smsd.1 | 4 +- docs/man/gammu-smsdrc.5 | 2 +- docs/man/gammu.1 | 2 +- docs/man/gammurc.5 | 2 +- docs/man/jadmaker.1 | 2 +- docs/manual/python/gammu.rst | 8 +++ docs/manual/smsd/run.rst | 7 ++ docs/manual/smsd/smsd.rst | 24 +++++++ gammu-detect/CMakeLists.txt | 1 + gammu.spec | 11 ++- libgammu/device/bluetooth/blue_osx.c | 4 +- libgammu/device/bluetooth/bluetooth.c | 4 +- libgammu/device/bluetooth/bluetooth.h | 4 +- libgammu/device/irda/irda.c | 4 +- libgammu/device/proxy/proxy.c | 4 +- libgammu/device/serial/ser_djg.c | 4 +- libgammu/device/serial/ser_unx.c | 4 +- libgammu/device/serial/ser_w32.c | 4 +- libgammu/device/usb/usb.c | 4 +- libgammu/gsmphones.c | 4 ++ libgammu/gsmstate.h | 6 +- libgammu/misc/coding/coding.c | 33 ++++++--- libgammu/phone/at/at-sms.c | 97 +++++++------------------- libgammu/phone/at/atgen.c | 52 +++++++------- libgammu/phone/at/atgen.h | 1 + libgammu/protocol/alcatel/alcabus.c | 2 +- libgammu/protocol/at/at.c | 5 +- libgammu/protocol/nokia/fbus2.c | 2 +- libgammu/protocol/nokia/mbus2.c | 2 +- libgammu/protocol/nokia/phonet.c | 2 +- libgammu/protocol/obex/obex.c | 2 +- libgammu/protocol/s60/s60.c | 2 +- libgammu/protocol/symbian/gnapbus.c | 2 +- libgammu/service/sms/gsmmulti.c | 124 ++++++++++++++++++++++++++++------ libgammu/service/sms/gsmsms.c | 31 ++++++--- locale/af/docs.po | 2 +- locale/ar/docs.po | 2 +- locale/bg/docs.po | 2 +- locale/bn/docs.po | 2 +- locale/ca/docs.po | 2 +- locale/cs/docs.po | 2 +- locale/cs/gammu.po | 2 +- locale/cs/libgammu.po | 2 +- locale/da/docs.po | 2 +- locale/de/docs.po | 2 +- locale/de/gammu.po | 2 +- locale/de/libgammu.po | 2 +- locale/el/docs.po | 2 +- locale/en_GB/docs.po | 2 +- locale/es/docs.po | 2 +- locale/et/docs.po | 2 +- locale/fi/docs.po | 2 +- locale/fr/docs.po | 33 ++++++--- locale/gammu.pot | 4 +- locale/gl/docs.po | 2 +- locale/he/docs.po | 2 +- locale/hu/docs.po | 2 +- locale/id/docs.po | 2 +- locale/id/gammu.po | 14 ++-- locale/id/libgammu.po | 2 +- locale/it/docs.po | 2 +- locale/it/gammu.po | 2 +- locale/it/libgammu.po | 2 +- locale/ko/docs.po | 2 +- locale/libgammu.pot | 4 +- locale/nl/docs.po | 2 +- locale/pl/docs.po | 2 +- locale/pl/gammu.po | 2 +- locale/pl/libgammu.po | 2 +- locale/pt_BR/docs.po | 2 +- locale/ro/docs.po | 2 +- locale/ru/docs.po | 2 +- locale/ru/gammu.po | 2 +- locale/ru/libgammu.po | 2 +- locale/sk/docs.po | 2 +- locale/sv/docs.po | 2 +- locale/sw/docs.po | 2 +- locale/tr/docs.po | 42 +++++------- locale/uk/docs.po | 2 +- locale/uk/libgammu.po | 32 +++------ locale/zh_CN/docs.po | 2 +- locale/zh_TW/docs.po | 2 +- smsd/core.c | 20 +++++- smsd/monitor.c | 2 +- smsd/services/pgsql.c | 29 ++++---- tests/CMakeLists.txt | 12 ++-- tests/debug.c | 9 +-- tests/smsbackups/mms-298.smsbackup | 24 +++++++ tests/utf-8.c | 14 +++- 115 files changed, 577 insertions(+), 364 deletions(-) create mode 100644 INSTALL.fr create mode 100644 cmake/MSVCRuntime.cmake create mode 100644 tests/smsbackups/mms-298.smsbackup diff --git a/.travis.yml b/.travis.yml index 7cbe12e..a9e66f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,10 +29,6 @@ script: after_success: - make gcov - bash <(curl -s https://codecov.io/bash) -X gcov -F $TRAVIS_OS_NAME -# trigger Buildtime Trend Service to parse Travis CI log -notifications: - webhooks: - - https://buildtimetrend.herokuapp.com/travis # use docker based faster build sudo: false # install build dependencies and enable Coverity scan diff --git a/CMakeLists.txt b/CMakeLists.txt index 40e0fff..d3f113d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ if (LARGE_FILES) endif (LARGE_FILES) # Set version -set (GAMMU_VERSION "1.38.1" CACHE INTERNAL "") +set (GAMMU_VERSION "1.38.2" CACHE INTERNAL "") string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\1" "GAMMU_VERSION_MAJOR" "${GAMMU_VERSION}") string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\2" "GAMMU_VERSION_MINOR" "${GAMMU_VERSION}") string (REGEX REPLACE "^([0-9]*)\\.([0-9]*)\\.([0-9]*)$" "\\3" "GAMMU_VERSION_PATCH" "${GAMMU_VERSION}") @@ -65,6 +65,7 @@ include (MacroOptionalFindPackage) include (MacroAddDLL) include (MacroGammuOption) include (MacroTuneCompiler) +include (MSVCRuntime) # WE use pkgconfig later find_package (PkgConfig) @@ -428,6 +429,12 @@ if(MSVC) # Generate PDB data even for release build set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") + set(MATH_LIBS "") + + # Call cmake with "-DMSVC_RUNTIME=static" to link with static runtime libraries + configure_msvc_runtime() +else(MSVC) + set(MATH_LIBS "-lm") endif(MSVC) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_MINGW OR diff --git a/ChangeLog b/ChangeLog index 657137e..bff1050 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,15 @@ the issue. ChangeLog ========= +20170328 - 1.38.2 + +[-] * Improved support for Huawei K3765, E150 and E372. +[-] * Fixed decoding of unicode surrogates at message boundary. +[+] * Environment variable PHONE_ID for external program. +[-] * SMS compatibility with devices following old version of GSM 03.38. +[-] * Unicode is now preferred when handling USSD. +[+] * Improved decoding of MMS indication SMS. + 20170105 - 1.38.1 [-] * Fixed sending SMS to numbers starting with 000. diff --git a/INSTALL.fr b/INSTALL.fr new file mode 100644 index 0000000..be4e4c1 --- /dev/null +++ b/INSTALL.fr @@ -0,0 +1,5 @@ +Gammu All Mobile Management Utilities - Installation +==================================================== + +Voir docs/manual/project/install.rst pour le guide d'installation ou le +chapitre "Compiling Gammu" dans le manuel de Gammu. diff --git a/admin/install_opencppcoverage.ps1 b/admin/install_opencppcoverage.ps1 index 431cd02..d364b29 100644 --- a/admin/install_opencppcoverage.ps1 +++ b/admin/install_opencppcoverage.ps1 @@ -1,6 +1,6 @@ #todo: convert this into a chocolatey package... -$downloadUrl = "http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=opencppcoverage&DownloadId=1594912&FileTime=131138681432830000&Build=21031" +$downloadUrl = "https://dl.cihar.com/ci/OpenCppCoverageSetup-x64-0.9.5.3.exe" $installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe") $installPath = [System.IO.Path]::Combine(${Env:ProgramFiles}, "OpenCppCoverage") diff --git a/admin/locales-update b/admin/locales-update index bbd550f..4cc8707 100755 --- a/admin/locales-update +++ b/admin/locales-update @@ -34,7 +34,7 @@ xgettext \ --package-version $ver \ `find libgammu -name '*.c' -o -name '*.h' | sort` -if [ "x$1" = "x--po4a" ] ; then +if [ "x$1" != "x--no-po4a" ] ; then ./admin/po4a-docs fi diff --git a/cmake/MSVCRuntime.cmake b/cmake/MSVCRuntime.cmake new file mode 100644 index 0000000..099f600 --- /dev/null +++ b/cmake/MSVCRuntime.cmake @@ -0,0 +1,41 @@ +macro(configure_msvc_runtime) + if(MSVC) + # Default to statically-linked runtime. + if("${MSVC_RUNTIME}" STREQUAL "") + set(MSVC_RUNTIME "dynamic") + endif() + + # Set compiler options. + set(variables + CMAKE_C_FLAGS + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_MINSIZEREL + CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_MINSIZEREL + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO) + + if(${MSVC_RUNTIME} STREQUAL "static") + message(STATUS "MSVC: using statically-linked runtime (/MT and /MTd).") + foreach(variable ${variables}) + if(${variable} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}") + endif() + endforeach() + else() + message(STATUS "MSVC: using dynamically-linked runtime (/MD and /MDd).") + foreach(variable ${variables}) + if(${variable} MATCHES "/MT") + string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}") + endif() + endforeach() + endif() + + foreach(variable ${variables}) + set(${variable} "${${variable}}" CACHE STRING "MSVC_${variable}" FORCE) + endforeach() + endif() +endmacro(configure_msvc_runtime) \ No newline at end of file diff --git a/cmake/templates/gammu-smsd.pc.cmake b/cmake/templates/gammu-smsd.pc.cmake index 7db7f2a..f961f60 100644 --- a/cmake/templates/gammu-smsd.pc.cmake +++ b/cmake/templates/gammu-smsd.pc.cmake @@ -7,5 +7,5 @@ Name: gammu-smsd Description: Gammu SMSD library Requires: gammu Version: @GAMMU_VERSION@ -Libs: -L${libdir} -lgsmsd -lm @SMSD_PRIVATE_LIBS@ +Libs: -L${libdir} -lgsmsd @MATH_LIBS@ @SMSD_PRIVATE_LIBS@ Cflags: -I${includedir} diff --git a/cmake/templates/gammu.spec.in b/cmake/templates/gammu.spec.in index be209b9..25c08b3 100644 --- a/cmake/templates/gammu.spec.in +++ b/cmake/templates/gammu.spec.in @@ -5,8 +5,8 @@ %define so_ver @GAMMU_SOVERSION@ -# Change if using tar.gz sources -%define extension bz2 +# Change if using tar.gz or tar.bz2 sources +%define extension xz Name: gammu Version: @GAMMU_VERSION@ @@ -92,7 +92,7 @@ Source0: https://dl.cihar.com/gammu/releases/%{name}-%{version}.tar.%{ext %endif %endif %endif -BuildRequires: cmake >= 2.8 +BuildRequires: cmake >= 3.0 BuildRequires: gcc BuildRequires: gettext BuildRequires: pkgconfig @@ -279,8 +279,7 @@ cmake ../ \ -DINSTALL_LSB_INIT=ON \ -DINSTALL_UDEV_RULES=ON \ -DSYSTEMD_FOUND=ON \ - -DWITH_SYSTEMD=ON \ - -DSYSTEMD_SERVICES_INSTALL_DIR=%{_libexecdir}/systemd/system + -DWITH_SYSTEMD=ON make %{?_smp_mflags} VERBOSE=1 %check diff --git a/contrib/smsd-scripts/receive-python b/contrib/smsd-scripts/receive-python index 84b104d..e9bfc58 100755 --- a/contrib/smsd-scripts/receive-python +++ b/contrib/smsd-scripts/receive-python @@ -5,17 +5,16 @@ import sys numparts = int(os.environ['DECODED_PARTS']) +text = '' # Are there any decoded parts? if numparts == 0: - print('No decoded parts!') - sys.exit(1) - + text = os.environ['SMS_1_TEXT'] # Get all text parts -text = '' -for i in range(1, numparts + 1): - varname = 'DECODED_%d_TEXT' % i - if varname in os.environ: - text = text + os.environ[varname] +else: + for i in range(0, numparts): + varname = 'DECODED_%d_TEXT' % i + if varname in os.environ: + text = text + os.environ[varname] # Do something with the text print('Number %s have sent text: %s' % (os.environ['SMS_1_NUMBER'], text)) diff --git a/description-pak b/description-pak index 5e8df7b..f70f32c 100644 --- a/description-pak +++ b/description-pak @@ -1,4 +1,4 @@ -Gammu (Gammu All Mobile Management Utilities) 1.38.1 +Gammu (Gammu All Mobile Management Utilities) 1.38.2 Gammu is a command line utility and library to work with mobile phones from many vendors. Support for different models differs, but basic diff --git a/docs/man/gammu-backup.5 b/docs/man/gammu-backup.5 index aea85ba..7748251 100644 --- a/docs/man/gammu-backup.5 +++ b/docs/man/gammu-backup.5 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-BACKUP" "5" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-BACKUP" "5" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-backup \- gammu(1) backup file format. . diff --git a/docs/man/gammu-config.1 b/docs/man/gammu-config.1 index 5320b7b..f0fc5f3 100644 --- a/docs/man/gammu-config.1 +++ b/docs/man/gammu-config.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-CONFIG" "1" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-CONFIG" "1" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-config \- Gammu configurator . diff --git a/docs/man/gammu-detect.1 b/docs/man/gammu-detect.1 index 120fc87..20580cb 100644 --- a/docs/man/gammu-detect.1 +++ b/docs/man/gammu-detect.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-DETECT" "1" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-DETECT" "1" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-detect \- Gammu device detection . diff --git a/docs/man/gammu-smsbackup.5 b/docs/man/gammu-smsbackup.5 index fa41840..b132f00 100644 --- a/docs/man/gammu-smsbackup.5 +++ b/docs/man/gammu-smsbackup.5 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSBACKUP" "5" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSBACKUP" "5" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsbackup \- gammu(1) SMS backup file format. . diff --git a/docs/man/gammu-smsd-dbi.7 b/docs/man/gammu-smsd-dbi.7 index f6850c9..3d64941 100644 --- a/docs/man/gammu-smsd-dbi.7 +++ b/docs/man/gammu-smsd-dbi.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-DBI" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-DBI" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-dbi \- gammu-smsd(1) backend using DBI abstraction layer to use any supported database as a message storage . diff --git a/docs/man/gammu-smsd-files.7 b/docs/man/gammu-smsd-files.7 index 44a191b..c50b5bc 100644 --- a/docs/man/gammu-smsd-files.7 +++ b/docs/man/gammu-smsd-files.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-FILES" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-FILES" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-files \- gammu-smsd(1) backend using filesystem as a message storage . diff --git a/docs/man/gammu-smsd-inject.1 b/docs/man/gammu-smsd-inject.1 index be79318..ab342c3 100644 --- a/docs/man/gammu-smsd-inject.1 +++ b/docs/man/gammu-smsd-inject.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-INJECT" "1" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-INJECT" "1" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-inject \- Inject messages into queue of SMS daemon for Gammu . diff --git a/docs/man/gammu-smsd-monitor.1 b/docs/man/gammu-smsd-monitor.1 index 4866217..a2b0746 100644 --- a/docs/man/gammu-smsd-monitor.1 +++ b/docs/man/gammu-smsd-monitor.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-MONITOR" "1" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-MONITOR" "1" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-monitor \- Monitor state of SMS daemon for Gammu . diff --git a/docs/man/gammu-smsd-mysql.7 b/docs/man/gammu-smsd-mysql.7 index 5235809..6e10cb0 100644 --- a/docs/man/gammu-smsd-mysql.7 +++ b/docs/man/gammu-smsd-mysql.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-MYSQL" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-MYSQL" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-mysql \- gammu-smsd(1) backend using MySQL database server as a message storage . diff --git a/docs/man/gammu-smsd-null.7 b/docs/man/gammu-smsd-null.7 index 0923396..399058c 100644 --- a/docs/man/gammu-smsd-null.7 +++ b/docs/man/gammu-smsd-null.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-NULL" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-NULL" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-null \- gammu-smsd(1) backend not storing messages . diff --git a/docs/man/gammu-smsd-odbc.7 b/docs/man/gammu-smsd-odbc.7 index 77a90ce..baf8c88 100644 --- a/docs/man/gammu-smsd-odbc.7 +++ b/docs/man/gammu-smsd-odbc.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-ODBC" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-ODBC" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-odbc \- gammu-smsd(1) backend using ODBC abstraction layer to use any supported database as a message storage . diff --git a/docs/man/gammu-smsd-pgsql.7 b/docs/man/gammu-smsd-pgsql.7 index 09c2284..03c50ab 100644 --- a/docs/man/gammu-smsd-pgsql.7 +++ b/docs/man/gammu-smsd-pgsql.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-PGSQL" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-PGSQL" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-pgsql \- gammu-smsd(1) backend using PostgreSQL database server as a message storage . diff --git a/docs/man/gammu-smsd-run.7 b/docs/man/gammu-smsd-run.7 index 3195a6c..920e81d 100644 --- a/docs/man/gammu-smsd-run.7 +++ b/docs/man/gammu-smsd-run.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-RUN" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-RUN" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-run \- documentation for RunOnReceive directive . @@ -75,6 +75,15 @@ Number of physical messages received. .B DECODED_PARTS Number of decoded message parts. .UNINDENT +.INDENT 0.0 +.TP +.B PHONE_ID +New in version 1.38.2. + +.sp +Value of \fBPhoneID\fP\&. Useful when running multiple instances +(see smsd\-multi). +.UNINDENT .SS Per message variables .sp The variables further described as \fBSMS_1_...\fP are generated for each physical @@ -249,17 +258,16 @@ import sys numparts = int(os.environ[\(aqDECODED_PARTS\(aq]) +text = \(aq\(aq # Are there any decoded parts? if numparts == 0: - print(\(aqNo decoded parts!\(aq) - sys.exit(1) - + text = os.environ[\(aqSMS_1_TEXT\(aq] # Get all text parts -text = \(aq\(aq -for i in range(1, numparts + 1): - varname = \(aqDECODED_%d_TEXT\(aq % i - if varname in os.environ: - text = text + os.environ[varname] +else: + for i in range(0, numparts): + varname = \(aqDECODED_%d_TEXT\(aq % i + if varname in os.environ: + text = text + os.environ[varname] # Do something with the text print(\(aqNumber %s have sent text: %s\(aq % (os.environ[\(aqSMS_1_NUMBER\(aq], text)) diff --git a/docs/man/gammu-smsd-sql.7 b/docs/man/gammu-smsd-sql.7 index d1dfab8..27123cb 100644 --- a/docs/man/gammu-smsd-sql.7 +++ b/docs/man/gammu-smsd-sql.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-SQL" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-SQL" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-sql \- gammu-smsd(1) backend using SQL abstraction layer to use any supported database as a message storage . diff --git a/docs/man/gammu-smsd-tables.7 b/docs/man/gammu-smsd-tables.7 index 96d2194..ae6bfe1 100644 --- a/docs/man/gammu-smsd-tables.7 +++ b/docs/man/gammu-smsd-tables.7 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD-TABLES" "7" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD-TABLES" "7" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd-tables \- description of tables for database backends of gammu-smsd(1) . diff --git a/docs/man/gammu-smsd.1 b/docs/man/gammu-smsd.1 index d6b03e5..19d7452 100644 --- a/docs/man/gammu-smsd.1 +++ b/docs/man/gammu-smsd.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSD" "1" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSD" "1" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsd \- SMS daemon for Gammu . @@ -311,6 +311,8 @@ fi .fi .UNINDENT .UNINDENT +.sp +Or even create a \fIgammu\-safe\fP script: .SH KNOWN LIMITATIONS .sp You can not use same phone by more programs in same time. However in case you diff --git a/docs/man/gammu-smsdrc.5 b/docs/man/gammu-smsdrc.5 index 8c7addb..06671ab 100644 --- a/docs/man/gammu-smsdrc.5 +++ b/docs/man/gammu-smsdrc.5 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU-SMSDRC" "5" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU-SMSDRC" "5" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu-smsdrc \- gammu-smsd(1) configuration file . diff --git a/docs/man/gammu.1 b/docs/man/gammu.1 index 9ca6c71..f82625a 100644 --- a/docs/man/gammu.1 +++ b/docs/man/gammu.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMU" "1" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMU" "1" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammu \- Does some neat things with your cellular phone or modem. . diff --git a/docs/man/gammurc.5 b/docs/man/gammurc.5 index 0f16a02..adcbfc6 100644 --- a/docs/man/gammurc.5 +++ b/docs/man/gammurc.5 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GAMMURC" "5" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "GAMMURC" "5" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME gammurc \- gammu(1) configuration file . diff --git a/docs/man/jadmaker.1 b/docs/man/jadmaker.1 index ce5c397..2b195f1 100644 --- a/docs/man/jadmaker.1 +++ b/docs/man/jadmaker.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "JADMAKER" "1" "Jan 05, 2017" "1.38.1" "Gammu" +.TH "JADMAKER" "1" "Mar 28, 2017" "1.38.2" "Gammu" .SH NAME jadmaker \- JAD File Generator . diff --git a/docs/manual/python/gammu.rst b/docs/manual/python/gammu.rst index e23ea1f..9a8dfde 100644 --- a/docs/manual/python/gammu.rst +++ b/docs/manual/python/gammu.rst @@ -1198,6 +1198,14 @@ Message processing :return: Message data, see :ref:`sms_obj` :rtype: dict + **Example:** + + .. code-block:: python + + gammu.DecodePDU( + '0681678968986811000a8152564557550010ff0d3bf67aed5ebbddeb1d7bed06'.decode('hex') + ) + .. function:: EncodePDU(SMS, Layout = Submit) Creates PDU packet. diff --git a/docs/manual/smsd/run.rst b/docs/manual/smsd/run.rst index 0cf2e82..1624334 100644 --- a/docs/manual/smsd/run.rst +++ b/docs/manual/smsd/run.rst @@ -48,6 +48,13 @@ Global variables Number of decoded message parts. +.. envvar:: PHONE_ID + + .. versionadded:: 1.38.2 + + Value of :config:option:`PhoneID`. Useful when running multiple instances + (see :ref:`smsd-multi`). + Per message variables +++++++++++++++++++++ diff --git a/docs/manual/smsd/smsd.rst b/docs/manual/smsd/smsd.rst index 78ecc2b..6314add 100644 --- a/docs/manual/smsd/smsd.rst +++ b/docs/manual/smsd/smsd.rst @@ -232,6 +232,30 @@ workaround this limitation by suspending SMSD temporarily using `SIGUSR1` and kill -SIGUSR2 $SMSD_PID fi +Or even create a `gammu-safe` script: + +.. code-block:: sh + #!/bin/bash + SMSD_PID=`pidof gammu-smsd` + if [ -z "$SMSD_PID" ] ; then + gammu $@ + else + tty=$(lsof |grep -E "gammu-sms\s+$SMSD_PID\s+.*/dev/tty*"|awk {'print $NF'}) + kill -SIGUSR1 $SMSD_PID + while test "$(fuser $ttyfuser $tty 2> /dev/null|xargs)" = $SMSD_PID + do + sleep 1 + done + sleep 1 + gammu $@ + kill -SIGUSR2 $SMSD_PID + while test "$(fuser $ttyfuser $tty 2> /dev/null|xargs)" != $SMSD_PID + do + sleep 1 + done + sleep 1 + fi + Known Limitations ----------------- diff --git a/gammu-detect/CMakeLists.txt b/gammu-detect/CMakeLists.txt index 5724382..32a0f6a 100644 --- a/gammu-detect/CMakeLists.txt +++ b/gammu-detect/CMakeLists.txt @@ -45,6 +45,7 @@ if (Glib_FOUND AND GObject_FOUND) ) add_test(gammu-detect-help "${CMAKE_CURRENT_BINARY_DIR}/gammu-detect${CMAKE_EXECUTABLE_SUFFIX}" --help) + add_test(gammu-detect-version "${CMAKE_CURRENT_BINARY_DIR}/gammu-detect${CMAKE_EXECUTABLE_SUFFIX}" --version) endif (Glib_FOUND AND GObject_FOUND) diff --git a/gammu.spec b/gammu.spec index 7b842c4..de04be6 100644 --- a/gammu.spec +++ b/gammu.spec @@ -5,11 +5,11 @@ %define so_ver 8 -# Change if using tar.gz sources -%define extension bz2 +# Change if using tar.gz or tar.bz2 sources +%define extension xz Name: gammu -Version: 1.38.1 +Version: 1.38.2 Release: 0 Summary: Mobile phone management utility License: GPL-2.0 @@ -92,7 +92,7 @@ Source0: https://dl.cihar.com/gammu/releases/%{name}-%{version}.tar.%{ext %endif %endif %endif -BuildRequires: cmake >= 2.8 +BuildRequires: cmake >= 3.0 BuildRequires: gcc BuildRequires: gettext BuildRequires: pkgconfig @@ -279,8 +279,7 @@ cmake ../ \ -DINSTALL_LSB_INIT=ON \ -DINSTALL_UDEV_RULES=ON \ -DSYSTEMD_FOUND=ON \ - -DWITH_SYSTEMD=ON \ - -DSYSTEMD_SERVICES_INSTALL_DIR=%{_libexecdir}/systemd/system + -DWITH_SYSTEMD=ON make %{?_smp_mflags} VERBOSE=1 %check diff --git a/libgammu/device/bluetooth/blue_osx.c b/libgammu/device/bluetooth/blue_osx.c index 5adf52c..a0e09f8 100644 --- a/libgammu/device/bluetooth/blue_osx.c +++ b/libgammu/device/bluetooth/blue_osx.c @@ -175,7 +175,7 @@ GSM_Error bluetooth_close(GSM_StateMachine *s) return ERR_NONE; } -int bluetooth_write(GSM_StateMachine *s, const void *buf, size_t nbytes) +ssize_t bluetooth_write(GSM_StateMachine *s, const void *buf, size_t nbytes) { GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; threadContext *pContext = (threadContext *)d->Data; @@ -191,7 +191,7 @@ int bluetooth_write(GSM_StateMachine *s, const void *buf, size_t nbytes) return nbytes; } -int bluetooth_read(GSM_StateMachine *s, void *buffer, size_t size) +ssize_t bluetooth_read(GSM_StateMachine *s, void *buffer, size_t size) { GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; threadContext *pContext = (threadContext *)d->Data; diff --git a/libgammu/device/bluetooth/bluetooth.c b/libgammu/device/bluetooth/bluetooth.c index 8cbb384..ba390f9 100644 --- a/libgammu/device/bluetooth/bluetooth.c +++ b/libgammu/device/bluetooth/bluetooth.c @@ -129,12 +129,12 @@ done: } #ifndef OSX_BLUE_FOUND -int bluetooth_read(GSM_StateMachine *s, void *buf, size_t nbytes) +ssize_t bluetooth_read(GSM_StateMachine *s, void *buf, size_t nbytes) { return socket_read(s, buf, nbytes, s->Device.Data.BlueTooth.hPhone); } -int bluetooth_write(GSM_StateMachine *s, const void *buf, size_t nbytes) +ssize_t bluetooth_write(GSM_StateMachine *s, const void *buf, size_t nbytes) { return socket_write(s, buf, nbytes, s->Device.Data.BlueTooth.hPhone); } diff --git a/libgammu/device/bluetooth/bluetooth.h b/libgammu/device/bluetooth/bluetooth.h index 13e8f03..aedeeb9 100644 --- a/libgammu/device/bluetooth/bluetooth.h +++ b/libgammu/device/bluetooth/bluetooth.h @@ -11,8 +11,8 @@ typedef struct { /* These are actually implemented in backend services */ GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device); GSM_Error bluetooth_findchannel(GSM_StateMachine *s); -int bluetooth_read(GSM_StateMachine *s, void *buf, size_t nbytes); -int bluetooth_write(GSM_StateMachine *s, const void *buf, size_t nbytes); +ssize_t bluetooth_read(GSM_StateMachine *s, void *buf, size_t nbytes); +ssize_t bluetooth_write(GSM_StateMachine *s, const void *buf, size_t nbytes); GSM_Error bluetooth_close(GSM_StateMachine *s); #endif diff --git a/libgammu/device/irda/irda.c b/libgammu/device/irda/irda.c index 0aa5077..aaad998 100644 --- a/libgammu/device/irda/irda.c +++ b/libgammu/device/irda/irda.c @@ -215,12 +215,12 @@ static GSM_Error irda_open (GSM_StateMachine *s) return ERR_NONE; } -static int irda_read(GSM_StateMachine *s, void *buf, size_t nbytes) +static ssize_t irda_read(GSM_StateMachine *s, void *buf, size_t nbytes) { return socket_read(s, buf, nbytes, s->Device.Data.Irda.hPhone); } -static int irda_write(GSM_StateMachine *s, const void *buf, size_t nbytes) +static ssize_t irda_write(GSM_StateMachine *s, const void *buf, size_t nbytes) { return socket_write(s, buf, nbytes, s->Device.Data.Irda.hPhone); } diff --git a/libgammu/device/proxy/proxy.c b/libgammu/device/proxy/proxy.c index db4a496..6dc91e6 100644 --- a/libgammu/device/proxy/proxy.c +++ b/libgammu/device/proxy/proxy.c @@ -132,7 +132,7 @@ GSM_Error proxy_open(GSM_StateMachine *s) return proxy_connect(s, &s->Device.Data.Proxy, s->CurrentConfig->Device); } -int proxy_read(GSM_StateMachine *s, void *buf, size_t nbytes) +ssize_t proxy_read(GSM_StateMachine *s, void *buf, size_t nbytes) { GSM_Device_ProxyData *d = &s->Device.Data.Proxy; struct timeval timeout2; @@ -172,7 +172,7 @@ ssize_t write_nosigpipe(int fd, const void *buf, size_t len) return result; } -int proxy_write(GSM_StateMachine *s, const void *buf, size_t nbytes) +ssize_t proxy_write(GSM_StateMachine *s, const void *buf, size_t nbytes) { GSM_Device_ProxyData *d = &s->Device.Data.Proxy; int ret; diff --git a/libgammu/device/serial/ser_djg.c b/libgammu/device/serial/ser_djg.c index 1ac69f4..da0f765 100644 --- a/libgammu/device/serial/ser_djg.c +++ b/libgammu/device/serial/ser_djg.c @@ -401,7 +401,7 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) return ERR_NONE; } -static int serial_read(GSM_StateMachine *s, char *buf, size_t nbytes) +static ssize_t serial_read(GSM_StateMachine *s, char *buf, size_t nbytes) { if(RecTail == RecHead) return 0; @@ -413,7 +413,7 @@ static int serial_read(GSM_StateMachine *s, char *buf, size_t nbytes) return 1; } -static int serial_write(GSM_StateMachine *s, char *buf, size_t nbytes) +static ssize_t serial_write(GSM_StateMachine *s, char *buf, size_t nbytes) { int i; diff --git a/libgammu/device/serial/ser_unx.c b/libgammu/device/serial/ser_unx.c index 845e5b1..c0fbd57 100644 --- a/libgammu/device/serial/ser_unx.c +++ b/libgammu/device/serial/ser_unx.c @@ -377,7 +377,7 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) return ERR_NONE; } -static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) +static ssize_t serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) { GSM_Device_SerialData *d = &s->Device.Data.Serial; struct timeval timeout2; @@ -399,7 +399,7 @@ static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) return actual; } -static int serial_write(GSM_StateMachine *s, const void *buf, size_t nbytes) +static ssize_t serial_write(GSM_StateMachine *s, const void *buf, size_t nbytes) { GSM_Device_SerialData *d = &s->Device.Data.Serial; int ret; diff --git a/libgammu/device/serial/ser_w32.c b/libgammu/device/serial/ser_w32.c index e177815..af8608f 100644 --- a/libgammu/device/serial/ser_w32.c +++ b/libgammu/device/serial/ser_w32.c @@ -372,7 +372,7 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) return ERR_NONE; } -static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) +static ssize_t serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) { COMSTAT ComStat; DWORD ErrorFlags, Length, Error; @@ -428,7 +428,7 @@ end: return Length; } -static int serial_write(GSM_StateMachine *s, const void *buf, size_t nbytes) +static ssize_t serial_write(GSM_StateMachine *s, const void *buf, size_t nbytes) { DWORD BytesWritten,ErrorFlags,BytesSent=0; COMSTAT ComStat; diff --git a/libgammu/device/usb/usb.c b/libgammu/device/usb/usb.c index c58d3c9..aa839b5 100644 --- a/libgammu/device/usb/usb.c +++ b/libgammu/device/usb/usb.c @@ -465,7 +465,7 @@ GSM_Error GSM_USB_Terminate(GSM_StateMachine *s) return ERR_NONE; } -int GSM_USB_Read(GSM_StateMachine *s, void *buf, size_t nbytes) +ssize_t GSM_USB_Read(GSM_StateMachine *s, void *buf, size_t nbytes) { GSM_Device_USBData *d = &s->Device.Data.USB; int rc = LIBUSB_ERROR_TIMEOUT, ret = 0, repeat = 0; @@ -496,7 +496,7 @@ int GSM_USB_Read(GSM_StateMachine *s, void *buf, size_t nbytes) return ret; } -int GSM_USB_Write(GSM_StateMachine *s, const void *buf, size_t nbytes) +ssize_t GSM_USB_Write(GSM_StateMachine *s, const void *buf, size_t nbytes) { GSM_Device_USBData *d = &s->Device.Data.USB; int rc = LIBUSB_ERROR_TIMEOUT, ret = 0, repeat = 0; diff --git a/libgammu/gsmphones.c b/libgammu/gsmphones.c index cf7bea0..9893b94 100644 --- a/libgammu/gsmphones.c +++ b/libgammu/gsmphones.c @@ -943,6 +943,7 @@ GSM_PhoneModel allmodels[] = { /* Huawei */ {"E17X", "E17X", "", {F_NO_UCS2, 0}}, {"E220", "E220", "", {0}}, + {"E150", "E150", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"E160", "E160", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"E160E", "E160E", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"E160X", "E160X", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, @@ -964,8 +965,10 @@ GSM_PhoneModel allmodels[] = { {"EM770W", "EM770W", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"E3372", "E3372", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"E3276", "E3276", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, + {"E372", "E372", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"E398", "E398", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"E3131", "E3131", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, + {"K3715", "K3715", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"K3765", "K3765", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"K3770", "K3770", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, {"K4505", "K4505", "", {F_SMS_LOCATION_0, F_ENCODED_USSD, F_FOUR_DIGIT_YEAR, F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, 0}}, @@ -973,6 +976,7 @@ GSM_PhoneModel allmodels[] = { /* ZTE */ {"MF100", "MF100", "", {F_ZTE_INIT, 0}}, + {"MF112", "MF112", "", {F_ZTE_INIT, 0}}, {"MF190", "MF190", "", {F_ZTE_INIT, 0}}, /* Ubinetics */ diff --git a/libgammu/gsmstate.h b/libgammu/gsmstate.h index 2ca0b21..61eb64e 100644 --- a/libgammu/gsmstate.h +++ b/libgammu/gsmstate.h @@ -249,11 +249,11 @@ typedef struct { /** * Attempts to read nbytes from device. */ - int (*ReadDevice) (GSM_StateMachine *s, void *buf, size_t nbytes); + ssize_t (*ReadDevice) (GSM_StateMachine *s, void *buf, size_t nbytes); /** * Attempts to read nbytes from device. */ - int (*WriteDevice) (GSM_StateMachine *s, const void *buf, size_t nbytes); + ssize_t (*WriteDevice) (GSM_StateMachine *s, const void *buf, size_t nbytes); } GSM_Device_Functions; #ifdef GSM_ENABLE_SERIALDEVICE @@ -345,7 +345,7 @@ typedef struct { * Writes message to device. */ GSM_Error (*WriteMessage) (GSM_StateMachine *s, unsigned const char *buffer, - int length, int type); + size_t length, int type); /** * This one is called when character is received from device. */ diff --git a/libgammu/misc/coding/coding.c b/libgammu/misc/coding/coding.c index aa033a0..7785ccd 100644 --- a/libgammu/misc/coding/coding.c +++ b/libgammu/misc/coding/coding.c @@ -235,8 +235,11 @@ void DecodeUnicode (const unsigned char *src, char *dest) if (value >= 0xD800 && value <= 0xDBFF) { second = src[(i + 1) * 2] * 256 + src[(i + 1) * 2 + 1]; if (second >= 0xDC00 && second <= 0xDFFF) { - i++; value = ((value - 0xD800) << 10) + (second - 0xDC00) + 0x010000; + i++; + } else if (second == 0) { + /* Surrogate at the end of string */ + value = 0xFFFD; /* REPLACEMENT CHARACTER */ } } o += DecodeWithUnicodeAlphabet(value, dest + o); @@ -1839,10 +1842,15 @@ gboolean EncodeUTF8QuotedPrintable(char *dest, const unsigned char *src) for (i = 0; i < len; i++) { value = src[i * 2] * 256 + src[i * 2 + 1]; /* Decode UTF-16 */ - if (value >= 0xD800 && value <= 0xDBFF && (i + 1) < len) { - second = src[(i + 1) * 2] * 256 + src[(i + 1) * 2 + 1]; - if (second >= 0xDC00 && second <= 0xDFFF) { - value = ((value - 0xD800) << 10) + (second - 0xDC00) + 0x010000; + if (value >= 0xD800 && value <= 0xDBFF) { + if ((i + 1) < len) { + second = src[(i + 1) * 2] * 256 + src[(i + 1) * 2 + 1]; + if (second >= 0xDC00 && second <= 0xDFFF) { + value = ((value - 0xD800) << 10) + (second - 0xDC00) + 0x010000; + } + } else { + /* Surrogate at the end of string */ + value = 0xFFFD; /* REPLACEMENT CHARACTER */ } } z = EncodeWithUTF8Alphabet(value, mychar); @@ -1880,11 +1888,16 @@ gboolean EncodeUTF8(char *dest, const unsigned char *src) for (i = 0; i < len; i++) { value = src[i * 2] * 256 + src[i * 2 + 1]; /* Decode UTF-16 */ - if (value >= 0xD800 && value <= 0xDBFF && (i + 1) < len) { - second = src[(i + 1) * 2] * 256 + src[(i + 1) * 2 + 1]; - if (second >= 0xDC00 && second <= 0xDFFF) { - i++; - value = ((value - 0xD800) << 10) + (second - 0xDC00) + 0x010000; + if (value >= 0xD800 && value <= 0xDBFF ) { + if ((i + 1) < len) { + second = src[(i + 1) * 2] * 256 + src[(i + 1) * 2 + 1]; + if (second >= 0xDC00 && second <= 0xDFFF) { + i++; + value = ((value - 0xD800) << 10) + (second - 0xDC00) + 0x010000; + } + } else { + /* Surrogate at the end of string */ + value = 0xFFFD; /* REPLACEMENT CHARACTER */ } } z = EncodeWithUTF8Alphabet(value, mychar); diff --git a/libgammu/phone/at/at-sms.c b/libgammu/phone/at/at-sms.c index 0cd0d65..aac34bb 100644 --- a/libgammu/phone/at/at-sms.c +++ b/libgammu/phone/at/at-sms.c @@ -2626,13 +2626,12 @@ GSM_Error ATGEN_GetCNMIMode(GSM_StateMachine *s) return error; } -GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, gboolean enable) +GSM_Error ATGEN_SetCNMI(GSM_StateMachine *s) { -#ifdef GSM_ENABLE_CELLBROADCAST - GSM_Error error = ERR_NONE; - GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; char buffer[100]; int length = 0; + GSM_Error error; + GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; if (Priv->CNMIMode == -1) { error = ATGEN_GetCNMIMode(s); @@ -2648,18 +2647,30 @@ GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, gboolean enable) if (Priv->CNMIBroadcastProcedure == 0) { return ERR_NOTSUPPORTED; } + + length = sprintf( + buffer, + "AT+CNMI=%d,%d,%d,%d\r", + Priv->CNMIMode, + s->Phone.Data.EnableIncomingSMS ? Priv->CNMIProcedure : 0, +#ifdef GSM_ENABLE_CELLBROADCAST + s->Phone.Data.EnableIncomingCB ? Priv->CNMIBroadcastProcedure : 0, +#else + 0, +#endif + Priv->CNMIDeliverProcedure + ); + + return ATGEN_WaitFor(s, buffer, length, 0x00, 80, ID_SetIncomingSMS); +} + + +GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, gboolean enable) +{ +#ifdef GSM_ENABLE_CELLBROADCAST if (s->Phone.Data.EnableIncomingCB != enable) { s->Phone.Data.EnableIncomingCB = enable; - if (enable) { - smprintf(s, "Enabling incoming CB\n"); - length = sprintf(buffer, "AT+CNMI=%d,,%d\r", Priv->CNMIMode, Priv->CNMIBroadcastProcedure); - error = ATGEN_WaitFor(s, buffer, length, 0x00, 80, ID_SetIncomingCB); - } else { - smprintf(s, "Disabling incoming CB\n"); - length = sprintf(buffer, "AT+CNMI=%d,,%d\r", Priv->CNMIMode, 0); - error = ATGEN_WaitFor(s, buffer, length, 0x00, 80, ID_SetIncomingCB); - } - return error; + return ATGEN_SetCNMI(s); } return ERR_NONE; #else @@ -2672,8 +2683,6 @@ GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, gboolean enable) { GSM_Error error = ERR_NONE; GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; - char buffer[100] = {'\0'}; - int length = 0; /* We will need this when incoming message, but we can not invoke AT commands there: */ if (Priv->PhoneSMSMemory == 0) { @@ -2689,63 +2698,9 @@ GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, gboolean enable) return error; } } - if (Priv->CNMIMode == -1) { - error = ATGEN_GetCNMIMode(s); - - if (error != ERR_NONE) { - return error; - } - } - if (Priv->CNMIMode == 0) { - return ERR_NOTSUPPORTED; - } - if (Priv->CNMIProcedure == 0 && Priv->CNMIDeliverProcedure == 0) { - return ERR_NOTSUPPORTED; - } if (s->Phone.Data.EnableIncomingSMS != enable) { s->Phone.Data.EnableIncomingSMS = enable; - - if (enable) { - smprintf(s, "Enabling incoming SMS\n"); - - /* Delivery reports */ - if (Priv->CNMIDeliverProcedure != 0) { - length = sprintf(buffer, "AT+CNMI=%d,,,%d\r", Priv->CNMIMode, Priv->CNMIDeliverProcedure); - error = ATGEN_WaitFor(s, buffer, length, 0x00, 80, ID_SetIncomingSMS); - - if (error != ERR_NONE) { - return error; - } - } - - /* Normal messages */ - if (Priv->CNMIProcedure != 0) { - length = sprintf(buffer, "AT+CNMI=%d,%d\r", Priv->CNMIMode, Priv->CNMIProcedure); - error = ATGEN_WaitFor(s, buffer, length, 0x00, 80, ID_SetIncomingSMS); - - if (error != ERR_NONE) { - return error; - } - } - } else { - smprintf(s, "Disabling incoming SMS\n"); - - /* Delivery reports */ - length = sprintf(buffer,"AT+CNMI=%d,,,%d\r", Priv->CNMIMode, 0); - error = ATGEN_WaitFor(s, buffer, length, 0x00, 80, ID_SetIncomingSMS); - - if (error != ERR_NONE) { - return error; - } - - /* Normal messages */ - length = sprintf(buffer, "AT+CNMI=%d,%d\r", Priv->CNMIMode, 0); - error = ATGEN_WaitFor(s, buffer, length, 0x00, 80, ID_SetIncomingSMS); - - if (error != ERR_NONE) { - return error; - } - } + return ATGEN_SetCNMI(s); } return ERR_NONE; } diff --git a/libgammu/phone/at/atgen.c b/libgammu/phone/at/atgen.c index f783e65..b267204 100644 --- a/libgammu/phone/at/atgen.c +++ b/libgammu/phone/at/atgen.c @@ -1925,6 +1925,7 @@ GSM_Error ATGEN_ReplyGetManufacturer(GSM_Protocol_Message *msg, GSM_StateMachine {"Option", AT_Option}, {"Wavecom", AT_Wavecom}, {"Qualcomm", AT_Qualcomm}, + {"Telit", AT_Telit}, {"ZTE", AT_ZTE}, {"\0", 0} }; @@ -4390,53 +4391,48 @@ GSM_Error ATGEN_DialService(GSM_StateMachine *s, char *number) char *req = NULL,*encoded = NULL; unsigned char *tmp = NULL; const char format[] = "AT+CUSD=%d,\"%s\",15\r"; - size_t len = 0, sevenlen = 0; + size_t len = 0, allocsize; + len = strlen(number); /* * We need to allocate twice more memory for number here, because it * might be encoded later. */ - req = (char *)malloc(strlen(format) + (strlen(number) * 2) + 1); + allocsize = 2 * (len + 1); + req = (char *)malloc(strlen(format) + allocsize + 1); if (req == NULL) { return ERR_MOREMEMORY; } - error = ATGEN_SetCharset(s, AT_PREF_CHARSET_GSM); + /* Prefer unicode to be able to deal with unicode response */ + error = ATGEN_SetCharset(s, AT_PREF_CHARSET_UNICODE); if (error != ERR_NONE) { free(req); req = NULL; return error; } - if (GSM_IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_ENCODED_USSD)) { - len = strlen(number); - encoded = (char *)malloc(2 * (len + 1)); - - if (encoded == NULL) { - free(req); - req = NULL; - return ERR_MOREMEMORY; - } - tmp = (unsigned char *)malloc(len + 1); - - if (tmp == NULL) { - free(req); - free(encoded); - return ERR_MOREMEMORY; - } - sevenlen = GSM_PackSevenBitsToEight(0, number, tmp, len); - EncodeHexBin(encoded, tmp, sevenlen); + encoded = (char *)malloc(allocsize); + tmp = (unsigned char *)malloc(allocsize); + if (tmp == NULL || encoded == NULL) { + free(req); free(tmp); - tmp = NULL; - } else { - encoded = number; + free(encoded); + return ERR_MOREMEMORY; } - len = sprintf(req, format, s->Phone.Data.EnableIncomingUSSD ? 1 : 0, encoded); - - if (encoded != number) { + EncodeUnicode(tmp, number, strlen(number)); + error = ATGEN_EncodeText(s, tmp, len, encoded, allocsize, &len); + free(tmp); + if (error != ERR_NONE) { + free(req); free(encoded); - encoded = NULL; + return error; } + + len = sprintf(req, format, s->Phone.Data.EnableIncomingUSSD ? 1 : 0, encoded); + + free(encoded); + error = ATGEN_WaitFor(s, req, len, 0x00, 30, ID_GetUSSD); free(req); req = NULL; diff --git a/libgammu/phone/at/atgen.h b/libgammu/phone/at/atgen.h index e2bebe6..9932e6c 100644 --- a/libgammu/phone/at/atgen.h +++ b/libgammu/phone/at/atgen.h @@ -80,6 +80,7 @@ typedef enum { AT_Philips, AT_Huawei, AT_Qualcomm, + AT_Telit, AT_ZTE, AT_Unknown } GSM_AT_Manufacturer; diff --git a/libgammu/protocol/alcatel/alcabus.c b/libgammu/protocol/alcatel/alcabus.c index 542dd36..ea741e8 100644 --- a/libgammu/protocol/alcatel/alcabus.c +++ b/libgammu/protocol/alcatel/alcabus.c @@ -15,7 +15,7 @@ #include "../../gsmcomon.h" #include "alcabus.h" -static GSM_Error ALCABUS_WriteMessage (GSM_StateMachine *s, unsigned const char *data, int len, int type) +static GSM_Error ALCABUS_WriteMessage (GSM_StateMachine *s, unsigned const char *data, size_t len, int type) { GSM_Protocol_ALCABUSData *d = &s->Protocol.Data.ALCABUS; unsigned char buffer[1024]; diff --git a/libgammu/protocol/at/at.c b/libgammu/protocol/at/at.c index 44b6176..5adedfc 100644 --- a/libgammu/protocol/at/at.c +++ b/libgammu/protocol/at/at.c @@ -12,9 +12,10 @@ #include "at.h" static GSM_Error AT_WriteMessage (GSM_StateMachine *s, unsigned const char *buffer, - int length, int type) + size_t length, int type) { - int sent=0, write_data=0, i=0; + size_t sent=0, i=0; + ssize_t write_data=0; GSM_DumpMessageText(s, buffer, length, type); GSM_DumpMessageBinary(s, buffer, length, type); diff --git a/libgammu/protocol/nokia/fbus2.c b/libgammu/protocol/nokia/fbus2.c index 18cab9a..1add22d 100644 --- a/libgammu/protocol/nokia/fbus2.c +++ b/libgammu/protocol/nokia/fbus2.c @@ -77,7 +77,7 @@ static GSM_Error FBUS2_WriteFrame(GSM_StateMachine *s, static GSM_Error FBUS2_WriteMessage (GSM_StateMachine *s, unsigned const char *MsgBuffer, - int MsgLength, + size_t MsgLength, int MsgType) { int i=0, nom=0, togo=0, thislength=0; /* number of messages, ... */ diff --git a/libgammu/protocol/nokia/mbus2.c b/libgammu/protocol/nokia/mbus2.c index da399a8..d732b49 100644 --- a/libgammu/protocol/nokia/mbus2.c +++ b/libgammu/protocol/nokia/mbus2.c @@ -14,7 +14,7 @@ static GSM_Error MBUS2_WriteMessage (GSM_StateMachine *s, unsigned const char *MsgBuffer, - int MsgLength, + size_t MsgLength, int MsgType) { unsigned char *buffer=NULL, checksum = 0; diff --git a/libgammu/protocol/nokia/phonet.c b/libgammu/protocol/nokia/phonet.c index e8efc34..e483616 100644 --- a/libgammu/protocol/nokia/phonet.c +++ b/libgammu/protocol/nokia/phonet.c @@ -26,7 +26,7 @@ static GSM_Error PHONET_WriteMessage (GSM_StateMachine *s, unsigned const char *MsgBuffer, - int MsgLength, + size_t MsgLength, int MsgType) { unsigned char *buffer=NULL; diff --git a/libgammu/protocol/obex/obex.c b/libgammu/protocol/obex/obex.c index feff665..0d558e1 100644 --- a/libgammu/protocol/obex/obex.c +++ b/libgammu/protocol/obex/obex.c @@ -14,7 +14,7 @@ #include "obex.h" static GSM_Error OBEX_WriteMessage (GSM_StateMachine *s, unsigned const char *MsgBuffer, - int MsgLength, int type) + size_t MsgLength, int type) { unsigned char *buffer=NULL; int length=0,sent=0; diff --git a/libgammu/protocol/s60/s60.c b/libgammu/protocol/s60/s60.c index f933a3d..5df3c6d 100644 --- a/libgammu/protocol/s60/s60.c +++ b/libgammu/protocol/s60/s60.c @@ -29,7 +29,7 @@ #include "s60-ids.h" static GSM_Error S60_WriteMessage (GSM_StateMachine *s, unsigned const char *MsgBuffer, - int MsgLength, int MsgType) + size_t MsgLength, int MsgType) { unsigned char *buffer=NULL; int pos, sent, length, buflen, bufpos; diff --git a/libgammu/protocol/symbian/gnapbus.c b/libgammu/protocol/symbian/gnapbus.c index c423bc4..6c945c1 100644 --- a/libgammu/protocol/symbian/gnapbus.c +++ b/libgammu/protocol/symbian/gnapbus.c @@ -12,7 +12,7 @@ #include "gnapbus.h" static GSM_Error GNAPBUS_WriteMessage (GSM_StateMachine *s, unsigned const char *MsgBuffer, - int MsgLength, int MsgType) + size_t MsgLength, int MsgType) { unsigned char *buffer=NULL; int sent=0,length=0,i=0; diff --git a/libgammu/service/sms/gsmmulti.c b/libgammu/service/sms/gsmmulti.c index 5cb826b..c956d8a 100644 --- a/libgammu/service/sms/gsmmulti.c +++ b/libgammu/service/sms/gsmmulti.c @@ -1013,29 +1013,39 @@ gboolean GSM_DecodeMMSIndication(GSM_Debug_Info *di, Info->Entries[0].MMSIndicator->Sender[0] = 0; Info->Entries[0].MMSIndicator->Address[0] = 0; - /* First byte is transaction ID */ - /* PUSH */ + /* First byte is the WSP transaction ID */ + /* Second byte is PUSH */ if (Buffer[1] != 0x06) { - dbgprintf(di, "Unsupported transaction id: 0x%02x\n", Buffer[1]); + dbgprintf(di, "Unsupported WSP PDU type: 0x%02x\n", Buffer[1]); return FALSE; } - /* Process payload */ + /* + * WSP Push PDU follows: + * + * Buffer[2] is length of content type and headers + * Buffer[3] is start of content type + * + * Process payload after headers per + * Multimedia Messaging Service Encapsulation Protocol + */ for (i = 3 + Buffer[2]; i < Length; i++) { switch(Buffer[i]) { case 0x8c: - /* Transaction type */ + /* X-Mms-Message-Type (Transaction type) */ i++; + /* We support only m-notification-ind (130) */ if (Buffer[i] != 0x82) { dbgprintf(di, "Unsupported transaction type: 0x%02x\n", Buffer[i]); return FALSE; } break; case 0x98: - /* Message ID */ + /* X-Mms-Transaction-Id (Message ID) */ + dbgprintf(di, "Transaction ID: %s\n", Buffer + i + 1); while (Buffer[i] != 0 && i < Length) i++; break; case 0x8d: - /* MMS version */ + /* X-Mms-MMS-Version (MMS version) */ i++; if (Buffer[i] < 0x90 || Buffer[i] > 0x92) { dbgprintf(di, "Unsupported MMS version: 0x%02x\n", Buffer[i]); @@ -1043,9 +1053,11 @@ gboolean GSM_DecodeMMSIndication(GSM_Debug_Info *di, } break; case 0x89: - /* Sender */ + /* From (Sender) */ i++; + /* Length */ if (Buffer[i] == 0) continue; + /* Address-present-token */ if (Buffer[i + 1] == 0x80) { if (Buffer[i + 2] < 32) { /* String with length + encoding, we just ignore it for now */ @@ -1057,7 +1069,7 @@ gboolean GSM_DecodeMMSIndication(GSM_Debug_Info *di, i += Buffer[i]; break; case 0x96: - /* Title */ + /* Subject (Title) */ if (Buffer[i + 1] == 0x0a && Buffer[i + 2] == 0xea) { /* UTF-8 */ strcpy(Info->Entries[0].MMSIndicator->Title, Buffer + i + 3); @@ -1068,7 +1080,7 @@ gboolean GSM_DecodeMMSIndication(GSM_Debug_Info *di, } break; case 0x8a: - /* Class */ + /* X-Mms-Message-Class (Class) */ i++; switch (Buffer[i]) { case 0x80: @@ -1089,28 +1101,100 @@ gboolean GSM_DecodeMMSIndication(GSM_Debug_Info *di, } break; case 0x8e: - /* Message size */ + /* X-Mms-Message-Size (Message size) */ i++; for (j = i + 1; j < i + 1 + Buffer[i]; j++) { Info->Entries[0].MMSIndicator->MessageSize = (Info->Entries[0].MMSIndicator->MessageSize << 8) + Buffer[j]; } i += Buffer[i]; break; - case 0x88: - /* Don't know */ + case 0x83: + /* X-Mms-Content-Location (URL) */ + strcpy(Info->Entries[0].MMSIndicator->Address, Buffer + i + 1); + i += strlen(Info->Entries[0].MMSIndicator->Address) + 1; + break; + + /* Ignored variable length fields */ + case 0x87: /* X-Mms-Delivery-Time */ + case 0x88: /* X-Mms-Expiry */ + case 0x9d: /* X-Mms-Reply-Charging-Deadline */ + case 0xa0: /* X-Mms-Previously-Sent-By */ + case 0xa1: /* X-Mms-Previously-Sent-Date */ + case 0xa4: /* X-Mms-MM-Flags */ + case 0xaa: /* X-Mms-Mbox-Totals */ + case 0xac: /* X-Mms-Mbox-Quotas */ + case 0xb2: /* X-Mms-Element-Descriptor */ i++; + i += Buffer[i]; break; - case 0x81: - /* Don't know */ + + /* Ignored long integer types */ + case 0x85: /* Date */ + case 0x9f: /* X-Mms-Reply-Charging-Size */ i++; i += Buffer[i]; break; - case 0x83: - /* URL */ - strcpy(Info->Entries[0].MMSIndicator->Address, Buffer + i + 1); - i += strlen(Info->Entries[0].MMSIndicator->Address) + 1; + + /* Ignored integer types */ + case 0xad: /* X-Mms-Message-Count */ + case 0xaf: /* X-Mms-Start */ + case 0xb3: /* X-Mms-Limit */ + i++; + break; + + /* Ignored octet types */ + case 0x86: /* X-Mms-Delivery-Report */ + case 0x8f: /* X-Mms-Priority */ + case 0x90: /* X-Mms-Read-Report */ + case 0x91: /* X-Mms-Report-Allowed */ + case 0x92: /* X-Mms-Response-Status */ + case 0x94: /* X-Mms-Sender-Visibility */ + case 0x95: /* X-Mms-Status */ + case 0x99: /* X-Mms-Retrieve-Status */ + case 0x9b: /* X-Mms-Read-Status */ + case 0x9c: /* X-Mms-Reply-Charging */ + case 0xa2: /* X-Mms-Store */ + case 0xa3: /* X-Mms-MM-State */ + case 0xa5: /* X-Mms-Store-Status */ + case 0xa7: /* X-Mms-Stored */ + case 0xa8: /* X-Mms-Attributes */ + case 0xa9: /* X-Mms-Totals */ + case 0xab: /* X-Mms-Quotas */ + case 0xb1: /* X-Mms-Distribution-Indicator */ + case 0xb4: /* X-Mms-Recommended-Retrieval-Mode */ + case 0xba: /* X-Mms-Content-Class */ + case 0xbb: /* X-Mms-DRM-Content */ + case 0xbc: /* X-Mms-Adaptation-Allowed */ + case 0xbf: /* X-Mms-Cancel-Status */ + i++; + break; + + /* Ignored encoded string types */ + case 0x81: /* Bcc */ + case 0x82: /* Cc */ + case 0x84: /* Content-Type */ + case 0x97: /* To */ + case 0x93: /* X-Mms-Response-Text */ + case 0x9a: /* X-Mms-Retrieve-Text */ + case 0xa6: /* X-Mms-Store-Status-Text */ + case 0xb5: /* X-Mms-Recommended-Retrieval-Mode-Text */ + case 0xb6: /* X-Mms-Status-Text */ + while (Buffer[i] != 0 && i < Length) { + i++; + } + break; + + /* Ignored string types */ + case 0x8b: /* Message-ID */ + case 0x9e: /* X-Mms-Reply-Charging-ID */ + case 0xb7: /* X-Mms-Applic-ID */ + case 0xb8: /* X-Mms-Reply-Applic-ID */ + case 0xb9: /* X-Mms-Aux-Applic-Info */ + case 0xbd: /* X-Mms-Replace-ID */ + case 0xbe: /* X-Mms-Cancel-ID */ + i++; + i += Buffer[i]; break; - case 0x87: default: dbgprintf(di, "Unknown MMS tag: 0x%02x\n", Buffer[i]); break; diff --git a/libgammu/service/sms/gsmsms.c b/libgammu/service/sms/gsmsms.c index 275e41a..5e4b946 100644 --- a/libgammu/service/sms/gsmsms.c +++ b/libgammu/service/sms/gsmsms.c @@ -1007,11 +1007,9 @@ static int GSM_EncodeSMSFrameText(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsig GSM_Error GSM_EncodeSMSFrame(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, gboolean clear) { - int i; - if (clear) { /* Cleaning up to the SMS text */ - for (i=0;iNumber,buffer+(Layout.Number+1),TRUE); - smfprintf(di, "Recipient number \"%s\"\n",DecodeUnicodeString(SMS->Number)); + smfprintf(di, "Recipient number \"%s\"\n", DecodeUnicodeString(SMS->Number)); } if (Layout.SMSCNumber!=255) { - buffer[Layout.SMSCNumber]=GSM_PackSemiOctetNumber(SMS->SMSC.Number,buffer+(Layout.SMSCNumber+1), FALSE); - smfprintf(di, "SMSC number \"%s\"\n",DecodeUnicodeString(SMS->SMSC.Number)); + buffer[Layout.SMSCNumber] = GSM_PackSemiOctetNumber(SMS->SMSC.Number,buffer+(Layout.SMSCNumber+1), FALSE); + smfprintf(di, "SMSC number \"%s\"\n", DecodeUnicodeString(SMS->SMSC.Number)); } /* Message Class*/ /* GSM 03.40 section 9.2.3.10 (TP-Data-Coding-Scheme) and GSM 03.38 section 4 */ if (Layout.TPDCS != 255) { - if (SMS->Class >= 0 && SMS->Class <= 3) buffer[Layout.TPDCS] |= SMS->Class | (1 << 4); + if (SMS->Class >= 0 && SMS->Class <= 3) { + buffer[Layout.TPDCS] |= SMS->Class; + if (SMS->Coding == SMS_Coding_Unicode_No_Compression) { + /* + * Use GSM 03.38 5.3.0 as it is necessary for + * Unicode + */ + buffer[Layout.TPDCS] |= 0x10; + } else { + /* + * Use TP-DCS as specified in GSM 03.38 5.0.0 + * to be compatible with older devices + */ + buffer[Layout.TPDCS] |= 0xf0; + } + } smfprintf(di, "SMS class %i\n",SMS->Class); } @@ -1055,7 +1068,7 @@ GSM_Error GSM_EncodeSMSFrame(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned c /* Bits 4 and 3: 10. TP-VP field present and integer represent (relative) */ buffer[Layout.firstbyte] |= 0x10; buffer[Layout.TPVP]=((unsigned char)SMS->SMSC.Validity.Relative); - smfprintf(di, "SMS validity %02x\n",SMS->SMSC.Validity.Relative); + smfprintf(di, "SMS validity %02x\n", SMS->SMSC.Validity.Relative); } if (Layout.DateTime != 255) { @@ -1063,7 +1076,7 @@ GSM_Error GSM_EncodeSMSFrame(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned c } if (Layout.TPMR != 255) { - smfprintf(di, "TPMR: %02x %i\n",SMS->MessageReference,SMS->MessageReference); + smfprintf(di, "TPMR: %02x %i\n", SMS->MessageReference,SMS->MessageReference); buffer[Layout.TPMR] = SMS->MessageReference; } diff --git a/locale/af/docs.po b/locale/af/docs.po index 2c5b04c..ade9188 100644 --- a/locale/af/docs.po +++ b/locale/af/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/ar/docs.po b/locale/ar/docs.po index 07fe6da..ae3b10a 100644 --- a/locale/ar/docs.po +++ b/locale/ar/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2010-09-03 14:46+0300\n" diff --git a/locale/bg/docs.po b/locale/bg/docs.po index 138d859..2876074 100644 --- a/locale/bg/docs.po +++ b/locale/bg/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/bn/docs.po b/locale/bn/docs.po index c005106..37cffd3 100644 --- a/locale/bn/docs.po +++ b/locale/bn/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2012-06-29 16:16+0300\n" diff --git a/locale/ca/docs.po b/locale/ca/docs.po index 1f8908b..af82c82 100644 --- a/locale/ca/docs.po +++ b/locale/ca/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/cs/docs.po b/locale/cs/docs.po index 79afb93..1668753 100644 --- a/locale/cs/docs.po +++ b/locale/cs/docs.po @@ -9,7 +9,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-02-23 16:59+0100\n" diff --git a/locale/cs/gammu.po b/locale/cs/gammu.po index 1bca513..3573fab 100644 --- a/locale/cs/gammu.po +++ b/locale/cs/gammu.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu 1.38.1\n" +"Project-Id-Version: Gammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2016-10-11 06:27+0000\n" diff --git a/locale/cs/libgammu.po b/locale/cs/libgammu.po index 4b29e1a..9c11dbb 100644 --- a/locale/cs/libgammu.po +++ b/locale/cs/libgammu.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: libGammu 1.38.1\n" +"Project-Id-Version: libGammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2016-10-11 06:28+0000\n" diff --git a/locale/da/docs.po b/locale/da/docs.po index 8b64ba6..aca789a 100644 --- a/locale/da/docs.po +++ b/locale/da/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-08-30 15:35+0200\n" diff --git a/locale/de/docs.po b/locale/de/docs.po index 3fb0d92..2a3c5d8 100644 --- a/locale/de/docs.po +++ b/locale/de/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-03-12 16:33+0200\n" diff --git a/locale/de/gammu.po b/locale/de/gammu.po index 3d09a2a..bea1c10 100644 --- a/locale/de/gammu.po +++ b/locale/de/gammu.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu 1.38.1\n" +"Project-Id-Version: Gammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2016-10-11 15:14+0000\n" diff --git a/locale/de/libgammu.po b/locale/de/libgammu.po index 91bd2bb..a4b321a 100644 --- a/locale/de/libgammu.po +++ b/locale/de/libgammu.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: libGammu 1.38.1\n" +"Project-Id-Version: libGammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2016-07-10 18:02+0000\n" diff --git a/locale/el/docs.po b/locale/el/docs.po index 62d52a3..dc3a65e 100644 --- a/locale/el/docs.po +++ b/locale/el/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/en_GB/docs.po b/locale/en_GB/docs.po index 061a6d9..4c9062f 100644 --- a/locale/en_GB/docs.po +++ b/locale/en_GB/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-04-05 16:14+0200\n" diff --git a/locale/es/docs.po b/locale/es/docs.po index 512c1c0..36dbd7b 100644 --- a/locale/es/docs.po +++ b/locale/es/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-03-10 19:26+0200\n" diff --git a/locale/et/docs.po b/locale/et/docs.po index 7846c48..f1a48a2 100644 --- a/locale/et/docs.po +++ b/locale/et/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/fi/docs.po b/locale/fi/docs.po index 9497b34..c523847 100644 --- a/locale/fi/docs.po +++ b/locale/fi/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-04-21 14:14+0200\n" diff --git a/locale/fr/docs.po b/locale/fr/docs.po index aa8cb7d..89f9f04 100644 --- a/locale/fr/docs.po +++ b/locale/fr/docs.po @@ -5,24 +5,26 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" -"PO-Revision-Date: 2009-06-01 13:48+0200\n" -"Last-Translator: Cédric Corazza \n" -"Language-Team: none\n" +"PO-Revision-Date: 2017-02-07 12:46+0000\n" +"Last-Translator: nvallas \n" +"Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" -"X-Generator: Pootle 1.2.1\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 2.11\n" #. type: Title = #: README.rst:2 #, no-wrap msgid "Gammu All Mobile Management Utilities" msgstr "" +"Gammu All Mobile Management Utilities (Utilitaire de gestion pour mobiles)" #. type: Plain text #: README.rst:6 @@ -30,6 +32,8 @@ msgid "" "Gammu is library and command line utility for mobile phones. It is released " "under GNU GPL version 2." msgstr "" +"Gammu est une librairie et un utilitaire en ligne de commande pour les " +"téléphones mobiles. Il est distribué sous licence GNU GPL version 2." #. type: Plain text #: README.rst:11 @@ -39,6 +43,10 @@ msgid "" "mwiacek.com/> projects. Gammu was former (up to version 0.58) called " "MyGnokii2." msgstr "" +"Il a été initié par Marcin Wiacek et d'autres personnes. A l'origine, le " +"code était basé sur les projets Gnokii et plus " +"tard MyGnokii . Jusqu'à la version 0.58, Gammu " +"était appelé MyGnokii2." #. type: Plain text #: README.rst:14 @@ -46,6 +54,8 @@ msgid "" "Currently the project is lead by Michal Cihar with help " "of many contributors." msgstr "" +"Actuellement, le projet est dirigé par Michal Cihar avec " +"l'aide de nombreux contributeurs." #. type: Labeled list #: README.rst:15 README.rst:19 README.rst:23 README.rst:27 README.rst:31 @@ -63,17 +73,18 @@ msgstr "https://travis-ci.org/gammu/gammu.png?branch=master" #. type: Plain text #: README.rst:18 -#, fuzzy -#| msgid ":target: https://travis-ci.org/gammu/gammu" msgid ":alt: Build status :target: https://travis-ci.org/gammu/gammu" -msgstr ":target: https://travis-ci.org/gammu/gammu" +msgstr ":alt: Build status :target: https://travis-ci.org/gammu/gammu" #. type: Plain text #: README.rst:20 +#, fuzzy msgid "" "https://ci.appveyor.com/api/projects/status/dkm2eam66rbhhuwn/branch/master?" "svg=true" msgstr "" +"https://ci.appveyor.com/api/projects/status/dkm2eam66rbhhuwn/branch/master?sv" +"g=true" #. type: Plain text #: README.rst:22 @@ -187,14 +198,14 @@ msgstr "" #: INSTALL:2 #, no-wrap msgid "Gammu All Mobile Management Utilities - Installation" -msgstr "" +msgstr "Gammu All Mobile Management Utilities - Installation" #. type: Plain text #: INSTALL:5 msgid "" "See docs/manual/project/install.rst for installation guide or see chapter " "\"Compiling Gammu\" in The Gammu Manual." -msgstr "" +msgstr "Voir docs/manual/project/install.rst pour le guide d'installation ou le chapitre \"Compiling Gammu\" dans le manuel de Gammu." #, fuzzy #~| msgid "https://travis-ci.org/gammu/gammu.png?branch=master" diff --git a/locale/gammu.pot b/locale/gammu.pot index 4799771..0aa4707 100644 --- a/locale/gammu.pot +++ b/locale/gammu.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: gammu 1.38.1\n" +"Project-Id-Version: gammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" -"POT-Creation-Date: 2017-01-05 13:32+0100\n" +"POT-Creation-Date: 2017-02-07 11:19+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/locale/gl/docs.po b/locale/gl/docs.po index 3f44e46..a2b0b2e 100644 --- a/locale/gl/docs.po +++ b/locale/gl/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-02-14 23:34+0100\n" diff --git a/locale/he/docs.po b/locale/he/docs.po index b2038df..5cbc1ab 100644 --- a/locale/he/docs.po +++ b/locale/he/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2010-02-20 13:09+0200\n" diff --git a/locale/hu/docs.po b/locale/hu/docs.po index 82afd5f..70329aa 100644 --- a/locale/hu/docs.po +++ b/locale/hu/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/id/docs.po b/locale/id/docs.po index 7090f1a..3616aa3 100644 --- a/locale/id/docs.po +++ b/locale/id/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-12-13 21:56+0200\n" diff --git a/locale/id/gammu.po b/locale/id/gammu.po index 8307d75..e321754 100644 --- a/locale/id/gammu.po +++ b/locale/id/gammu.po @@ -4,11 +4,11 @@ # Automatically generated, 2009. msgid "" msgstr "" -"Project-Id-Version: Gammu 1.38.1\n" +"Project-Id-Version: Gammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" -"PO-Revision-Date: 2016-11-18 15:50+0000\n" -"Last-Translator: Prasasto Adi \n" +"PO-Revision-Date: 2017-02-13 04:00+0000\n" +"Last-Translator: Ahmad Zafrullah <23Pstars@gmail.com>\n" "Language-Team: Indonesian " "\n" "Language: id\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 2.10-dev\n" +"X-Generator: Weblate 2.12-dev\n" #: gammu/backup.c:49 gammu/backup.c:72 gammu/backup.c:95 gammu/backup.c:116 #: helper/message-cmdline.c:373 helper/message-cmdline.c:397 @@ -1543,14 +1543,10 @@ msgstr "Penyelidikan port serial Windows" msgid "" "Copyright (C) 2010 - 2017 Michal Cihar and other authors." msgstr "" -"Copyright (C) 2010 - 2017 Michal Cihar dan penulis " +"Hak cipta (C) 2010 - 2017 Michal Cihar dan penulis " "lainnya." #: gammu-detect/main.c:87 gammu/gammu.c:336 -#, fuzzy -#| msgid "" -#| "License GPLv2: GNU GPL version 2 ." msgid "License GPLv2: GNU GPL version 2 ." msgstr "Lisensi GPLv2: GNU GPL versi 2 ." diff --git a/locale/id/libgammu.po b/locale/id/libgammu.po index 0984ccb..ca50e06 100644 --- a/locale/id/libgammu.po +++ b/locale/id/libgammu.po @@ -4,7 +4,7 @@ # Automatically generated, 2009. msgid "" msgstr "" -"Project-Id-Version: libGammu 1.38.1\n" +"Project-Id-Version: libGammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2016-10-22 17:05+0000\n" diff --git a/locale/it/docs.po b/locale/it/docs.po index ce4c638..c648cc1 100644 --- a/locale/it/docs.po +++ b/locale/it/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2012-02-23 03:10+0200\n" diff --git a/locale/it/gammu.po b/locale/it/gammu.po index 1797e55..e90d183 100644 --- a/locale/it/gammu.po +++ b/locale/it/gammu.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu 1.38.1\n" +"Project-Id-Version: Gammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2013-11-19 11:01+0200\n" diff --git a/locale/it/libgammu.po b/locale/it/libgammu.po index e62a156..e0bd5f1 100644 --- a/locale/it/libgammu.po +++ b/locale/it/libgammu.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: libGammu 1.38.1\n" +"Project-Id-Version: libGammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2012-08-27 11:45+0200\n" diff --git a/locale/ko/docs.po b/locale/ko/docs.po index 6c8e7e6..5eaf481 100644 --- a/locale/ko/docs.po +++ b/locale/ko/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/libgammu.pot b/locale/libgammu.pot index 54c2ae1..b838031 100644 --- a/locale/libgammu.pot +++ b/locale/libgammu.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: libgammu 1.38.1\n" +"Project-Id-Version: libgammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" -"POT-Creation-Date: 2017-01-05 13:32+0100\n" +"POT-Creation-Date: 2017-02-07 11:19+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/locale/nl/docs.po b/locale/nl/docs.po index 49d774b..49f8c0c 100644 --- a/locale/nl/docs.po +++ b/locale/nl/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-05-25 12:11+0200\n" diff --git a/locale/pl/docs.po b/locale/pl/docs.po index c073d13..dcc56aa 100644 --- a/locale/pl/docs.po +++ b/locale/pl/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-12-19 09:43+0200\n" diff --git a/locale/pl/gammu.po b/locale/pl/gammu.po index f7dadc1..17d5806 100644 --- a/locale/pl/gammu.po +++ b/locale/pl/gammu.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu 1.38.1\n" +"Project-Id-Version: Gammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2013-11-25 16:30+0200\n" diff --git a/locale/pl/libgammu.po b/locale/pl/libgammu.po index 63ad482..f855365 100644 --- a/locale/pl/libgammu.po +++ b/locale/pl/libgammu.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: libGammu 1.38.1\n" +"Project-Id-Version: libGammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2013-02-23 23:11+0200\n" diff --git a/locale/pt_BR/docs.po b/locale/pt_BR/docs.po index 7219fe4..b4bc04a 100644 --- a/locale/pt_BR/docs.po +++ b/locale/pt_BR/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2011-06-02 23:02+0200\n" diff --git a/locale/ro/docs.po b/locale/ro/docs.po index da59599..5d80a3b 100644 --- a/locale/ro/docs.po +++ b/locale/ro/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2012-06-29 16:16+0300\n" diff --git a/locale/ru/docs.po b/locale/ru/docs.po index 7b8be82..94421dd 100644 --- a/locale/ru/docs.po +++ b/locale/ru/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-07 18:00+0100\n" diff --git a/locale/ru/gammu.po b/locale/ru/gammu.po index b651e88..3281e1d 100644 --- a/locale/ru/gammu.po +++ b/locale/ru/gammu.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu 1.38.1\n" +"Project-Id-Version: Gammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2015-10-13 04:57+0200\n" diff --git a/locale/ru/libgammu.po b/locale/ru/libgammu.po index 591ed87..5f2af2b 100644 --- a/locale/ru/libgammu.po +++ b/locale/ru/libgammu.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: libGammu 1.38.1\n" +"Project-Id-Version: libGammu 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" "PO-Revision-Date: 2013-04-25 15:45+0200\n" diff --git a/locale/sk/docs.po b/locale/sk/docs.po index 93f5b84..668613f 100644 --- a/locale/sk/docs.po +++ b/locale/sk/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/sv/docs.po b/locale/sv/docs.po index cadbf17..fbba620 100644 --- a/locale/sv/docs.po +++ b/locale/sv/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/locale/sw/docs.po b/locale/sw/docs.po index 12f4e90..1c53f42 100644 --- a/locale/sw/docs.po +++ b/locale/sw/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-08-20 11:53+0300\n" diff --git a/locale/tr/docs.po b/locale/tr/docs.po index 2faa1e3..e0955e6 100644 --- a/locale/tr/docs.po +++ b/locale/tr/docs.po @@ -5,17 +5,19 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" -"PO-Revision-Date: 2010-09-03 14:46+0300\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" +"PO-Revision-Date: 2017-02-07 16:03+0000\n" +"Last-Translator: Burak Yavuz \n" +"Language-Team: Turkish \n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 2.12-dev\n" #. type: Title = #: README.rst:2 @@ -55,17 +57,13 @@ msgstr ".. image" #. type: Plain text #: README.rst:16 -#, fuzzy -#| msgid "https://travis-ci.org/gammu/gammu.png?branch=master" msgid "https://travis-ci.org/gammu/gammu.svg?branch=master" -msgstr "https://travis-ci.org/gammu/gammu.png?branch=master" +msgstr "https://travis-ci.org/gammu/gammu.svg?branch=master" #. type: Plain text #: README.rst:18 -#, fuzzy -#| msgid ":target: https://travis-ci.org/gammu/gammu" msgid ":alt: Build status :target: https://travis-ci.org/gammu/gammu" -msgstr ":target: https://travis-ci.org/gammu/gammu" +msgstr ":alt: Yapım durumu :target: https://travis-ci.org/gammu/gammu" #. type: Plain text #: README.rst:20 @@ -76,19 +74,17 @@ msgstr "" #. type: Plain text #: README.rst:22 -#, fuzzy -#| msgid ":target: https://travis-ci.org/gammu/gammu" msgid "" ":alt: Windows Build status :target: https://ci.appveyor.com/project/nijel/" "gammu/branch/master" -msgstr ":target: https://travis-ci.org/gammu/gammu" +msgstr "" +":alt: Windows Yapım durumu :target: " +"https://ci.appveyor.com/project/nijel/gammu/branch/master" #. type: Plain text #: README.rst:24 -#, fuzzy -#| msgid "https://hosted.weblate.org/widgets/gammu-status-badge.png" msgid "https://hosted.weblate.org/widgets/gammu/-/svg-badge.svg" -msgstr "https://hosted.weblate.org/widgets/gammu-status-badge.png" +msgstr "https://hosted.weblate.org/widgets/gammu/-/svg-badge.svg" #. type: Plain text #: README.rst:26 @@ -96,8 +92,8 @@ msgid "" ":alt: Translation status :target: https://hosted.weblate.org/engage/gammu/?" "utm_source=widget" msgstr "" -":alt: Translation status :target: https://hosted.weblate.org/engage/gammu/?" -"utm_source=widget" +":alt: Çeviri durumu :target: " +"https://hosted.weblate.org/engage/gammu/?utm_source=widget" #. type: Plain text #: README.rst:28 @@ -106,10 +102,8 @@ msgstr "" #. type: Plain text #: README.rst:30 -#, fuzzy -#| msgid ":alt: Bitdeli badge :target: https://bitdeli.com/free" msgid ":alt: Coverity scan :target: https://scan.coverity.com/projects/2890" -msgstr ":alt: Bitdeli badge :target: https://bitdeli.com/free" +msgstr ":alt: Kapak taraması :target: https://scan.coverity.com/projects/2890" #. type: Plain text #: README.rst:32 @@ -118,10 +112,8 @@ msgstr "https://img.shields.io/gratipay/Gammu.svg" #. type: Plain text #: README.rst:34 -#, fuzzy -#| msgid ":target: https://travis-ci.org/gammu/gammu" msgid ":alt: Gratipay :target: https://gratipay.com/Gammu/" -msgstr ":target: https://travis-ci.org/gammu/gammu" +msgstr ":alt: Gratipay :target: https://gratipay.com/Gammu/" #. type: Plain text #: README.rst:36 diff --git a/locale/uk/docs.po b/locale/uk/docs.po index ec7ad87..241a945 100644 --- a/locale/uk/docs.po +++ b/locale/uk/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2012-04-10 11:40+0300\n" diff --git a/locale/uk/libgammu.po b/locale/uk/libgammu.po index 8a7b3c8..348f069 100644 --- a/locale/uk/libgammu.po +++ b/locale/uk/libgammu.po @@ -8,17 +8,17 @@ msgstr "" "Project-Id-Version: libgammu 1.31.91\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 08:16+0200\n" -"PO-Revision-Date: 2016-02-05 20:15+0000\n" +"PO-Revision-Date: 2017-01-25 20:00+0000\n" "Last-Translator: Olexandr Nesterenko \n" -"Language-Team: Ukrainian \n" +"Language-Team: Ukrainian " +"\n" "Language: uk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 2.5-dev\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=" +"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 2.11-dev\n" #: libgammu/gsmcomon.c:84 msgid "No error." @@ -83,40 +83,28 @@ msgid "No response in specified timeout. Probably phone not connected." msgstr "Перевищено час очікування відповіді. Можливо, телефон не під'єднано." #: libgammu/gsmcomon.c:98 -#, fuzzy -#| msgid "" -#| "Frame not requested right now. See for " -#| "information how to report it." msgid "" "Frame not requested right now. See for " "information how to report it." msgstr "" -"Невідомий відгук від телефону. На сторінці " +"Невідомий відгук від телефону. На сторінці " "розказано як про це повідомити." #: libgammu/gsmcomon.c:99 -#, fuzzy -#| msgid "" -#| "Unknown response from phone. See for " -#| "information how to report it." msgid "" "Unknown response from phone. See for " "information how to report it." msgstr "" -"Невідомий відгук від телефону. На сторінці " +"Невідомий відгук від телефону. На сторінці " "розказано як про це повідомити." #: libgammu/gsmcomon.c:100 -#, fuzzy -#| msgid "" -#| "Unknown frame. See for information how to " -#| "report it." msgid "" "Unknown frame. See for information how to " "report it." msgstr "" -"Невідомий кадр. На сторінці розказано як про " -"це повідомити." +"Невідомий кадр. На сторінці розказано як " +"про це повідомити." #: libgammu/gsmcomon.c:101 msgid "Unknown connection type string. Check config file." diff --git a/locale/zh_CN/docs.po b/locale/zh_CN/docs.po index 90f8ce4..e290d31 100644 --- a/locale/zh_CN/docs.po +++ b/locale/zh_CN/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:06+0100\n" diff --git a/locale/zh_TW/docs.po b/locale/zh_TW/docs.po index 93e5b5e..311b2cd 100644 --- a/locale/zh_TW/docs.po +++ b/locale/zh_TW/docs.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Gammu-docs 1.38.1\n" +"Project-Id-Version: Gammu-docs 1.38.2\n" "Report-Msgid-Bugs-To: gammu-users@lists.sourceforge.net\n" "POT-Creation-Date: 2016-10-11 13:13+0200\n" "PO-Revision-Date: 2009-01-27 14:27+0100\n" diff --git a/smsd/core.c b/smsd/core.c index 743ecd6..7c29640 100644 --- a/smsd/core.c +++ b/smsd/core.c @@ -644,7 +644,7 @@ GSM_Error SMSD_ConfigureLogging(GSM_SMSDConfig *Config, gboolean uselog) fprintf(stderr, "Can't open log file \"%s\"\n", Config->logfilename); return ERR_CANTOPENFILE; } - fprintf(stderr, "Log filename is \"%s\"\n",Config->logfilename); + fprintf(stdout, "Log filename is \"%s\"\n",Config->logfilename); } return ERR_NONE; } @@ -1036,6 +1036,11 @@ void SMSD_RunOnReceiveEnvironment(GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Conf /* Raw message data */ sprintf(buffer, "%d", sms->Number); setenv("SMS_MESSAGES", buffer, 1); + + if (Config->PhoneID) { + setenv("PHONE_ID", Config->PhoneID, 1); + } + for (i = 0; i < sms->Number; i++) { sprintf(buffer, "%d", sms->SMS[i].Class); sprintf(name, "SMS_%d_CLASS", i + 1); @@ -1936,7 +1941,7 @@ GSM_Error SMSD_MainLoop(GSM_SMSDConfig *Config, gboolean exit_on_failure, int ma { GSM_Error error; int errors = -1, initerrors=0; - unsigned int lastsleep; + double lastsleep; time_t lastreceive = 0, lastreset = time(NULL), lasthardreset = time(NULL), lastnothingsent = 0, laststatus = 0; time_t lastloop = 0, current_time; int i; @@ -2099,6 +2104,9 @@ GSM_Error SMSD_MainLoop(GSM_SMSDConfig *Config, gboolean exit_on_failure, int ma force_hard_reset = TRUE; continue; } + if (Config->shutdown) { + break; + } /* Send any queued messages */ current_time = time(NULL); @@ -2109,6 +2117,9 @@ GSM_Error SMSD_MainLoop(GSM_SMSDConfig *Config, gboolean exit_on_failure, int ma } /* We don't care about other errors here, they are handled in SMSD_SendSMS */ } + if (Config->shutdown) { + break; + } /* Refresh phone status in shared memory and in service */ current_time = time(NULL); @@ -2118,9 +2129,12 @@ GSM_Error SMSD_MainLoop(GSM_SMSDConfig *Config, gboolean exit_on_failure, int ma Config->Service->RefreshPhoneStatus(Config); } + if (Config->shutdown) { + break; + } /* Sleep some time before another loop */ current_time = time(NULL); - lastsleep = round(difftime(current_time, lastloop)); + lastsleep = difftime(current_time, lastloop); if (Config->loopsleep == 1) { sleep(1); } else if (lastsleep < Config->loopsleep) { diff --git a/smsd/monitor.c b/smsd/monitor.c index 4b30b65..1a50f56 100644 --- a/smsd/monitor.c +++ b/smsd/monitor.c @@ -98,7 +98,7 @@ void help(void) print_option_param("d", "delay", "DELAY", "delay in seconds between loops"); print_option_param("n", "loops", "NUMBER", - "delay in seconds between loops"); + "number of loops"); print_option("l", "use-log", "use logging configuration from config file"); print_option("L", "no-use-log", "do not use logging configuration from config file (default)"); } diff --git a/smsd/services/pgsql.c b/smsd/services/pgsql.c index 90f8ddc..d640d1a 100644 --- a/smsd/services/pgsql.c +++ b/smsd/services/pgsql.c @@ -52,6 +52,15 @@ const char *SMSDPgSQL_GetString(GSM_SMSDConfig * Config, SQL_result *res, unsign return PQgetvalue(res->pg.res, res->pg.iter, field); } +static void SMSDPgSQL_LogError(GSM_SMSDConfig * Config, PGresult * Res) +{ + if (Res == NULL) { + SMSD_Log(DEBUG_INFO, Config, "Error: %s", PQerrorMessage(Config->conn.pg)); + } else { + SMSD_Log(DEBUG_INFO, Config, "Error: %s", PQresultErrorMessage(Res)); + } +} + /* Disconnects from a database */ void SMSDPgSQL_Free(GSM_SMSDConfig * Config) { @@ -65,7 +74,8 @@ void SMSDPgSQL_Free(GSM_SMSDConfig * Config) static GSM_Error SMSDPgSQL_Connect(GSM_SMSDConfig * Config) { unsigned char buf[400]; - PGresult *Res; + PGresult *rc; + int Status; unsigned int port = 5432; char *pport; @@ -86,8 +96,12 @@ static GSM_Error SMSDPgSQL_Connect(GSM_SMSDConfig * Config) return ERR_DB_CONNECT; } - Res = PQexec(Config->conn.pg, "SET NAMES UTF8"); - PQclear(Res); + rc = PQexec(Config->conn.pg, "SET NAMES 'UTF8'"); + if ((rc == NULL) || ((Status = PQresultStatus(rc)) != PGRES_COMMAND_OK && (Status != PGRES_TUPLES_OK))) { + SMSDPgSQL_LogError(Config, rc); + return ERR_DB_CONNECT; + } + PQclear(rc); SMSD_Log(DEBUG_INFO, Config, "Connected to database: %s on %s. Server version: %d Protocol: %d", PQdb(Config->conn.pg), PQhost(Config->conn.pg), PQserverVersion(Config->conn.pg), PQprotocolVersion(Config->conn.pg)); @@ -108,15 +122,6 @@ int SMSDPgSQL_NextRow(GSM_SMSDConfig * Config, SQL_result *res) return 0; } -static void SMSDPgSQL_LogError(GSM_SMSDConfig * Config, PGresult * Res) -{ - if (Res == NULL) { - SMSD_Log(DEBUG_INFO, Config, "Error: %s", PQerrorMessage(Config->conn.pg)); - } else { - SMSD_Log(DEBUG_INFO, Config, "Error: %s", PQresultErrorMessage(Res)); - } -} - static GSM_Error SMSDPgSQL_Query(GSM_SMSDConfig * Config, const char *query, SQL_result * Res) { ExecStatusType Status = PGRES_COMMAND_OK; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e435740..f7005a1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -153,17 +153,17 @@ if (WITH_BACKUP) target_link_libraries(smsbackup libGammu ${LIBINTL_LIBRARIES}) # List test cases - file(GLOB VCARDS + file(GLOB SMSBACKUPS RELATIVE "${Gammu_SOURCE_DIR}/tests/smsbackups" "${Gammu_SOURCE_DIR}/tests/smsbackups/*.smsbackup") - list(SORT VCARDS) + list(SORT SMSBACKUPS) - foreach(TESTVCARD ${VCARDS}) - string(REPLACE .smsbackup "" TESTNAME ${TESTVCARD}) + foreach(TESTSMSBACKUP ${SMSBACKUPS}) + string(REPLACE .smsbackup "" TESTNAME ${TESTSMSBACKUP}) add_test("smsbackup-${TESTNAME}" "${GAMMU_TEST_PATH}/smsbackup${CMAKE_EXECUTABLE_SUFFIX}" - "${Gammu_SOURCE_DIR}/tests/smsbackups/${TESTVCARD}") - endforeach(TESTVCARD $VCARDS) + "${Gammu_SOURCE_DIR}/tests/smsbackups/${TESTSMSBACKUP}") + endforeach(TESTSMSBACKUP $SMSBACKUPS) endif (WITH_BACKUP) if (WITH_BACKUP) diff --git a/tests/debug.c b/tests/debug.c index 397d3a2..eab454c 100644 --- a/tests/debug.c +++ b/tests/debug.c @@ -26,21 +26,22 @@ void check_log(FILE * f, gboolean match, const char *test_name) char buff[100]; char test_message[] = "T3ST M3S5AG3"; char cleaner[] = "XXXXXXXXXXXXXXXXX"; - int result; + size_t result; + int cmp; rewind(f); GSM_LogError(s, test_message, ERR_MOREMEMORY); rewind(f); result = fread(buff, 1, sizeof(test_message), f); if (match && result != sizeof(test_message)) { - printf("%s: Read failed (%d)!\n", test_name, result); + printf("%s: Read failed (%ld)!\n", test_name, (long)result); fail(10); } if (!match && result != sizeof(test_message)) { goto done; } - result = strncmp(test_message, buff, sizeof(test_message) - 1); - if (match && result != 0) { + cmp = strncmp(test_message, buff, sizeof(test_message) - 1); + if (match && cmp != 0) { printf("%s: Match failed!\n", test_name); fail(11); } diff --git a/tests/smsbackups/mms-298.smsbackup b/tests/smsbackups/mms-298.smsbackup new file mode 100644 index 0000000..22f87d3 --- /dev/null +++ b/tests/smsbackups/mms-298.smsbackup @@ -0,0 +1,24 @@ +; This file format was designed for Gammu and is compatible with Gammu+ +; See for more info +; Saved 20100114T220009 (Čt 14. leden 2010, 22:00:09 ) + +[SMSBackup000] +SMSC = "+420603052000" +SMSCUnicode = 002B003400320030003600300033003000350032003000300030 +PDU = Deliver +DateTime = 20100114T204215 +State = Read +Number = "5574" +NumberUnicode = 0035003500370034 +Name = "" +NameUnicode = +UDH = 0B05040B8423F00003AA0101 +Text00 = 2e06246170706c69636174696f6e2f766e642e7761702e6d6d732d6d65737361676500af848c82983831333433393734406d6d7331008d928918802b33323437363439333231312f545950453d504c4d4e0096008f8186818a808e0303e17b8805810303f48083687474703a2f2f6d74732f3f69643d383133343339373400 +Coding = 8bit +Folder = 3 +Length = 127 +Class = 1 +ReplySMSC = False +RejectDuplicates = False +ReplaceMessage = 0 +MessageReference = 0 diff --git a/tests/utf-8.c b/tests/utf-8.c index f28104b..03e50bb 100644 --- a/tests/utf-8.c +++ b/tests/utf-8.c @@ -11,9 +11,11 @@ int main(int argc UNUSED, char **argv UNUSED) { - unsigned char out[20]; + unsigned char out[200], out2[200]; gammu_char_t dest; size_t i; + const char input[] = "005400680061006E006B00200079006F0075002E002000570065002000770069006C006C00200063006F006E007400610063007400200079006F007500200073006F006F006E00200078006F0078006F00200078006F0078006F00200061006E0064002000490020D83DDE18D83DDE18D83DDE18D83DDE18D83DDE18D83DDE18D83DDE18D83D"; + const char expected[] = "Thank you. We will contact you soon xoxo xoxo and I 😘😘😘😘😘😘😘�"; test_result(EncodeWithUTF8Alphabet(0x24, out) == 1); test_result(out[0] == 0x24); @@ -58,6 +60,14 @@ int main(int argc UNUSED, char **argv UNUSED) test_string("\x00\x61\x00h\x00o\x00j\x00\x00\x00", out, 10); - return 0; + /* Decode hex encoded unicode */ + test_result(DecodeHexUnicode(out, input, strlen(input))); + test_string("\x00T\x00h\x00\x61\x00n\x00k\x00", out, 10); + + /* Convert it to UTF-8 */ + test_result(EncodeUTF8(out2, out)); + test_string(expected, out2, strlen(expected)); + + return 0; } -- cgit v1.2.3