├── .clang-format ├── .gitattributes ├── .gitignore ├── .gitlab-ci.yml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── COPYING-DOCS ├── NEWS ├── README.dev.org ├── README.mingw ├── README.mingw64_msys2 ├── README.org ├── README.windows.in ├── config-cmake.h.in ├── docs ├── mainwindow.png ├── manual.org └── scoring.org ├── help ├── C │ ├── figures │ │ └── pan_window.png │ ├── index.docbook │ └── legal.xml ├── CMakeLists.txt ├── cs │ └── cs.po ├── de │ └── de.po ├── es │ └── es.po └── sv │ └── sv.po ├── mknews ├── org.gnome.pan.desktop.in ├── org.gnome.pan.metainfo.xml.in ├── org.gnome.pan.service.in ├── pan.1 ├── pan.doap ├── pan.iss.in ├── pan ├── CMakeLists.txt ├── data-impl │ ├── CMakeLists.txt │ ├── article-filter.cc │ ├── article-filter.h │ ├── article-rules.cc │ ├── article-rules.h │ ├── data-impl.cc │ ├── data-impl.h │ ├── data-io.cc │ ├── data-io.h │ ├── groups.cc │ ├── headers-test.cc │ ├── headers.cc │ ├── memchunk.h │ ├── my-tree.cc │ ├── profiles.cc │ ├── profiles.h │ ├── server.cc │ ├── speed-test-load-group.cc │ ├── task-archive.cc │ └── xover.cc ├── data │ ├── CMakeLists.txt │ ├── article-cache.cc │ ├── article-cache.h │ ├── article-test.cc │ ├── article.cc │ ├── article.h │ ├── cert-store.cc │ ├── cert-store.h │ ├── data.cc │ ├── data.h │ ├── decode-test-cache │ │ ├── apostrophe.msg │ │ ├── collision.msg │ │ ├── micro.msg │ │ ├── noisy_1_2.msg │ │ ├── noisy_2_2.msg │ │ ├── penguin_1_2.msg │ │ ├── penguin_2_2.msg │ │ ├── two_mime_attachments.msg │ │ ├── two_uu_attachments.msg │ │ ├── xuuencode.msg │ │ ├── yenc.msg │ │ ├── yenc_1_2.msg │ │ └── yenc_2_2.msg │ ├── encode-cache.cc │ ├── encode-cache.h │ ├── parts.cc │ ├── parts.h │ ├── server-info.h │ ├── xref-test.cc │ ├── xref.cc │ └── xref.h ├── general │ ├── CMakeLists.txt │ ├── article_number.cc │ ├── article_number.h │ ├── compression.cc │ ├── compression.h │ ├── debug.cc │ ├── debug.h │ ├── e-util.cc │ ├── e-util.h │ ├── file-util.cc │ ├── file-util.h │ ├── line-reader.cc │ ├── line-reader.h │ ├── locking.h │ ├── log.cc │ ├── log.h │ ├── macros.h │ ├── map-vector.h │ ├── messages.h │ ├── progress-test.cc │ ├── progress.cc │ ├── progress.h │ ├── quark-test.cc │ ├── quark.cc │ ├── quark.h │ ├── singleton-template.h │ ├── sorted-vector.h │ ├── string-view-test.cc │ ├── string-view.cc │ ├── string-view.h │ ├── test.h │ ├── text-match-test.cc │ ├── text-match.cc │ ├── text-match.h │ ├── time-elapsed.h │ ├── utf8-utils.cc │ ├── utf8-utils.h │ ├── worker-pool.cc │ └── worker-pool.h ├── gui │ ├── CMakeLists.txt │ ├── action-manager.h │ ├── actions-extern.h │ ├── actions.cc │ ├── actions.h │ ├── body-pane.cc │ ├── body-pane.h │ ├── dl-headers-ui.cc │ ├── dl-headers-ui.h │ ├── e-action-combo-box.c │ ├── e-action-combo-box.h │ ├── e-charset-combo-box.c │ ├── e-charset-combo-box.h │ ├── e-charset-dialog.c │ ├── e-charset-dialog.h │ ├── e-charset.c │ ├── e-charset.h │ ├── e-cte-dialog.c │ ├── e-cte-dialog.h │ ├── editor-spawner.cc │ ├── editor-spawner.h │ ├── group-pane.cc │ ├── group-pane.h │ ├── group-prefs-dialog.cc │ ├── group-prefs-dialog.h │ ├── group-prefs.cc │ ├── group-prefs.h │ ├── gui.cc │ ├── gui.h │ ├── header-pane.cc │ ├── header-pane.h │ ├── hig.cc │ ├── hig.h │ ├── license.h │ ├── load-icon.cc │ ├── load-icon.h │ ├── log-ui.cc │ ├── log-ui.h │ ├── my-massif.sh │ ├── my-valgrind.sh │ ├── pad.h │ ├── pan-colors.h │ ├── pan-file-entry.cc │ ├── pan-file-entry.h │ ├── pan-tree.cc │ ├── pan-tree.h │ ├── pan-ui.h │ ├── pan.cc │ ├── pan.manifest.xml │ ├── pan.ui.h │ ├── panrc.rc │ ├── post-ui.cc │ ├── post-ui.h │ ├── post.ui.h │ ├── prefs-file.cc │ ├── prefs-file.h │ ├── prefs-ui.cc │ ├── prefs-ui.h │ ├── prefs.cc │ ├── prefs.h │ ├── profiles-dialog.cc │ ├── profiles-dialog.h │ ├── progress-view.cc │ ├── progress-view.h │ ├── render-bytes.cc │ ├── render-bytes.h │ ├── save-attach-ui.cc │ ├── save-attach-ui.h │ ├── save-ui.cc │ ├── save-ui.h │ ├── score-add-ui.cc │ ├── score-add-ui.h │ ├── score-view-ui.cc │ ├── score-view-ui.h │ ├── server-ui.cc │ ├── server-ui.h │ ├── startup-sysprof.sh │ ├── tango-colors.h │ ├── task-pane.cc │ ├── task-pane.h │ ├── taskpane.ui.h │ ├── url.cc │ ├── url.h │ ├── wait.h │ ├── xface.c │ └── xface.h ├── icons │ ├── CMakeLists.txt │ ├── Pan.ico │ ├── hicolor_apps_16x16_org.gnome.pan.png │ ├── hicolor_apps_24x24_org.gnome.pan.png │ ├── hicolor_apps_256x256_org.gnome.pan.png │ ├── hicolor_apps_32x32_org.gnome.pan.png │ ├── hicolor_apps_48x48_org.gnome.pan.png │ ├── icon_article_read.png │ ├── icon_article_unread.png │ ├── icon_binary_complete.png │ ├── icon_binary_complete_read.png │ ├── icon_binary_incomplete.png │ ├── icon_binary_incomplete_read.png │ ├── icon_bluecheck.png │ ├── icon_by_me.png │ ├── icon_by_others.png │ ├── icon_cert.png │ ├── icon_collapse_thread.png │ ├── icon_compose_followup.png │ ├── icon_compose_post.png │ ├── icon_disk.png │ ├── icon_empty.png │ ├── icon_expand_thread.png │ ├── icon_filter.png │ ├── icon_filter_only_attachments.png │ ├── icon_filter_only_cached.png │ ├── icon_filter_only_me.png │ ├── icon_filter_only_read.png │ ├── icon_filter_only_unread.png │ ├── icon_filter_only_watched.png │ ├── icon_get_dialog.png │ ├── icon_get_flagged.png │ ├── icon_get_selected.png │ ├── icon_get_subscribed.png │ ├── icon_layout_1.png │ ├── icon_layout_2.png │ ├── icon_layout_3.png │ ├── icon_layout_4.png │ ├── icon_layout_5.png │ ├── icon_mozilla_frown.png │ ├── icon_mozilla_smile.png │ ├── icon_mozilla_surprised.png │ ├── icon_mozilla_tongueout.png │ ├── icon_mozilla_wink.png │ ├── icon_pan.png │ ├── icon_pan_about_logo.png │ ├── icon_pan_about_logo.xcf │ ├── icon_pan_logo.xcf │ ├── icon_plain.png │ ├── icon_prefs_actions.png │ ├── icon_prefs_applications.png │ ├── icon_prefs_behavior.png │ ├── icon_prefs_colors.png │ ├── icon_prefs_extras.png │ ├── icon_prefs_fonts.png │ ├── icon_prefs_headers.png │ ├── icon_prefs_hotkeys.png │ ├── icon_prefs_layout.png │ ├── icon_prefs_panes.png │ ├── icon_prefs_upload.png │ ├── icon_read_group.png │ ├── icon_read_less.png │ ├── icon_read_more.png │ ├── icon_read_unread_article.png │ ├── icon_read_unread_thread.png │ ├── icon_red_flag.png │ ├── icon_refresh.png │ ├── icon_score.png │ ├── icon_search_pulldown.png │ ├── icon_show_signature.png │ ├── icon_sig_fail.png │ ├── icon_sig_ok.png │ ├── icon_status_active.png │ ├── icon_status_error.png │ ├── icon_status_idle.png │ ├── icon_status_new_articles.png │ ├── icon_status_offline.png │ ├── icon_status_online.png │ ├── icon_status_queue_empty.png │ ├── icon_tabbar.png │ ├── icon_x.png │ └── pan-template.xcf ├── pan.cfg ├── tasks │ ├── CMakeLists.txt │ ├── adaptable-set-test.cc │ ├── adaptable-set.cc │ ├── adaptable-set.h │ ├── decoder.cc │ ├── decoder.h │ ├── encoder.cc │ ├── encoder.h │ ├── health.h │ ├── nntp-pool.cc │ ├── nntp-pool.h │ ├── nntp.cc │ ├── nntp.h │ ├── nzb-test.cc │ ├── nzb.cc │ ├── nzb.h │ ├── queue.cc │ ├── queue.h │ ├── socket-impl-gio.cc │ ├── socket-impl-gio.h │ ├── socket-impl-main.cc │ ├── socket-impl-main.h │ ├── socket-impl-openssl.cc │ ├── socket-impl-openssl.h │ ├── socket-impl-scripted.cc │ ├── socket-impl-scripted.h │ ├── socket.cc │ ├── socket.h │ ├── task-article.cc │ ├── task-article.h │ ├── task-groups.cc │ ├── task-groups.h │ ├── task-post.cc │ ├── task-post.h │ ├── task-upload.cc │ ├── task-upload.h │ ├── task-weak-ordering.h │ ├── task-xover.cc │ ├── task-xover.h │ ├── task.cc │ ├── task.h │ ├── upload-queue.cc │ └── upload-queue.h └── usenet-utils │ ├── CMakeLists.txt │ ├── MersenneTwister.h │ ├── blowfish.cc │ ├── blowfish.h │ ├── blowfish_cyphers.h │ ├── filter-info.cc │ ├── filter-info.h │ ├── gnksa-test.cc │ ├── gnksa.cc │ ├── gnksa.h │ ├── gpg.cc │ ├── gpg.h │ ├── message-check-test.cc │ ├── message-check.cc │ ├── message-check.h │ ├── mime-utils.cc │ ├── mime-utils.h │ ├── numbers-test.cc │ ├── numbers.cc │ ├── numbers.h │ ├── rules-info.cc │ ├── rules-info.h │ ├── scorefile-test.cc │ ├── scorefile.cc │ ├── scorefile.h │ ├── ssl-utils.cc │ ├── ssl-utils.h │ ├── text-massager-test.cc │ ├── text-massager.cc │ ├── text-massager.h │ ├── url-find-test.cc │ ├── url-find.cc │ └── url-find.h ├── po ├── CMakeLists.txt ├── LINGUAS ├── Makevars ├── POTFILES.in ├── POTFILES.skip ├── am.po ├── ar.po ├── az.po ├── bg.po ├── bs.po ├── ca.po ├── cs.po ├── da.po ├── de.po ├── dz.po ├── el.po ├── en_CA.po ├── en_GB.po ├── eo.po ├── es.po ├── et.po ├── eu.po ├── fi.po ├── fr.po ├── ga.po ├── gl.po ├── hr.po ├── hu.po ├── id.po ├── ie.po ├── it.po ├── ja.po ├── ka.po ├── ko.po ├── lt.po ├── lv.po ├── ms.po ├── nb.po ├── nl.po ├── oc.po ├── pl.po ├── pt.po ├── pt_BR.po ├── ro.po ├── ru.po ├── sk.po ├── sl.po ├── sq.po ├── sr.po ├── sr@latin.po ├── sv.po ├── tr.po ├── uk.po ├── vi.po ├── zh_CN.po └── zh_TW.po ├── uulib ├── CMakeLists.txt ├── crc32.c ├── crc32.h ├── fptools.c ├── fptools.h ├── uucheck.c ├── uudeview.h ├── uuencode.c ├── uuint.h ├── uulib.c ├── uunconc.c ├── uuscan.c ├── uustring.c ├── uustring.h └── uuutil.c └── wininstall.py /.gitattributes: -------------------------------------------------------------------------------- 1 | configure.ac export-subst 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | ABOUT-NLS 3 | *.a 4 | *.bak 5 | *.exe 6 | *.o 7 | build/ 8 | ChangeLog 9 | .deps 10 | help/*/*.mo 11 | help/*/*.stamp 12 | help/*/index.docbook 13 | !help/C/index.docbook 14 | install-sh 15 | missing 16 | mkinstalldirs 17 | org.gnome.pan.desktop 18 | org.gnome.pan.metainfo.xml 19 | pan-git.version 20 | pan/icons/pan-pixbufs.h 21 | pan/icons/pan-pixbufs-internal.h 22 | pan.iss 23 | po/boldquot.sed 24 | po/en@boldquot.header 25 | po/en@quot.header 26 | po/*.gmo 27 | po/insert-header.sin 28 | po/Makevars.template 29 | po/pan.pot 30 | po/POTFILES 31 | po/quot.sed 32 | po/remove-potcdate.sed 33 | po/remove-potcdate.sin 34 | po/Rules-quot 35 | po/stamp-po 36 | README.windows 37 | stamp-h1 38 | Thumbs.db 39 | .waf*/ 40 | waf*/ 41 | cppcheck-*.log.txt 42 | *.gcov 43 | *.gcda 44 | *.gcno 45 | *-test.log 46 | *-test.trs 47 | test-suite.log 48 | test-driver 49 | std-build/ 50 | compile_commands.json 51 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - build 3 | 4 | variables: 5 | DEBIAN_FRONTEND: noninteractive 6 | 7 | cmake-ubuntu: 8 | image: ubuntu:rolling 9 | stage: build 10 | variables: 11 | BUILD_DIR: cmake-build 12 | except: 13 | - tags 14 | before_script: 15 | - apt-get update 16 | - apt-get install -q -y --no-install-recommends 17 | build-essential 18 | cmake 19 | gettext 20 | gcc 21 | itstool 22 | libglib2.0-dev-bin 23 | libdbus-1-dev 24 | libgcr-3-dev 25 | libgmime-3.0-dev 26 | libgnutls28-dev 27 | libgtk-3-dev 28 | libnotify-dev 29 | libsecret-1-dev 30 | libgspell-1-dev 31 | script: 32 | - mkdir $BUILD_DIR 33 | - >- 34 | cmake 35 | -DENABLE_MANUAL=1 36 | -DWANT_DBUS=1 37 | -DWANT_GKR=1 38 | -DWANT_NOTIFY=1 39 | -B $BUILD_DIR 40 | - cmake --build $BUILD_DIR 41 | 42 | cmake-ubuntu-bare-bones: 43 | image: ubuntu:rolling 44 | stage: build 45 | variables: 46 | BUILD_DIR: cmake-build 47 | except: 48 | - tags 49 | before_script: 50 | - apt-get update 51 | - apt-get install -q -y --no-install-recommends 52 | build-essential 53 | cmake 54 | gettext 55 | gcc 56 | libglib2.0-dev-bin 57 | libgmime-3.0-dev 58 | libgtk-3-dev 59 | libsecret-1-dev 60 | script: 61 | - mkdir $BUILD_DIR 62 | - >- 63 | cmake 64 | -D WANT_GNUTLS=off 65 | -D WANT_GSPELL=off 66 | -B $BUILD_DIR 67 | - cmake --build $BUILD_DIR 68 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Please see the README.org file for information on how to report bugs. 2 | 3 | PAN AUTHOR 4 | 5 | Charles Kerr 6 | 7 | CONTRIBUTORS 8 | 9 | Heinrich Müller 10 | Kenneth Haley 11 | Petr Kovar 12 | Calin Culianu 13 | 14 | ORIGINAL PAN DEVELOPMENT 15 | 16 | Charles Kerr 17 | Christophe Lambin 18 | Matt Eagleson 19 | 20 | For a complete list of contributors, see the NEWS file. 21 | -------------------------------------------------------------------------------- /README.dev.org: -------------------------------------------------------------------------------- 1 | * Information for developers 2 | 3 | ** How to create a release 4 | 5 | - Run =./mknews = and cut'n'paste the information you 6 | want in [[file:NEWS][NEWS]] file 7 | - update [[file:NEWS][NEWS]] file to feature the new version number and code 8 | name. Pan release number and title are extracted from this file, so 9 | please make sure that the first line of the file is: 10 | #+begin_example 11 | "" <whatever> 12 | #+end_example 13 | - commit the changes 14 | - create a signed tag on master 15 | - push the modifications and tag 16 | - click on release button on gitlab 17 | - send a mail to all pan mailing lists. 18 | 19 | ** Useful links 20 | 21 | - [[https://developer.gnome.org/documentation/index.html][GNOME Developer Documentation]] 22 | -------------------------------------------------------------------------------- /README.mingw64_msys2: -------------------------------------------------------------------------------- 1 | Instructions for msys2/mingw64 2 | 3 | 4 | See https://www.mingw-w64.org/ 5 | https://www.msys2.org/ 6 | 7 | Install msys2 as per instructions. You will also need to install 8 | $ pacman -S mingw-w64-x86_64-pcre mingw-w64-x86_64-gmime gspell 9 | 10 | To run wininstall, you will also need mingw-w64-x86_64-python-pip 11 | 12 | Also for the sake of your own sanity, add 'export MSYS=winsymlinks:native' to your .bash_profile 13 | 14 | $ pacman -S mingw-w64-x86_64-gtkspell3 15 | 16 | You also need some dictionaries to spell check against! 17 | $ pacman -S mingw-w64-x86_64-hunspell-en 18 | 19 | and this (possibly optional, but...) 20 | $ pacman -S mingw-w64-x86_64-iso-codes 21 | 22 | Then you can create an msys2 x64 window and build with cmake as per README.org instructions. 23 | 24 | NOTE: enchant is somewhat broken under mingw64 and cannot find the appropriate libraries as it appears to expect to find at least 'lib/enchant-2' in the the same directory as the executable. You might want to create a soft link or copy. If you run wininstall, it copies the appropriate directories to the same place as the executable, and works fine. Go figure. 25 | 26 | Haven't tried these yet (these are the automake switches so not quite cmake): 27 | 28 | 1. --with-dbus 29 | 30 | 2. libnotify: autogen with --enable-libnotify 31 | $ pacman -S mingw-w64-x86_64-libnotify 32 | 33 | 3. --with-yelp-tools --enable-manual for user manual (can build but have no idea how to install) 34 | $ pacman -S yelp-tools 35 | 36 | 4. --enable-gkr for gnome keyring (gtk2 and 3 different for this, not sure if this is necessary) 37 | 38 | 5. --with-gnutls 39 | 40 | 5. --with-webkit 41 | 42 | and `make`. 43 | 44 | If you want a windows theme in gtk3, run 45 | ``` 46 | mkdir ./etc/gtk-3.0 47 | cat > ./etc/gtk-3.0/settings.ini 48 | [Settings] 49 | gtk-theme-name=win32 50 | <ctrl-d> 51 | 52 | If you want other themes, you can install them in share/themes in the target directory. 53 | 54 | To add: 55 | 56 | 57 | - [[https://developer.gnome.org/libsecret/][libsecret]] 0.16 or higher and [[https://developer.gnome.org/gcr/][gcr]] 3.20 or higher for password storage 58 | 59 | ([[https://wiki.gnome.org/Projects/GnomeKeyring][GNOME Keyring]] 3.2.0 or higher when using GTK 2) 60 | 61 | - [[http://www.freedesktop.org/wiki/Software/dbus][D-Bus]] to support running multiple Pan instances 62 | 63 | - [[http://www.gnu.org/software/gnutls/][GnuTLS]] 3.0.0 or higher for encrypted connections (TLS 1.x) 64 | -------------------------------------------------------------------------------- /README.windows.in: -------------------------------------------------------------------------------- 1 | 2 | http://pan.rebelbase.com/download/releases/@VERSION@/ 3 | has a full list of changes since the previous release. 4 | 5 | On Windows, Pan requires GTK @GTK_REQUIRED@ or higher, which can be found at 6 | <http://gtk-win.sourceforge.net/>. 7 | 8 | Found a bug? Have a suggestion? 9 | Send feedback to the pan-users@nongnu.org mailing list. 10 | 11 | Information on building Pan on Windows can be found at 12 | <https://gitlab.gnome.org/GNOME/pan/raw/master/README.mingw>. 13 | 14 | See the following page for more information on Pan builds for Windows: 15 | <http://pan.rebelbase.com/download/>. 16 | 17 | -------------------------------------------------------------------------------- /docs/mainwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/docs/mainwindow.png -------------------------------------------------------------------------------- /help/C/figures/pan_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/help/C/figures/pan_window.png -------------------------------------------------------------------------------- /help/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # need to build docbook 2 | # see https://build.opensuse.org/package/live_build_log/openSUSE:Factory/pan/standard/x86_64 3 | 4 | if (ENABLE_MANUAL) 5 | 6 | # https://cmake.org/cmake/help/latest/command/find_program.html 7 | find_program(has_itstool NAMES itstool REQUIRED) 8 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/C/figures") 9 | set(png_path "figures/pan_window.png") 10 | file(COPY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/C/${png_path}" "${CMAKE_CURRENT_BINARY_DIR}/C/${png_path}") 11 | file(COPY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/C/index.docbook" "${CMAKE_CURRENT_BINARY_DIR}/C/index.docbook") 12 | 13 | set(lang_list cs de es sv) 14 | foreach(lang IN LISTS lang_list) 15 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${lang}/figures") 16 | add_custom_target( 17 | "${lang}-docbook" ALL 18 | BYPRODUCTS "${lang}/${lang}.mo" 19 | DEPENDS "${lang}/${lang}.po" 20 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${lang}" 21 | COMMAND msgfmt -o "${lang}.mo" "${CMAKE_CURRENT_SOURCE_DIR}/${lang}/${lang}.po" 22 | COMMAND itstool -m "${lang}.mo" "${CMAKE_CURRENT_SOURCE_DIR}/C/index.docbook" 23 | ) 24 | file(CREATE_LINK "../../../C/pan/${png_path}" "${CMAKE_CURRENT_BINARY_DIR}/${lang}/${png_path}" SYMBOLIC) 25 | endforeach() 26 | 27 | foreach(lang IN LISTS lang_list ITEMS C) 28 | # https://cmake.org/cmake/help/latest/command/install.html#files 29 | install( 30 | FILES "${CMAKE_CURRENT_BINARY_DIR}/${lang}/index.docbook" 31 | DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/help/${lang}/pan/" 32 | ) 33 | install( 34 | FILES "${CMAKE_CURRENT_BINARY_DIR}/${lang}/${png_path}" 35 | DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/help/${lang}/pan/figures" 36 | ) 37 | endforeach() 38 | 39 | install(FILES "C/legal.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/help/C/pan/") 40 | 41 | endif() 42 | -------------------------------------------------------------------------------- /mknews: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Based on shaunm's simple NEWS entry generator: 3 | # https://gitlab.gnome.org/GNOME/gnome-user-docs/raw/master/mknews 4 | 5 | if [ "$#" != "1" ]; then 6 | echo "Usage: mknews PREVTAG" 1>&2 7 | exit 1 8 | fi 9 | 10 | commits=`git log ${1}.. --pretty="format: %h %s (%an)" -- . ":!po"` 11 | echo "$commits" 12 | 13 | echo '* Contributors to this release:' 14 | contrib=`git log ${1}.. --pretty=format:%an, -- . ":!po" | sort | uniq -c | sort -rn | sed -e 's/^ *[0-9]\+ \+//'` 15 | echo ' '$contrib'' | grep -v '()$' | sed -e 's/,$//' 16 | 17 | spc=' ' 18 | echo '* Updated translations:' 19 | find . -name '*.po' -exec basename {} .po \; | sort -u | while read lc; do 20 | contrib=`git log ${1}.. --pretty=format:%an, po/${lc}.po | sort | uniq -c | sort -rn | sed -e 's/^ *[0-9]\+ \+//'` 21 | echo " $lc${spc:0:((10-${#lc}))}("$contrib")" 22 | done | grep -v '()$' | sed -e 's/,)$/)/' 23 | 24 | -------------------------------------------------------------------------------- /org.gnome.pan.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Pan 3 | GenericName=Newsreader 4 | Comment=Read and post Usenet articles 5 | # Translators: Search terms to find this application. Do NOT translate or localise the semicolons! The list MUST also end with a semicolon! 6 | Keywords=usenet;news;newsreader;newsgroup;article;yenc;nzb; 7 | Exec=pan %U 8 | MimeType=application/x-nzb; 9 | # Translators: Do NOT translate or transliterate this text (this is an icon file name)! 10 | Icon=org.gnome.pan 11 | Terminal=false 12 | Type=Application 13 | Categories=GTK;Network;News; 14 | StartupNotify=false 15 | -------------------------------------------------------------------------------- /org.gnome.pan.metainfo.xml.in: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!-- Copyright 2015 Petr Kovar <pknbe@volny.cz> --> 3 | <component type="desktop-application"> 4 | <id>org.gnome.pan</id> 5 | <metadata_license>CC0-1.0</metadata_license> 6 | <name>Pan Newsreader</name> 7 | <summary>Read and post Usenet articles</summary> 8 | <description> 9 | <p>Pan is a Usenet newsreader that is good at both text and binaries. It 10 | supports offline reading, scoring and killfiles, yEnc, NZB, PGP handling, 11 | multiple servers, and secure connections.</p> 12 | <p>It is also the only Unix newsreader to get a perfect score on the Good 13 | Net-Keeping Seal of Approval evaluations.</p> 14 | </description> 15 | <launchable type="desktop-id">org.gnome.pan.desktop</launchable> 16 | <provides> 17 | <binary>pan</binary> 18 | </provides> 19 | <screenshots> 20 | <screenshot type="default" height="902" width="1344"> 21 | <image>https://gitlab.gnome.org/GNOME/pan/raw/HEAD/docs/mainwindow.png</image> 22 | </screenshot> 23 | </screenshots> 24 | <url type="homepage">https://gitlab.gnome.org/GNOME/pan</url> 25 | <update_contact>pan-users@nongnu.org</update_contact> 26 | <project_license>GPL-2.0</project_license> 27 | <developer_name>Pan</developer_name> 28 | <url type="bugtracker">https://gitlab.gnome.org/GNOME/pan/issues</url> 29 | <url type="help">https://gitlab.gnome.org/GNOME/pan/-/blob/master/docs/manual.org</url> 30 | <url type="translate">https://l10n.gnome.org/module/pan/</url> 31 | <url type="vcs-browser">https://gitlab.gnome.org/GNOME/pan</url> 32 | <translation type="gettext">pan</translation> 33 | <content_rating type="oars-1.0"> 34 | <content_attribute id="language-humor">mild</content_attribute> 35 | <content_attribute id="social-chat">intense</content_attribute> 36 | <content_attribute id="social-contacts">intense</content_attribute> 37 | </content_rating> 38 | </component> 39 | -------------------------------------------------------------------------------- /org.gnome.pan.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=@PAN_DBUS_SERVICE_NAME@ 3 | Exec=@CMAKE_INSTALL_FULL_BINDIR@/pan 4 | -------------------------------------------------------------------------------- /pan.1: -------------------------------------------------------------------------------- 1 | .TH PAN 1 2 | .SH NAME 3 | Pan \- read and post Usenet articles 4 | .SH SYNOPSIS 5 | .B pan 6 | [\fIOPTIONS...\fR] 7 | [\fBheaders\fR:\fIGROUP-NAME\fR | \fBnews\fR:\fIMESSAGE-ID\fR] 8 | .SH DESCRIPTION 9 | \fBPan\fR is a Usenet newsreader that is good at both text and binaries. 10 | It supports offline reading, scoring and killfiles, yEnc, NZB, PGP 11 | handling, multiple servers, and secure connections. 12 | .SH USAGE 13 | \fBpan\fR is a program that can be run headless in non-GUI mode, allowing 14 | for batch processing of NZB files, downloading headers, and more. 15 | .SH OPTIONS 16 | .SS "General Options" 17 | .TP 18 | .B \-h, \-\-help 19 | Print usage information and exit. 20 | .TP 21 | .B \-v, \-\-version 22 | Print release version and exit. 23 | .TP 24 | .B \-\-verbose 25 | Be verbose (in non-GUI mode). 26 | .TP 27 | .B \-\-debug 28 | Run in debug mode. Use --debug twice for verbose debug. 29 | .TP 30 | .B \-\-debug-ssl 31 | Run in TLS (aka SSL) debug mode. 32 | .SS "URL Options" 33 | .TP 34 | .BR headers:\fIGROUP-NAME\fR 35 | Download new headers for the \fIGROUP-NAME\fR newsgroup. 36 | .TP 37 | .B news:\fIMESSAGE-ID\fR 38 | When specified together with \fB\-\-no-gui\fR, dump the \fIMESSAGE-ID\fR 39 | article to standard output. 40 | .SS "NZB Batch Options" 41 | .TP 42 | .B \-\-nzb \fIFILE-1 FILE-2 ...\fR 43 | Process NZB files in non-GUI mode. 44 | .TP 45 | .B \-o, \-\-output=\fIPATH\fR 46 | Path to save attachments listed in the NZB file(s). 47 | .TP 48 | .B \-\-no-gui 49 | Only show console output, not the download queue. 50 | .SH ENVIRONMENT 51 | .TP 52 | .B PAN_HOME 53 | User data directory to use. Defaults to \fI$HOME/.pan2\fR. 54 | .TP 55 | .B SSL_CERT_DIR, SSL_DIR 56 | Directories to search for SSL certificates. 57 | .SH BUGS 58 | To report a bug, visit: \fIhttp://pan.rebelbase.com/bugs/\fR -------------------------------------------------------------------------------- /pan.doap: -------------------------------------------------------------------------------- 1 | <Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 2 | xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 3 | xmlns:foaf="http://xmlns.com/foaf/0.1/" 4 | xmlns:gnome="http://api.gnome.org/doap-extensions#" 5 | xmlns="http://usefulinc.com/ns/doap#"> 6 | 7 | <name xml:lang="en">Pan</name> 8 | <shortdesc xml:lang="en">Read and post Usenet articles</shortdesc> 9 | <description xml:lang="en"> 10 | Pan is a Usenet newsreader that is good at both text and binaries. It supports 11 | offline reading, scoring and killfiles, yEnc, NZB, PGP handling, multiple 12 | servers, and secure connections. 13 | </description> 14 | <homepage rdf:resource="http://pan.rebelbase.com/" /> 15 | <mailing-list rdf:resource="http://lists.nongnu.org/mailman/listinfo/pan-users" /> 16 | <download-page rdf:resource="http://pan.rebelbase.com/download/" /> 17 | <bug-database rdf:resource="https://gitlab.gnome.org/GNOME/pan/issues/" /> 18 | <category rdf:resource="http://api.gnome.org/doap-extensions#apps" /> 19 | <programming-language>C++</programming-language> 20 | 21 | <maintainer> 22 | <foaf:Person> 23 | <foaf:name>Dominique Dumont</foaf:name> 24 | <gnome:userid>ddumont</gnome:userid> 25 | </foaf:Person> 26 | </maintainer> 27 | <maintainer> 28 | <foaf:Person> 29 | <foaf:name>Petr Kovar</foaf:name> 30 | <gnome:userid>pmkovar</gnome:userid> 31 | </foaf:Person> 32 | </maintainer> 33 | </Project> 34 | -------------------------------------------------------------------------------- /pan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # order of add_subdirectory is important 2 | foreach(subdir data data-impl general icons tasks usenet-utils gui) 3 | add_subdirectory(${subdir}) 4 | endforeach() 5 | -------------------------------------------------------------------------------- /pan/data-impl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(data-impl 2 | article-filter.cc 3 | article-rules.cc 4 | data-io.cc 5 | data-impl.cc 6 | groups.cc 7 | headers.cc 8 | profiles.cc 9 | server.cc 10 | my-tree.cc 11 | task-archive.cc 12 | xover.cc 13 | ) 14 | 15 | # Sanity checking 16 | # https://cmake.org/cmake/help/latest/command/add_compile_options.html 17 | target_compile_options(data-impl PRIVATE "${CXX_STD}" "-Wreorder" "-Wzero-as-null-pointer-constant") 18 | 19 | target_link_libraries(data-impl PUBLIC PkgConfig::GTK3) 20 | target_link_libraries(data-impl PUBLIC PkgConfig::GMIME) 21 | 22 | if(WANT_GNUTLS) 23 | target_link_libraries(data-impl PUBLIC PkgConfig::GNUTLS) 24 | endif() 25 | 26 | if(WANT_GKR) 27 | target_link_libraries(data-impl PUBLIC PkgConfig::LIBSECRET) 28 | target_link_libraries(data-impl PUBLIC PkgConfig::GCR3) 29 | endif() 30 | -------------------------------------------------------------------------------- /pan/data-impl/article-filter.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __ArticleFilter_h__ 21 | #define __ArticleFilter_h__ 22 | 23 | #include <pan/data/article.h> 24 | #include <pan/data/data.h> 25 | #include <pan/general/quark.h> 26 | #include <pan/usenet-utils/filter-info.h> 27 | #include <pan/usenet-utils/rules-info.h> 28 | #include <pan/usenet-utils/scorefile.h> 29 | 30 | namespace pan { 31 | /** 32 | * This private class should only be used by data-impl classes. 33 | * 34 | * It's used for implementing article filters as described by 35 | * FilterInfo in the 'backend interfaces' module. 36 | * 37 | * @ingroup data_impl 38 | */ 39 | class ArticleFilter 40 | { 41 | private: 42 | Quark const subject; 43 | Quark const from; 44 | Quark const xref; 45 | Quark const references; 46 | Quark const newsgroups; 47 | Quark const message_Id; 48 | Quark const message_ID; 49 | 50 | StringView const get_header(Article const &a, 51 | Quark const &header_name) const; 52 | 53 | public: 54 | ArticleFilter() : 55 | subject("Subject"), 56 | from("From"), 57 | xref("Xref"), 58 | references("References"), 59 | newsgroups("Newsgroups"), 60 | message_Id("Message-Id"), 61 | message_ID("Message-ID") 62 | { 63 | } 64 | 65 | typedef std::vector<Article const *> articles_t; 66 | 67 | void test_articles(Data const &data, 68 | FilterInfo const &criteria, 69 | Quark const &group, 70 | articles_t const &in, 71 | articles_t &setme_pass, 72 | articles_t &setme_fail) const; 73 | 74 | bool test_article(Data const &data, 75 | FilterInfo const &criteria, 76 | Quark const &group, 77 | Article const &article) const; 78 | 79 | typedef std::vector<Scorefile::Section const *> sections_t; 80 | 81 | int score_article(Data const &data, 82 | sections_t const &score, 83 | Quark const &group, 84 | Article const &article) const; 85 | 86 | void get_article_scores(Data const &data, 87 | sections_t const &score, 88 | Quark const &group, 89 | Article const &article, 90 | Scorefile::items_t &setme) const; 91 | }; 92 | } // namespace pan 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /pan/data-impl/article-rules.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __RulesFilter_h__ 21 | #define __RulesFilter_h__ 22 | 23 | #include <pan/data/article.h> 24 | #include <pan/data/data.h> 25 | #include <pan/general/quark.h> 26 | #include <pan/tasks/queue.h> 27 | #include <pan/usenet-utils/filter-info.h> 28 | #include <pan/usenet-utils/rules-info.h> 29 | #include <pan/usenet-utils/scorefile.h> 30 | 31 | namespace pan { 32 | /** 33 | * @ingroup data_impl 34 | */ 35 | class ArticleRules 36 | { 37 | 38 | public: 39 | ArticleRules(bool cache, bool dl) : 40 | _auto_cache_mark_read(cache), 41 | _auto_dl_mark_read(dl) 42 | { 43 | } 44 | 45 | bool apply_rules(Data &data, 46 | RulesInfo &rules, 47 | Quark const &group, 48 | Article &article); 49 | 50 | private: 51 | std::set<Article const *> _mark_read; 52 | std::set<Article const *> _delete; 53 | bool _auto_cache_mark_read, _auto_dl_mark_read; 54 | 55 | public: 56 | std::set<Article const *> _cached; 57 | std::set<Article const *> _downloaded; 58 | void finalize(Data &data); 59 | }; 60 | } // namespace pan 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /pan/data-impl/data-io.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __DataIO_h__ 21 | #define __DataIO_h__ 22 | 23 | #include <iosfwd> 24 | #include <pan/general/quark.h> 25 | #include <pan/general/string-view.h> 26 | #include <pan/general/line-reader.h> 27 | 28 | namespace pan 29 | { 30 | /** 31 | * Specifies the datafiles used by DataImpl. 32 | * It's abstracted out so that unit tests can substitute in its own data. 33 | * This private class should only be used by code in the data-impl module. 34 | * 35 | * @ingroup data_impl 36 | */ 37 | struct DataIO 38 | { 39 | DataIO() {} 40 | virtual ~DataIO() {} 41 | 42 | virtual std::string get_scorefile_name () const; 43 | virtual std::string get_posting_name () const; 44 | virtual std::string get_server_filename () const; 45 | 46 | virtual void clear_group_headers (const Quark& group); 47 | 48 | virtual LineReader* read_tasks () const; 49 | virtual LineReader* read_group_xovers () const; 50 | virtual LineReader* read_group_headers (const Quark& group) const; 51 | virtual LineReader* read_group_descriptions () const; 52 | virtual LineReader* read_group_permissions () const; 53 | virtual LineReader* read_download_stats () const; 54 | 55 | virtual std::ostream* write_tasks (); 56 | virtual std::ostream* write_server_properties (); 57 | virtual std::ostream* write_group_xovers (); 58 | virtual std::ostream* write_group_descriptions (); 59 | virtual std::ostream* write_group_permissions (); 60 | virtual std::ostream* write_download_stats (); 61 | virtual std::ostream* write_group_headers (const Quark& group); 62 | virtual void write_done (std::ostream*); 63 | 64 | virtual LineReader* read_file (const StringView& filename) const; 65 | virtual std::ostream* write_file (const StringView& filename); 66 | }; 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /pan/data-impl/memchunk.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __MemChunk_h__ 21 | #define __MemChunk_h__ 22 | 23 | #include <cstddef> 24 | 25 | namespace pan { 26 | 27 | template <class T> class MemChunk 28 | { 29 | public: 30 | void push_back(T const &src) 31 | { 32 | if (chunks_ == nullptr || chunks_->count_ == chunks_->elements_) 33 | { 34 | grow(nelem); 35 | } 36 | T *thead = head_; 37 | new (thead) T(src); 38 | back_ = thead; 39 | head_ += 1; 40 | chunks_->count_ += 1; 41 | } 42 | 43 | T &back() 44 | { 45 | return *back_; 46 | } 47 | 48 | T *alloc() 49 | { 50 | push_back(T()); 51 | return back_; 52 | } 53 | 54 | MemChunk() : 55 | chunks_(nullptr), 56 | back_(nullptr), 57 | head_(nullptr), 58 | allocated_(0) 59 | { 60 | } 61 | 62 | ~MemChunk() 63 | { 64 | while (chunks_ != nullptr) 65 | { 66 | T *t = chunks_->data(); 67 | for (int i = 0; i < chunks_->count_; i += 1) 68 | { 69 | t[i].~T(); 70 | } 71 | Chunk *p = chunks_; 72 | chunks_ = chunks_->next_; 73 | ::operator delete(p); 74 | } 75 | } 76 | 77 | template <class U> MemChunk(MemChunk<U> &) = delete; 78 | MemChunk *operator=(MemChunk const &) = delete; 79 | 80 | /** Ensures there's enough space for the specified number of elements */ 81 | void reserve(std::size_t elements) 82 | { 83 | if (elements > allocated_) 84 | { 85 | grow(elements - allocated_); 86 | } 87 | } 88 | 89 | private: 90 | struct Chunk 91 | { 92 | Chunk *next_; 93 | std::size_t elements_; 94 | std::size_t count_; 95 | 96 | T *data() 97 | { 98 | return reinterpret_cast<T *>(this + 1); 99 | } 100 | }; 101 | 102 | void grow(std::size_t elements) 103 | { 104 | Chunk *c = static_cast<Chunk *>( 105 | ::operator new(sizeof(Chunk) + elements * sizeof(T)) 106 | ); 107 | 108 | c->next_ = chunks_; 109 | c->elements_ = elements; 110 | c->count_ = 0; 111 | chunks_ = c; 112 | head_ = c->data(); 113 | allocated_ += elements; 114 | }; 115 | 116 | enum { nelem = 16 * 1024 }; 117 | 118 | Chunk *chunks_; 119 | T *back_; 120 | T *head_; 121 | std::size_t allocated_; 122 | }; 123 | 124 | } // namespace pan 125 | #endif 126 | -------------------------------------------------------------------------------- /pan/data-impl/profiles.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __Profiles_h__ 21 | #define __Profiles_h__ 22 | 23 | #include <iosfwd> 24 | #include <map> 25 | #include <pan/data/data.h> 26 | #include <pan/general/string-view.h> 27 | #include <set> 28 | #include <string> 29 | 30 | namespace pan { 31 | class DataIO; 32 | 33 | /** 34 | * This private class should only be used by classes in the same module. 35 | * 36 | * It's an implementation of the Profiles class. 37 | */ 38 | class ProfilesImpl : public virtual Profiles 39 | { 40 | public: 41 | ProfilesImpl(DataIO &io); 42 | virtual ~ProfilesImpl(); 43 | 44 | public: 45 | std::set<std::string> get_profile_names() const override; 46 | bool has_profiles() const override; 47 | bool has_from_header(StringView const &from) const override; 48 | bool get_profile(const std::string &profile_name, 49 | Profile &setme) const override; 50 | 51 | public: 52 | void delete_profile(const std::string &profile_name) override; 53 | void add_profile(const std::string &profile_name, 54 | const Profile &profile) override; 55 | 56 | private: 57 | void clear(); 58 | void load(const StringView &filename); 59 | void serialize(std::ostream &) const; 60 | void save() const; 61 | 62 | private: 63 | typedef std::map<std::string, Profile> profiles_t; 64 | profiles_t profiles; 65 | std::string active_profile; 66 | DataIO &_data_io; 67 | }; 68 | } // namespace pan 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /pan/data-impl/speed-test-load-group.cc: -------------------------------------------------------------------------------- 1 | #include <config.h> 2 | #include <pan/data/data.h> 3 | #include "data-impl.h" 4 | 5 | using namespace pan; 6 | 7 | int main (int argc, char *argv[]) 8 | { 9 | if (argc < 2) 10 | fprintf (stderr, "Usage: %s groupname\n", argv[0]); 11 | else { 12 | const Quark group (argv[1]); 13 | for (int i=0; i<8; ++i) { 14 | DataImpl data; 15 | Data::ArticleTree * tree (data.group_get_articles (group,Quark(""))); 16 | delete tree; 17 | } 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /pan/data-impl/task-archive.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <config.h> 21 | #include <glib.h> 22 | #include <pan/general/debug.h> 23 | #include <pan/general/macros.h> 24 | #include <pan/tasks/nzb.h> 25 | #include "data-impl.h" 26 | #include "data-io.h" 27 | 28 | void 29 | DataImpl :: save_tasks (const std::vector<Task*>& tasks) 30 | { 31 | std::ostream * out (_data_io->write_tasks ()); 32 | NZB :: nzb_to_xml (*out, tasks); 33 | _data_io->write_done (out); 34 | } 35 | 36 | void 37 | DataImpl :: load_tasks (std::vector<Task*>& setme) 38 | { 39 | typedef std::deque<std::string> lines_t; 40 | lines_t lines; 41 | StringView line; 42 | size_t total_len (0); 43 | LineReader * in (_data_io->read_tasks ()); 44 | while (in && in->getline (line)) { 45 | total_len += line.len; 46 | lines.push_back (line.to_string()); 47 | } 48 | delete in; 49 | 50 | std::string full; 51 | full.reserve (total_len+1); 52 | foreach_const (lines_t, lines, it) 53 | full += *it; 54 | 55 | char * dir (g_get_current_dir ()); // hmm, maybe we could add a tag to nzb for this? 56 | NZB :: tasks_from_nzb_string (StringView(full), dir, get_cache(), get_encode_cache(), *this, *this, *this, setme); 57 | g_free (dir); 58 | } 59 | -------------------------------------------------------------------------------- /pan/data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | article.cc 3 | article-cache.cc 4 | encode-cache.cc 5 | cert-store.cc 6 | data.cc 7 | parts.cc 8 | xref.cc 9 | ) 10 | 11 | add_library(data ${SOURCES}) 12 | 13 | # Sanity checking 14 | # https://cmake.org/cmake/help/latest/command/add_compile_options.html 15 | target_compile_options(data PRIVATE "${CXX_STD}" "-Wreorder" "-Wzero-as-null-pointer-constant" ) 16 | 17 | target_link_libraries(data PUBLIC PkgConfig::GTK3) 18 | target_link_libraries(data PUBLIC PkgConfig::GMIME) 19 | 20 | if(WANT_GNUTLS) 21 | target_link_libraries(data PUBLIC PkgConfig::GNUTLS) 22 | endif() 23 | 24 | # this test is broken 25 | # add_executable(article-test article-test.cc) 26 | # add_test(NAME article COMMAND article-test) 27 | -------------------------------------------------------------------------------- /pan/data/article-test.cc: -------------------------------------------------------------------------------- 1 | #include <config.h> 2 | #include <iostream> 3 | #include <pan/general/string-view.h> 4 | #include <pan/general/test.h> 5 | #include "article.h" 6 | 7 | using namespace pan; 8 | 9 | #define test_message_id(s) \ 10 | in = s; \ 11 | a.add_part (++i, in, 1); \ 12 | check (a.get_part_info (i, out, bytes)) \ 13 | check (bytes == 1) \ 14 | check (out == in) 15 | 16 | int 17 | main (void) 18 | { 19 | Parts::number_t i = 0; 20 | Parts::bytes_t bytes; 21 | Quark key = "<abcd@efghijk.com>"; 22 | std::string in, out; 23 | 24 | Article a; 25 | a.message_id = key; 26 | a.set_part_count (2); 27 | 28 | test_message_id (key.to_string()); // two equal strings 29 | test_message_id ("<abcdefg@efghijk.com>"); // extra in the middle... 30 | test_message_id ("<abcd@hijk.com>"); // missing in the middle... 31 | test_message_id ("zzz<abcd@efghijkl.com>"); // crazy test: extra at front 32 | test_message_id ("<abcd@efghijkl.com>zzz"); // crazy test: extra at end 33 | test_message_id ("zzz<abcd@efghijkl.com>zzz"); // crazy test: extra at both ends 34 | test_message_id ("abcd@efghijkl.com>"); // crazy test: less at front 35 | test_message_id ("<abcd@efghijkl.com"); // crazy test: less at end 36 | test_message_id ("abcd@efghijkl.com"); // crazy test: less at both ends 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /pan/data/data.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <config.h> 21 | #include "data.h" 22 | 23 | using namespace pan; 24 | 25 | /**** 26 | ***** 27 | ****/ 28 | 29 | void 30 | Data :: add_listener (Listener * l) 31 | { 32 | _listeners.insert (l); 33 | } 34 | 35 | void 36 | Data :: remove_listener (Listener * l) 37 | { 38 | _listeners.erase (l); 39 | } 40 | 41 | /*** 42 | **** 43 | ***/ 44 | 45 | void 46 | Data :: fire_grouplist_rebuilt () 47 | { 48 | for (listeners_t::iterator it(_listeners.begin()), end(_listeners.end()); it!=end; ) 49 | (*it++)->on_grouplist_rebuilt (); 50 | } 51 | 52 | void 53 | Data :: fire_group_counts (const Quark& group, Article_Count unread, Article_Count total) 54 | { 55 | for (listeners_t::iterator it(_listeners.begin()), end(_listeners.end()); it!=end; ) { 56 | (*it++)->on_group_counts (group, unread, total); 57 | } 58 | } 59 | 60 | void 61 | Data :: fire_group_read (const Quark& group) 62 | { 63 | for (listeners_t::iterator it(_listeners.begin()), end(_listeners.end()); it!=end; ) 64 | (*it++)->on_group_read (group); 65 | } 66 | 67 | void 68 | Data :: fire_group_subscribe (const Quark& group, bool sub) 69 | { 70 | for (listeners_t::iterator it(_listeners.begin()), end(_listeners.end()); it!=end; ) 71 | (*it++)->on_group_subscribe (group, sub); 72 | } 73 | 74 | void 75 | Data :: fire_article_flag_changed (articles_t& a, const Quark& group) 76 | { 77 | for (listeners_t::iterator it(_listeners.begin()), end(_listeners.end()); it!=end; ) 78 | (*it++)->on_article_flag_changed (a, group); 79 | } 80 | 81 | void 82 | Data :: fire_group_entered (const Quark& group, Article_Count unread, Article_Count total) 83 | { 84 | for (listeners_t::iterator it(_listeners.begin()), end(_listeners.end()); it!=end; ) 85 | (*it++)->on_group_entered (group, unread, total); 86 | 87 | } 88 | -------------------------------------------------------------------------------- /pan/data/decode-test-cache/apostrophe.msg: -------------------------------------------------------------------------------- 1 | From: charles@rebelbase.com 2 | Newsgroups: alt.test 3 | Subject: Apostrophe 4 | Organization: Lazars Android Works 5 | Lines: 687 6 | Message-ID: <apostrophe> 7 | Date: Wed, 02 May 2001 04:17:10 GMT 8 | 9 | begin 644 ap'str'ph'.txt 10 | 28FQA:"P@8FQA:"P@8FQA:"X* 11 | ` 12 | end 13 | 14 | -------------------------------------------------------------------------------- /pan/data/decode-test-cache/collision.msg: -------------------------------------------------------------------------------- 1 | From: charles@rebelbase.com 2 | Newsgroups: alt.test 3 | Subject: Collision - three attachments, one filename 4 | Organization: Lazars Android Works 5 | Lines: 687 6 | Message-ID: <collision> 7 | Date: Wed, 02 May 2001 04:17:10 GMT 8 | 9 | begin 644 collision 10 | M5&AI<R!I<R *9FEL92!N=6UB97(@;VYE+@I)=',@;F%M92!I<PH*(" @(" @ 11 | -($-/3$Q)4TE/3@H*"B!N 12 | 13 | end 14 | begin 644 collision 15 | M"E1H:7,*"6ES"@D)9FEL90H)"0EN=6UB97(*"0D)"71W;RX*"@I)=',@;F%M 16 | 692!I<R!A;'-O(&!C;VQL:7-I;VXG"FUB 17 | 18 | end 19 | begin 644 collision 20 | M"@H*"@H*"@H*"@D)"0D)5&AI<R!I<R!F:6QE(&YU;6)E<B!T:')E92X@($ET 21 | 5<R!N86UE(&ES(&-O;&QI<VEO;BX* 22 | 23 | end 24 | -------------------------------------------------------------------------------- /pan/data/decode-test-cache/micro.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/data/decode-test-cache/micro.msg -------------------------------------------------------------------------------- /pan/data/decode-test-cache/penguin_2_2.msg: -------------------------------------------------------------------------------- 1 | From: charles@rebelbase.com 2 | Newsgroups: alt.test 3 | Subject: Penguin 4 | Organization: Lazars Android Works 5 | Lines: 687 6 | Message-ID: <penguin_2_2> 7 | Date: Wed, 02 May 2001 04:17:10 GMT 8 | 9 | M78W6-3R!$)A``CRD`OA!!$C!R)R),)Y24%`")W",?8E&-O#^P2S,0`8XHP84 10 | MVX+=7DQ*Y?X$5DIJ``B47SW\FA;]U>0YF7-])2'*Y("15DJIP$-60#.HY6K9 11 | M$H%X@0U0@@08T&4\1?X1A*Q4AB:@@`T$`BQPP`BY%$6X@Q3@Y9#5@T&EXGH! 12 | M'P-*I6.NGS^B%21=P56>%C^47TC,(K`)&W$MU?Y\W_<9I""RWP7:E9T)01U8 13 | M)@*`P#L0PPS`@!2T4]=0DZ!\T-BXIGD*$FQF!5(Z0P1@0S,4CTOF'`8*IA=) 14 | M)56BE7`"&QI$@7&6!'SQ6>_Y%6"Q4$,A7',^)U1"8EF)%IX)U7N!@`(X`2W, 15 | MP@1`7'I>J$?<)0PLY3L@F7]9VF[^?F%A)=<_LMA#BH$?]"=*Z)-6WIM/$5?4 16 | MQ=YR=9$%:IF-9A]D=IF=`><%&&8];"<MW$$53$!+8:B14H0R;J@?-`.2N8%? 17 | M$N@MMB*.,M6=D9Q074&]'0$:O(,UJ.A*#-H^]1.`NH&\(=IPS9G)"2ACREZ- 18 | MFJ%@>F4&SF0D\A8LYJ0&((`8*$`.^`$VW,$L5`%V':F12L$$;"@!Y$`]Z%.` 19 | M(I-A12GSX*CKB6A@`:>)VL.>U4.*>NE+*`"G*D`]?&JB#EIP%1.`)B>]V=I1 20 | MH:F:5JER66!O,I-):E_CE1:-H0&$-L.>!BD,`*J@"NIL5D$$T`(Q>&HQ'9J` 21 | M$BB";I_^8S;8G0'GG-F#I>X9"#B!IAZ&$^1`#C1#,[S#.WAJHH;JGVDIGXTK 22 | M@"HFO@V77\$H<SKGLBK;+2I7K4EK/>AI#A`#`<Q`!,#`!`1JK\*F;/)!%>0E 23 | M`33#IP;7H:$K8"D3NS88E;+07P6GI8[KGS5#M5I'!CC!M6JKIWIKP1:LJ/X9 24 | M,9W0":&;O`T56JUIF]YBW#1LR<V8O.*JO6+##-S!KO*!A?9K>DJ!#A3J#!`` 25 | M,32#IS:I3\6HHHU6"]E9LP;GO.DG",RK`F!#Q?:(-1```?@!,5PKMF*KMFYM 26 | MIWKJD>F3K_64F::I8!7>8-5:CVHI&LQK,]@K`=`"ON[JOHK^!G\`0"S8[51D 27 | M@PX`;`3,`#%D:]`6JW*JZ9I:J=*Z;(W9ZKQ*:#5$[;!$`!#0`BU@`]56+3'X 28 | M`=9F*[=RJAB`;)CVTT$)FYG.6;SMVFDU+;:Z[0S,;+Y6`1]@E^7L+<_Z+."& 29 | M:M@&&[[E+KZAVY[QDXW)EP(T0P8`@>.>317`P"S<P0Q,;N5B;L9N:[=&0134 30 | M0^>"*3%=K^+.:^I6[NK>@9_JZ^LRQ_#PP00$;,\2P\]R*KBRJ.^2J^_ZV9]Q 31 | M*J[R:004KQ7UP_$F[_)2K=5FKK9R*[=N;=:BK]O>Z\Q^K[Y.`#LL$CN0[_'N 32 | M[]\";:>"ZI]1KZ@FJGS-*[?F@!/:^(&0VJ^!E6\$]*WD4BXV8(,?5&X!5R[5 33 | MKNX!S\*NNNX"ZQ0?.#`,**_E8NL[`&VW=JT/!Z\37*[,?C`(UUSYYN\L1(#W 34 | M*J\+=^\2(_"03H`.1%H-VW#R3JX?9/'?9FV]7FT'8T.01@`,]T,1JRCYEB\, 35 | M("\,IW$,1_$$U+#N[>T95T'`)K$2>R_KCO`L_&D_\$$9%S$?[*T."++]5K$A 36 | M'_(?)[(B+S(C-[(C/S(D1[(D3S(E5[(E7S(F9[(F;S(G=[(G?S(HA[(HCS(I 37 | 0E[(IGS(JI[(JK[)A!`0`.P`` 38 | ` 39 | end 40 | 41 | la la la 42 | -------------------------------------------------------------------------------- /pan/data/decode-test-cache/two_uu_attachments.msg: -------------------------------------------------------------------------------- 1 | Path: e3500-chi1.usenetserver.com!e420r-sjo4.usenetserver.com!cyclone2.usenetserver.com!news-out.usenetserver.com!newsfeed2.earthlink.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!logbridge.uoregon.edu!leto.backbone.ou.edu!news.ou.edu!not-for-mail 2 | Message-ID: <two_uu_attachments> 3 | From: Charles Kerr <charles@rebelbase.com> 4 | Subject: uu attachment test 5 | Newsgroups: alt.test 6 | Date: Wed, 2 May 2001 14:17:22 -0500 7 | 8 | Two uu attachments in this post: foo_01.txt and foo_02.txt 9 | 10 | begin 644 foo_01.txt 11 | D5&AI<R!I<R!T:&4@8F]D>2!O9B!M97-S86=E(")F;V\@,2(* 12 | ` 13 | end 14 | 15 | begin 644 foo_02.txt 16 | D5&AI<R!I<R!T:&4@8F]D>2!O9B!M97-S86=E(")F;V\@,B(* 17 | ` 18 | end 19 | -------------------------------------------------------------------------------- /pan/data/decode-test-cache/yenc.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/data/decode-test-cache/yenc.msg -------------------------------------------------------------------------------- /pan/data/decode-test-cache/yenc_1_2.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/data/decode-test-cache/yenc_1_2.msg -------------------------------------------------------------------------------- /pan/data/decode-test-cache/yenc_2_2.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/data/decode-test-cache/yenc_2_2.msg -------------------------------------------------------------------------------- /pan/general/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(generalutils 2 | article_number.cc 3 | debug.cc 4 | e-util.cc 5 | file-util.cc 6 | log.cc 7 | line-reader.cc 8 | progress.cc 9 | quark.cc 10 | string-view.cc 11 | text-match.cc 12 | utf8-utils.cc 13 | worker-pool.cc 14 | compression.cc 15 | ) 16 | 17 | # Sanity checking 18 | # https://cmake.org/cmake/help/latest/command/add_compile_options.html 19 | target_compile_options(generalutils PRIVATE "${CXX_STD}" "-Wreorder" "-Wzero-as-null-pointer-constant") 20 | 21 | # see https://cmake.org/cmake/help/latest/module/FindZLIB.html 22 | if(ZLIB_FOUND) 23 | my_target_system_lib(generalutils PUBLIC ZLIB) 24 | endif() 25 | 26 | target_link_libraries(generalutils PUBLIC PkgConfig::GMIME) 27 | target_link_libraries(generalutils PUBLIC PkgConfig::GTK3) 28 | -------------------------------------------------------------------------------- /pan/general/article_number.cc: -------------------------------------------------------------------------------- 1 | #include "article_number.h" 2 | 3 | #include <pan/general/string-view.h> 4 | 5 | #include <glib.h> 6 | 7 | #include <ostream> 8 | 9 | namespace pan { 10 | 11 | Article_Count::Article_Count(StringView const &str) 12 | { 13 | if (str.empty()) 14 | { 15 | val_ = 0; 16 | } 17 | else 18 | { 19 | char *end; 20 | val_ = g_ascii_strtoull(str.str, &end, 10); 21 | //Error checking? 22 | //*end != 0 23 | //val = max and errno set to E_RANGE 24 | } 25 | } 26 | 27 | std::ostream &operator<<(std::ostream &os, Article_Count a) 28 | { 29 | return os << static_cast<Article_Count::type>(a); 30 | } 31 | 32 | Article_Number::Article_Number(StringView const &str) 33 | { 34 | if (str.empty()) 35 | { 36 | val_ = 0; 37 | } 38 | else 39 | { 40 | char *end; 41 | val_ = g_ascii_strtoull(str.str, &end, 10); 42 | //Error checking? 43 | //*end != 0 44 | //val = max and errno set to E_RANGE 45 | } 46 | } 47 | 48 | std::ostream &operator<<(std::ostream &os, Article_Number a) 49 | { 50 | return os << static_cast<Article_Number::type>(a); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /pan/general/compression.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __Compression_h__ 21 | #define __Compression_h__ 22 | 23 | #include <iostream> 24 | #include <fstream> 25 | #include <config.h> 26 | #include <pan/general/string-view.h> 27 | 28 | namespace pan 29 | { 30 | 31 | enum CompressionType 32 | { 33 | HEADER_COMPRESS_NONE = 0, 34 | HEADER_COMPRESS_XZVER = 1, 35 | HEADER_COMPRESS_XFEATURE = 2, 36 | HEADER_COMPRESS_DIABLO = 3 37 | }; 38 | 39 | 40 | 41 | const static char* COMPRESS_GZIP = "[COMPRESS=GZIP]"; 42 | const static char* ENABLE_COMPRESS_GZIP = "XFEATURE COMPRESS GZIP\r\n"; 43 | 44 | namespace compression 45 | { 46 | bool inflate_zlib(std::stringstream *source, std::stringstream *dest, 47 | const CompressionType& compression); 48 | 49 | bool ydecode(std::stringstream* in, std::stringstream* out); 50 | 51 | void inflate_gzip (std::stringstream*, std::stringstream*); 52 | } 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /pan/general/debug.cc: -------------------------------------------------------------------------------- 1 | #include <config.h> 2 | #include "debug.h" 3 | 4 | namespace pan 5 | { 6 | bool _debug_flag = false; 7 | bool _debug_verbose_flag = false; 8 | bool _verbose_flag = false; 9 | std::ofstream _dbg_file; 10 | 11 | bool _dbg_ssl = false; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pan/general/debug.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __Debug_h__ 21 | #define __Debug_h__ 22 | 23 | #include <iostream> 24 | #include <fstream> 25 | 26 | namespace pan 27 | { 28 | extern bool _debug_flag; 29 | extern bool _debug_verbose_flag; 30 | extern bool _verbose_flag; 31 | extern bool _dbg_ssl; 32 | extern std::ofstream _dbg_file; 33 | 34 | } 35 | 36 | #define LINE_ID '(' << __FILE__ << ':' << __LINE__ << ':' << __func__ << ')' 37 | 38 | #define pan_debug(A) \ 39 | do { \ 40 | if (_debug_flag) \ 41 | std::cerr<< LINE_ID << ' ' << A << '\n'; \ 42 | } while (0) 43 | 44 | #define pan_debug_v(A) \ 45 | do { \ 46 | if (_debug_verbose_flag) \ 47 | std::cerr << LINE_ID << ' ' << A << '\n'; \ 48 | } while (0) 49 | 50 | #define verbose(A) \ 51 | do { \ 52 | if (_verbose_flag) \ 53 | std::cerr << A << '\n'; \ 54 | } while (0) 55 | 56 | #define debug_SSL(A) \ 57 | do { \ 58 | if (_dbg_ssl) \ 59 | std::cerr << A << '\n'; \ 60 | } while (0) 61 | 62 | #define debug_SSL_verbatim(A) \ 63 | do { \ 64 | if (_dbg_ssl) \ 65 | std::cerr << A << '\n'; \ 66 | } while (0) 67 | 68 | #ifndef UNUSED 69 | #ifdef __GNUC__ 70 | #define UNUSED __attribute__((unused)) 71 | #else 72 | #define UNUSED 73 | #endif 74 | #endif 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /pan/general/e-util.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | /* 3 | * e-util.h 4 | * Copyright 2000, 2001, Ximian, Inc. 5 | * 6 | * Authors: 7 | * Chris Lahey <clahey@ximian.com> 8 | * 9 | * This library is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Library General Public 11 | * License, version 2, as published by the Free Software Foundation. 12 | * 13 | * This library is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Library General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Library General Public 19 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. 20 | */ 21 | 22 | #ifndef _E_UTIL_H_ 23 | #define _E_UTIL_H_ 24 | 25 | #include <stddef.h> 26 | #include <time.h> 27 | 28 | namespace pan { 29 | 30 | class EvolutionDateMaker 31 | { 32 | private: 33 | char * locale_recent; 34 | char * locale_today; 35 | char * locale_this_week; 36 | char * locale_this_year; 37 | char * locale_old; 38 | bool am_pm_are_defined_in_locale; 39 | 40 | private: 41 | size_t e_strftime_fix_am_pm (char *s, size_t max, 42 | const char *fmt, const struct tm *tm) const; 43 | size_t e_utf8_strftime_fix_am_pm (char *s, size_t max, 44 | const char *locale_fmt, const struct tm *tm) const; 45 | 46 | private: 47 | time_t now_time; 48 | struct tm now_tm; 49 | struct tm last_seven_days[7]; // [0=yesterday ... 6=one week ago] 50 | 51 | public: 52 | EvolutionDateMaker (time_t n=time(nullptr)); 53 | ~EvolutionDateMaker (); 54 | char* get_date_string (time_t date) const; 55 | }; 56 | 57 | } 58 | 59 | #endif /* _E_UTIL_H_ */ 60 | -------------------------------------------------------------------------------- /pan/general/line-reader.cc: -------------------------------------------------------------------------------- 1 | #include <config.h> 2 | #include <cstdio> 3 | #include <cstdlib> 4 | #include <glib/gi18n.h> 5 | #include <cerrno> 6 | #include "file-util.h" 7 | #include "line-reader.h" 8 | #include "log.h" 9 | 10 | #define INITIAL_BUF_SIZE 4096 11 | 12 | using namespace pan; 13 | 14 | FileLineReader :: FileLineReader (const StringView& filename): 15 | _buf ((char*) calloc (INITIAL_BUF_SIZE, 1)), 16 | _bufend (_buf + INITIAL_BUF_SIZE), 17 | _end (_buf), 18 | _pos (_buf), 19 | _alloc_size (INITIAL_BUF_SIZE), 20 | _fp (fopen (filename.to_string().c_str(), "rb")) 21 | { 22 | } 23 | 24 | FileLineReader :: ~FileLineReader () 25 | { 26 | if (_fp) 27 | fclose (_fp); 28 | free (_buf); 29 | } 30 | 31 | bool 32 | FileLineReader :: getline (StringView& setme) 33 | { 34 | const char * eoln ((const char*) memchr ((const void*)_pos, '\n', _end-_pos)); 35 | if (eoln != nullptr) // found an end of line... easy case. 36 | { 37 | setme.assign (_pos, eoln-_pos); 38 | _pos = eoln + 1; 39 | return true; 40 | } 41 | else // no eoln -- try to read more. 42 | { 43 | const size_t remainder (_end - _pos); 44 | if (remainder != _alloc_size) { // still have room left at the end... 45 | memmove (_buf, _pos, remainder); 46 | _pos = _buf; 47 | _end = _buf + remainder; 48 | } else { // this line is bigger than our buffer - resize 49 | char * oldbuf = _buf; 50 | _alloc_size *= 2u; 51 | _buf = (char*) calloc (_alloc_size, 1); 52 | memmove (_buf, _pos, remainder); 53 | _pos = _buf; 54 | _end = _buf + remainder; 55 | _bufend = _buf + _alloc_size; 56 | free (oldbuf); 57 | } 58 | const int readval (_fp!=nullptr ? fread ((char*)_end, 1, _bufend-_end, _fp) : 0); 59 | _end += readval; 60 | if (readval > 0) // new content to try 61 | return getline (setme); 62 | else { 63 | setme.assign (_pos, _end-_pos); 64 | _pos = _end; 65 | return !setme.empty(); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /pan/general/line-reader.h: -------------------------------------------------------------------------------- 1 | #ifndef _Line_Reader_h_ 2 | #define _Line_Reader_h_ 3 | 4 | #include <cstdio> 5 | #include <list> 6 | #include <string> 7 | #include <vector> 8 | #include <pan/general/string-view.h> 9 | 10 | namespace pan 11 | { 12 | /** 13 | * Interface for objects that read data line-by-line. 14 | * 15 | * These hold live data when running Pan and test data 16 | * when we're running unit tests. 17 | * 18 | * Maybe this should be replaced with good ol' std::getline(istream). 19 | * 20 | * @ingroup general 21 | */ 22 | class LineReader 23 | { 24 | public: 25 | virtual ~LineReader () {} 26 | virtual bool getline (StringView& setme) = 0; 27 | virtual bool fail () const = 0; 28 | }; 29 | 30 | /** 31 | * A LineReader that reads from a local file. 32 | * @ingroup general 33 | */ 34 | class FileLineReader final: public LineReader 35 | { 36 | public: 37 | FileLineReader (const StringView& filename); 38 | virtual ~FileLineReader (); 39 | bool getline (StringView& setme) override; 40 | bool fail () const override { return !_fp || ferror(_fp); } 41 | 42 | FileLineReader(FileLineReader const &) = delete; 43 | FileLineReader operator=(FileLineReader const &) = delete; 44 | 45 | private: 46 | char * _buf; 47 | const char * _bufend; 48 | const char * _end; 49 | const char * _pos; 50 | size_t _alloc_size; 51 | FILE * _fp; 52 | }; 53 | 54 | /** 55 | * Used for feeding mock data to objects in unit tests. 56 | * 57 | * @ingroup general 58 | */ 59 | class ScriptedLineReader final: public LineReader 60 | { 61 | public: 62 | ScriptedLineReader () {} 63 | ScriptedLineReader (const StringView& in) { _buf.assign (in.str, in.len); } 64 | virtual ~ScriptedLineReader () {} 65 | bool fail () const override { return false; } 66 | bool getline (StringView& setme) override { 67 | if (_buf.empty()) 68 | return false; 69 | std::string::size_type pos = _buf.find ('\n'); 70 | if (pos != std::string::npos) { 71 | _line.assign (_buf, 0, pos); 72 | _buf.erase (0, pos+1); 73 | } else { 74 | _line.clear (); 75 | _line.swap (_buf); 76 | } 77 | setme = _line; 78 | return true; 79 | } 80 | std::string _line; 81 | std::string _buf; 82 | }; 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /pan/general/locking.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2007 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This file 7 | * Copyright (C) 2007 Calin Culianu <calin@ajvar.org> 8 | * 9 | * This file is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2 of the License, or (at your option) any later version. * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 20 | * 21 | */ 22 | #ifndef _Mutex_h_ 23 | #define _Mutex_h_ 24 | 25 | #include <glib.h> 26 | 27 | namespace pan 28 | { 29 | /*** 30 | * A C++ wrapper for GMutex. 31 | * 32 | * @author Calin Culianu <calin@ajvar.org> 33 | * @ingroup general 34 | * (changed for glib >= 3.32) 35 | */ 36 | class Mutex 37 | { 38 | private: 39 | GMutex mutex; 40 | GMutex * m; 41 | 42 | public: 43 | 44 | /** Create a new mutex */ 45 | Mutex() 46 | { 47 | #if !GLIB_CHECK_VERSION(2,32,0) 48 | m = g_mutex_new(); 49 | #else 50 | m = &mutex; 51 | g_mutex_init(m); 52 | #endif 53 | } 54 | 55 | /** Destroy the mutex */ 56 | virtual ~Mutex() 57 | { 58 | #if !GLIB_CHECK_VERSION(2,32,0) 59 | g_mutex_free(m); 60 | #else 61 | g_mutex_clear(m); 62 | #endif 63 | } 64 | 65 | /** Block until a lock is acquired */ 66 | void lock() { g_mutex_lock(m); } 67 | 68 | /** Unlock the mutex - may wake another thread waiting on it */ 69 | void unlock() { g_mutex_unlock(m); } 70 | }; 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /pan/general/log.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <config.h> 21 | #include <iostream> 22 | #include <cstdarg> 23 | #include <cstdio> // vsnprintf 24 | #include "log.h" 25 | 26 | using namespace pan; 27 | 28 | /*** 29 | ***/ 30 | 31 | void 32 | Log :: clear () 33 | { 34 | _entries.clear (); 35 | fire_cleared (); 36 | } 37 | 38 | /*** 39 | ***/ 40 | 41 | void 42 | Log :: fire_entry_added (const Entry& e) { 43 | for (listeners_t::const_iterator i(_listeners.begin()), end(_listeners.end()); i!=end; ) 44 | (*i++)->on_log_entry_added (e); 45 | } 46 | 47 | void 48 | Log :: fire_cleared () { 49 | for (listeners_t::const_iterator i(_listeners.begin()), end(_listeners.end()); i!=end; ) 50 | (*i++)->on_log_cleared (); 51 | } 52 | 53 | /*** 54 | ***/ 55 | 56 | void 57 | Log :: add_entry(Entry& e, std::deque<Entry>& list) 58 | { 59 | _entries.resize (_entries.size() + 1); 60 | Entry& a (_entries.back()); 61 | a.date = time(NULL); 62 | a.severity = e.severity; 63 | a.message = e.message; 64 | foreach (std::deque<Entry>, list, it) 65 | { 66 | Entry* new_entry = new Entry(*it); 67 | a.messages.push_back(new_entry); 68 | } 69 | fire_entry_added (a); 70 | } 71 | 72 | void 73 | Log :: add (Severity severity, const char * msg) 74 | { 75 | _entries.resize (_entries.size() + 1); 76 | Entry& e (_entries.back()); 77 | e.date = time(NULL); 78 | e.severity = severity; 79 | e.message = msg; 80 | fire_entry_added (e); 81 | } 82 | 83 | void 84 | Log :: add_va (Severity severity, const char * fmt, ...) 85 | { 86 | if (fmt != NULL) 87 | { 88 | va_list args; 89 | va_start (args, fmt); 90 | char buf[4096]; 91 | vsnprintf (buf, sizeof(buf), fmt, args); 92 | va_end (args); 93 | add (severity, buf); 94 | } 95 | } 96 | 97 | void 98 | Log :: add_info_va (const char * fmt, ...) 99 | { 100 | va_list args; 101 | va_start (args, fmt); 102 | char buf[4096]; 103 | vsnprintf (buf, sizeof(buf), fmt, args); 104 | va_end (args); 105 | 106 | add_info (buf); 107 | } 108 | 109 | void 110 | Log :: add_err_va (const char * fmt, ...) 111 | { 112 | va_list args; 113 | va_start (args, fmt); 114 | char buf[4096]; 115 | vsnprintf (buf, sizeof(buf), fmt, args); 116 | va_end (args); 117 | 118 | add_err (buf); 119 | } 120 | 121 | void 122 | Log :: add_urgent_va (const char * fmt, ...) 123 | { 124 | va_list args; 125 | va_start (args, fmt); 126 | char buf[4096]; 127 | vsnprintf (buf, sizeof(buf), fmt, args); 128 | va_end (args); 129 | 130 | add_urgent (buf); 131 | } 132 | -------------------------------------------------------------------------------- /pan/general/macros.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __Pan_Macros_h__ 21 | #define __Pan_Macros_h__ 22 | 23 | #define STD_SSL_PORT 563 24 | #define STD_NNTP_PORT 119 25 | 26 | /** 27 | *** foreach 28 | **/ 29 | 30 | #define foreach(Type,var,itname) \ 31 | for (Type::iterator itname(var.begin()), \ 32 | itname##end(var.end()); itname!=itname##end; \ 33 | ++itname) 34 | 35 | #define foreach_const(Type,var,itname) \ 36 | for (Type::const_iterator itname(var.begin()), \ 37 | itname##end(var.end()); itname!=itname##end; \ 38 | ++itname) 39 | 40 | #define foreach_r(Type,var,itname) \ 41 | for (Type::reverse_iterator itname(var.rbegin()), \ 42 | itname##end(var.rend()); itname!=itname##end; \ 43 | ++itname) 44 | 45 | #define foreach_const_r(Type,var,itname) \ 46 | for (Type::const_reverse_iterator itname(var.rbegin()), \ 47 | itname##end(var.rend()); itname!=itname##end; \ 48 | ++itname) 49 | 50 | /** 51 | *** UNUSED 52 | **/ 53 | 54 | #ifndef UNUSED 55 | #ifdef __GNUC__ 56 | #define UNUSED __attribute__((unused)) 57 | #else 58 | #define UNUSED 59 | #endif 60 | #endif 61 | 62 | /** 63 | *** g_assert 64 | **/ 65 | 66 | #include <glib.h> 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /pan/general/messages.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __Messages_h__ 21 | #define __Messages_h__ 22 | 23 | #include <iostream> 24 | 25 | #define pan_return_if_fail(expr) \ 26 | do { \ 27 | if (!(expr)) { \ 28 | std::cerr << "(" << __FILE__ << ':' << __LINE__ << " " << __func__ << "): assertion \"" << #expr << "\" failed.\n"; \ 29 | return; \ 30 | } \ 31 | } while (0) 32 | 33 | #define pan_return_val_if_fail(expr, val) \ 34 | do { \ 35 | if (!(expr)) { \ 36 | std::cerr << "(" << __FILE__ << ':' << __LINE__ << " " << __func__ << "): assertion \"" << #expr << "\" failed.\n"; \ 37 | return val; \ 38 | } \ 39 | } while (0) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /pan/general/progress-test.cc: -------------------------------------------------------------------------------- 1 | #include <config.h> 2 | #include <iostream> 3 | #include "progress.h" 4 | #include "string-view.h" 5 | #include "test.h" 6 | 7 | using namespace pan; 8 | 9 | class MyListener : public Progress::Listener 10 | { 11 | public: 12 | std::string status; 13 | std::string error; 14 | int percentage; 15 | int finished; 16 | void on_progress_step (Progress&, int p) override { 17 | percentage = p; 18 | } 19 | void on_progress_status (Progress&, const StringView& s) override { 20 | status = s.to_string (); 21 | } 22 | void on_progress_error (Progress&, const StringView& s) override { 23 | error = s.to_string (); 24 | } 25 | void on_progress_finished (Progress&, int s) override { 26 | finished = s; 27 | } 28 | }; 29 | 30 | 31 | 32 | int 33 | main (void) 34 | { 35 | const std::string description ("this is the description"); 36 | Progress p (description); 37 | MyListener myl; 38 | p.add_listener (&myl); 39 | check (p.describe() == description) 40 | check (p.get_progress_of_100() == 0) 41 | 42 | std::string s = "Hello World"; 43 | p.set_status (s); 44 | check (myl.status == s) 45 | 46 | s = "This is an error message"; 47 | p.set_error (s); 48 | check (myl.error == s) 49 | 50 | p.init_steps (100); 51 | check (p.get_progress_of_100() == 0) 52 | check (myl.percentage == 0) 53 | p.increment_step (); 54 | check (p.get_progress_of_100() == 1) 55 | check (myl.percentage == 1) 56 | p.increment_step (); 57 | check (p.get_progress_of_100() == 2) 58 | check (myl.percentage == 2) 59 | p.increment_step (); 60 | check (p.get_progress_of_100() == 3) 61 | check (myl.percentage == 3) 62 | p.set_step (50); 63 | check (p.get_progress_of_100() == 50) 64 | check (myl.percentage == 50) 65 | 66 | p.init_steps (200); 67 | check (p.get_progress_of_100() == 0) 68 | check (myl.percentage == 0) 69 | p.set_step (50); 70 | check (p.get_progress_of_100() == 25) 71 | check (myl.percentage == 25) 72 | 73 | p.set_finished (2); 74 | check (myl.finished == 2) 75 | 76 | p.remove_listener (&myl); 77 | p.init_steps (100); 78 | check (p.get_progress_of_100() == 0) 79 | check (myl.percentage == 25) // unchanged -- no listener 80 | 81 | // all clear 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /pan/general/quark-test.cc: -------------------------------------------------------------------------------- 1 | #include <config.h> 2 | #include <iostream> 3 | #include <map> 4 | #include "quark.h" 5 | #include "test.h" 6 | 7 | using namespace pan; 8 | 9 | int 10 | main (void) 11 | { 12 | { 13 | Quark o ("foo"); 14 | { 15 | Quark a (o); 16 | Quark b (o); 17 | check (a == b) 18 | check (a == a) 19 | check (a == "foo") 20 | check (Quark::size() == 1) 21 | Quark c ("bar"); 22 | check (a != c) 23 | check (b != c) 24 | check (Quark::size() == 2) 25 | a = c; 26 | check (Quark::size() == 2) 27 | check (a != b) 28 | check (a == c) 29 | c = "mum"; 30 | check (Quark::size() == 3) 31 | o = c; 32 | 33 | std::map<Quark,std::string> mymap; 34 | mymap[o] = o; 35 | check (mymap[c] == o.to_string()) 36 | check (o.to_string() == mymap[c]) 37 | check (c.to_string() == o.to_string()) 38 | check (Quark::size() == 3) 39 | c = "gronk"; 40 | check (Quark::size() == 4) 41 | } 42 | check (Quark::size() == 1) 43 | check (o == "mum"); 44 | } 45 | check (Quark::size() == 0) 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /pan/general/quark.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include "quark.h" 21 | 22 | #include <config.h> 23 | 24 | #include <iostream> 25 | #include <string> 26 | #include "string-view.h" 27 | 28 | namespace pan { 29 | 30 | Quark::lookup_t Quark::_lookup; 31 | 32 | /*** 33 | **** 34 | ***/ 35 | 36 | void 37 | Quark :: dump (std::ostream& o) 38 | { 39 | if (size()) { 40 | o << "Existing Quarks: " << size() << ':' << "\n"; 41 | for (lookup_t::const_iterator it(_lookup.begin()), e(_lookup.end()); it!=e; ++it) { 42 | o << " [" << it->to_view() << "] (refcount " << it->refcount << ')' << "\n"; 43 | } 44 | o << "\n"; 45 | } 46 | } 47 | 48 | std::ostream& 49 | operator<< (std::ostream& os, const Quark& s) 50 | { 51 | const StringView& v (s.to_view()); 52 | os.write (v.str, v.len); 53 | return os; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /pan/general/singleton-template.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef _PAN_SINGLETON_H_ 21 | #define _PAN_SINGLETON_H_ 22 | 23 | template <class T_DERIVED> 24 | class PanSingleton 25 | { 26 | public: 27 | static T_DERIVED& get() 28 | { 29 | static T_DERIVED oInstance ; 30 | return oInstance ; 31 | } 32 | 33 | protected: 34 | PanSingleton(){} 35 | 36 | private: 37 | PanSingleton( const PanSingleton& ) ; 38 | PanSingleton& operator=( const PanSingleton& ) {return *this;} 39 | } ; 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /pan/general/test.h: -------------------------------------------------------------------------------- 1 | #include <iosfwd> 2 | #include <iostream> 3 | 4 | int test = 0; 5 | 6 | #define check(A) \ 7 | { \ 8 | ++test; \ 9 | if (A) \ 10 | { \ 11 | std::cout << "PASS test #" << test << " (" << __FILE__ << ", " \ 12 | << __LINE__ << ")\n"; \ 13 | } \ 14 | else \ 15 | { \ 16 | std::cout << "FAIL test #" << test << " (" << __FILE__ << ", " \ 17 | << __LINE__ << ") \"" << #A << "\"\n"; \ 18 | return test; \ 19 | } \ 20 | } 21 | 22 | #define check_op(A, OP, B) \ 23 | { \ 24 | ++test; \ 25 | if ((A) OP (B)) \ 26 | { \ 27 | std::cout << "PASS test #" << test << " (" << __FILE__ << ", " \ 28 | << __LINE__ << ")\n"; \ 29 | } \ 30 | else \ 31 | { \ 32 | std::cout << "FAIL test #" << test << " (" << __FILE__ << ", " \ 33 | << __LINE__ << ") \"" << (A) << ' ' << #OP << ' ' << (B) \ 34 | << "\"\n"; \ 35 | return test; \ 36 | } \ 37 | } 38 | 39 | #define check_eq(A, B) check_op(A, ==, B) 40 | -------------------------------------------------------------------------------- /pan/general/time-elapsed.h: -------------------------------------------------------------------------------- 1 | #ifndef __Time_Elapsed_h__ 2 | #define __Time_Elapsed_h__ 3 | 4 | #include <glib.h> // for GTimeVal, g_get_current_time and GUSEC_PER_SEC 5 | 6 | namespace pan 7 | { 8 | /** 9 | * Simple object used for logging how long a piece of code takes to execute. 10 | * 11 | * Instantiate it before calling the code to be timed, then call 12 | * get_seconds_elapsed() after the code returns. 13 | * 14 | * @ingroup general 15 | */ 16 | struct TimeElapsed 17 | { 18 | GTimeVal start; 19 | TimeElapsed() { g_get_current_time (&start); } 20 | double get_seconds_elapsed () const { 21 | GTimeVal finish; 22 | g_get_current_time (&finish); 23 | double diff = finish.tv_sec - start.tv_sec; 24 | diff += (finish.tv_usec - start.tv_usec)/(double)G_USEC_PER_SEC; 25 | return diff; 26 | } 27 | 28 | double get_usecs_elapsed () const { 29 | GTimeVal finish; 30 | g_get_current_time (&finish); 31 | double diff = finish.tv_usec - start.tv_usec; 32 | return diff; 33 | } 34 | }; 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /pan/general/utf8-utils.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef _pan_utf8_utils_h_ 21 | #define _pan_utf8_utils_h_ 22 | 23 | #include <string> 24 | #include <gmime/gmime.h> 25 | #include <pan/general/string-view.h> 26 | 27 | namespace pan 28 | { 29 | std::string header_to_utf8 (const StringView & in, 30 | const char * fallback_charset_1=nullptr, 31 | const char * fallback_charset_2=nullptr); 32 | 33 | std::string mime_part_to_utf8 (GMimePart * part, 34 | const char * fallback_charset=nullptr); 35 | 36 | std::string content_to_utf8 (const StringView & in, 37 | const char * fallback_charset_1=nullptr, 38 | const char * fallback_charset_2=nullptr); 39 | 40 | std::string clean_utf8 (const StringView & in); 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /pan/general/worker-pool.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2007 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This file 7 | * Copyright (C) 2007 Calin Culianu <calin@ajvar.org> 8 | * 9 | * This file is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2 of the License, or (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 21 | * 22 | */ 23 | #include <cassert> 24 | #include <glib.h> // for g_idle_add 25 | #include <gdk/gdk.h> 26 | #include <pan/general/debug.h> 27 | #include <pan/general/macros.h> 28 | #include "worker-pool.h" 29 | 30 | using namespace pan; 31 | 32 | WorkerPool::WorkerPool(int n, bool exclusive) 33 | { 34 | assert((!exclusive || n>0) && "can't have unlimited exclusive threads!"); 35 | tpool = g_thread_pool_new(Worker::worker_thread_func, this, n, exclusive, nullptr); 36 | } 37 | 38 | void 39 | WorkerPool::cancel_all_silently() 40 | { 41 | foreach (WorkerSet, my_workers, it)(*it)->cancel_silently (); 42 | } 43 | 44 | WorkerPool::~WorkerPool() 45 | { 46 | foreach (WorkerSet, my_workers, it){ 47 | (*it)->pool = nullptr; 48 | (*it)->cancel (); 49 | } 50 | 51 | // blocks until *all* workers, both running and queued, have run. 52 | g_thread_pool_free (tpool, false, true); 53 | } 54 | 55 | /*** 56 | **** 57 | ***/ 58 | 59 | void 60 | WorkerPool::push_work(Worker *w, Worker::Listener *l, bool delete_worker) 61 | { 62 | w->cancelled = false; 63 | w->silent = false; 64 | w->pool = this; 65 | w->listener = l; 66 | w->delete_worker = delete_worker; 67 | my_workers.insert(w); 68 | g_thread_pool_push(tpool, w, nullptr); // jump to worker_thread_func 69 | } 70 | 71 | void 72 | WorkerPool::Worker::worker_thread_func(gpointer g, gpointer unused UNUSED) 73 | { 74 | static_cast<Worker*>(g)->do_work(); 75 | g_idle_add(main_thread_cleanup_cb, g); // jump to main_thread_cleanup_cb 76 | } 77 | 78 | gboolean 79 | WorkerPool::Worker::main_thread_cleanup_cb(gpointer g) 80 | { 81 | static_cast<Worker*>(g)->main_thread_cleanup(); 82 | return false; // tell main loop that we're done 83 | } 84 | 85 | void 86 | WorkerPool::Worker::main_thread_cleanup() 87 | { 88 | if (listener && !silent) 89 | listener->on_worker_done(was_cancelled()); 90 | 91 | if (pool) 92 | pool->my_workers.erase(this); 93 | 94 | if (delete_worker) 95 | delete this; 96 | } 97 | -------------------------------------------------------------------------------- /pan/gui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRC_CC_FILES 2 | actions.cc 3 | body-pane.cc 4 | dl-headers-ui.cc 5 | editor-spawner.cc 6 | group-pane.cc 7 | group-prefs-dialog.cc 8 | group-prefs.cc 9 | header-pane.cc 10 | hig.cc 11 | load-icon.cc 12 | log-ui.cc 13 | pan-file-entry.cc 14 | pan-tree.cc 15 | post-ui.cc 16 | prefs-file.cc 17 | prefs-ui.cc 18 | prefs.cc 19 | profiles-dialog.cc 20 | progress-view.cc 21 | render-bytes.cc 22 | save-attach-ui.cc 23 | save-ui.cc 24 | score-add-ui.cc 25 | score-view-ui.cc 26 | server-ui.cc 27 | task-pane.cc 28 | url.cc 29 | ) 30 | 31 | set(SRC_C_FILES 32 | e-action-combo-box.c 33 | e-charset-combo-box.c 34 | e-charset-dialog.c 35 | e-charset.c 36 | e-cte-dialog.c 37 | xface.c 38 | ) 39 | 40 | # https://cmake.org/cmake/help/latest/command/add_library.html 41 | add_library(pan-cc-gui STATIC ${SRC_CC_FILES}) 42 | 43 | add_library(pan-c-gui STATIC ${SRC_C_FILES}) 44 | 45 | foreach (my_target "pan-cc-gui" "pan-c-gui") 46 | target_link_libraries(${my_target} PRIVATE tasks) 47 | 48 | target_link_libraries(${my_target} PUBLIC PkgConfig::GTK3) 49 | target_link_libraries(${my_target} PUBLIC PkgConfig::GMIME) 50 | 51 | if(WANT_GSPELL) 52 | my_target_system_lib(${my_target} PUBLIC GSPELL) 53 | endif() 54 | 55 | if(WANT_WEBKIT) 56 | target_link_libraries(${my_target} PUBLIC PkgConfig::WEBKITGTK) 57 | endif() 58 | 59 | if(WANT_GNUTLS) 60 | target_link_libraries(${my_target} PUBLIC PkgConfig::GNUTLS) 61 | endif() 62 | 63 | if(WANT_NOTIFY) 64 | target_link_libraries(${my_target} PUBLIC PkgConfig::LIBNOTIFY) 65 | endif() 66 | 67 | if(Iconv_FOUND) 68 | my_target_system_lib(${my_target} PUBLIC Iconv) 69 | endif() 70 | 71 | if(WANT_GKR) 72 | target_link_libraries(${my_target} PUBLIC PkgConfig::LIBSECRET) 73 | target_link_libraries(${my_target} PUBLIC PkgConfig::GCR3) 74 | endif() 75 | 76 | if(WANT_WEBKIT) 77 | target_link_libraries(${my_target} PUBLIC PkgConfig::WEBKITGTK) 78 | endif() 79 | 80 | endforeach() 81 | 82 | # Sanity checking 83 | # https://cmake.org/cmake/help/latest/command/add_compile_options.html 84 | target_compile_options(pan-cc-gui PRIVATE "-Wreorder" "${CXX_STD}" "-Wzero-as-null-pointer-constant") 85 | 86 | if(WIN32) 87 | target_sources(pan PRIVATE panrc.rc) 88 | endif() 89 | -------------------------------------------------------------------------------- /pan/gui/action-manager.h: -------------------------------------------------------------------------------- 1 | #ifndef ACTION_MANAGER_H 2 | #define ACTION_MANAGER_H 3 | 4 | /** 5 | * Interface for objects that encapsulate GTK action groups. 6 | * @ingroup GUI 7 | */ 8 | struct ActionManager 9 | { 10 | ActionManager () {} 11 | virtual ~ActionManager () {} 12 | 13 | virtual bool is_action_active (const char * action) const = 0; 14 | virtual void activate_action (const char * action) const = 0; 15 | virtual void toggle_action (const char * action, bool) const = 0; 16 | virtual void sensitize_action (const char * action, bool) const = 0; 17 | virtual void hide_action (const char * key, bool b) const = 0; 18 | virtual GtkWidget* get_action_widget (const char * key) const = 0; 19 | virtual void disable_accelerators_when_focused (GtkWidget * entry) const = 0; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /pan/gui/actions-extern.h: -------------------------------------------------------------------------------- 1 | 2 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 3 | /* 4 | * Pan - A Newsreader for Gtk+ 5 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; version 2 of the License. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 18 | * 19 | */ 20 | 21 | #ifndef ACTION_EXTERN_H 22 | #define ACTION_EXTERN_H 23 | 24 | #include <map> 25 | 26 | namespace pan 27 | { 28 | 29 | // extern GtkActionEntry entries[]; 30 | // extern GtkActionEntry toggle_entries[]; 31 | // extern int ACTION_ENTRIES; 32 | // extern int TOGGLE_ACTION_ENTRIES; 33 | 34 | extern std::map<std::string,std::string> action_trans; 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /pan/gui/actions.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | #ifndef _actions_h_ 20 | #define _actions_h_ 21 | 22 | #include <gtk/gtk.h> 23 | #include <gdk/gdk.h> 24 | #include <pan/gui/pan-ui.h> 25 | #include <pan/gui/prefs.h> 26 | #include <pan/data/data.h> 27 | 28 | namespace pan 29 | { 30 | void add_actions (PanUI*, GtkUIManager*, Prefs*, Data*); 31 | } 32 | 33 | #endif /* __PAN_H__ */ 34 | -------------------------------------------------------------------------------- /pan/gui/dl-headers-ui.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | #ifndef DOWNLOAD_HEADERS_UI_H 20 | #define DOWNLOAD_HEADERS_UI_H 21 | 22 | #include <gtk/gtk.h> 23 | #include <gdk/gdk.h> 24 | #include <pan/general/quark.h> 25 | #include "prefs.h" 26 | 27 | namespace pan 28 | { 29 | struct Data; 30 | struct Queue; 31 | void headers_dialog (Data&, Prefs&, Queue&, const quarks_t& groups, GtkWindow* parent); 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /pan/gui/e-action-combo-box.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ 2 | /* e-action-combo-box.h 3 | * 4 | * Copyright (C) 2008 Novell, Inc. 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of version 2 of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | */ 18 | 19 | #ifndef E_ACTION_COMBO_BOX_H 20 | #define E_ACTION_COMBO_BOX_H 21 | 22 | /* This is a GtkComboBox that is driven by a group of GtkRadioActions. 23 | * Just plug in a GtkRadioAction and the widget will handle the rest. 24 | * (Based on GtkhtmlComboBox.) */ 25 | 26 | #include <gtk/gtk.h> 27 | #include <gdk/gdk.h> 28 | 29 | /* Standard GObject macros */ 30 | #define E_TYPE_ACTION_COMBO_BOX \ 31 | (e_action_combo_box_get_type ()) 32 | #define E_ACTION_COMBO_BOX(obj) \ 33 | (G_TYPE_CHECK_INSTANCE_CAST \ 34 | ((obj), E_TYPE_ACTION_COMBO_BOX, EActionComboBox)) 35 | #define E_ACTION_COMBO_BOX_CLASS(cls) \ 36 | (G_TYPE_CHECK_CLASS_CAST \ 37 | ((cls), E_TYPE_ACTION_COMBO_BOX, EActionComboBoxClass)) 38 | #define E_ACTION_IS_COMBO_BOX(obj) \ 39 | (G_TYPE_CHECK_INSTANCE_TYPE \ 40 | ((obj), E_TYPE_ACTION_COMBO_BOX)) 41 | #define E_ACTION_IS_COMBO_BOX_CLASS(cls) \ 42 | (G_TYPE_CHECK_CLASS_TYPE \ 43 | ((cls), E_TYPE_ACTION_COMBO_BOX)) 44 | #define E_ACTION_COMBO_BOX_GET_CLASS(obj) \ 45 | (G_TYPE_INSTANCE_GET_CLASS \ 46 | ((obj), E_TYPE_ACTION_COMBO_BOX, EActionComboBoxClass)) 47 | 48 | G_BEGIN_DECLS 49 | 50 | typedef struct _EActionComboBox EActionComboBox; 51 | typedef struct _EActionComboBoxClass EActionComboBoxClass; 52 | typedef struct _EActionComboBoxPrivate EActionComboBoxPrivate; 53 | 54 | struct _EActionComboBox { 55 | GtkComboBox parent; 56 | EActionComboBoxPrivate *priv; 57 | // quick fix for error : "specified instance size for type `EActionComboBox' is 58 | // smaller than the parent type's `GtkComboBox' instance size" 59 | double pad, pad2, pad3; 60 | }; 61 | 62 | struct _EActionComboBoxClass { 63 | GtkComboBoxClass parent_class; 64 | }; 65 | 66 | GType e_action_combo_box_get_type (void); 67 | GtkWidget * e_action_combo_box_new (void); 68 | GtkWidget * e_action_combo_box_new_with_action 69 | (GtkRadioAction *action); 70 | GtkRadioAction *e_action_combo_box_get_action (EActionComboBox *combo_box); 71 | void e_action_combo_box_set_action (EActionComboBox *combo_box, 72 | GtkRadioAction *action); 73 | gint e_action_combo_box_get_current_value 74 | (EActionComboBox *combo_box); 75 | void e_action_combo_box_set_current_value 76 | (EActionComboBox *combo_box, 77 | gint current_value); 78 | void e_action_combo_box_add_separator_before 79 | (EActionComboBox *combo_box, 80 | gint action_value); 81 | void e_action_combo_box_add_separator_after 82 | (EActionComboBox *combo_box, 83 | gint action_value); 84 | 85 | G_END_DECLS 86 | 87 | #endif /* E_ACTION_COMBO_BOX_H */ 88 | -------------------------------------------------------------------------------- /pan/gui/e-charset-combo-box.h: -------------------------------------------------------------------------------- 1 | /* 2 | * e-charset-combo-box.h 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with the program; if not, see <http://www.gnu.org/licenses/> 16 | * 17 | * 18 | * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 19 | * 20 | */ 21 | 22 | #ifndef E_CHARSET_COMBO_BOX_H 23 | #define E_CHARSET_COMBO_BOX_H 24 | 25 | #include "e-action-combo-box.h" 26 | 27 | /* Standard GObject macros */ 28 | #define E_TYPE_CHARSET_COMBO_BOX \ 29 | (e_charset_combo_box_get_type ()) 30 | #define E_CHARSET_COMBO_BOX(obj) \ 31 | (G_TYPE_CHECK_INSTANCE_CAST \ 32 | ((obj), E_TYPE_CHARSET_COMBO_BOX, ECharsetComboBox)) 33 | #define E_CHARSET_COMBO_BOX_CLASS(cls) \ 34 | (G_TYPE_CHECK_CLASS_CAST \ 35 | ((cls), E_TYPE_CHARSET_COMBO_BOX, ECharsetComboBoxClass)) 36 | #define E_IS_CHARSET_COMBO_BOX(obj) \ 37 | (G_TYPE_CHECK_INSTANCE_TYPE \ 38 | ((obj), E_TYPE_CHARSET_COMBO_BOX)) 39 | #define E_IS_CHARSET_COMBO_BOX_CLASS(cls) \ 40 | (G_TYPE_CHECK_CLASS_TYPE \ 41 | ((cls), E_TYPE_CHARSET_COMBO_BOX)) 42 | #define E_CHARSET_COMBO_BOX_GET_CLASS(obj) \ 43 | (G_TYPE_INSTANCE_GET_CLASS \ 44 | ((obj), E_TYPE_CHARSET_COMBO_BOX, ECharsetComboBoxClass)) 45 | 46 | G_BEGIN_DECLS 47 | 48 | typedef struct _ECharsetComboBox ECharsetComboBox; 49 | typedef struct _ECharsetComboBoxClass ECharsetComboBoxClass; 50 | typedef struct _ECharsetComboBoxPrivate ECharsetComboBoxPrivate; 51 | 52 | struct _ECharsetComboBox { 53 | EActionComboBox parent; 54 | ECharsetComboBoxPrivate *priv; 55 | }; 56 | 57 | struct _ECharsetComboBoxClass { 58 | EActionComboBoxClass parent_class; 59 | }; 60 | 61 | GType e_charset_combo_box_get_type (void); 62 | GtkWidget * e_charset_combo_box_new (void); 63 | const gchar * e_charset_combo_box_get_charset (ECharsetComboBox *combo_box); 64 | void e_charset_combo_box_set_charset (ECharsetComboBox *combo_box, 65 | const gchar *charset); 66 | 67 | G_END_DECLS 68 | 69 | #endif /* E_CHARSET_COMBO_BOX_H */ 70 | -------------------------------------------------------------------------------- /pan/gui/e-charset-dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef E_CHARSET_DIALOG_H 2 | #define E_CHARSET_DIALOG_H 3 | 4 | G_BEGIN_DECLS 5 | 6 | char* e_charset_dialog (const char *title, const char *prompt, 7 | const char *default_charset, GtkWindow *parent); 8 | 9 | G_END_DECLS 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /pan/gui/e-charset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This program is free software; you can redistribute it and/or 4 | * modify it under the terms of the GNU Lesser General Public 5 | * License as published by the Free Software Foundation; either 6 | * version 2 of the License, or (at your option) version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public 14 | * License along with the program; if not, see <http://www.gnu.org/licenses/> 15 | * 16 | * 17 | * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 18 | * 19 | */ 20 | 21 | #ifndef E_CHARSET_H 22 | #define E_CHARSET_H 23 | 24 | #include <gtk/gtk.h> 25 | #include <gdk/gdk.h> 26 | 27 | G_BEGIN_DECLS 28 | 29 | GSList * e_charset_add_radio_actions (GtkActionGroup *action_group, 30 | const gchar *action_prefix, 31 | const gchar *default_charset, 32 | GCallback callback, 33 | gpointer user_data); 34 | 35 | G_END_DECLS 36 | 37 | #endif /* E_CHARSET_H */ 38 | -------------------------------------------------------------------------------- /pan/gui/e-cte-dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef E_CTE_DIALOG_H 2 | #define E_CTE_DIALOG_H 3 | 4 | #include <config.h> 5 | #include <gmime/gmime.h> 6 | #include <gtk/gtk.h> 7 | #include <gdk/gdk.h> 8 | #include <glib/gi18n.h> 9 | 10 | G_BEGIN_DECLS 11 | 12 | GMimeContentEncoding e_cte_dialog (const char *title, const char *prompt, GMimeContentEncoding now, GtkWindow *parent); 13 | 14 | G_END_DECLS 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /pan/gui/editor-spawner.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __EditorSpawner_h__ 21 | #define __EditorSpawner_h__ 22 | 23 | #include <functional> 24 | #include <stdexcept> 25 | 26 | namespace pan { 27 | 28 | class Prefs; 29 | 30 | class EditorSpawner { 31 | public: 32 | typedef std::function<void(int, char *)> Callback; 33 | 34 | /** Spawns an editor for the named file. 35 | * 36 | * The callback is actioned when the editor window is closed, and it 37 | * should take care of popping the correct window back to the front if 38 | * required. 39 | * 40 | * If there's an error, an exception is thrown and an error message is 41 | * logged. 42 | */ 43 | EditorSpawner(char *fname, 44 | Callback callback, 45 | Prefs const & prefs); 46 | 47 | /** Destructor does some cleanup */ 48 | ~EditorSpawner(); 49 | 50 | private: 51 | unsigned int _child_id; 52 | }; 53 | 54 | class EditorSpawnerError : public std::runtime_error 55 | { 56 | public: 57 | EditorSpawnerError(); 58 | }; 59 | 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /pan/gui/group-prefs-dialog.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __GroupPrefsDialog_h__ 21 | #define __GroupPrefsDialog_h__ 22 | 23 | #include <pan/general/quark.h> 24 | #include <pan/data/data.h> 25 | #include <gtk/gtk.h> 26 | #include <gdk/gdk.h> 27 | #include "group-prefs.h" 28 | #include "prefs.h" 29 | 30 | namespace pan 31 | { 32 | class GroupPrefsDialog 33 | { 34 | public: 35 | GroupPrefsDialog (Data & data, 36 | const quarks_v & groups, 37 | Prefs & prefs, 38 | GroupPrefs & group_prefs, 39 | GtkWindow * parent_window); 40 | 41 | ~GroupPrefsDialog () {} 42 | GtkWidget * root() { return _root; } 43 | 44 | private: 45 | const quarks_v _groups; 46 | Prefs & _prefs; 47 | GroupPrefs & _group_prefs; 48 | GtkWidget * _root; 49 | GtkWidget * _charset; 50 | GtkWidget * _profile; 51 | GtkWidget * _spellchecker_language; 52 | GtkWidget * _group_color; 53 | GtkWidget * _save_path; 54 | GdkRGBA _color; 55 | 56 | private: 57 | static void response_cb (GtkDialog*, int, gpointer); 58 | void save_from_gui (); 59 | 60 | public: 61 | GtkWidget* get_color_button() { return _group_color; } 62 | const quarks_v& get_groups() { return _groups; } 63 | GroupPrefs& get_prefs() { return _group_prefs; } 64 | }; 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /pan/gui/group-prefs.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <pan/general/string-view.h> 21 | #include <pan/general/quark.h> 22 | #include "prefs.h" 23 | 24 | #ifndef _GroupPrefs_h_ 25 | #define _GroupPrefs_h_ 26 | 27 | namespace pan 28 | { 29 | class GroupPrefs 30 | { 31 | public: 32 | 33 | bool get_flag (const Quark & group, 34 | const StringView & key, 35 | bool fallback) const; 36 | 37 | void set_flag (const Quark & group, 38 | const StringView & key, 39 | bool fallback); 40 | 41 | int get_int (const Quark & group, 42 | const StringView & key, 43 | int fallback) const; 44 | 45 | void set_int (const Quark & group, 46 | const StringView & key, 47 | int fallback); 48 | 49 | std::string get_string (const Quark & group, 50 | const StringView & key, 51 | const StringView & fallback) const; 52 | 53 | void set_string (const Quark & group, 54 | const StringView & key, 55 | const StringView & fallback); 56 | 57 | void set_group_color (const Quark& group, const GdkRGBA& color); 58 | 59 | std::string get_group_color_str (const Quark& group) const; 60 | GdkRGBA get_group_color (const Quark& group, const StringView& fallback_str) const; 61 | 62 | protected: 63 | static void start_element (GMarkupParseContext *context, 64 | const gchar *element_name, 65 | const gchar **attribute_names, 66 | const gchar **attribute_vals, 67 | gpointer group_prefs_gpointer, 68 | GError **error); 69 | 70 | public: 71 | GroupPrefs (); 72 | GroupPrefs (const StringView& filename); 73 | virtual ~GroupPrefs (); 74 | void save () const; 75 | 76 | private: 77 | typedef std::map<Quark,Prefs> group_prefs_t; 78 | mutable group_prefs_t _prefs; 79 | 80 | private: 81 | void from_string (const StringView&); 82 | void set_from_file (const StringView& filename); 83 | std::string _filename; 84 | }; 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /pan/gui/load-icon.cc: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include <config.h> 3 | #endif 4 | 5 | #include "load-icon.h" 6 | #include "pan/general/debug.h" 7 | 8 | #include <stdio.h> 9 | #include <stdlib.h> 10 | #include <string.h> 11 | 12 | #include <gdk-pixbuf/gdk-pixbuf.h> 13 | #include <glib/gi18n-lib.h> 14 | 15 | namespace pan { 16 | 17 | GdkPixbuf *load_icon(gchar const *file_name) 18 | { 19 | // try local icon 20 | GdkPixbuf *pixbuf = load_icon_from_path(file_name, "pan/icons"); 21 | if (pixbuf != nullptr) { 22 | return pixbuf; 23 | } 24 | 25 | // try system icon 26 | pixbuf = load_icon_from_path(file_name, PAN_SYSTEM_ICON_PATH); 27 | if (pixbuf != nullptr) { 28 | return pixbuf; 29 | } 30 | 31 | std::cerr << "Unable to load " << file_name << " icon. Use --debug flag for more details"; 32 | return nullptr; 33 | } 34 | 35 | GdkPixbuf *load_icon_from_path(const gchar *file_name, const gchar *icon_dir) 36 | { 37 | GError *error = NULL; 38 | gchar *icon_path = g_build_filename(icon_dir, file_name, NULL); 39 | GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(icon_path, &error); 40 | 41 | if (error != NULL) 42 | { 43 | pan_debug("Unable to load icon " << file_name << " from " << icon_dir << ": " << error->message); 44 | g_error_free(error); 45 | } 46 | 47 | g_free(icon_path); 48 | return pixbuf; 49 | } 50 | 51 | } // namespace pan 52 | -------------------------------------------------------------------------------- /pan/gui/load-icon.h: -------------------------------------------------------------------------------- 1 | #ifndef E_LOAD_ICON_H 2 | #define E_LOAD_ICON_H 3 | 4 | #include <gtk/gtk.h> 5 | #include <gdk/gdk.h> 6 | 7 | G_BEGIN_DECLS 8 | 9 | namespace pan { 10 | GdkPixbuf* load_icon(const char *file); 11 | GdkPixbuf* load_icon_from_path(const char *file, const gchar* path); 12 | } 13 | 14 | G_END_DECLS 15 | 16 | #endif /* E_LOAD_ICON_H */ 17 | -------------------------------------------------------------------------------- /pan/gui/log-ui.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | #ifndef LOG_UI_H 20 | #define LOG_UI_H 21 | 22 | #include <gtk/gtk.h> 23 | #include <gdk/gdk.h> 24 | #include "prefs.h" 25 | 26 | namespace pan 27 | { 28 | /** 29 | * @ingroup GUI 30 | */ 31 | GtkWidget* log_dialog_new (Prefs& prefs, GtkWindow* parent); 32 | 33 | gboolean on_button_pressed (GtkWidget *treeview, GdkEventButton *event, gpointer userdata); 34 | void do_popup_menu (GtkWidget *treeview, GdkEventButton *event, gpointer userdata); 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /pan/gui/my-massif.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | export G_SLICE=always-malloc 3 | export G_DEBUG=gc-friendly 4 | export GLIBCXX_FORCE_NEW=1 5 | valgrind --tool=massif --depth=8 --num-callers=8 --alloc-fn=g_malloc --alloc-fn=g_realloc --alloc-fn=g_try_malloc --alloc-fn=g_malloc0 --alloc-fn=g_mem_chunk_alloc ./pan 6 | -------------------------------------------------------------------------------- /pan/gui/my-valgrind.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | export G_SLICE=always-malloc 3 | export G_DEBUG=gc-friendly 4 | export GLIBCXX_FORCE_NEW=1 5 | valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=42 --log-file=pan-valgrind --show-reachable=yes ./pan 6 | -------------------------------------------------------------------------------- /pan/gui/pad.h: -------------------------------------------------------------------------------- 1 | #ifndef _PAD_H_ 2 | #define _PAD_H_ 3 | 4 | namespace pan 5 | { 6 | extern void pan_box_pack_start_defaults (GtkBox * box, GtkWidget * child); 7 | }; 8 | 9 | #define PAD_SMALL 3 10 | #define PAD 6 11 | #define PAD_BIG 9 12 | #define PAD_LARGE 9 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /pan/gui/pan-colors.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef _PanColors_h_ 21 | #define _PanColors_h_ 22 | 23 | #include <config.h> 24 | #include <string> 25 | #include <gtk/gtk.h> 26 | #include <gdk/gdk.h> 27 | #include <pan/general/singleton-template.h> 28 | 29 | class PanColors : public PanSingleton< PanColors > 30 | { 31 | public: 32 | std::string def_fg; 33 | std::string def_bg; 34 | GdkRGBA def_fg_col; 35 | GdkRGBA def_bg_col; 36 | 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /pan/gui/pan-file-entry.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __PanFileEntry_h__ 21 | #define __PanFileEntry_h__ 22 | 23 | #include <gtk/gtk.h> 24 | #include <gdk/gdk.h> 25 | 26 | namespace pan 27 | { 28 | GtkWidget* file_entry_new (const char * title, 29 | int chooser_mode = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); 30 | 31 | GtkWidget* file_entry_gtk_entry (GtkWidget * w); 32 | 33 | void file_entry_set (GtkWidget * w, const char * file); 34 | 35 | const char* file_entry_get (GtkWidget * w); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /pan/gui/pan.manifest.xml: -------------------------------------------------------------------------------- 1 | <assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0"> 2 | <asmv3:application> 3 | <!-- gtk3 doesn't support fractional scaling though it doesn't seem 4 | to be a problem for gtk2 --> 5 | <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> 6 | <dpiAware>false</dpiAware> 7 | </asmv3:windowsSettings> 8 | </asmv3:application> 9 | </assembly> 10 | -------------------------------------------------------------------------------- /pan/gui/panrc.rc: -------------------------------------------------------------------------------- 1 | // Wormux resource for win32 target 2 | 3 | #include <winuser.h> 4 | #include <winver.h> 5 | #include "config.h" 6 | #if ENABLE_NLS 7 | # define IS_NLS_ENABLED "yes" 8 | #else 9 | # define IS_NLS_ENABLED "no" 10 | #endif 11 | 12 | #ifndef VERSION_MAJOR 13 | #define VERSION_MAJOR 0 14 | #endif 15 | 16 | #ifndef VERSION_MINOR 17 | #define VERSION_MINOR 0 18 | #endif 19 | 20 | #ifndef VERSION_PATCH 21 | #define VERSION_PATCH 0 22 | #endif 23 | 24 | #ifndef VERSION_TWEAK 25 | #define VERSION_TWEAK 0 26 | #endif 27 | 28 | 1 VERSIONINFO 29 | FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,VERSION_TWEAK 30 | PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,VERSION_TWEAK 31 | FILEFLAGSMASK 0x3fL 32 | #ifdef _DEBUG 33 | FILEFLAGS 0x1L 34 | #else 35 | FILEFLAGS 0x0L 36 | #endif 37 | FILEOS VOS__WINDOWS32 38 | FILETYPE VFT_APP 39 | { 40 | BLOCK "StringFileInfo" 41 | { 42 | BLOCK "000004b0" 43 | { 44 | VALUE "Comments","Localization support: " IS_NLS_ENABLED "." 45 | VALUE "CompanyName", "\000" 46 | VALUE "FileDescription", "Pan Newsreader" 47 | VALUE "FileVersion", PACKAGE_VERSION 48 | VALUE "InternalName", "pan" 49 | VALUE "LegalCopyright", "Copyright (C) 2002-2024 Charles Kerr and others" 50 | VALUE "LegalTrademarks", "GPL 2" 51 | VALUE "OriginalFilename", "pan.exe" 52 | VALUE "ProductName", "pan" 53 | VALUE "ProductVersion", PACKAGE_VERSION 54 | VALUE "SpecialBuild", "Build date: " __DATE__ ", " __TIME__ " with compiler version " __VERSION__ 55 | } 56 | } 57 | BLOCK "VarFileInfo" 58 | { 59 | VALUE "Translation", 0x0, 1200 60 | } 61 | } 62 | 63 | IDI_ICON1 ICON DISCARDABLE "../icons/Pan.ico" 64 | 65 | CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "pan.manifest.xml" 66 | -------------------------------------------------------------------------------- /pan/gui/post.ui.h: -------------------------------------------------------------------------------- 1 | // " <menuitem action='wrapselected' />\n" doesnt exist yet, so deactivated for now.... 2 | const char * fallback_post_ui = 3 | "<ui>\n" 4 | " <menubar name='post'>\n" 5 | " <menu action='file-menu'>\n" 6 | " <menuitem action='post-article' />\n" 7 | " <menuitem action ='post-and-save-articles' />\n" 8 | " <separator />\n" 9 | " <menuitem action='save-draft' />\n" 10 | " <menuitem action='open-draft' />\n" 11 | " <separator />\n" 12 | " <menuitem action='close' />\n" 13 | " </menu>\n" 14 | " <menu action='edit-menu'>\n" 15 | " <menuitem action='cut' />\n" 16 | " <menuitem action='copy' />\n" 17 | " <menuitem action='paste' />\n" 18 | " <menuitem action='rot13' />\n" 19 | " <separator />\n" 20 | " <menuitem action='set-encoding' />\n" 21 | " <menuitem action='set-charset' />\n" 22 | " <menuitem action='remember-charset' />\n" 23 | " <separator />\n" 24 | " <menuitem action='master-reply' />\n" 25 | " <separator />\n" 26 | #ifdef HAVE_GMIME_CRYPTO 27 | " <menuitem action='gpg-encrypt' />\n" 28 | " <menuitem action='gpg-sign' />\n" 29 | " <separator />\n" 30 | #endif 31 | " <menuitem action='run-editor' />\n" 32 | " <menuitem action='always-run-editor' />\n" 33 | " <separator />\n" 34 | " <menuitem action='wrap' />\n" 35 | " <menuitem action='spellcheck' />\n" 36 | " <separator />\n" 37 | " <menuitem action='manage-profiles' />\n" 38 | " </menu>\n" 39 | " </menubar>\n" 40 | "\n" 41 | " <toolbar name='post-toolbar'>\n" 42 | " <toolitem action='post-article' />\n" 43 | " <toolitem action='post-and-save-articles' />\n" 44 | " <separator />\n" 45 | " <toolitem action='save-draft' />\n" 46 | " <toolitem action='open-draft' />\n" 47 | " <separator />\n" 48 | " <toolitem action='wrap' />\n" 49 | " <separator />\n" 50 | " <toolitem action='rot13' />\n" 51 | " <toolitem action='run-editor' />\n" 52 | " <separator />\n" 53 | " <toolitem action='add-files' />\n" 54 | " </toolbar>\n" 55 | "\n" 56 | " <popup name='filequeue-popup'>\n" 57 | " <menuitem action='remove-files' />\n" 58 | " <menuitem action='clear-list' />\n" 59 | " <separator />\n" 60 | " <menuitem action='select-parts' />\n" 61 | " <separator />\n" 62 | " <menuitem action='move-up' />\n" 63 | " <menuitem action='move-down' />\n" 64 | " <separator />\n" 65 | " <menuitem action='move-top' />\n" 66 | " <menuitem action='move-bottom' />\n" 67 | " </popup>\n" 68 | "\n" 69 | "</ui>\n"; 70 | -------------------------------------------------------------------------------- /pan/gui/prefs-file.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <config.h> 21 | #include <iostream> 22 | #include <fstream> 23 | #include <string> 24 | extern "C" { 25 | #include <sys/types.h> // for chmod 26 | #include <sys/stat.h> // for chmod 27 | } 28 | #include <glib.h> 29 | #include <pan/general/file-util.h> 30 | #include "prefs-file.h" 31 | 32 | using namespace pan; 33 | 34 | void 35 | PrefsFile :: set_from_file (const StringView& filename) 36 | { 37 | std::string s; 38 | if (file :: get_text_file_contents (filename, s)) 39 | from_string (s); 40 | } 41 | 42 | 43 | PrefsFile :: PrefsFile (const StringView& filename): 44 | _filename (filename.to_string()) 45 | { 46 | set_from_file (_filename); 47 | } 48 | 49 | PrefsFile :: ~PrefsFile () 50 | { 51 | save (); 52 | } 53 | 54 | void 55 | PrefsFile :: save () const 56 | { 57 | std::string s; 58 | to_string (0, s); 59 | std::ofstream out (_filename.c_str()); 60 | out << "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" 61 | << "<preferences>\n" 62 | << s 63 | << "</preferences>\n"; 64 | out.close (); 65 | chmod (_filename.c_str(), 0600); 66 | } 67 | -------------------------------------------------------------------------------- /pan/gui/prefs-file.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef _PrefsFile_h_ 21 | #define _PrefsFile_h_ 22 | 23 | #include "prefs.h" 24 | 25 | namespace pan 26 | { 27 | class PrefsFile: public Prefs 28 | { 29 | public: 30 | PrefsFile (const StringView& filename); 31 | ~PrefsFile (); 32 | void save () const override; 33 | 34 | private: 35 | std::string _filename; 36 | 37 | private: 38 | void set_from_file (const StringView& filename); 39 | void set_from_xml (const StringView& xml_string); 40 | }; 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /pan/gui/prefs-ui.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef PREFS_UI_H 21 | #define PREFS_UI_H 22 | 23 | #include <list> 24 | #include <gtk/gtk.h> 25 | #include <gdk/gdk.h> 26 | #include <pan/gui/prefs.h> 27 | #include <pan/gui/group-prefs.h> 28 | 29 | namespace pan 30 | { 31 | 32 | class PrefsDialog : 33 | public Prefs::Listener 34 | { 35 | 36 | public: 37 | 38 | struct CallBackData 39 | { 40 | PrefsDialog* dialog; 41 | std::string name; 42 | std::string value; 43 | GtkWidget* entry; 44 | GtkWidget* label; 45 | }; 46 | 47 | public: 48 | PrefsDialog (Prefs&, GtkWindow*) ; 49 | ~PrefsDialog (); 50 | Prefs& prefs () { return _prefs; } 51 | GtkWidget* notebook () { return _notebook; } 52 | GtkWidget* root() { return _root; } 53 | 54 | static void populate_popup_cb (GtkEntry*, GtkMenu*, gpointer); 55 | static void edit_shortkey_cb (GtkMenuItem*, gpointer); 56 | 57 | void set_current_hotkey(const char* s) { _hotkey = s; } 58 | const char* get_current_hotkey() const { return _hotkey; } 59 | 60 | private: 61 | Prefs& _prefs; 62 | GtkWidget* _root; 63 | GtkWidget* charset_label; 64 | GtkWidget* _notebook; 65 | std::list<CallBackData*> shortcut_ptr_list; 66 | 67 | void update_default_charset_label(const StringView&); 68 | 69 | void on_prefs_flag_changed (const StringView& key, bool value) override; 70 | void on_prefs_int_changed (const StringView& key, int color) override {} 71 | void on_prefs_string_changed (const StringView& key, const StringView& value) override; 72 | void on_prefs_color_changed (const StringView& key, const GdkRGBA& color) override {} 73 | 74 | const char* _hotkey; 75 | 76 | public: 77 | void populate_popup (GtkEntry*, GtkMenu*); 78 | void edit_shortkey (gpointer); 79 | void update_hotkey (gpointer); 80 | 81 | 82 | }; 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /pan/gui/profiles-dialog.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __ProfilesDialog_h__ 21 | #define __ProfilesDialog_h__ 22 | 23 | #include <gdk/gdk.h> 24 | #include <gtk/gtk.h> 25 | #include <pan/data/data.h> 26 | 27 | namespace pan { 28 | /** 29 | * Dialog for editing a posting profile. 30 | * @ingroup GUI 31 | */ 32 | class ProfileDialog 33 | { 34 | public: 35 | ProfileDialog(Data const &, 36 | StringView const &profile_name, 37 | Profile const &profile, 38 | GtkWindow *parent); 39 | ~ProfileDialog(); 40 | 41 | GtkWidget *root() 42 | { 43 | return _root; 44 | } 45 | 46 | void get_profile(std::string &setme_name, Profile &setme_profile); 47 | 48 | private: 49 | GtkWidget *_root; 50 | GtkWidget *_name_entry; 51 | GtkWidget *_username_entry; 52 | GtkWidget *_address_entry; 53 | GtkWidget *_msgid_fqdn_entry; 54 | GtkWidget *_face_entry; 55 | GtkWidget *_xface_entry; 56 | GtkWidget *_attribution_entry; 57 | GtkWidget *_signature_file_check; 58 | GtkWidget *_server_combo; 59 | GtkWidget *_extra_headers_tv; 60 | GtkWidget *_signature_file_combo; 61 | 62 | public: 63 | GtkWidget *_signature_file_combo_box; 64 | GtkWidget *_signature_file; 65 | GtkWidget *_gpg_sig_entry; 66 | 67 | static bool run_until_valid_or_cancel(ProfileDialog &p); 68 | }; 69 | 70 | /** 71 | * Dialog for managing all posting profiles. 72 | * @ingroup GUI 73 | */ 74 | class ProfilesDialog 75 | { 76 | public: 77 | ProfilesDialog(Data const &data, Profiles &profiles, GtkWindow *parent); 78 | ~ProfilesDialog(); 79 | 80 | GtkWidget *root() 81 | { 82 | return _root; 83 | } 84 | 85 | public: 86 | void edit_profile(); 87 | void delete_profile(); 88 | void create_new_profile(); 89 | void rebuild_store(); 90 | void refresh_buttons(); 91 | 92 | private: 93 | Data const &_data; 94 | Profiles &_profiles; 95 | GtkWidget *_root; 96 | GtkWidget *_view; 97 | GtkWidget *_edit_button; 98 | GtkWidget *_remove_button; 99 | GtkListStore *_store; 100 | }; 101 | } // namespace pan 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /pan/gui/progress-view.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __Progress_View_h__ 21 | #define __Progress_View_h__ 22 | 23 | #include <gtk/gtk.h> 24 | #include <gdk/gdk.h> 25 | #include <pan/general/progress.h> 26 | 27 | namespace pan 28 | { 29 | /** 30 | * GtkProgressBar representations of general::Progress objects. 31 | * 32 | * These are used at the bottom of Pan's main window to show 33 | * the status of running Task objects. 34 | * 35 | * @ingroup GUI 36 | */ 37 | class ProgressView: 38 | private Progress::Listener 39 | { 40 | public: 41 | ProgressView (); 42 | virtual ~ProgressView () ; 43 | GtkWidget* root () { return _root; } 44 | void set_progress (Progress *); 45 | Progress* get_progress () { return _progress; } 46 | const Progress* get_progress () const { return _progress; } 47 | void set_color (const std::string& color); 48 | void reset_color (); 49 | 50 | private: // inherited from progress listener 51 | void on_progress_step (Progress&, int percentage) override; 52 | void on_progress_status (Progress&, const StringView&) override; 53 | void on_progress_error (Progress&, const StringView&) override; 54 | void on_progress_finished (Progress&, int) override { } 55 | 56 | private: 57 | void update_text_soon (); 58 | void update_percentage_soon (); 59 | guint _progress_step_idle_tag; 60 | guint _progress_status_idle_tag; 61 | static gboolean on_progress_step_idle (gpointer); 62 | static gboolean on_progress_status_idle (gpointer); 63 | 64 | private: 65 | GtkWidget * _root; 66 | GtkWidget * _progressbar; 67 | GtkStyle * _style; 68 | std::string _last_status; 69 | Progress * _progress; 70 | 71 | }; 72 | } 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /pan/gui/render-bytes.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <glib.h> // g_snprintf 21 | #include "render-bytes.h" 22 | 23 | namespace pan 24 | { 25 | char* 26 | render_bytes (guint64 bytes) 27 | { 28 | static const unsigned long KIBI (1024ul); 29 | static const unsigned long MEBI (1048576ul); 30 | static const unsigned long GIBI (1073741824ul); 31 | static char buf[128]; 32 | 33 | if (bytes < KIBI) 34 | g_snprintf (buf, sizeof(buf), "%d B", (int)bytes); 35 | else if (bytes < MEBI) 36 | g_snprintf (buf, sizeof(buf), "%.0f KiB", (double)bytes/KIBI); 37 | else if (bytes < GIBI) 38 | g_snprintf (buf, sizeof(buf), "%.1f MiB", (double)bytes/MEBI); 39 | else 40 | g_snprintf (buf, sizeof(buf), "%.2f GiB", (double)bytes/GIBI); 41 | 42 | return buf; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pan/gui/render-bytes.h: -------------------------------------------------------------------------------- 1 | #ifndef RENDER_BYTES_H 2 | #define RENDER_BYTES_H 3 | #include <glib.h> 4 | namespace pan { 5 | extern char* render_bytes (guint64); 6 | } 7 | #endif 8 | -------------------------------------------------------------------------------- /pan/gui/save-attach-ui.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __SaveAttachUI_h__ 21 | #define __SaveAttachUI_h__ 22 | 23 | #include <string> 24 | #include <vector> 25 | #include <pan/general/quark.h> 26 | #include <pan/data/article.h> 27 | #include <pan/data/article-cache.h> 28 | #include <pan/data/data.h> 29 | #include <pan/tasks/task-article.h> 30 | #include <gtk/gtk.h> 31 | #include <gdk/gdk.h> 32 | #include "group-prefs.h" 33 | #include "prefs.h" 34 | 35 | namespace pan 36 | { 37 | class SaveAttachmentsDialog 38 | { 39 | public: 40 | 41 | SaveAttachmentsDialog (Prefs & prefs, 42 | const GroupPrefs & group_prefs, 43 | const ServerRank & server_rank, 44 | const GroupServer & group_server, 45 | ArticleCache & cache, 46 | ArticleRead & read, 47 | Queue & queue, 48 | GtkWindow * parent_window, 49 | const Quark & group, 50 | const std::vector<Article> & articles, 51 | const TaskArticle::SaveOptions & options, 52 | const char * filename=nullptr 53 | ); 54 | 55 | 56 | ~SaveAttachmentsDialog () {} 57 | GtkWidget * root() { return _root; } 58 | 59 | private: 60 | Prefs& _prefs; 61 | const ServerRank& _server_rank; 62 | const GroupServer& _group_server; 63 | ArticleCache& _cache; 64 | ArticleRead& _read; 65 | Queue& _queue; 66 | const Quark _group; 67 | GtkWidget * _root; 68 | GtkWidget * _save_path_entry; 69 | GtkWidget * _save_custom_path_radio; 70 | GtkWidget * _save_group_path_radio; 71 | std::vector<Article> _articles; 72 | TaskArticle::SaveOptions _options; 73 | const char* _filename; 74 | 75 | private: 76 | static void response_cb (GtkDialog*, int, gpointer); 77 | 78 | private: 79 | static bool _save_text; 80 | static bool _save_attachments; 81 | }; 82 | } 83 | #endif 84 | -------------------------------------------------------------------------------- /pan/gui/save-ui.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __SaveUI_h__ 21 | #define __SaveUI_h__ 22 | 23 | #include <string> 24 | #include <vector> 25 | #include <pan/general/quark.h> 26 | #include <pan/data/article.h> 27 | #include <pan/data/article-cache.h> 28 | #include <pan/data/data.h> 29 | #include <gtk/gtk.h> 30 | #include <gdk/gdk.h> 31 | #include "group-prefs.h" 32 | #include "prefs.h" 33 | 34 | namespace pan 35 | { 36 | class SaveDialog 37 | { 38 | public: 39 | SaveDialog (Prefs & prefs, 40 | const GroupPrefs & group_prefs, 41 | const ServerRank & server_rank, 42 | const GroupServer & group_server, 43 | ArticleCache & cache, 44 | ArticleRead & read, 45 | Queue & queue, 46 | GtkWindow * parent_window, 47 | const Quark & group, 48 | const std::vector<Article> & articles); 49 | 50 | 51 | ~SaveDialog () {} 52 | GtkWidget * root() { return _root; } 53 | 54 | private: 55 | Prefs& _prefs; 56 | const ServerRank& _server_rank; 57 | const GroupServer& _group_server; 58 | ArticleCache& _cache; 59 | ArticleRead& _read; 60 | Queue& _queue; 61 | const Quark _group; 62 | GtkWidget * _root; 63 | GtkWidget * _save_path_entry; 64 | GtkWidget * _save_custom_path_radio; 65 | GtkWidget * _save_group_path_radio; 66 | std::vector<Article> _articles; 67 | 68 | private: 69 | static void response_cb (GtkDialog*, int, gpointer); 70 | 71 | private: 72 | static bool _save_text; 73 | static bool _save_attachments; 74 | }; 75 | } 76 | #endif 77 | -------------------------------------------------------------------------------- /pan/gui/score-add-ui.h: -------------------------------------------------------------------------------- 1 | #ifndef __SCORE_ADD_UI_H__ 2 | #define __SCORE_ADD_UI_H__ 3 | 4 | #include <gtk/gtk.h> 5 | #include <gdk/gdk.h> 6 | #include <pan/data/article.h> 7 | #include <pan/data/data.h> 8 | 9 | namespace pan 10 | { 11 | /** 12 | * Dialog for creating a new entry for the Scorefile. 13 | * @ingroup GUI 14 | */ 15 | struct ScoreAddDialog 16 | { 17 | public: 18 | enum Mode { ADD, PLONK, WATCH_SUBTHREAD, IGNORE_SUBTHREAD }; 19 | ScoreAddDialog (Data& data, GtkWidget* parent, const Quark& group, const Article&, Mode); 20 | 21 | public: 22 | GtkWidget* root() { return _root; } 23 | 24 | private: 25 | void populate (const Quark& group, const Article&, Mode); 26 | void add_this_to_scorefile (bool do_rescore_all); 27 | static void response_cb (GtkDialog*, int response, gpointer); 28 | 29 | private: 30 | Data& _data; 31 | const Article _article; 32 | Quark _group; 33 | GtkWidget * _root; 34 | GtkWidget * _section_menu; 35 | GtkWidget * _section_entry; 36 | GtkWidget * _field_menu; 37 | GtkWidget * _criteria_menu; 38 | GtkWidget * _text_criteria_entry; 39 | GtkWidget * _numeric_criteria_spin; 40 | GtkWidget * _score_menu; 41 | GtkWidget * _score_spin; 42 | GtkWidget * _duration_menu; 43 | }; 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /pan/gui/score-view-ui.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | #ifndef _ScoreViewUI_h_ 20 | #define _ScoreViewUI_h_ 21 | 22 | #include <vector> 23 | #include <gtk/gtk.h> 24 | #include <gdk/gdk.h> 25 | #include <pan/general/quark.h> 26 | #include <pan/usenet-utils/scorefile.h> 27 | #include <pan/data/article.h> 28 | #include <pan/data/data.h> 29 | 30 | namespace pan 31 | { 32 | class Scorefile; 33 | 34 | /** 35 | * Dialog that shows what Scorefile entries apply to a given Article. 36 | * @ingroup GUI 37 | */ 38 | class ScoreView 39 | { 40 | public: 41 | ScoreView (Data& data, GtkWindow* parent, 42 | const Quark& group, 43 | const Article& article); 44 | ~ScoreView () {} 45 | 46 | public: 47 | GtkWidget* root() { return _root; } 48 | 49 | private: 50 | Data& _data; 51 | const Quark _group; 52 | const Article _article; 53 | GtkWidget * _root; 54 | GtkWidget * tree_view; 55 | GtkListStore * _store; 56 | typedef Scorefile::items_t items_t; 57 | items_t _items; 58 | 59 | private: 60 | void tree_view_refresh (); 61 | 62 | private: 63 | static void remove_clicked_cb (GtkWidget*, gpointer); 64 | void on_remove (); 65 | static void add_clicked_cb (GtkWidget*, gpointer); 66 | void on_add (); 67 | static void add_destroy_cb (GtkWidget*, gpointer); 68 | }; 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /pan/gui/server-ui.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef SERVER_UI_H 21 | #define SERVER_UI_H 22 | 23 | #include <set> 24 | #include <gtk/gtk.h> 25 | #include <gdk/gdk.h> 26 | #include <pan/data/data.h> 27 | #include <pan/tasks/queue.h> 28 | 29 | namespace pan 30 | { 31 | 32 | typedef std::set<std::string> strings_t; 33 | 34 | /** @ingroup GUI */ 35 | GtkWidget* server_edit_dialog_new (Data&, Queue&, Prefs&, GtkWindow*, const Quark& server); 36 | 37 | /** @ingroup GUI */ 38 | GtkWidget* server_list_dialog_new (Data&, Queue&, Prefs&, GtkWindow*); 39 | 40 | /** @ingroup GUI */ 41 | GtkWidget* sec_dialog_new (Data& data, Queue& queue, Prefs&, GtkWindow* parent); 42 | 43 | /** @ingroup GUI */ 44 | std::string 45 | import_sec_from_disk_dialog_new (Data& data, Queue& queue, GtkWindow * window); 46 | 47 | /** @ingroup GUI */ 48 | void render_cert_flag (GtkTreeViewColumn * , 49 | GtkCellRenderer * , 50 | GtkTreeModel * , 51 | GtkTreeIter * , 52 | gpointer ); 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /pan/gui/startup-sysprof.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | COUNTER=0 3 | while [ $COUNTER -lt 30 ]; do 4 | echo The counter is $COUNTER 5 | let COUNTER=COUNTER+1 6 | ./pan 7 | done 8 | -------------------------------------------------------------------------------- /pan/gui/tango-colors.h: -------------------------------------------------------------------------------- 1 | #ifndef TANGO_COLORS_H 2 | #define TANGO_COLORS_H 3 | 4 | /* http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines */ 5 | 6 | #define TANGO_BUTTER_LIGHT "#fce94f" 7 | #define TANGO_BUTTER "#edd400" 8 | #define TANGO_BUTTER_DARK "#c4a000" 9 | 10 | #define TANGO_ORANGE_LIGHT "#fcaf3e" 11 | #define TANGO_ORANGE "#f57900" 12 | #define TANGO_ORANGE_DARK "#ce5c00" 13 | 14 | #define TANGO_CHOCOLATE_LIGHT "#e9b96e" 15 | #define TANGO_CHOCOLATE "#c17d11" 16 | #define TANGO_CHOCOLATE_DARK "#8f5902" 17 | 18 | #define TANGO_CHAMELEON_LIGHT "#8ae234" 19 | #define TANGO_CHAMELEON "#73d216" 20 | #define TANGO_CHAMELEON_DARK "#4e9a06" 21 | 22 | #define TANGO_SKY_BLUE_LIGHT "#728fcf" 23 | #define TANGO_SKY_BLUE "#3465a4" 24 | #define TANGO_SKY_BLUE_DARK "#204a87" 25 | 26 | #define TANGO_PLUM_LIGHT "#ad7fa8" 27 | #define TANGO_PLUM "#75507b" 28 | #define TANGO_PLUM_DARK "#5c3566" 29 | 30 | #define TANGO_SCARLET_RED_LIGHT "#ef2929" 31 | #define TANGO_SCARLET_RED "#cc0000" 32 | #define TANGO_SCARLET_RED_DARK "#a40000" 33 | 34 | #define TANGO_ALUMINUM_1 "#eeeeec" 35 | #define TANGO_ALUMINUM_2 "#d3d7cf" 36 | #define TANGO_ALUMINUM_3 "#babdb6" 37 | #define TANGO_ALUMINUM_4 "#888a85" 38 | #define TANGO_ALUMINUM_5 "#555753" 39 | #define TANGO_ALUMINUM_6 "#2e3436" 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /pan/gui/taskpane.ui.h: -------------------------------------------------------------------------------- 1 | const char * fallback_taskpane_ui = 2 | "<ui>\n" 3 | "\n" 4 | " <popup name='taskpane-popup'>\n" 5 | " <menuitem action='move-up' />\n" 6 | " <menuitem action='move-down' />\n" 7 | " <separator />\n" 8 | " <menuitem action='move-top' />\n" 9 | " <menuitem action='move-bottom' />\n" 10 | " <separator />\n" 11 | " <menuitem action='show-info' />\n" 12 | " <separator />\n" 13 | " <menuitem action='stop' />\n" 14 | " <menuitem action='delete' />\n" 15 | " <menuitem action='restart' />\n" 16 | " <separator />\n" 17 | " <menuitem action='change-dest' />\n" 18 | " </popup>\n" 19 | "\n" 20 | "</ui>\n"; 21 | -------------------------------------------------------------------------------- /pan/gui/url.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | #ifndef URL_SHOW_H 20 | #define URL_SHOW_H 21 | 22 | #include <set> 23 | #include <string> 24 | #include "prefs.h" 25 | 26 | namespace pan 27 | { 28 | struct URL 29 | { 30 | static const char* get_environment (); 31 | 32 | static void get_default_editors (std::set<std::string>& setme); 33 | 34 | enum Mode { WEB, MAIL, GEMINI, AUTO }; 35 | 36 | static void open (const Prefs&, const char * url, Mode mode=AUTO); 37 | }; 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /pan/gui/wait.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | #ifndef _Wait_h_ 20 | #define _Wait_h_ 21 | 22 | namespace pan 23 | { 24 | struct WaitUI 25 | { 26 | virtual ~WaitUI () {} 27 | virtual void watch_cursor_on () = 0; 28 | virtual void watch_cursor_off () = 0; 29 | }; 30 | } 31 | 32 | #endif // _Wait_h_ 33 | -------------------------------------------------------------------------------- /pan/gui/xface.h: -------------------------------------------------------------------------------- 1 | #ifndef __PAN_XFACE_H__ 2 | #define __PAN_XFACE_H__ 3 | 4 | #include <gdk/gdk.h> 5 | #include <gdk-pixbuf/gdk-pixbuf.h> 6 | 7 | G_BEGIN_DECLS 8 | 9 | /** @ingroup GUI */ 10 | extern GdkPixbuf* pan_gdk_pixbuf_create_from_x_face (const char *); 11 | 12 | G_END_DECLS 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /pan/icons/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB public_icons hicolor_apps_*.pan.png) 3 | 4 | # keep .png otherwise dependency check fails 5 | list(APPEND stock_images 6 | icon_article_read.png 7 | icon_article_unread.png 8 | icon_binary_complete.png 9 | icon_binary_complete_read.png 10 | icon_binary_incomplete.png 11 | icon_binary_incomplete_read.png 12 | icon_bluecheck.png 13 | icon_red_flag.png 14 | icon_by_me.png 15 | icon_by_others.png 16 | icon_compose_followup.png 17 | icon_compose_post.png 18 | icon_disk.png 19 | icon_empty.png 20 | icon_filter.png 21 | icon_filter_only_attachments.png 22 | icon_filter_only_cached.png 23 | icon_filter_only_me.png 24 | icon_filter_only_read.png 25 | icon_filter_only_unread.png 26 | icon_filter_only_watched.png 27 | icon_get_dialog.png 28 | icon_get_flagged.png 29 | icon_get_selected.png 30 | icon_get_subscribed.png 31 | icon_layout_1.png 32 | icon_layout_2.png 33 | icon_layout_3.png 34 | icon_layout_4.png 35 | icon_layout_5.png 36 | icon_pan_about_logo.png 37 | icon_pan.png 38 | icon_read_group.png 39 | icon_read_more.png 40 | icon_read_less.png 41 | icon_read_unread_article.png 42 | icon_read_unread_thread.png 43 | icon_score.png 44 | icon_search_pulldown.png 45 | icon_x.png 46 | icon_mozilla_frown.png 47 | icon_mozilla_smile.png 48 | icon_mozilla_surprised.png 49 | icon_mozilla_tongueout.png 50 | icon_mozilla_wink.png 51 | icon_plain.png 52 | icon_cert.png 53 | icon_status_online.png 54 | icon_status_offline.png 55 | icon_status_active.png 56 | icon_status_queue_empty.png 57 | icon_status_error.png 58 | icon_status_idle.png 59 | icon_status_new_articles.png 60 | icon_sig_ok.png 61 | icon_sig_fail.png 62 | icon_show_signature.png 63 | icon_prefs_applications.png 64 | icon_prefs_extras.png 65 | icon_prefs_hotkeys.png 66 | icon_prefs_behavior.png 67 | icon_prefs_fonts.png 68 | icon_prefs_upload.png 69 | icon_prefs_colors.png 70 | icon_prefs_headers.png 71 | icon_prefs_layout.png 72 | icon_prefs_actions.png 73 | icon_prefs_panes.png 74 | icon_expand_thread.png 75 | icon_collapse_thread.png 76 | ) 77 | 78 | foreach(image_file IN LISTS stock_images) 79 | string(REPLACE "\.png" "" image "${image_file}") 80 | # install png files 81 | install(FILES ${image_file} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pan/icons/") 82 | endforeach() 83 | 84 | # install hicolor icons 85 | foreach (icon_path ${public_icons}) 86 | cmake_path(GET icon_path FILENAME icon_file) 87 | string(REPLACE "_" ";" words ${icon_file}) 88 | list(GET words 0 theme) 89 | list(GET words 1 context) 90 | list(GET words 2 size) 91 | list(GET words 3 target) 92 | set(destdir "${CMAKE_INSTALL_DATAROOTDIR}/icons/${theme}/${size}/${context}/") 93 | install(FILES ${icon_file} DESTINATION ${destdir} RENAME ${target}) 94 | endforeach() 95 | -------------------------------------------------------------------------------- /pan/icons/Pan.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/Pan.ico -------------------------------------------------------------------------------- /pan/icons/hicolor_apps_16x16_org.gnome.pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/hicolor_apps_16x16_org.gnome.pan.png -------------------------------------------------------------------------------- /pan/icons/hicolor_apps_24x24_org.gnome.pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/hicolor_apps_24x24_org.gnome.pan.png -------------------------------------------------------------------------------- /pan/icons/hicolor_apps_256x256_org.gnome.pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/hicolor_apps_256x256_org.gnome.pan.png -------------------------------------------------------------------------------- /pan/icons/hicolor_apps_32x32_org.gnome.pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/hicolor_apps_32x32_org.gnome.pan.png -------------------------------------------------------------------------------- /pan/icons/hicolor_apps_48x48_org.gnome.pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/hicolor_apps_48x48_org.gnome.pan.png -------------------------------------------------------------------------------- /pan/icons/icon_article_read.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_article_read.png -------------------------------------------------------------------------------- /pan/icons/icon_article_unread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_article_unread.png -------------------------------------------------------------------------------- /pan/icons/icon_binary_complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_binary_complete.png -------------------------------------------------------------------------------- /pan/icons/icon_binary_complete_read.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_binary_complete_read.png -------------------------------------------------------------------------------- /pan/icons/icon_binary_incomplete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_binary_incomplete.png -------------------------------------------------------------------------------- /pan/icons/icon_binary_incomplete_read.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_binary_incomplete_read.png -------------------------------------------------------------------------------- /pan/icons/icon_bluecheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_bluecheck.png -------------------------------------------------------------------------------- /pan/icons/icon_by_me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_by_me.png -------------------------------------------------------------------------------- /pan/icons/icon_by_others.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_by_others.png -------------------------------------------------------------------------------- /pan/icons/icon_cert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_cert.png -------------------------------------------------------------------------------- /pan/icons/icon_collapse_thread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_collapse_thread.png -------------------------------------------------------------------------------- /pan/icons/icon_compose_followup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_compose_followup.png -------------------------------------------------------------------------------- /pan/icons/icon_compose_post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_compose_post.png -------------------------------------------------------------------------------- /pan/icons/icon_disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_disk.png -------------------------------------------------------------------------------- /pan/icons/icon_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_empty.png -------------------------------------------------------------------------------- /pan/icons/icon_expand_thread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_expand_thread.png -------------------------------------------------------------------------------- /pan/icons/icon_filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_filter.png -------------------------------------------------------------------------------- /pan/icons/icon_filter_only_attachments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_filter_only_attachments.png -------------------------------------------------------------------------------- /pan/icons/icon_filter_only_cached.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_filter_only_cached.png -------------------------------------------------------------------------------- /pan/icons/icon_filter_only_me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_filter_only_me.png -------------------------------------------------------------------------------- /pan/icons/icon_filter_only_read.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_filter_only_read.png -------------------------------------------------------------------------------- /pan/icons/icon_filter_only_unread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_filter_only_unread.png -------------------------------------------------------------------------------- /pan/icons/icon_filter_only_watched.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_filter_only_watched.png -------------------------------------------------------------------------------- /pan/icons/icon_get_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_get_dialog.png -------------------------------------------------------------------------------- /pan/icons/icon_get_flagged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_get_flagged.png -------------------------------------------------------------------------------- /pan/icons/icon_get_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_get_selected.png -------------------------------------------------------------------------------- /pan/icons/icon_get_subscribed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_get_subscribed.png -------------------------------------------------------------------------------- /pan/icons/icon_layout_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_layout_1.png -------------------------------------------------------------------------------- /pan/icons/icon_layout_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_layout_2.png -------------------------------------------------------------------------------- /pan/icons/icon_layout_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_layout_3.png -------------------------------------------------------------------------------- /pan/icons/icon_layout_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_layout_4.png -------------------------------------------------------------------------------- /pan/icons/icon_layout_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_layout_5.png -------------------------------------------------------------------------------- /pan/icons/icon_mozilla_frown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_mozilla_frown.png -------------------------------------------------------------------------------- /pan/icons/icon_mozilla_smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_mozilla_smile.png -------------------------------------------------------------------------------- /pan/icons/icon_mozilla_surprised.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_mozilla_surprised.png -------------------------------------------------------------------------------- /pan/icons/icon_mozilla_tongueout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_mozilla_tongueout.png -------------------------------------------------------------------------------- /pan/icons/icon_mozilla_wink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_mozilla_wink.png -------------------------------------------------------------------------------- /pan/icons/icon_pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_pan.png -------------------------------------------------------------------------------- /pan/icons/icon_pan_about_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_pan_about_logo.png -------------------------------------------------------------------------------- /pan/icons/icon_pan_about_logo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_pan_about_logo.xcf -------------------------------------------------------------------------------- /pan/icons/icon_pan_logo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_pan_logo.xcf -------------------------------------------------------------------------------- /pan/icons/icon_plain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_plain.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_actions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_actions.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_applications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_applications.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_behavior.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_behavior.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_colors.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_extras.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_extras.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_fonts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_fonts.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_headers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_headers.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_hotkeys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_hotkeys.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_layout.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_panes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_panes.png -------------------------------------------------------------------------------- /pan/icons/icon_prefs_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_prefs_upload.png -------------------------------------------------------------------------------- /pan/icons/icon_read_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_read_group.png -------------------------------------------------------------------------------- /pan/icons/icon_read_less.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_read_less.png -------------------------------------------------------------------------------- /pan/icons/icon_read_more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_read_more.png -------------------------------------------------------------------------------- /pan/icons/icon_read_unread_article.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_read_unread_article.png -------------------------------------------------------------------------------- /pan/icons/icon_read_unread_thread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_read_unread_thread.png -------------------------------------------------------------------------------- /pan/icons/icon_red_flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_red_flag.png -------------------------------------------------------------------------------- /pan/icons/icon_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_refresh.png -------------------------------------------------------------------------------- /pan/icons/icon_score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_score.png -------------------------------------------------------------------------------- /pan/icons/icon_search_pulldown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_search_pulldown.png -------------------------------------------------------------------------------- /pan/icons/icon_show_signature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_show_signature.png -------------------------------------------------------------------------------- /pan/icons/icon_sig_fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_sig_fail.png -------------------------------------------------------------------------------- /pan/icons/icon_sig_ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_sig_ok.png -------------------------------------------------------------------------------- /pan/icons/icon_status_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_status_active.png -------------------------------------------------------------------------------- /pan/icons/icon_status_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_status_error.png -------------------------------------------------------------------------------- /pan/icons/icon_status_idle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_status_idle.png -------------------------------------------------------------------------------- /pan/icons/icon_status_new_articles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_status_new_articles.png -------------------------------------------------------------------------------- /pan/icons/icon_status_offline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_status_offline.png -------------------------------------------------------------------------------- /pan/icons/icon_status_online.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_status_online.png -------------------------------------------------------------------------------- /pan/icons/icon_status_queue_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_status_queue_empty.png -------------------------------------------------------------------------------- /pan/icons/icon_tabbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_tabbar.png -------------------------------------------------------------------------------- /pan/icons/icon_x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/icon_x.png -------------------------------------------------------------------------------- /pan/icons/pan-template.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/pan/89a33f9dbaf75dd50ad3f83b9e41037b31de0888/pan/icons/pan-template.xcf -------------------------------------------------------------------------------- /pan/tasks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(tasks 2 | decoder.cc 3 | encoder.cc 4 | task.cc 5 | task-article.cc 6 | task-groups.cc 7 | task-post.cc 8 | task-xover.cc 9 | task-upload.cc 10 | nntp.cc 11 | nzb.cc 12 | queue.cc 13 | upload-queue.cc 14 | socket.cc 15 | socket-impl-main.cc 16 | socket-impl-openssl.cc 17 | socket-impl-gio.cc 18 | socket-impl-scripted.cc 19 | nntp-pool.cc 20 | ) 21 | 22 | # Sanity checking 23 | # https://cmake.org/cmake/help/latest/command/add_compile_options.html 24 | target_compile_options(tasks PRIVATE "${CXX_STD}" "-Wreorder" "-Wzero-as-null-pointer-constant") 25 | 26 | target_link_libraries(tasks PUBLIC PkgConfig::GTK3) 27 | 28 | target_link_libraries(tasks PUBLIC PkgConfig::GMIME) 29 | 30 | if(Iconv_FOUND) 31 | my_target_system_lib(tasks PUBLIC Iconv) 32 | endif() 33 | 34 | if(WANT_GNUTLS) 35 | target_link_libraries(tasks PUBLIC PkgConfig::GNUTLS) 36 | endif() 37 | -------------------------------------------------------------------------------- /pan/tasks/health.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef _Health_h_ 21 | #define _Health_h_ 22 | 23 | namespace pan 24 | { 25 | /** 26 | * Possible health states of a Task. 27 | * 28 | * @ingroup tasks 29 | */ 30 | enum Health 31 | { 32 | /** The task's health is fine. */ 33 | OK, 34 | 35 | /** The task has failed because of a bad connection. 36 | The queue should leave this task as-is so that it 37 | can retry when the network clears up. */ 38 | ERR_NETWORK, 39 | 40 | /** The server has rejected a command sent by this task. 41 | For example, an expired article can't be retrieved 42 | or an article can't be posted due to no permissions. 43 | The queue should stop the task (but let other tasks 44 | continue) and let the user decide how to proceed. */ 45 | ERR_COMMAND, 46 | 47 | /** The task has failed because of some local 48 | environment problem. 49 | Further tasks are likely to fail for the 50 | same reason, so the queue should go offline 51 | until the user intervenes to fix the problem. */ 52 | ERR_LOCAL, 53 | 54 | /** Handle disk full by setting the queue offline */ 55 | ERR_NOSPACE 56 | }; 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /pan/tasks/nzb.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __NZB_H__ 21 | #define __NZB_H__ 22 | 23 | #include <iosfwd> 24 | #include <vector> 25 | #include <pan/data/data.h> 26 | 27 | namespace pan 28 | { 29 | class StringView; 30 | class ArticleCache; 31 | class Task; 32 | 33 | /** 34 | * Converts NZB files in to a vector of TaskArticle objects, and vice versa. 35 | * @ingroup tasks 36 | */ 37 | struct NZB 38 | { 39 | static void tasks_from_nzb_string (const StringView & nzb, 40 | const StringView & save_path, 41 | ArticleCache & cache, 42 | EncodeCache & encode_cache, 43 | ArticleRead & read, 44 | const ServerRank & ranks, 45 | const GroupServer & gs, 46 | std::vector<Task*> & appendme); 47 | 48 | static void tasks_from_nzb_file (const StringView & filename, 49 | const StringView & save_path, 50 | ArticleCache & cache, 51 | EncodeCache & encode_cache, 52 | ArticleRead & read, 53 | const ServerRank & ranks, 54 | const GroupServer & gs, 55 | std::vector<Task*> & appendme); 56 | 57 | static std::ostream& nzb_to_xml (std::ostream & out, 58 | const std::vector<Task*> & tasks); 59 | 60 | static std::ostream& upload_list_to_xml_file (std::ostream& out, 61 | const std::vector<Article*> & tasks); 62 | 63 | static std::ostream& nzb_to_xml_file (std::ostream & out, 64 | const std::vector<Task*> & tasks); 65 | 66 | static std::ostream &print_header(std::ostream &out); 67 | 68 | static std::ostream &print_footer(std::ostream &out); 69 | 70 | }; 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /pan/tasks/socket-impl-gio.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __SocketGIO_h__ 21 | #define __SocketGIO_h__ 22 | 23 | #include <string> 24 | #include <glib.h> 25 | #include <pan/tasks/socket.h> 26 | 27 | namespace pan 28 | { 29 | /** 30 | * glib implementation of Socket 31 | * 32 | * @ingroup tasks 33 | */ 34 | class GIOChannelSocket: public Socket 35 | { 36 | public: 37 | GIOChannelSocket (); 38 | virtual ~GIOChannelSocket (); 39 | bool open (const StringView& address, int port, std::string& setme_err) override; 40 | void get_host (std::string& setme) const override; 41 | 42 | private: 43 | GIOChannel * _channel; 44 | unsigned int _tag_watch; 45 | unsigned int _tag_timeout; 46 | Listener * _listener; 47 | GString * _out_buf; 48 | GString * _in_buf; 49 | std::string _partial_read; 50 | std::string _host; 51 | bool _io_performed; 52 | 53 | private: 54 | friend class GIOChannelSocketSSL; 55 | enum WatchMode { READ_NOW, WRITE_NOW, IGNORE_NOW }; 56 | void set_watch_mode (WatchMode mode); 57 | void write_command (const StringView& chars, Listener *) override; 58 | static gboolean gio_func (GIOChannel*, GIOCondition, gpointer); 59 | gboolean gio_func (GIOChannel*, GIOCondition); 60 | static gboolean timeout_func (gpointer); 61 | enum DoResult { IO_ERR, IO_READ, IO_WRITE, IO_DONE }; 62 | DoResult do_read (); 63 | DoResult do_write (); 64 | }; 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /pan/tasks/socket-impl-scripted.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __ScriptedSocket_h__ 21 | #define __ScriptedSocket_h__ 22 | 23 | #include <deque> 24 | #include <pan/tasks/socket.h> 25 | 26 | namespace pan 27 | { 28 | /** 29 | * A mock socket suitable for automated tests. 30 | * 31 | * This object reads from a script and, if the commands passed to it match 32 | * the script, it quotes back its lines from the script. If the commands 33 | * don't match, it explodes. 34 | */ 35 | class ScriptedSocket: public Socket 36 | { 37 | public: 38 | 39 | ScriptedSocket (); 40 | virtual ~ScriptedSocket (); 41 | virtual bool open (const StringView& address, int port); 42 | void write_command (const StringView& chars, Listener *) override; 43 | 44 | typedef std::deque<std::string> strings_t; 45 | static const std::string NETWORK_ERROR; 46 | static const std::string ABORT; 47 | void add_script (const std::string& command, const strings_t& responses); 48 | void add_script (const std::string& command, const std::string& response); 49 | bool empty () const; 50 | void clear (); 51 | 52 | private: 53 | 54 | typedef std::pair<std::string,strings_t> command_and_responses_t; 55 | typedef std::deque<command_and_responses_t> script_t; 56 | script_t _script; 57 | }; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /pan/tasks/socket.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <config.h> 21 | #include <cstdarg> 22 | #include <ctime> 23 | #include <cmath> 24 | #include <glib.h> 25 | #include <pan/general/debug.h> 26 | #include <pan/general/string-view.h> 27 | #include "socket.h" 28 | 29 | using namespace pan; 30 | 31 | Socket :: Socket (): 32 | _bytes_since_last_check (0), 33 | _time_of_last_check (time(nullptr)), 34 | _speed_KiBps (0.0), 35 | _abort_flag (false), 36 | _id(0) 37 | { 38 | } 39 | 40 | Socket :: ~Socket () 41 | {} 42 | 43 | void 44 | Socket :: set_abort_flag (bool b) 45 | { 46 | _abort_flag = b; 47 | } 48 | 49 | bool 50 | Socket :: is_abort_set () const 51 | { 52 | return _abort_flag; 53 | } 54 | 55 | double 56 | Socket :: get_speed_KiBps () const 57 | { 58 | const time_t now (time(nullptr)); 59 | 60 | if (now > _time_of_last_check) 61 | { 62 | const int delta = now - _time_of_last_check; 63 | const double current_speed = (_bytes_since_last_check/1024.0) / delta; 64 | _time_of_last_check = now; 65 | _bytes_since_last_check = 0; 66 | 67 | _speed_KiBps = (std::fabs(_speed_KiBps)<0.0001) 68 | ? current_speed // if no previous speed, no need to smooth 69 | : (_speed_KiBps*0.8 + current_speed*0.2); // smooth across 5 readings 70 | } 71 | 72 | return _speed_KiBps; 73 | } 74 | 75 | void 76 | Socket :: reset_speed_counter () 77 | { 78 | _time_of_last_check = time(nullptr); 79 | _bytes_since_last_check = 0; 80 | } 81 | 82 | void 83 | Socket :: increment_xfer_byte_count (unsigned long byte_count) 84 | { 85 | _bytes_since_last_check += byte_count; 86 | } 87 | 88 | void 89 | Socket :: write_command_va (Listener * l, const char *fmt, ...) 90 | { 91 | va_list args; 92 | va_start (args, fmt); 93 | char * str = g_strdup_vprintf (fmt, args); 94 | va_end (args); 95 | write_command (str, l); 96 | g_free (str); 97 | } 98 | -------------------------------------------------------------------------------- /pan/tasks/task-groups.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __TASK_GROUPS_H__ 21 | #define __TASK_GROUPS_H__ 22 | 23 | #include <pan/general/quark.h> 24 | #include <pan/data/data.h> 25 | #include <pan/tasks/task.h> 26 | #include <pan/data/cert-store.h> 27 | #include <pan/tasks/nntp.h> 28 | 29 | namespace pan 30 | { 31 | /** 32 | * Task for downloading the grouplist of a new server. 33 | * @ingroup tasks 34 | */ 35 | class TaskGroups: 36 | public Task, 37 | private NNTP::Listener 38 | { 39 | public: // life cycle 40 | TaskGroups (Data& data, const Quark& server); 41 | virtual ~TaskGroups (); 42 | 43 | public: // Task's virtual functions 44 | unsigned long get_bytes_remaining () const override { return 0; } 45 | 46 | protected: // Task's virtual functions 47 | virtual void use_nntp (NNTP * nntp) override; 48 | 49 | private: // NNTP::Listener's virtual functions 50 | void on_nntp_line (NNTP*, const StringView&) override; 51 | void on_nntp_line_process (NNTP*, const StringView&); 52 | void on_nntp_done (NNTP*, Health, const StringView&) override; 53 | 54 | private: // implementation 55 | Data& _data; 56 | Quark _servername; 57 | typedef std::map<Quark,Data::NewGroup> new_groups_t; 58 | new_groups_t _new_groups; 59 | unsigned long _group_count; 60 | 61 | enum Step { LIST, LIST_NEWSGROUPS, DONE }; 62 | Step _step; 63 | 64 | std::stringstream stream; 65 | }; 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /pan/tasks/task-post.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <config.h> 21 | #include <glib/gi18n.h> 22 | #include "task-post.h" 23 | #include <pan/general/debug.h> 24 | #include <pan/general/log.h> 25 | 26 | using namespace pan; 27 | 28 | namespace 29 | { 30 | std::string get_description (GMimeMessage * message) 31 | { 32 | char buf[1024]; 33 | snprintf (buf, sizeof(buf), _("Posting \"%s\""), g_mime_message_get_subject(message)); 34 | return buf; 35 | } 36 | } 37 | 38 | TaskPost :: TaskPost (const Quark& server, GMimeMessage * message): 39 | Task ("POST", get_description(message)), 40 | _server (server), 41 | _message (message) 42 | { 43 | g_object_ref (G_OBJECT(_message)); 44 | 45 | _state.set_need_nntp (server); 46 | } 47 | 48 | TaskPost :: ~TaskPost () 49 | { 50 | g_object_unref (G_OBJECT(_message)); 51 | } 52 | 53 | void 54 | TaskPost :: use_nntp (NNTP * nntp) 55 | { 56 | _state.set_working (); 57 | 58 | char * text = g_mime_object_to_string (GMIME_OBJECT(_message), NULL); 59 | nntp->post (text, this); 60 | g_free (text); 61 | } 62 | 63 | void 64 | TaskPost :: on_nntp_done (NNTP * nntp, 65 | Health health, 66 | const StringView & response) 67 | { 68 | _state.set_health (health); 69 | 70 | const char* res(g_mime_message_get_subject(_message)); 71 | 72 | if (health == ERR_NETWORK || health == ERR_COMMAND) 73 | { 74 | Log :: add_err_va (_("Posting of \"%s\" failed: %s"), 75 | res, response.str); 76 | _state.set_need_nntp (_server); 77 | } 78 | else { 79 | Log :: add_info_va (_("Posting of \"%s\" successful: %s"), 80 | res, response.str); 81 | _state.set_completed (); 82 | set_error (response); 83 | set_finished (health); 84 | } 85 | 86 | check_in (nntp, health); 87 | } 88 | -------------------------------------------------------------------------------- /pan/tasks/task-post.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __TaskPost_h__ 21 | #define __TaskPost_h__ 22 | 23 | #include <gmime/gmime-message.h> 24 | #include <pan/general/quark.h> 25 | #include <pan/data/data.h> 26 | #include <pan/tasks/task.h> 27 | #include <pan/tasks/nntp.h> 28 | 29 | namespace pan 30 | { 31 | /** 32 | * Task for posting an article. 33 | * @ingroup tasks 34 | */ 35 | class TaskPost: public Task, private NNTP::Listener 36 | { 37 | public: // life cycle 38 | TaskPost (const Quark& server, GMimeMessage * message); 39 | virtual ~TaskPost (); 40 | 41 | public: // Task's virtual functions 42 | unsigned long get_bytes_remaining () const override { return 0; } 43 | GMimeMessage* get_message () { return _message; } 44 | 45 | protected: // Task's virtual functions 46 | void use_nntp (NNTP * nntp) override; 47 | 48 | private: // NNTP::Listener's virtual functions 49 | void on_nntp_done (NNTP*, Health, const StringView&) override; 50 | 51 | private: // implementation 52 | Quark _server; 53 | GMimeMessage * _message; 54 | }; 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /pan/tasks/task-weak-ordering.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __TASK_WEAK_ORDERING__H__ 21 | #define __TASK_WEAK_ORDERING__H__ 22 | 23 | #include <cassert> 24 | #include <pan/general/quark.h> 25 | #include <pan/tasks/task.h> 26 | #include <pan/tasks/task-article.h> 27 | 28 | namespace pan 29 | { 30 | /** 31 | * A StrictWeakOrdering binary predicate for tasks. 32 | * 33 | * @ingroup tasks 34 | */ 35 | struct TaskWeakOrdering 36 | { 37 | const Quark BODIES, CANCEL, GROUPS, POST, SAVE, XOVER, UPLOAD; 38 | TaskWeakOrdering (): 39 | BODIES ("BODIES"), 40 | CANCEL ("CANCEL"), 41 | GROUPS ("GROUPS"), 42 | POST ("POST"), 43 | SAVE ("SAVE"), 44 | XOVER ("XOVER"), 45 | UPLOAD ("UPLOAD") 46 | {} 47 | 48 | int get_rank_for_type (const Quark& type) const 49 | { 50 | int rank (0); 51 | 52 | if (type==BODIES || type==POST || type==CANCEL) 53 | rank = 0; 54 | else if (type==XOVER || type==GROUPS) 55 | rank = 1; 56 | else if (type==SAVE) 57 | rank = 2; 58 | else if (type==UPLOAD) 59 | rank = 3; 60 | 61 | return rank; 62 | } 63 | 64 | bool operator() (const Task* a, const Task* b) const 65 | { 66 | const Quark& a_type (a->get_type ()); 67 | const Quark& b_type (b->get_type ()); 68 | 69 | const int a_rank (get_rank_for_type(a_type)); 70 | const int b_rank (get_rank_for_type(b_type)); 71 | if (a_rank != b_rank) 72 | return a_rank < b_rank; 73 | 74 | if (a_type == SAVE) { // order 'save' by oldest 75 | const TaskArticle* _a = dynamic_cast<const TaskArticle*>(a); 76 | const TaskArticle* _b = dynamic_cast<const TaskArticle*>(b); 77 | 78 | if (!_a || !_b) return false; 79 | 80 | const time_t a_time (_a->get_time_posted ()); 81 | const time_t b_time (_b->get_time_posted ()); 82 | if (a_time != b_time) 83 | return a_time < b_time; 84 | } 85 | 86 | return false; 87 | } 88 | }; 89 | } 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /pan/tasks/task.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #include <config.h> 21 | #include <pan/general/debug.h> 22 | #include <pan/general/messages.h> 23 | #include "task.h" 24 | 25 | using namespace pan; 26 | 27 | Task :: Task (const Quark& type, const StringView& description): Progress(description), _type(type) 28 | { 29 | verbose (_description); 30 | } 31 | 32 | Task :: ~Task () 33 | { 34 | } 35 | 36 | /*** 37 | **** Socket Handling 38 | ***/ 39 | 40 | void 41 | Task :: give_nntp (NNTP::Source * source, NNTP* nntp) 42 | { 43 | _nntp_to_source[nntp] = source; 44 | pan_debug ("gave nntp " << nntp->_server << " (" << nntp << ") to task " << this << ", which now has " << _nntp_to_source.size() << " nntps"); 45 | use_nntp (nntp); 46 | } 47 | 48 | void 49 | Task :: check_in (NNTP * nntp, Health health) 50 | { 51 | pan_debug ("task " << this << " returning nntp " << nntp); 52 | 53 | nntp_to_source_t::iterator it = _nntp_to_source.find (nntp); 54 | if (it != _nntp_to_source.end()) 55 | { 56 | NNTP::Source * source = it->second; 57 | _nntp_to_source.erase (nntp); 58 | pan_debug ("returned nntp " << nntp << " OK; task " << this << " now has " << _nntp_to_source.size() << " nntps"); 59 | 60 | source->check_in (nntp, health); 61 | } 62 | } 63 | 64 | /*** 65 | **** 66 | ***/ 67 | 68 | void 69 | Task :: give_decoder (DecoderSource* s, Decoder* d) 70 | { 71 | _decoder_to_source[d] = s; 72 | use_decoder (d); 73 | } 74 | 75 | void 76 | Task :: give_encoder (EncoderSource* s, Encoder* d) 77 | { 78 | _encoder_to_source[d] = s; 79 | use_encoder (d); 80 | } 81 | 82 | void 83 | Task :: use_decoder (Decoder * d UNUSED) 84 | { 85 | assert(0 && "oops, child class task.cc called!\n"); 86 | } 87 | 88 | void 89 | Task :: use_encoder (Encoder * d UNUSED) 90 | { 91 | assert(0 && "oops, child class task.cc called!\n"); 92 | } 93 | 94 | void 95 | Task :: check_in (Decoder * d) 96 | { 97 | decoder_to_source_t::iterator it (_decoder_to_source.find (d)); 98 | 99 | if (it != _decoder_to_source.end()) 100 | { 101 | DecoderSource * s (it->second); 102 | _decoder_to_source.erase (d); 103 | s->check_in (d, this); 104 | } 105 | } 106 | 107 | void 108 | Task :: check_in (Encoder * d) 109 | { 110 | encoder_to_source_t::iterator it (_encoder_to_source.find (d)); 111 | 112 | if (it != _encoder_to_source.end()) 113 | { 114 | EncoderSource * s (it->second); 115 | _encoder_to_source.erase (d); 116 | s->check_in (d, this); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /pan/usenet-utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(usenet-utils 2 | filter-info.cc 3 | rules-info.cc 4 | gnksa.cc 5 | message-check.cc 6 | mime-utils.cc 7 | numbers.cc 8 | scorefile.cc 9 | ssl-utils.cc 10 | text-massager.cc 11 | url-find.cc 12 | blowfish.cc 13 | gpg.cc 14 | ) 15 | 16 | 17 | # TODO: fix message-check-test and add it to this list 18 | set(test-programs gnksa-test numbers-test scorefile-test text-massager-test url-find-test) 19 | 20 | target_link_libraries(usenet-utils PUBLIC PkgConfig::GTK3) 21 | target_link_libraries(usenet-utils PUBLIC PkgConfig::GMIME) 22 | target_link_libraries(usenet-utils PUBLIC PkgConfig::GLIB) 23 | 24 | if(WANT_GNUTLS) 25 | target_link_libraries(usenet-utils PUBLIC PkgConfig::GNUTLS) 26 | endif() 27 | 28 | foreach(test ${test-programs}) 29 | add_executable(${test} ${test}.cc) 30 | # Sanity checking 31 | # https://cmake.org/cmake/help/latest/command/add_compile_options.html 32 | target_compile_options(${test} PRIVATE "${CXX_STD}" "-Wreorder" "-Wzero-as-null-pointer-constant") 33 | target_link_libraries(${test} usenet-utils generalutils pan-cc-gui) 34 | add_test(NAME ${test}-test COMMAND ${test}) 35 | endforeach() 36 | -------------------------------------------------------------------------------- /pan/usenet-utils/blowfish.h: -------------------------------------------------------------------------------- 1 | // blowfish.h interface file for blowfish.cpp 2 | // _THE BLOWFISH ENCRYPTION ALGORITHM_ 3 | // by Bruce Schneier 4 | // Revised code--3/20/94 5 | // Converted to C++ class 5/96, Jim Conger 6 | 7 | #define MAXKEYBYTES 56 // 448 bits max 8 | #define NPASS 16 // SBox passes 9 | 10 | #ifndef DWORD 11 | #define DWORD unsigned long 12 | #endif 13 | #ifndef WORD 14 | #define WORD unsigned short 15 | #endif 16 | #ifndef BYTE 17 | #define BYTE char 18 | #endif 19 | 20 | class CBlowFish 21 | { 22 | private: 23 | DWORD * PArray ; 24 | DWORD (* SBoxes)[256]; 25 | void Blowfish_encipher (DWORD *xl, DWORD *xr) ; 26 | void Blowfish_decipher (DWORD *xl, DWORD *xr) ; 27 | 28 | public: 29 | CBlowFish () ; 30 | ~CBlowFish () ; 31 | 32 | CBlowFish(CBlowFish const &) = delete; 33 | CBlowFish &operator=(CBlowFish const &) = delete; 34 | 35 | void Initialize (BYTE key[], int keybytes) ; 36 | DWORD GetOutputLength (DWORD lInputLong) ; 37 | DWORD Encode (BYTE * pInput, BYTE * pOutput, DWORD lSize) ; 38 | void Decode (BYTE * pInput, BYTE * pOutput, DWORD lSize) ; 39 | 40 | } ; 41 | 42 | // choose a byte order for your hardware 43 | #define ORDER_DCBA // chosing Intel in this case 44 | 45 | #ifdef ORDER_DCBA // DCBA - little endian - intel 46 | union aword { 47 | DWORD dword; 48 | BYTE byte [4]; 49 | struct { 50 | unsigned int byte3:8; 51 | unsigned int byte2:8; 52 | unsigned int byte1:8; 53 | unsigned int byte0:8; 54 | } w; 55 | }; 56 | #endif 57 | 58 | #ifdef ORDER_ABCD // ABCD - big endian - motorola 59 | union aword { 60 | DWORD dword; 61 | BYTE byte [4]; 62 | struct { 63 | unsigned int byte0:8; 64 | unsigned int byte1:8; 65 | unsigned int byte2:8; 66 | unsigned int byte3:8; 67 | } w; 68 | }; 69 | #endif 70 | 71 | #ifdef ORDER_BADC // BADC - vax 72 | union aword { 73 | DWORD dword; 74 | BYTE byte [4]; 75 | struct { 76 | unsigned int byte1:8; 77 | unsigned int byte0:8; 78 | unsigned int byte3:8; 79 | unsigned int byte2:8; 80 | } w; 81 | }; 82 | #endif 83 | 84 | -------------------------------------------------------------------------------- /pan/usenet-utils/message-check.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __MESSAGE_CHECK_H__ 21 | #define __MESSAGE_CHECK_H__ 22 | 23 | #include <string> 24 | #include <set> 25 | #include <gmime/gmime-message.h> 26 | #include <pan/general/quark.h> 27 | 28 | namespace pan 29 | { 30 | /** 31 | * Used to check a message's correctness before being posted. 32 | * Mild errors result in a warning; severe errors result in Pan's refusal to post. 33 | * @ingroup usenet_utils 34 | */ 35 | class MessageCheck 36 | { 37 | public: 38 | 39 | /** 40 | * Convenience class to specify whether an article being checked 41 | * is OKAY, or it deserves a warning, or Pan should refuse to post it. 42 | */ 43 | struct Goodness { 44 | enum { OKAY=0, WARN, REFUSE }; 45 | int state; 46 | Goodness(): state(OKAY) {} 47 | void clear() { state = OKAY; } 48 | void raise_to_warn() { if (state<WARN) state = WARN; } 49 | void raise_to_refuse() { if (state<REFUSE) state = REFUSE; } 50 | bool is_ok () const { return state == OKAY; } 51 | bool is_warn () const { return state == WARN; } 52 | bool is_refuse () const { return state == REFUSE; } 53 | }; 54 | 55 | typedef std::set<std::string> unique_strings_t; 56 | 57 | static void message_check (const GMimeMessage * message, 58 | const StringView & attribution, 59 | const quarks_t & groups_our_server_has, 60 | unique_strings_t & errors, 61 | Goodness & goodness, 62 | bool binpost = false); 63 | }; 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /pan/usenet-utils/rules-info.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __Rules_Info_h__ 21 | #define __Rules_Info_h__ 22 | 23 | #include <deque> 24 | #include <pan/general/quark.h> 25 | #include <pan/general/string-view.h> 26 | #include <pan/general/text-match.h> 27 | 28 | /** 29 | * Pre-declaring swap(...) is a bit involved, given the use 30 | * of the namespace pan and it needs to be outside. 31 | */ 32 | namespace pan { 33 | class RulesInfo; 34 | }; 35 | 36 | void swap(pan::RulesInfo &first, pan::RulesInfo &second); 37 | 38 | namespace pan 39 | { 40 | /** 41 | * Interface class describing a filter that can be applied to a set of articles. 42 | * @ingroup usenet_utils 43 | * RulesInfo is used with a top level RuleInfo with AGGREGATE_RULES type. 44 | * It contains a set of rules of type MARK_READ, AUTOCACHE, AUTODOWNLOAD DELETE_ARTICLE 45 | * This construct is not used in a recursive way. 46 | */ 47 | class RulesInfo 48 | { 49 | public: 50 | 51 | /** The different type of filters we support. */ 52 | enum RulesType { 53 | TYPE__ERR, 54 | AGGREGATE_RULES, // all rules are applied to each article 55 | MARK_READ, 56 | AUTOCACHE, 57 | AUTODOWNLOAD, 58 | DELETE_ARTICLE 59 | }; 60 | 61 | /** Defines what type of filter this is. */ 62 | RulesType _type; 63 | 64 | bool empty() const { return _type == TYPE__ERR; } 65 | RulesInfo () { clear(); } 66 | RulesInfo (const RulesInfo &that); 67 | friend void ::swap (RulesInfo &first, RulesInfo &second); 68 | RulesInfo &operator = (RulesInfo other); 69 | virtual ~RulesInfo (); 70 | 71 | /** Convenience typedef. */ 72 | typedef std::deque<RulesInfo *> aggregatesp_t; 73 | 74 | /** When `_type' is AGGREGATE_RULES 75 | the aggregated rules are applied one by one. */ 76 | aggregatesp_t _aggregates; 77 | 78 | private: 79 | void set_type_is (RulesType type); 80 | void set_type_le (RulesType type, unsigned long le); 81 | void set_type_ge (RulesType type, unsigned long ge); 82 | void set_type_bounds (RulesType type, int low, int high); 83 | 84 | public: 85 | 86 | unsigned long _ge; 87 | int _lb, _hb; 88 | 89 | void clear (); 90 | void set_type_aggregate (); 91 | void set_type_mark_read_b (int lb, int hb); 92 | void set_type_autocache_b (int lb, int hb); 93 | void set_type_dl_b (int lb, int hb); 94 | void set_type_delete_b (int lb, int hb); 95 | }; 96 | } 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /pan/usenet-utils/ssl-utils.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This file 7 | * Copyright (C) 2011 Heinrich Müller <henmull@src.gnome.org> 8 | * SSL functions : Copyright (C) 2002 vjt (irssi project) 9 | * 10 | * GnuTLS functions and code 11 | * Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2010 Free Software 12 | * Foundation, Inc. 13 | * 14 | * This program is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU General Public License as published by 16 | * the Free Software Foundation; version 2 of the License. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 25 | * 26 | */ 27 | 28 | #ifndef _SSL_UTILS_H_ 29 | #define _SSL_UTILS_H_ 30 | 31 | #include "config.h" 32 | 33 | #ifdef HAVE_GNUTLS 34 | 35 | #include <gnutls/x509.h> 36 | 37 | #include <stddef.h> 38 | 39 | namespace pan { 40 | 41 | class Quark; 42 | 43 | void pretty_print_x509(char *buf, 44 | size_t size, 45 | Quark const &server, 46 | gnutls_x509_crt_t c, 47 | bool on_connect); 48 | } // namespace pan 49 | 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /pan/usenet-utils/text-massager.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __Text_Massager_h__ 21 | #define __Text_Massager_h__ 22 | 23 | #include <string> 24 | #include <climits> 25 | #include <set> 26 | #include <pan/general/string-view.h> 27 | #include <pan/general/quark.h> 28 | #include <pan/data/article.h> 29 | 30 | namespace pan 31 | { 32 | /** 33 | * Used for manipluating text in ways that a newsreader might need: 34 | * <ul> 35 | * <li>rot13'ing text 36 | * <li>muting quoted text 37 | * <li>'filling' text to wrap at 78 cols 38 | * </ul> 39 | * 40 | * @ingroup usenet_utils 41 | */ 42 | class TextMassager { 43 | public: 44 | TextMassager (); 45 | ~TextMassager (); 46 | 47 | TextMassager(TextMassager const &) = delete; 48 | TextMassager &operator=(TextMassager const &) = delete; 49 | 50 | public: 51 | static char* rot13_inplace (char * text); 52 | std::string mute_quotes (const StringView& text) const; 53 | std::string fill (const StringView& text, bool flowed = false) const; 54 | int get_wrap_column () const { return _wrap_column; } 55 | bool is_quote_character (unsigned int unichar) const; 56 | std::set<char> get_quote_characters () const; 57 | void set_wrap_column (int column) { _wrap_column = column; } 58 | void set_quote_characters (const std::set<char>& quote_chars); 59 | private: 60 | int _wrap_column; 61 | char * _quote_characters; 62 | }; 63 | 64 | /** 65 | * Used to convert a subject line to a path for saving articles. 66 | * 67 | * @ingroup usenet_utils 68 | */ 69 | std::string subject_to_path (const char * subjectline, bool full_subj, const std::string &separator); 70 | 71 | std::string expand_download_dir_subject (const char * dir, const char * subjectline, const std::string &sep); 72 | std::string expand_download_dir (const char * dir, const StringView& group); 73 | std::string expand_attachment_headers(const Quark& path, const Article& article); 74 | 75 | std::pair<std::string,std::string> get_email_address(std::string& s); 76 | 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /pan/usenet-utils/url-find.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * Pan - A Newsreader for Gtk+ 4 | * Copyright (C) 2002-2006 Charles Kerr <charles@rebelbase.com> 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; version 2 of the License. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 | * 18 | */ 19 | 20 | #ifndef __URL_FIND_H__ 21 | #define __URL_FIND_H__ 22 | 23 | #include <pan/general/string-view.h> 24 | 25 | namespace pan 26 | { 27 | bool url_find (const StringView& text, StringView& setme_url); 28 | } 29 | 30 | #endif /* __URL_FIND_H__ */ 31 | -------------------------------------------------------------------------------- /po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # see https://cmake.org/cmake/help/latest/module/FindGettext.html 2 | find_package(Gettext) 3 | file(STRINGS "${CMAKE_SOURCE_DIR}/po/LINGUAS" lang_list REGEX "^[a-z]") 4 | foreach(lang IN LISTS lang_list) 5 | # this creates the gmo file in build directory instead of po/*.gmo. Although this is 6 | # a change from previous build system, it may not be a problem 7 | GETTEXT_PROCESS_PO_FILES( 8 | ${lang} ALL 9 | PO_FILES "${CMAKE_SOURCE_DIR}/po/${lang}.po" 10 | ) 11 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo 12 | DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES/" 13 | RENAME pan.mo 14 | ) 15 | endforeach() 16 | add_dependencies(pan pofiles) 17 | 18 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | # please keep this list sorted alphabetically 2 | # 3 | am 4 | ar 5 | az 6 | bg 7 | bs 8 | ca 9 | cs 10 | da 11 | de 12 | dz 13 | el 14 | en_CA 15 | en_GB 16 | eo 17 | es 18 | et 19 | eu 20 | fi 21 | fr 22 | ga 23 | gl 24 | hr 25 | hu 26 | id 27 | ie 28 | it 29 | ja 30 | ka 31 | ko 32 | lt 33 | lv 34 | ms 35 | nb 36 | nl 37 | oc 38 | pl 39 | pt 40 | pt_BR 41 | ro 42 | ru 43 | sk 44 | sl 45 | sq 46 | sr 47 | sr@latin 48 | sv 49 | tr 50 | uk 51 | vi 52 | zh_CN 53 | zh_TW 54 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files containing translatable strings. 2 | # Please keep this file sorted alphabetically. 3 | org.gnome.pan.desktop.in 4 | org.gnome.pan.metainfo.xml.in 5 | pan/data/article-cache.cc 6 | pan/data/cert-store.cc 7 | pan/data/encode-cache.cc 8 | pan/data-impl/data-impl.cc 9 | pan/data-impl/data-io.cc 10 | pan/data-impl/groups.cc 11 | pan/data-impl/headers.cc 12 | pan/data-impl/profiles.cc 13 | pan/data-impl/server.cc 14 | pan/data-impl/xover.cc 15 | pan/general/e-util.cc 16 | pan/general/file-util.cc 17 | pan/general/line-reader.cc 18 | pan/general/text-match.cc 19 | pan/general/utf8-utils.cc 20 | pan/gui/actions.cc 21 | pan/gui/body-pane.cc 22 | pan/gui/dl-headers-ui.cc 23 | pan/gui/e-action-combo-box.c 24 | pan/gui/e-charset.c 25 | pan/gui/e-charset-combo-box.c 26 | pan/gui/e-charset-dialog.c 27 | pan/gui/e-cte-dialog.c 28 | pan/gui/editor-spawner.cc 29 | pan/gui/group-pane.cc 30 | pan/gui/group-prefs-dialog.cc 31 | pan/gui/gui.cc 32 | pan/gui/header-pane.cc 33 | pan/gui/log-ui.cc 34 | pan/gui/pan.cc 35 | pan/gui/pan-file-entry.cc 36 | pan/gui/post-ui.cc 37 | pan/gui/prefs.cc 38 | pan/gui/prefs-ui.cc 39 | pan/gui/profiles-dialog.cc 40 | pan/gui/save-attach-ui.cc 41 | pan/gui/save-ui.cc 42 | pan/gui/score-add-ui.cc 43 | pan/gui/score-view-ui.cc 44 | pan/gui/server-ui.cc 45 | pan/gui/task-pane.cc 46 | pan/gui/url.cc 47 | pan/tasks/decoder.cc 48 | pan/tasks/encoder.cc 49 | pan/tasks/nntp.cc 50 | pan/tasks/nntp-pool.cc 51 | pan/tasks/queue.cc 52 | pan/tasks/socket-impl-gio.cc 53 | pan/tasks/socket-impl-openssl.cc 54 | pan/tasks/task-article.cc 55 | pan/tasks/task-groups.cc 56 | pan/tasks/task-post.cc 57 | pan/tasks/task-upload.cc 58 | pan/tasks/task-xover.cc 59 | pan/usenet-utils/filter-info.cc 60 | pan/usenet-utils/gnksa.cc 61 | pan/usenet-utils/message-check.cc 62 | pan/usenet-utils/scorefile.cc 63 | pan/usenet-utils/ssl-utils.cc 64 | pan/usenet-utils/text-massager.cc 65 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- 1 | # List of source files that should *not* be translated. 2 | # Please keep this file sorted alphabetically. 3 | uulib/uuencode.c 4 | -------------------------------------------------------------------------------- /uulib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # collect up the source files 2 | file(GLOB SRC_FILES "*.c") 3 | 4 | add_library(uulib STATIC ${SRC_FILES}) 5 | 6 | target_include_directories(uulib PRIVATE ".") 7 | target_compile_definitions(uulib PUBLIC "PROTOTYPES") 8 | 9 | target_link_libraries(uulib PUBLIC PkgConfig::GLIB) 10 | 11 | # see https://cmake.org/cmake/help/latest/module/FindZLIB.html 12 | if(ZLIB_FOUND) 13 | target_include_directories(uulib PUBLIC ${ZLIB_INCLUDE_DIRS}) 14 | target_link_libraries(uulib PUBLIC ${ZLIB_LIBRARIES}) 15 | endif() 16 | -------------------------------------------------------------------------------- /uulib/crc32.h: -------------------------------------------------------------------------------- 1 | #ifndef __CRC32_H__ 2 | #define __CRC32_H__ 3 | 4 | #ifndef _ANSI_ARGS_ 5 | #ifdef PROTOTYPES 6 | #define _ANSI_ARGS_(c) c 7 | #else 8 | #define _ANSI_ARGS_(c) () 9 | #endif 10 | #endif 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | typedef unsigned long crc32_t; 17 | #undef Z_NULL 18 | #define Z_NULL nullptr 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif 24 | -------------------------------------------------------------------------------- /uulib/fptools.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fptools.c, some helper functions for getcgi.c and uu(en|de)view 3 | * 4 | * Distributed under the terms of the GNU General Public License. 5 | * Use and be happy. 6 | */ 7 | 8 | /* 9 | * Some handy, nonstandard functions. Note that the original may 10 | * be both faster and better. ``better'', if your compiler allows 11 | * cleaner use of such functions by proper use of ``const''. 12 | * 13 | * $Id$ 14 | */ 15 | 16 | #ifndef __FPTOOLS_H__ 17 | #define __FPTOOLS_H__ 18 | 19 | #ifndef _ANSI_ARGS_ 20 | #ifdef PROTOTYPES 21 | #define _ANSI_ARGS_(c) c 22 | #else 23 | #define _ANSI_ARGS_(c) () 24 | #endif 25 | #endif 26 | 27 | #ifndef TOOLEXPORT 28 | #define TOOLEXPORT 29 | #endif 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | void TOOLEXPORT _FP_free _ANSI_ARGS_((void *)); 36 | char * TOOLEXPORT _FP_strdup _ANSI_ARGS_((char *)); 37 | char * TOOLEXPORT _FP_strncpy _ANSI_ARGS_((char *, char *, int)); 38 | void * TOOLEXPORT _FP_memdup _ANSI_ARGS_((void *, int)); 39 | int TOOLEXPORT _FP_stricmp _ANSI_ARGS_((char *, char *)); 40 | int TOOLEXPORT _FP_strnicmp _ANSI_ARGS_((char *, char *, int)); 41 | char * TOOLEXPORT _FP_strrstr _ANSI_ARGS_((char *, char *)); 42 | char * TOOLEXPORT _FP_stoupper _ANSI_ARGS_((char *)); 43 | char * TOOLEXPORT _FP_stolower _ANSI_ARGS_((char *)); 44 | int TOOLEXPORT _FP_strmatch _ANSI_ARGS_((char *, char *)); 45 | char * TOOLEXPORT _FP_strstr _ANSI_ARGS_((char *, char *)); 46 | char * TOOLEXPORT _FP_stristr _ANSI_ARGS_((char *, char *)); 47 | char * TOOLEXPORT _FP_strirstr _ANSI_ARGS_((char *, char *)); 48 | char * TOOLEXPORT _FP_strrchr _ANSI_ARGS_((char *, int)); 49 | char * TOOLEXPORT _FP_fgets _ANSI_ARGS_((char *, int, FILE *)); 50 | char * TOOLEXPORT _FP_strpbrk _ANSI_ARGS_((char *, char *)); 51 | char * TOOLEXPORT _FP_strtok _ANSI_ARGS_((char *, char *)); 52 | char * TOOLEXPORT _FP_cutdir _ANSI_ARGS_((char *)); 53 | char * TOOLEXPORT _FP_strerror _ANSI_ARGS_((int)); 54 | char * TOOLEXPORT _FP_tempnam _ANSI_ARGS_((char *, char *)); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #endif 60 | -------------------------------------------------------------------------------- /uulib/uustring.h: -------------------------------------------------------------------------------- 1 | /* extracted from Id: uustring.c,v 1.8 2002/03/11 09:15:47 fp Exp */ 2 | #define S_NOT_OPEN_SOURCE 1 3 | #define S_NOT_OPEN_TARGET 2 4 | #define S_NOT_OPEN_FILE 3 5 | #define S_NOT_STAT_FILE 4 6 | #define S_SOURCE_READ_ERR 5 7 | #define S_READ_ERROR 6 8 | #define S_IO_ERR_TARGET 7 9 | #define S_WR_ERR_TARGET 8 10 | #define S_WR_ERR_TEMP 9 11 | #define S_TMP_NOT_REMOVED 10 12 | #define S_OUT_OF_MEMORY 11 13 | #define S_TARGET_EXISTS 12 14 | #define S_NOT_RENAME 13 15 | #define S_ERR_ENCODING 14 16 | #define S_STAT_ONE_PART 15 17 | #define S_PARM_CHECK 16 18 | #define S_SHORT_BINHEX 17 19 | #define S_DECODE_CANCEL 18 20 | #define S_ENCODE_CANCEL 19 21 | #define S_SCAN_CANCEL 20 22 | #define S_SIZE_MISMATCH 21 23 | #define S_PSIZE_MISMATCH 22 24 | #define S_CRC_MISMATCH 23 25 | #define S_PCRC_MISMATCH 24 26 | #define S_LOADED_PART 25 27 | #define S_NO_DATA_FOUND 26 28 | #define S_NO_BIN_FILE 27 29 | #define S_STRIPPED_SETUID 28 30 | #define S_DATA_SUSPICIOUS 29 31 | #define S_NO_TEMP_NAME 30 32 | #define S_BINHEX_SIZES 31 33 | #define S_BINHEX_BOTH 32 34 | #define S_SMERGE_MERGED 33 35 | #define S_MIME_NO_BOUNDARY 34 36 | #define S_MIME_B_NOT_FOUND 35 37 | #define S_MIME_MULTI_DEPTH 36 38 | #define S_MIME_PART_MULTI 37 39 | #define S_PART_MISSING 38 40 | --------------------------------------------------------------------------------