J'ai créer un petit logiciel de visualisation des messages directement depuis la messagerie, au lieu de vous connecter sur internet a votre serveur.
La configuration du logiciel se trouve dans Data\Config
J'ai utilisé la Lib PurePOP3
Bonne journée
https://docs.google.com/open?id=0BxdHw- ... UZ1OC0xcHM
Code : Tout sélectionner
;*********************************************************
;* Logiciel de messagerie *
;* Le 17.05.2012 *
;* Version Pure basic : 4.61 Beta 1 *
;* Librairie PurePOP3 *
;*********************************************************
;-Init
;{
UsePNGImageDecoder()
source$=GetCurrentDirectory()
OpenPreferences(source$+"Data\Config.pref")
PreferenceGroup("Parametre")
Server.s = ReadPreferenceString("Serveur_pop:","pop.orange.fr")
Port.l = ReadPreferenceLong("Port:",110)
User.s = ReadPreferenceString("Adresse_mail:","")
Pwd.s = ReadPreferenceString("Mot_de_passe:","")
ClosePreferences()
Global Dim Lecture_message.s(1)
Global Dim Piece_jointe.s(1)
Global Dim Nbr_piece_joint(1)
Element=-1
Couleur = 0
;}
;-Enumeration
;{
Enumeration
#Window_0
#List_Messsage
#Nbr_message
#Message
#Piece_jointe
#Raffraichir
#Supprimer
#ProgressW
#TextNbrMess
#BarProgress
#Combo
#Directory
#NouveauMess
#IRefresh
#ISupprime
EndEnumeration
#LVM_SETEXTENDEDLISTVIEWSTYLE = 4150
#LVS_EX_SUBITEMIMAGES = 2
;}
;-Suppéssion des Pièce jointes
;{
If ExamineDirectory(#Directory, source$+"temp\", "*.*")
While NextDirectoryEntry(#Directory)
DeleteFile(source$+"temp\"+DirectoryEntryName(#Directory))
Wend
FinishDirectory(#Directory)
EndIf
;}
Procedure ProgressBar(NbrMessage) ;Fenetre de chargement
OpenWindow(#ProgressW,0,0,200,55,"Progression",#PB_Window_ScreenCentered|#PB_Window_Tool)
TextGadget(#TextNbrMess,2,2,180,20,"Message télécharger :0/"+Str(NbrMessage))
ProgressBarGadget(#BarProgress,2,25,196,20,0,NbrMessage-1)
StickyWindow(#ProgressW, 1)
EndProcedure
Procedure JointItem(Gadget.l, Element, TextE$) ;Ajoute un texte dans une case de la liste
; add an item with an image from the ListImage or a subitem without image
; put -1 to ImageIndex to not display Image
; fill up var to set subitem icon and text
var.lvitem
Var\mask = #LVIF_TEXT
Var\iItem = element ; row number
Var\iSubItem = 0 ; subitem
Var\pszText = @TextE$ ; text to set
;Var\iImage = ImageIndex ; index of icon in the list
; set text + icon in the listicongadget item/subitem
SendMessage_(GadgetID(Gadget), #LVM_SETITEM, 0, @Var)
EndProcedure
;-Fenetre Windows
;{
If OpenWindow (#Window_0, 0, 0, 600, 600, "Messagerie", #PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
SetWindowColor (#Window_0,$7E7E81)
LoadImage(#IRefresh, source$+"Data\refresh.png")
LoadImage(#ISupprime, source$+"Data\cross.png")
ListIconGadget (#List_Messsage, 0, 0, 565, 150,"",20, #PB_ListIcon_FullRowSelect)
AddGadgetColumn (#List_Messsage,1,"Date",200)
AddGadgetColumn (#List_Messsage,2,"Sujet",200)
AddGadgetColumn (#List_Messsage,3,"Expéditeur",200)
AddGadgetColumn (#List_Messsage,4,"Piece jointe",0)
AddGadgetColumn (#List_Messsage,5,"Poids",80)
ComboBoxGadget (#Combo,0,152,380,20)
WebGadget (#Message, 0, 175, 600, 425,"")
ButtonGadget (#Piece_jointe, 385, 152, 100, 20, "Ouvrir pièce joint"):GadgetToolTip(#Piece_jointe,"Piece jointe"):DisableGadget(#Piece_jointe,1)
ButtonImageGadget (#Raffraichir, 570, 2, 30, 30, ImageID(#IRefresh)):GadgetToolTip(#Raffraichir,"Raffraichir")
ButtonImageGadget (#Supprimer, 570, 40, 30, 30, ImageID(#ISupprime)):GadgetToolTip(#Supprimer,"Supprimer le message")
SendMessage_(GadgetID(#List_Messsage), #LVM_SETEXTENDEDLISTVIEWSTYLE , #LVS_EX_SUBITEMIMAGES, #LVS_EX_SUBITEMIMAGES)
;}
Gosub Recherche_message
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget()=#List_Messsage And EventType()=#PB_EventType_LeftClick
Element = GetGadgetState(#List_Messsage)
If Element <> -1
valeur = GetGadgetItemData(#List_Messsage, element)
If valeur = -1 ;Pas encore lut
If PurePOP3_OpenPOP3Connection(Server, Port, User, Pwd) = #PurePOP3_Ok ;Connexion au serveur
If PurePOP3_RetrieveMessage(Element+1) > 0 ;Recevoire les info des messages
PurePOP3_SaveAttachementsToFile(Source$+"temp\") ;Enregistrer les pièces jointes
If PurePOP3_IsMessageHTML()
*Message = PurePOP3_GetMessageTextInMemory(#True)
Else
*Message = PurePOP3_GetMessageTextInMemory()
EndIf
If *Message
SetGadgetItemData(#List_Messsage,Element,Element)
JointItem(#List_Messsage,Element,"V")
SetGadgetItemColor(#List_Messsage,Element,#PB_Gadget_BackColor ,$00FFFF,0)
Lecture_message.s(Element) = PeekS(*Message)
SetGadgetItemText(#Message, #PB_Web_HtmlCode,PeekS(*Message))
EndIf
ClearGadgetItems(#Combo)
Resultat.l = PurePOP3_CountAttachedFiles()
If Resultat
JointItem(#List_Messsage,Element,"P")
SetGadgetItemColor(#List_Messsage,Element,#PB_Gadget_BackColor ,$FF00FF,0)
DisableGadget(#Piece_jointe,0)
List_piece_jointe$=PurePOP3_ListAttachementsForMessage()
Piece_jointe.s(Element) = List_piece_jointe$
Nbr_piece_joint(Element) = Resultat
For NbrJoint=1 To Resultat
AddGadgetItem(#Combo,-1, StringField(List_piece_jointe$, NbrJoint, Chr(9))): SetGadgetState(#Combo,0)
Next NbrJoint
Else
DisableGadget(#Piece_jointe,1)
EndIf
EndIf
PurePOP3_ClosePOP3Connection()
EndIf
Else ;Deja lut
ClearGadgetItems(#Combo)
SetGadgetItemText(#Message, #PB_Web_HtmlCode,Lecture_message(Element))
Resultat = Nbr_piece_joint(Element)
If Resultat
DisableGadget(#Piece_jointe,0)
List_piece_jointe$ = Piece_jointe(Element)
For NbrJoint=1 To Resultat
AddGadgetItem(#Combo,-1, StringField(List_piece_jointe$, NbrJoint, Chr(9))): SetGadgetState(#Combo,0)
Next NbrJoint
Else
DisableGadget(#Piece_jointe,1)
EndIf
EndIf
EndIf
EndIf
If EventGadget() = #Piece_jointe ;Boutton ouvrir pièce jointe
RunProgram(source$+"Temp\"+GetGadgetText(#Combo))
EndIf
If EventGadget()=#Supprimer
If Element<0
MessageRequester("Erreur","Pas de message selectionner")
Else
Reponce = MessageRequester("Attention","Le message sera supprimer du serveur",#PB_MessageRequester_YesNo)
If Reponce = #PB_MessageRequester_Yes
If PurePOP3_OpenPOP3Connection(Server, Port, User, Pwd) = #PurePOP3_Ok
PurePOP3_DeleteMessage(Element+1)
SetGadgetItemColor(#List_Messsage,Element,#PB_Gadget_BackColor,$0000FF)
PurePOP3_ClosePOP3Connection()
Else
MessageRequester("Erreur","Impossible de se connecter!")
EndIf
EndIf
EndIf
EndIf
If EventGadget()=#Raffraichir
ClearGadgetItems(#List_Messsage)
ClearGadgetItems(#Message)
Element = 0
Gosub Recherche_message
EndIf
EndIf
If Event = #PB_Event_SizeWindow
ResizeGadget(#List_Messsage,#PB_Ignore, #PB_Ignore, WindowWidth(#Window_0)-35, #PB_Ignore)
ResizeGadget(#Raffraichir, WindowWidth(#Window_0)-30 ,#PB_Ignore, #PB_Ignore, #PB_Ignore)
ResizeGadget(#Supprimer, WindowWidth(#Window_0)-30 ,#PB_Ignore, #PB_Ignore, #PB_Ignore)
ResizeGadget(#Message, #PB_Ignore, #PB_Ignore, WindowWidth(#Window_0), WindowHeight(#Window_0)-175)
SetGadgetItemAttribute(#List_Messsage,0,#PB_ListIcon_ColumnWidth,WindowWidth(#Window_0)-680,5)
EndIf
If Event = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf
PurePOP3_ClosePOP3Connection()
End
Recherche_message:
;{
If PurePOP3_OpenPOP3Connection(Server, Port, User, Pwd) = #PurePOP3_Ok
Numero_Message = 0
Messages = PurePOP3_CountMessages()
ProgressBar(Messages)
SetWindowTitle(#Window_0,"Vous avez " + Str(Messages) + " messages.")
ReDim Lecture_message.s(Messages)
ReDim Piece_jointe.s(Messages)
ReDim Nbr_piece_joint(Messages)
If Messages
For MessageCounter = 1 To Messages
If PurePOP3_RetrieveInfo(MessageCounter) > 0
Text$=PurePOP3_GetMessageInfo()
Text$=ReplaceString(Text$,Chr(9),Chr(10))
Text$=RemoveString(Text$,"Delivery-date:")
Text$=RemoveString(Text$,"Subject:")
Text$=RemoveString(Text$,"From:")
Text$=RemoveString(Text$,"Attachements:")
Text$=RemoveString(Text$,"Length:")
Text$=Chr(10)+Text$+Chr(10)+PurePOP3_ListAttachementsForMessage()
AddGadgetItem(#List_Messsage,-1,Text$)
SetGadgetText(#TextNbrMess,"Message télécharger :"+Str(MessageCounter)+"/"+Str(Messages))
SetGadgetState(#BarProgress,MessageCounter)
EndIf
Next MessageCounter
EndIf
Delay(20)
CloseWindow(#ProgressW)
PurePOP3_ClosePOP3Connection()
For Element=0 To Messages
Couleur = 1-Couleur
If Couleur = 1
SetGadgetItemColor(#List_Messsage, Element, #PB_Gadget_BackColor, $D6D6D6, -1)
Else
SetGadgetItemColor(#List_Messsage, Element , #PB_Gadget_BackColor, $FFFFFF, -1)
EndIf
SetGadgetItemData(#List_Messsage,Element,-1)
Next Element
Else
MessageRequester("Erreur","Impossible de se connecter!")
EndIf
Return
;}