Giter Site home page Giter Site logo

hpi-swa-teaching / imapclient Goto Github PK

View Code? Open in Web Editor NEW
22.0 12.0 3.0 10.74 MB

This project provides a library and tool set to access email through IMAP in the Squeak/Smalltalk environment. (SWT22-13)

License: MIT License

Smalltalk 100.00%
squeak smalltalk imap email

imapclient's Introduction

IMAPClient Coverage Status

Welcome to our IMAP Client project. We are a team of 4th semester IT-Systems Engineering students and are happy to take over this project for the seventh iteration. This project is part of a lecture in Software Engineering techniques and will be contributing to our final grade, so we are giving it our best ;) As this is a student project, it will mostly be worked on during the summer terms. Therefore our time with this project is limited to the beginning of august.

In case of any questions, feel free to contact us.

Installation

If you want to participate in development, have a look at the Development section below

  1. Get Squeak 5.2 or later
  2. Load Metacello
  3. Load the Morphic Testing Framework with:
Metacello new
	baseline: 'MorphicTestingFramework';
	repository: 'github://hpi-swa-teaching/Morphic-Testing-Framework:master/packages';
	load.
  1. Finally, load the package with the following command:
Metacello new
  baseline: 'IMAPClient';
  repository: 'github://hpi-swa-teaching/IMAPClient:develop/packages';
  load.

If you encounter any dependency problems, click proceed. 5. Now you can setup a Menu Entry under "Apps" using ICFolderDialog install.

Open

You can open the tool with the command ICFolderDialog new or using a Menu Entry.

Features

  • Manage different accounts You can add an account by clicking the + button. You will then be prompted to enter the account information needed to establish a connection with the server.

  • Fetch new mails from the server Mails are automatically fetched on the first login. If you wish to update and resynchronize with the server afterwards, click the update button. The title bar of the tool will show you the time of the last successful synchronization to help you decide if you want to update.

  • Delete & move mails A right click on any mail will show you your options. Deleting a mail automatically moves it to the trash folder. If you want to revert a deletion, you can simply navigate to the trash folder and move the email back to another folder. When you want to permanently delete emails, right click on the trash folder and choose expunge. This will dump your trash folder permanently.

  • Flag and read emails A right click on any mail will show you your options. You can flag an email for later use or mark it as seen if you do not want to be disturbed by it beeing highlighted anymore. Also you can mark already seen mails as unseen again.

  • See unseen mails immediately. All unseen mails will be highlighted and the number of unseen mails per folder can be seen next to the folder name.

  • Search Mails You can enter a search string into the search bar at the top. Right next to the search bar you can see how many search results you got for the current search.

  • Parse different encodings

  • Reflect server changes back to Client. If you're accessing your mails for a different device, and deleting/moving them, just press the update button in the Client, and every change should be correctly updated.

  • Offline mode All above features are also available while you are offline. Specifically, mails can be read, flagged and moved to other folders after they were downloaded on the first login. As soon as you are online again, you may resynchronize your account with the server by clicking on the update button and filling in your password.

  • Sort mails by different categories. By default all sortings are ascending. Clicking the button again will reverse the sorting order.

  • Addressbook. You can open the addressbook by clicking the button with the icon of a person. The adressbook holds all sender names and addresses of mails from any of the currently logged in accounts. You can also add your own contacts by clicking on the respective button. Finally, it is possible to sort contacts in ascending or descending order by both sender name and address.

Usage

Start the IMAP Client with ICFolderDialog new. Add new Accounts with the + Button. We tested the functionality with web.de and gmx.de Accounts. But other accounts should work fine. The HPI OWA accounts are known to be relatively large, as calendar and contact meta information is also sent to our client as folder objects. Therefore it might not entirely load in the requested time of 5 seconds.

For HPI accounts use the following login info:

Server: owa.hpi.de
Port: 993
Username: firstname.lastname
Password: xxxxxxx
Use SSL: True

For web.de accounts use the following login info:

Server: imap.web.de
Port: 993
Username: username
Password: xxxxxxx
Use SSL: True

Configuration

You can customize the number of mails, which are fetched if you press the Load older Mails Button. The default is 10. Change ICFolder>>numbersOfHeadersToFetchAtLoadOlderMail This will not regard the e-mails that are already persisted on your disk, so if you have some e-mails in a Maildir directory, all of them will be read no matter what you defined here.

You can access a setting for which folder should not be synced by the IMAPClient and hidden in the Overview as well as a setting for how many folders to show at once in the menu that pops up when you want to move a mail to another folder in the settings browser, acessed by clicking the cogwheel on the top left.

Security

Your password isn't stored on disk, but will be visible to your Squeak environment. It is immediately deleted after login, so you will not be able to retrieve it afterwards, but be aware that we are no security experts and you might not want to test this with a sensitive account. After closing the IMAP-Client and reopening it, you are welcomed by a password prompt when you click the update button for the first time.

Development

To take part in developing the IMAPClient, follow the steps of Installation. Instead of loading it with Meatcello however, clone the project via git and check out the latest commit. Before commiting something yourself, you should format your code with PoppyPrint. You can install it with the following command:

Metacello new baseline: 'PoppyPrint'; repository: 'github://hpi-swa-teaching/poppy-print/packages'; load

And use it to format one package with PPFormatter formatPackage: 'IMAPClient-Core'. This ensures consistent formatting across the whole project, enforcing the coding standard.

Known Problems

As this project has lived through many iterations, there are a couple of known issues that we could not resolve during the few months we spend with this project. If you encounter any problem while using our IMAP client, have a look at the Issues of this GitHub Project. Most of them are probably already known to us. In case your problem has not been reported yet, feel free to post a new issue and describe what you did to get the problem, what the unexpected behaviour was and what behaviour you would have expected. Thank you in advance for contributing to making this project better by reporting any problems that we are not yet aware of!

Documentation

Have a look at the GitHub Project Wiki to find more insights into the project.

History

2016: Johannes Schneider, Maximilian Söchting, Julian Weise, Alexander Riese, Alexander Loeser

2017: Jonathan Sauder, Marcus Ding, Melvin Witte, Daniel Lindner

2018: Claudia Grabowski, Leonard Von Merzljak, Marius Walter, David Hennemann

2019: Paul Methfessel, Martin Taraz, Otto Kissig, Tim Garrels, Felix Rindt

2020: Henrik Guhl, Lorenz Woth, Niko Hastrich, Julia Joch

2021: Smilla Fox, Elena Gensch, Jan Groeneveld, Christian Helms, Lukas Rost, Johann Schulze Tast

2022: Fynn Kröger, Simon Weißmüller, Raban Gießler, Anton Neubauer, Johanna Schlimme, Hannes Spitz

imapclient's People

Contributors

alorcus avatar antonneubauer avatar blackjack2693 avatar brokkoli71 avatar claygee avatar codezeilen avatar davidhennemann avatar dey4ss avatar eightsq avatar elenagensch avatar felixrindt avatar fniephaus avatar fynnkroeger avatar jannikgro avatar jeilef avatar johannaschlimme avatar josauder avatar juliajoch avatar julianweise avatar kryptokommunist avatar laugengebaeck avatar mariwalt avatar martintaraz avatar mrhenrik avatar msoechting avatar paulpanther avatar querenker avatar simon-weissmueller avatar timgarrels avatar veladus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imapclient's Issues

Please readd the deleted metadata

The develop branch is missing:

  • .travis.yml and .smalltalk.ston. How do you even Travis-CI?
  • LICENSE. It is morally questionable to remove the License.
  • README. The MIT license (The license the original Client is under) requires stating the original authors. Removing the README amounts to license violation.

Just reverting the files should fix these issues.

Add functionality to mark E-Mails as \Flagged and \Seen

The IMAP protocol includes flags for \Answered \Flagged \Deleted \Draft \Seen.
We should be able to incorporate functionality for flagged, draft and seen. Flags for \Answered may be difficult without SMTP. Also we shouldn't care about flags for deletion, since we put deleted emails simply in the "trash-folder" (but this should be done in a different issue).

deleting emails may change messageIDs stored in Email object

Currently a dynamic message id is stored in an email object. The message ids are enumerated beginning from 1 on the server. If a email is removed out of our system from the server, the stored message ids may not be up to date.
This could be fixed by a server wide global message id or by fetching the message ids every time before they are used.

Implement test cases for ICFolder class

Within my latest commit we implemented our new class ICFolder.
We need to find some useful ways to test this new class.

I already wrote a test scenario when adding new folders in the hierarchy.

Test for broken connection

Check whether the framework recognizes a sudden connection loss. If this is not the case, implement a feature to handle this behavior.

Test refactoring

TestCase method not used properly

for example:
[self assert: (self endPoint ping)] on: Exception do: [ ^ self ]. self fail
self should: (self endPoint ping) raise: Exception

self assert: (self endPoint logout) = true.
self assert: (self endPoint logout) equals: true
or even better: self assert: (self endPoint logout).

Remove comments in source code resp. using message comments

  • ICEndpoint>>connectTo: a "stream nextResponse" call is needed to skip the server greetings. Since this call is on a different abstraction level and the purpose is not clear a commend was used.
    Ideas:
    1. a skipServerGreetings message which encapsulate this line
    2. a checkServerGreetings message which encapsulate this line and could (later) check the greeting for success etc.
  • ICEndpoint>>fetchNextResponse
    ideas:
    1. using the message comment
  • ICEndpoint>>folderFromResponse
    idea:
    1. using the message comment

Feature: Delete emails

Deleting messages in IMAP is a bit tricky, as there is no explicit delete command. Instead, a flag is set on the message marking it as deleted. This, by itself, does nothing to get the message removed. Just when a special command is called all messages in the current folder marked as to be deleted are removed.

. UID SEARCH ALL

  • 1 EXISTS
  • 1 RECENT
  • SEARCH 1814
    . OK Completed
    . UID STORE 1814 +FLAGS (\Deleted)
  • 1 FETCH (FLAGS (\Recent \Deleted \Seen) UID 1814)
    . OK Completed
    . EXPUNGE
  • 1 EXPUNGE
  • 0 EXISTS
  • 0 RECENT
    . OK Completed
    . UID SEARCH ALL
  • SEARCH
    . OK Completed

The above is executed in a folder containing just a single message (see the result of the UID SEARCH ALL). The flag \Deleted is then added to flag list of the message (UID STORE 1814 +FLAGS (\Deleted)). The STORE command returns the new flag list. The EXPUNGE command then removes the message.

Fetching Email Bodys often fails

Maybe we should collect here different types of mails, which cant be parsed atm:

So i wanted to open an amazon mail, which fails in the parseFetchBody Method within the Function asTextFromHtml. So there are 2 issues at the moment. The Amazon Mail contains two Content-Types.
Content-Type: text/plain; charset=utf-8 and Content-Type: text/html; charset=utf-8. I think as long as we are not able to display css with html properly (we should think about using an squeak web browser?). We should always go for the Content-Type: text/plain; charset=utf-8. Often Emails are sent with both Content-Types for devices not capable of displaying HTML.

At the Moment our parseFetchBody method is just

((self lastResponse copyFrom: 2 to: (self lastResponse size - 1)) joinSeparatedBy: Character cr) asTextFromHtml 

Instead of taking everything from 2 to last -1 index, we have to parse the body, looking for content-types and only render the specific content-type.

Server connection closed after inactivity

Seems like the server is closing the connections after a few minutes of inactivity. We should find a way to reopen the connection. At the Moment i cant open any mails anymore, after waiting for a few minutes.

image

improve interface for connect methods

At the moment a error is thrown if the connect fails otherwise it returns true.
For me it is a little bit confusing. Either the return value should be checked to indicate failure or the failure is indicated through an exception. As far as I know currently no message (for example UI) checks the return value, so it should be enough to check for exceptions?

Improve the Save Credentials Feature

A User who checks his mails on a regular basis, wont fill in his credentials every time. So I implemented the save credentials check box. Its just creating an config.txt in the Resources Directory, where the credentials are stored in plaintext. This is far away from being good. If i hand my squeak image to a friend, i would also give him my password in plain text.

  • We shouldnt save the Logindata file into the resource directory of the image
  • We should encrypt it somehow. The IMAP Client should be the only one able to decrypt it again. But how should we implement this? Any Ideas?

Add functionality to mark E-Mails as read/unread

Sobald der Inhalt einer Email geöffnet wird, wird die Email als gelesen markiert.
Die Schrift von Betreff, Absender und Datum einer ungelesenen Email wird fett markiert.
Eine gelesene Email wird nicht fett markiert.

Response class?

ICEndpoint owns methods to check the responses. These could also be used by other objects. Maybe it is a good idea to encapsulate these in a Response class?

Constants on class or on instance side

In SWA we learned (from @krono) that constants should be implemented on instance side of classes.
In @Hannes01071995 and my opinion this does not make much sense. Since constants should be constant for every instance of a class this should be on class side.
Please state your opinion.

ICAuthenricationInfo>>isValid misleading name?

The message checks if the username and passwort differs from the default values.
If the default values are not valid values, the name default value is a little bit misleading?

Furthermore if a server has these default values as user credentials, they can not be used, because they are incorrectly recognised as "inValid".

In my opinion these message is not necessary and can be deleted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.