Program avorted. (by external library)
Posted: Thu Oct 06, 2011 9:37 pm
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
;Ïðîãðàììà äëÿ ñâîåâðåìåííîãî îïîâåùåíèÿ î ñîîáùåíèÿõ íà ñòðèòôàéëçå
#ver = "v0.7"
#icq = "63-1100-298"
#email = "streetfiler@li.ru"
#author = "Nikita StreetFiler"
#site = ""
#email0 = "ilove2ihate2@mailforspam.com"
#pass = "imsosorry"
#UserAgent = "StreetFiles client v0.7beta"
;#######Ñìåíà ÿçûêà#######
;Ãëîáàëüíûå ÿçûêîâûå ïåðåìåííûå
Global l_option.s
Global l_email.s
Global l_pass.s
Global l_mon.s
Global l_sec.s
Global l_autorun.s
Global l_save.s
Global l_back.s
Global l_new_messages.s
Global l_error.s
Global l_wrong_data.s
Global l_about.s
Global l_exit.s
Global l_about_text.s
Global l_opt_save_title.s
Global l_opt_save.s
Global l_is_internet.s
Global l_on_error.s
Global l_tool_tip.s
Global l_no_readme.s
Global l_help.s
Global l_mes_from.s
Global l_inf_title.s
Global l_ch_l_act.s
Global l_act_ph_ev.s
Global l_sitt_mes.s
Global l_sitt_act.s
Global l_new_msg_title.s
Global h ;âûñîòà øðèôòà
Global h2;
;Èíèöèàëèçàöèÿ èíòåðíåòà è çâóêà
InitNetwork()
;Îáúÿâëåíèå ãëîáàëüíûõ ïåðåìåííûõ
Global email.s
Global pass.s
Global lang.s
Global Icon ; õýíäë èêîíêè
Global win_id ; õýíäë îêíà
Global f ; ôëàã - åñòü ëè íîâûå ñîîáùåíèÿ
Global f2 ; ôëàã - åñòü ëè íîâàÿ àêòèâíîñòü
Global m ; êîë-âî ñîîáùåíèé
Global sound; íîìåð çâóêà
Global lstr.s
Global rstr.s
Global mon ; ïîòîê ìîíèòîðèíãà
Global win_open; - îòêðûòî ëè îêíî
Global delay.s = "5"; îæèäàíèå ñîîáùåíÿ
Global delay_a.s = "60"; îæèäàíèå àêòèâíîñòè
Global s
Global who.s ;îò êîãî ïðèøëî ñîîáùåíèå
Global wr_l.s
Global cod; ïåðåâîäèëèñü ëè ïàðîëü è ìûëî â êîäèðâêó è óðë-êîäèðîâêó
Global resize
Global f_msg
Global f_info
Global way; êàêèì ïóòåì îáðàáàòûâàòü ïðîöåäóðó ïðîâåðêè ñîîáùåíèé (ïðè delay1 <=> delay2)
Global way_flag;ôëàã äëÿ òðåòüåãî ñëó÷àÿ (>)
Global WinX,WinY; Êîîðäèíàòû îêíà
Global orig.s ;îðèãèíàëüíûé òåêñò àêòèâíîñòè â ôîòîãðàôèÿõ
Global norig.s ;íåîðèãèíàëüíûé -"-
Global result.s ; ïðèíèìàåìûå îò ñàéòà äàííûå
;Ïîäãðóæàåì çâóê èç äàòàñåêöèè
InitSound()
;sound = CatchSound(#PB_Any,?mus)
;Íóìåðàöèÿ
Enumeration
#Window_0 ;îêíî íàñòðîåê
#Window_info ;îêíî èíôîðìàöèè èç òðåÿ
#Window_msg ;îêíî ñîîáùåíèé
EndEnumeration
Enumeration
#Text_10
#String_email
#Text_12
#String_pass
#Text_14
#Text_15
#String_mon_time
#Text_17
#CheckBox_autorun
#Button_save
#Button_back
#ComboBox_lang
#Image_pic
#Text_date
#Text_name
#Text_action
#Text_21i
#Text_23i
#String_mon_ac_time
#Text_25i
#Text_new_msg
#Text_l_msg
#Text_last_msg_from
EndEnumeration
Enumeration
#Font_Text_10
#Font_Text_12
#Font_Text_14
#Font_Text_15
#Font_Text_17
#Font_Button_save
#Font_Button_back
#Font_Text_name
#Font_Text_21i
#Font_Text_23i
#Font_Text_25i
#Font_Text_last_msg_from
EndEnumeration
Enumeration
#Image_Image_0
EndEnumeration
DataSection
Image_Image_0:
;IncludeBinary "C:\Trash\test.jpg"
EndDataSection
UseJPEGImageDecoder()
UsePNGImageDecoder()
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;Ãëàâíîå îêíî (íàñòðîéêè)
Procedure OpenWindow_Window_0()
ExamineDesktops()
If OpenWindow(#Window_0,384 , 383, 171, 191, l_option.s, #PB_Window_TitleBar)
TextGadget(#Text_10, 5, 6, 45, 15, l_email.s)
StringGadget(#String_email, 50, 5, 115, 20, "example@site.com")
TextGadget(#Text_12, 5, 30, 65, 15, l_pass.s)
StringGadget(#String_pass, 70, 30, 95, 20, "password", #PB_String_Password)
TextGadget(#Text_14, 5, 55, 115, 35, l_mon.s)
TextGadget(#Text_15, 140, 71, 30, 20, l_sec.s)
StringGadget(#String_mon_time, 118, 71, 22, 17, "5", #PB_String_Numeric)
TextGadget(#Text_17, 6, 137, 50, 15, l_autorun.s)
CheckBoxGadget(#CheckBox_autorun, 60, 138, 15, 15, "")
ButtonGadget(#Button_save, 5, 160, 80, 25, l_save.s)
ButtonGadget(#Button_back, 85, 160, 80, 25, l_back.s)
TextGadget(#Text_21i, 5, 92, 195, 20, l_ch_l_act.s)
TextGadget(#Text_25i, 5, 107, 105, 20, l_act_ph_ev.s)
TextGadget(#Text_23i, 140, 107, 30, 20, l_sec.s)
StringGadget(#String_mon_ac_time, 118, 108, 22, 17, "60", #PB_String_Numeric)
ComboBoxGadget(#ComboBox_lang, 85, 135, 79, 20)
AddGadgetItem(#ComboBox_lang, 0, "Eng. lang.")
AddGadgetItem(#ComboBox_lang, 1, "Ðóñ. ÿçûê")
SetGadgetText(#ComboBox_lang,"Eng. lang.")
; Gadget Fonts
SetGadgetFont(#Text_10, LoadFont(#Font_Text_10, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
SetGadgetFont(#Text_12, LoadFont(#Font_Text_12, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
SetGadgetFont(#Text_14, LoadFont(#Font_Text_14, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
SetGadgetFont(#Text_15, LoadFont(#Font_Text_15, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
SetGadgetFont(#Text_17, LoadFont(#Font_Text_17, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
SetGadgetFont(#Button_save, LoadFont(#Font_Button_save, "Microsoft Sans Serif", h2, #PB_Font_HighQuality))
SetGadgetFont(#Button_back, LoadFont(#Font_Button_back, "Microsoft Sans Serif", h2, #PB_Font_HighQuality))
SetGadgetFont(#Text_21i, LoadFont(#Font_Text_21i, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
SetGadgetFont(#Text_23i, LoadFont(#Font_Text_23i, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
SetGadgetFont(#Text_25i, LoadFont(#Font_Text_25i, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
EndIf
EndProcedure
;Îêíî èíôîðìàöèè èç òðåÿ
Procedure OpenWindow_Window_info()
ExamineDesktops()
screenW = DesktopWidth(0)
screenH = DesktopHeight(0)
InfoWinW = 226
InfoWinH = 69
WinX = screenW - InfoWinW - 8
WinY = screenH
If OpenWindow(#Window_info, WinX, WinY-124, InfoWinW, InfoWinH, l_inf_title.s, #PB_Window_Tool)
ImageGadget(#Image_pic, 5, 5, 69, 46, CatchImage(#Image_Image_0, ?Image_Image_0))
TextGadget(#Text_date, 100, 5, 120, 15, "-")
TextGadget(#Text_name, 100, 20, 120, 15, "-")
TextGadget(#Text_action, 100, 35, 120, 30, "-")
; Gadget Fonts
SetGadgetFont(#Text_name, LoadFont(#Font_Text_name, "Microsoft Sans Serif", 8, #PB_Font_Bold|#PB_Font_HighQuality))
EndIf
plus1=0
EndProcedure
;Îêíî èíô î ñîîáùåíèÿõ èç òðåÿ
Procedure OpenWindow_Window_msg()
ExamineDesktops()
screenW = DesktopWidth(0)
screenH = DesktopHeight(0)
InfoWinW = 173
InfoWinH = 58
WinX = screenW - InfoWinW - 8
WinY = 25 + 113
If OpenWindow(#Window_msg, WinX, WinY-113, InfoWinW, InfoWinH, l_new_msg_title.s, #PB_Window_Tool)
TextGadget(#Text_new_msg, 5, 5, 160, 15, "Ó 902 íîâûõ ñîîáùåíèé!", #PB_Text_Center)
TextGadget(#Text_l_msg, 5, 20, 160, 15, "Ïîñëåäíåå ñîîáùåíèå îò:", #PB_Text_Center)
TextGadget(#Text_last_msg_from, 5, 35, 165, 15, "thaves.photographer", #PB_Text_Center)
; Gadget Fonts
SetGadgetFont(#Text_last_msg_from, LoadFont(#Font_Text_last_msg_from, "Microsoft Sans Serif", h, #PB_Font_Bold|#PB_Font_HighQuality))
EndIf
plus =0
EndProcedure
;Ïðîöåäóðà äëÿ ñìåíà ÿçûêà
; Procedure lang(lang.s)
; If lang.s = "rus"
; l_option.s = "Íàñòðîéêè" ; Çàãîëîâîê îêíà "Íàñòðîéêè" | Ìåíþ â òðåå
; l_email.s = "E-ìýéë:" ; Íàäïèñü "Åìåéë"
; l_pass.s = "Ïàðîëü:" ; Íàäïèñü "Ïàðîëü"
; l_mon.s = "Ïðîâåðÿòü íîâûå ñîîáùåíèÿ êàæäûå" ; Íàäïèñü "Ïðîâåðÿòü êàæäûå [10] {ñåê.}"
; l_sec.s = "ñåê." ; Íàäïèñü "{Ïðîâåðÿòü êàæäûå} [10] ñåê."
; l_autorun.s = "Àâòîðàí:" ; Íàäïèñü "Àâòîçàãðóçêà"
; l_save.s = "Ñîõðàíèòü" ; Êíîïêà Ñîõðàíèòü
; l_back.s = "Íàçàä"; Êíîïêà Íàçàä
; l_new_messages.s = "íîâûõ ñîîáùåíèé!" ;Èíôîðìàöèÿ èç òðåÿ ïðî ñîîáùåíèÿ
; l_error.s = "Îøèáêà" ; Ñîîáùåíèå îá îøèáêå(çàãîëîâîê)
; l_wrong_data.s = "Íåïðàâèëüíûå å-ìýéë èëè ïàðîëü!"; Ñîîáùåíèå îá îøèáêå(òåëî ñîîáùåíèÿ)
; l_about.s = "Î ïðîãðàììå" ; Ìåíþ â òðåå
; l_exit.s = "Âûõîä"; Ìåíþ â òðåå
; l_about_text.s = "Ïðîãðàììà äëÿ îïîâåùåíèÿ î"+#CRLF$+"íîâûõ ñîîáùåíèÿõ íà StreetFiles" + #CRLF$ + "Âåðñèÿ: " + #ver + #CRLF$ + "Àâòîð: " + #author + #CRLF$ + "Êîíòàêòû àâòîðà ïðîãðàììû: " + #CRLF$ + "ICQ: " + #icq + #CRLF$ + "E-mail: " + #email + #CRLF$ + "[Èç Ðîññèè ñ ëþáîâüþ]"
; l_opt_save_title.s = "Èíôî"
; l_opt_save.s = "Íàñòðîéêè ñîõðàíåíû"
; l_is_internet.s = "Íå ìîãó ïîäêëþ÷èòüñÿ ê èíòåðíåòó." +Chr(13)+ "Ïðîâåðüòå íàñòðîéêè ñåòè."
; l_on_error.s = "Â ïðîãðàììå îáíàðóæåíà îøèáêà!" + #CRLF$ + "Ïîæàëóéñòà, ñîîáùèòå îá ýòîì àâòîðó ïðîãðàììû" +#CRLF$+ "è ïåðåäàéòå åìó ôàéë 'Error.txt'(îí ïîÿâèòñÿ â ïàïêå ñ ïðîãðàììîé)" +#CRLF$+ "äëÿ ïðåäîòâðàùåíèÿ ïîÿâëåíèÿ ýòîé îøèáêè â äàëüíåéøåì." +#CRLF$+#CRLF$+ "Êîíòàêòû àâòîðà áóäóò â ôàéëå 'Error.txt'" + error_text.s
; l_tool_tip.s = "SF messages notifier"
; l_no_readme.s = "Ôàéë 'Readme.txt' íå íàéäåí!"
; l_help.s = "Ïîìîùü"
; l_mes_from.s = "Ïîñëåäíåå ñîîáùåíèå îò "
; l_inf_title.s=" "+"Íîâîå ñîáûòèå ñ âàøèìè ôîòî"
; l_ch_l_act.s="Ïðîâåðÿòü íîâûå ñîáûòèÿ"
; l_act_ph_ev.s="ñ ôîòî êàæäûå"
; l_new_msg_title.s = " "+"Íîâûå ñîîáùåíèÿ"
;
; h=9
; h2=10
; EndIf
; If lang.s = "eng"
; l_option.s = "Options" ; Çàãîëîâîê îêíà "Íàñòðîéêè" | Ìåíþ â òðååjdjfj
; l_email.s = "E-mail:" ; Íàäïèñü "Åìåéë"
; l_pass.s = "Password:" ; Íàäïèñü "Ïàðîëü"
; l_mon.s = "Check for new messages every" ; Íàäïèñü "Ïðîâåðÿòü êàæäûå [10] {ñåê.}"
; l_sec.s = "sec." ; Íàäïèñü "{Ïðîâåðÿòü êàæäûå} [10] ñåê."
; l_autorun.s = "Autorun" ; Íàäïèñü "Àâòîçàãðóçêà"
; l_save.s = "Save" ; Êíîïêà Ñîõðàíèòü
; l_back.s = "Back"; Êíîïêà Íàçàä
; l_new_messages.s = "new messages!" ;Èíôîðìàöèÿ èç òðåÿ ïðî ñîîáùåíèÿ
; l_error.s = "Error" ; Ñîîáùåíèå îá îøèáêå(çàãîëîâîê)
; l_wrong_data.s = "Wrong e-mail or password"; Ñîîáùåíèå îá îøèáêå(òåëî ñîîáùåíèÿ)
; l_about.s = "About" ; Ìåíþ â òðåå
; l_exit.s = "Exit"; Ìåíþ â òðåå
; l_about_text.s = "Programm to alert you about"+#CRLF$+"new messages on StreetFiles" + #CRLF$ + "Version: " + #ver + #CRLF$ + "Author: " + #author + #CRLF$ + "Contacts programm author: " + #CRLF$ + "ICQ: " + #icq + #CRLF$ + "E-mail: " + #email + #CRLF$ + "[From Russia with love]"
; l_opt_save_title.s = "Info"
; l_opt_save.s = "Options saved"
; l_is_internet.s = "Can't connect to internet." +Chr(13)+ "Look internet options."
; l_on_error.s = "The program has encountered a problem!" + #CRLF$ + "Please inform the author of the program" +#CRLF$+ "pass the file 'Error.txt'(file will appear in the program)" +#CRLF$+ "to prevent this error in future." +#CRLF$+#CRLF$+ "Contact the author would be in the file 'Error.txt'" + error_text.s
; l_tool_tip.s = "SF messages notifier"
; l_no_readme.s = "File 'Readme.txt' Not found!"
; l_help.s = "Help"
; l_mes_from.s = "The last message from "
; l_inf_title.s="Latest activities on your photos"
; l_ch_l_act.s="Check latest activities"
; l_act_ph_ev.s="on photos every"
; l_new_msg_title.s = "New messages"
;
; h=10
; h2=11
; EndIf
;
; ;Ìåíþ äëÿ òðåÿ
; CreatePopupMenu(0);Ñîçäàåì ìåíþ
; MenuItem(0,l_option.s)
; MenuBar()
; MenuItem(1,l_help.s)
; MenuItem(2,l_about.s)
; MenuItem(3,l_exit.s)
;
; ;Åñëè îêíî îòêðûòî (òîåñòü ãàäæåòû óæå îïðåäååíû) òî ìåíÿåì òåêñò â ãàäæåòàõ
; If win_open = 1
; SetWindowTitle(#Window_0,l_option.s)
; SetWindowTitle(#Window_info,l_inf_title.s)
; SetWindowTitle(#Window_msg,l_new_msg_title.s)
; SetGadgetText(#Text_10, l_email.s)
; SetGadgetText(#Text_12, l_pass.s)
; SetGadgetText(#Text_14, l_mon.s)
; SetGadgetText(#Text_15, l_sec.s)
; SetGadgetText(#Text_17, l_autorun.s)
; SetGadgetText(#Button_save, l_save.s)
; SetGadgetText(#Button_back, l_back.s)
; SetGadgetText(#Text_21i, l_ch_l_act.s)
; SetGadgetText(#Text_25i, l_act_ph_ev.s)
; SetGadgetText(#Text_23i, l_sec.s)
; ;Äëÿ ðóññêîãî ÿçûêà ïðèõîäèòüñÿ óìåíüøàòü ðàçìåðøðèôòîâ
; SetGadgetFont(#Text_10, LoadFont(#Font_Text_10, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
; SetGadgetFont(#Text_12, LoadFont(#Font_Text_12, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
; SetGadgetFont(#Text_14, LoadFont(#Font_Text_14, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
; SetGadgetFont(#Text_15, LoadFont(#Font_Text_15, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
; SetGadgetFont(#Text_17, LoadFont(#Font_Text_17, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
; SetGadgetFont(#Button_save, LoadFont(#Font_Button_save, "Microsoft Sans Serif",h2 , #PB_Font_HighQuality))
; SetGadgetFont(#Button_back, LoadFont(#Font_Button_back, "Microsoft Sans Serif", h2, #PB_Font_HighQuality))
; SetGadgetFont(#Text_21i, LoadFont(#Font_Text_21i, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
; SetGadgetFont(#Text_23i, LoadFont(#Font_Text_23i, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
; SetGadgetFont(#Text_25i, LoadFont(#Font_Text_25i, "Microsoft Sans Serif", h, #PB_Font_HighQuality))
; EndIf
; EndProcedure
; ;Îòêðûâàåì êîíôèãóðàöèþ è ñìîòðèì êàêîé ÿçûê
; OpenPreferences("cfg.ini")
; ;Â çàâèñèìîñòè îò ÿçûêà çàïóñêàåì ïðîöåäóðó ñ ðàçíûì ïàðàìåòðîì
; If ReadPreferenceString("lang","eng") = "eng"
; lang("eng")
; ElseIf ReadPreferenceString("lang","eng") = "rus"
; lang("rus")
; EndIf
; ClosePreferences()
; ANSI1251 -> UTF8
Procedure.s getCharToUtf(tmp$)
If Asc(tmp$) = Asc("¸")
ProcedureReturn "Ñ" + Chr(145)
EndIf
If Asc(tmp$) = Asc("¨")
ProcedureReturn "Ñ" + Chr(129)
EndIf
If (Asc(tmp$) < Asc("À")) Or (Asc(tmp$) > Asc("ÿ"))
ProcedureReturn tmp$
Else
If Asc(tmp$) < 240
ProcedureReturn "Ð" + Chr(Asc(tmp$) + 144 - Asc("À"))
Else
ProcedureReturn "Ñ" + Chr(Asc(tmp$) + 128 - Asc("ð"))
EndIf
EndIf
EndProcedure
Procedure.s Ansi2Utf(prm$)
tmp$ = ""
For j = 1 To Len(prm$)
tmp$ = tmp$ + getCharToUtf(Mid(prm$, j, 1))
Next
ProcedureReturn tmp$
EndProcedure
; UTF8 -> ANSI1251
Procedure.s getTextUtf(tmp, tmp1, *i)
If (tmp = 208) Or (tmp = 209)
If tmp = 209
t = 64
EndIf
PokeL(*i, PeekL(*i) +1)
ProcedureReturn Chr(tmp1 - 144 + Asc("À") + t)
Else
ProcedureReturn Chr(tmp)
EndIf
EndProcedure
Procedure.s Utf2Ansi(prm$)
tmp$ = "" : j = 1
While j < Len(prm$)
tmp1$ = getTextUtf(Asc(Mid(prm$, j, 1)), Asc(Mid(prm$, j + 1, 1)), @j)
tmp$ = tmp$ + tmp1$
j + 1
Wend
ProcedureReturn tmp$
EndProcedure
;proc between
ProcedureDLL.s Between(string.s, LString.s, RString.s)
Protected Between.s, LIndex.l, RIndex.l
LIndex = FindString(string, LString, 0)
RIndex = FindString(string, RString, Lindex+1)
If LIndex And RIndex
LIndex + Len(LString)
Between = Mid(string, LIndex, RIndex-LIndex)
EndIf
ProcedureReturn Between
EndProcedure
Procedure.s Between_int(string.s, LString.s, RString.s) ;for internal purposes
Protected Between.s, LIndex.l, RIndex.l
LIndex = FindString(string, LString, 0)
RIndex = FindString(string, RString, Lindex+1)
If LIndex And RIndex
LIndex + Len(LString)
Between = Mid(string, LIndex, RIndex-LIndex)
EndIf
ProcedureReturn Between
EndProcedure
;Ïðè ïîëó÷åíèè íîâîãî ñîîáùåíèÿ
Procedure newmessage(a)
PlaySound(sound,0,20)
If f_info = 1
f_info = 0
plus1 = WindowHeight(#Window_info)+25
ResizeWindow(#Window_msg,#PB_Ignore,WindowY(#Window_msg)-plus1,#PB_Ignore,#PB_Ignore)
EndIf
HideWindow(#Window_msg,0)
f_msg=1
d2 = Date()
Repeat
If Date() - d2 = 25
HideWindow(#Window_msg,1)
ResizeWindow(#Window_msg,#PB_Ignore,WindowY(#Window_msg)+plus1,#PB_Ignore,#PB_Ignore)
resize = 1
f_msg=0
EndIf
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico1)))
Delay (600)
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico2)))
Delay (200)
Until f=0
HideWindow(#Window_msg,1)
If resize <> 1
f_msg=0
ResizeWindow(#Window_msg,#PB_Ignore,WindowY(#Window_msg)+plus1,#PB_Ignore,#PB_Ignore)
resize = 0
EndIf
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico0)))
SysTrayIconToolTip(Icon,l_tool_tip.s)
f_msg=0
EndProcedure
;Íîâàÿ àêòèâíîñòü â âàøèõ ôîòî
Procedure newaction(g)
SysTrayIconToolTip(Icon,l_sitt_act.s)
PlaySound(sound,0,20)
If f_msg = 1
f_msg = 0
plus = WindowHeight(#Window_msg)+25
ResizeWindow(#Window_info,#PB_Ignore,WindowY(#Window_info)-plus,#PB_Ignore,#PB_Ignore)
EndIf
HideWindow(#Window_info,0)
f_info=1
d = Date()
Repeat
If Date() - d = 25
HideWindow(#Window_info,1)
ResizeWindow(#Window_info,#PB_Ignore,WindowY(#Window_info)+plus,#PB_Ignore,#PB_Ignore)
f_info=0
EndIf
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico11)))
Delay (600)
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico2)))
Delay (200)
Until f2=0
HideWindow(#Window_info,1)
If resize <> 1
f_info=0
ResizeWindow(#Window_msg,#PB_Ignore,WindowY(#Window_msg)+plus,#PB_Ignore,#PB_Ignore)
resize = 0
EndIf
ResizeWindow(#Window_info,#PB_Ignore,WindowY(#Window_info)+plus,#PB_Ignore,#PB_Ignore)
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico0)))
SysTrayIconToolTip(Icon,l_tool_tip.s)
f_info=0
EndProcedure
;Ìîíèòîðèíã ñîîáùåíèé
Procedure monitoring(zx)
MessageRequester("","test")
;Ïåðåâîä â UTF8
If cod=0
email.s = URLEncoder(Ansi2Utf(email.s))
pass.s = URLEncoder(Ansi2Utf(pass.s))
cod=1
EndIf
;Ïîëó÷åíèå êóêèñîâ
Connect = OpenNetworkConnection("www.streetfiles.org", 80)
klo = Len("POSTDATA:_method=POST&data%5BUser%5D%5Bemail%5D="+email.s+"&Data%5BUser%5D%5Bpassword%5D="+pass.s+"&Data%5BUser%5D%5Bpermanent%5D=1" + Chr(13) + Chr(10) )
com$=""
com$ = "GET /login/ HTTP/1.1" + Chr(13) + Chr(10)
com$ = com$ + "Host: streetfiles.org" + Chr(13) + Chr(10)
com$ = com$ + "User-Agent: "+#UserAgent + Chr(13) + Chr(10)
com$ = com$ + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Language: ru,en-us;q=0.7,en;q=0.3" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Encoding: gzip,deflate" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7" + Chr(13) + Chr(10)
com$ = com$ + "Connection: keep-alive" + Chr(13) + Chr(10)
com$ = com$ + "Cookie:0" + Chr(13) + Chr(10)
com$ = com$ + Chr(13) + Chr(10)
SendNetworkData(Connect, @com$, Len(com$))
result$ = Space(14500)
ReceiveNetworkData(Connect, @result$, 14500)
coo1 = FindString(result$,"Set-Cookie:",0)
coo2 = FindString(result$,"Set-Cookie: CakeCookie",0)
cookies.s ="__utma=68549075.491041073.1305989824.1314866823.1314870151.38; __utmz=68549075.1314870151.38.31.utmcsr=blogger.com|utmccn=(referral)|utmcmd=referral|utmcct=/stats2.g; " +Mid(result$,coo1+12,40) +" rsi_segs=10001; __utmc=68549075; "+Mid(result$,coo2+12,37) + " __utmb=68549075.1.10.1314870151"
CloseNetworkConnection(Connect)
Delay(10)
;Àâòîðèçàöèÿ
Connect = OpenNetworkConnection("www.streetfiles.org", 80)
com$=""
com$ = "POST /login/ HTTP/1.1" + Chr(13) + Chr(10)
com$ = com$ + "Host: streetfiles.org" + Chr(13) + Chr(10)
com$ = com$ + "User-Agent: "+#UserAgent + Chr(13) + Chr(10)
com$ = com$ + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Language: ru,en-us;q=0.7,en;q=0.3" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Encoding: gzip,deflate" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7" + Chr(13) + Chr(10)
com$ = com$ + "Connection: keep-alive" + Chr(13) + Chr(10)
com$ = com$ + "Referer: http://streetfiles.org/login/" + Chr(13) + Chr(10)
com$ = com$ + "Cookie:" + cookies.s + Chr(13) + Chr(10)
com$ = com$ + "Content-Type: application/x-www-form-urlencoded" + Chr(13) + Chr(10)
com$ = com$ + "Content-Length: " + Str(klo) + Chr(13) + Chr(10)
com$ = com$ + Chr(13) + Chr(10)
com$ = com$ + "POSTDATA:POSTDATA=_method=POST&data%5BUser%5D%5Bemail%5D="+email.s+"&data%5BUser%5D%5Bpassword%5D="+pass.s+"&data%5BUser%5D%5Bpermanent%5D=1" + Chr(13) + Chr(10)
SendNetworkData(Connect, @com$, Len(com$))
result$ = Space(14500)
ReceiveNetworkData(Connect, @result$, 14500)
CloseNetworkConnection(Connect)
;Ïðîâåðêà îòâåòà îò ñàéòà, íà èíôîðìàöèþ î íåâåðíîì åìåéëå\ïàðîëå
If FindString(result$,"Location: http://streetfiles.org/login/",0); <> 0
wr_l.s="1"
MessageRequester(l_error.s, l_wrong_data.s);SysTrayIconBalloon(Icon, win_id, l_error.s, l_wrong_data.s,100, 3)
s=0;Óêàçûâàåì ÷òî ïðîãðàììà òåïåðü íåêòèâíà
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico00))); Ìåíÿåì èêîíêó íà íåàêòèâíóþ
;If IsThread(mon) ; Åñëè ïîòîê çàïóùåí
;KillThread(mon) ; Ãðîõàåì ïîòîê
;EndIf
Else
wr_l.s="0"
EndIf
If wr_l.s="0"
s=1;Óêàçûâàåì ÷òî ïðîãðàììà òåïåðü àêòèâíà
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico0))); Ìåíÿåì èêîíêó íà àêòèâíóþ
EndIf
;Öèêë ïðîâåðêè íîâûõ ñîîáùåíèé
;Ïîïðîáîâàòü ñìîòðåòü äàòó èçìåíåíèÿ ñòðàíèöû ñ ñîîáùåíèÿìè, òàêèì îáðàçîì óìåíüøèâ ïîòðåáëåíèå òðàôôèêà
If Val(delay.s) < Val(delay_a.s)
way=1
ElseIf Val(delay.s) = Val(delay_a.s)
way=2
ElseIf Val(delay.s) > Val(delay_a.s)
way=3
way_flag = 1
EndIf
Repeat
one:
If way=1
Delay(Val(delay.s)*1000)
ElseIf way=2
Delay(Val(delay.s)*1000)
ElseIf way=3
Delay(((Val(delay.s))-(Val(delay_a.s)))*1000)
If way_flag = 1
way_flag = 0
Goto two
EndIf
EndIf
;çàïðîñ äëÿ îòñëåæèâàíèÿ ñîîáùåíèé
Connect = OpenNetworkConnection("www.streetfiles.org", 80)
com$=""
result$=""
com$ = "GET /my/messages/ HTTP/1.1" + Chr(13) + Chr(10)
com$ = com$ + "Host: streetfiles.org" + Chr(13) + Chr(10)
com$ = com$ + "User-Agent: "+#UserAgent + Chr(13) + Chr(10)
com$ = com$ + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Language: ru,en-us;q=0.7,en;q=0.3" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Encoding: gzip,deflate" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7" + Chr(13) + Chr(10)
com$ = com$ + "Connection: keep-alive" + Chr(13) + Chr(10)
com$ = com$ + "Cookie:"+ cookies.s+ Chr(13) + Chr(10)
com$ = com$ + Chr(13) + Chr(10)
SendNetworkData(Connect, @com$, Len(com$))
result$ = Space(8000)
ReceiveNetworkData(Connect, @result$, 8000)
CloseNetworkConnection(Connect)
lstr.s = "linkNewMessage"+Chr(34)+">";Òåêñò ñëåâà îò êîë-âà ñîîáùåíèé
rstr.s= "new message";Òåêñò ñïðàâà îò êîë-âà ñîîáùåíèé
m = Val(Between(result$,lstr.s,rstr.s));êîë-âî ñîîáùåíèé
; MessageRequester("",result$)
If way = 3
If way_flag=1
way_flag=0
Else
way_flag=1
EndIf
EndIf
If m = n ; Åñëè òåêóùåå êîë-âî ñîîáùåíèé = ïðåäûäóùåìó êîë-âó ñîîáùåíèé, òî ïðîâåðÿåì çàíîâî
Goto two
ElseIf m<n;Åñëè òåêóùåå êîë-âî ñîîáùåíèé < ïðåäûäóùåãî êîë-âî ñîîáùåíèé(íàïðèìåð ïðèøëî 5 íîâûõ, íî 2 èç íèõ ïðî÷èòàëè), òî
n = m ;çàíîñèì íîâîå çíà÷åíèå â ñòàðóþ ïåðåìåííóþ è ïðîâåðÿåì âñ¸ çàíîâî
Goto two
ElseIf m>n ;Åñëè òåêóùåå êîë-âî ñîîáùåíèé > ïðåäûäóùåãî êîë-âî ñîîáùåíèé(òîåñòü ïðèøëî íîâîå ñîîáùåíèå), òî
n = m
EndIf
;Îò êîãî ïðèøëî
str_pos = FindString(result$,"message_id",0); ïîçèöèÿ íà÷àëà îáëàñòè ñ èìåíåì ïðèñëàâøåãî
who.s = Mid(result$,str_pos,100); îòñåèâàíèå
who.s = Between(who.s,"href=","/a>"); íåíóæíûõ
who.s = Between(who.s,">","<"); ñèìâîëîâ
SetGadgetText(#Text_last_msg_from,who.s)
SetGadgetText(#Text_new_msg,Str(m) + " " + l_new_messages.s)
SetGadgetText(#Text_l_msg,l_mes_from.s)
;Òóò íàäî èçáàâèòüñÿ îò ýòîé êîíñòðóêöèè.
If FindString(result$,"linkNewMessage",0)
f=1
CreateThread(@newmessage(),0)
Else
m=0: n=0
EndIf
;çàïðîñ äëÿ îòñëåæèâàíèÿ àêòèâíîñòè â ïðîôèëå
two:
If way=1
Delay(((Val(delay_a.s))-(Val(delay.s)))*1000)
ElseIf way=2
Delay(50)
ElseIf way=3
Delay(Val(delay_a.s))
EndIf
Connect = OpenNetworkConnection("www.streetfiles.org", 80)
com$=""
result$=""
com$ = "GET /my/myphotos_activities/ HTTP/1.1" + Chr(13) + Chr(10)
com$ = com$ + "Host: streetfiles.org" + Chr(13) + Chr(10)
com$ = com$ + "User-Agent: "+#UserAgent + Chr(13) + Chr(10)
com$ = com$ + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Language: ru,en-us;q=0.7,en;q=0.3" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Encoding: gzip,deflate" + Chr(13) + Chr(10)
com$ = com$ + "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7" + Chr(13) + Chr(10)
com$ = com$ + "Connection: keep-alive" + Chr(13) + Chr(10)
com$ = com$ + "Cookie:"+ cookies.s+ Chr(13) + Chr(10)
com$ = com$ + Chr(13) + Chr(10)
SendNetworkData(Connect, @com$, Len(com$))
result$ = Space(4000)
ReceiveNetworkData(Connect, @result$, 4000)
CloseNetworkConnection(Connect)
result$ = Mid(result$,594,400)
pic.s = Between(result$,"<img src="+Chr(34),Chr(34)+" id=")
DeleteFile("tmp.jpg");Äèðåêòîðèþ ïîìåíÿòü!!!!!
rec_pic:
If ReceiveHTTPFile(pic.s, "tmp.jpg")
LoadImage(99,"tmp.jpg")
ResizeImage(99,84, 59,#PB_Image_Smooth)
Else
Goto rec_pic
EndIf
SetGadgetState(#Image_pic,ImageID(99))
result$ = Utf2Ansi(result$)
usr.s = Between(result$,"<b><a href="+Chr(34)+"/","</b> ")
usr.s = Between(usr.s,Chr(34)+">","</a>")
date.s = Between(result$,"</a></b> "," <br />")
wd.s = Between(result$,"<span class="+Chr(34),"an> </p>")
wd.s = Between(wd.s,Chr(34)+">","</sp")
If FindString(wd.s,"… ",0)
wd.s = Mid(wd.s,10,100)
EndIf
SetGadgetText(#Text_date,date.s)
SetGadgetText(#Text_name,usr.s)
SetGadgetText(#Text_action,wd.s)
orig.s = result$
If orig.s <> norig.s
f2=1
CreateThread(@newaction(),0)
norig.s = orig.s
EndIf
fz:
ForEver
EndProcedure
;##########_Body_##########
;--------
OpenWindow_Window_info()
;SetWindowAboveAll(WindowID(#Window_info))
HideWindow(#Window_info,1)
;--------
OpenWindow_Window_msg()
;SetWindowAboveAll(WindowID(#Window_msg))
HideWindow(#Window_msg,1)
;--------
n=0 ; ïàìÿòü ñîîáùåíèé
m=0 ; ñîîáùåíèÿ
f=0 ; ôëàã íîâûõ ñîîáùåíèé
s=1 ; ôëàã àêòèâíîñòè ïðîãðàììû
cod=0 ; ôëàã ïåðåâîäà òåêñòà äëÿ îòñûëêè
OpenWindow_Window_0()
win_open=1
HideWindow(#Window_0,1)
win_id = WindowID(#Window_0)
Icon = AddSysTrayIcon(#PB_Any,win_id,ImageID(CatchImage(#PB_Any,?ico0))) ; Áåðåì è äîáàëÿåì â òðåé èêîíêó èç ñàìîé ïðîãðàììû
SysTrayIconToolTip(Icon,l_tool_tip.s)
OpenPreferences("cfg.ini")
email.s = ReadPreferenceString("email",#email0)
pass.s = ReadPreferenceString("pass",#pass)
SetGadgetText(#String_email,email.s)
SetGadgetText(#String_pass,pass.s)
delay.s = ReadPreferenceString("delay","5")
delay_a.s = ReadPreferenceString("delay_a","60")
SetGadgetText(#String_mon_time,delay.s)
SetGadgetText(#String_mon_ac_time,delay_a.s)
If ReadPreferenceString("autorun","0") = "0"
SetGadgetState(#CheckBox_autorun,0)
Else
SetGadgetState(#CheckBox_autorun,1)
EndIf
If ReadPreferenceString("lang","eng") = "eng"
SetGadgetText(#ComboBox_lang,"Eng. lang.")
ElseIf ReadPreferenceString("lang","eng") = "rus"
SetGadgetText(#ComboBox_lang,"Ðóñ. ÿçûê")
EndIf
ClosePreferences()
mon = CreateThread(@monitoring(),0)
;##########################
;Îïðîñ ãàäæåòîâ
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #String_email ; åìåéë
ElseIf EventGadget = #String_pass ; ïàðîëü
ElseIf EventGadget = #String_mon_time ; ïàðîëü
ElseIf EventGadget = #CheckBox_autorun ; Àâòîðàí
ElseIf EventGadget = #Button_save ; Ñîõð
OpenPreferences("cfg.ini");Îòêðûâàåì ôàéë íàñòðîåê
email.s = GetGadgetText(#String_email) ; Áåðåì èç ãàäæåòà ââåäåííûå ìûëî
pass.s = GetGadgetText(#String_pass) ; è ïàðîë
;Ïðîâåðÿåì íà ñîâïàäåíèå ñ ïðåäûäóùèìè (èç ôàéëà íàñòðîåê)
email2.s = ReadPreferenceString("email",#email0)
pass2.s = ReadPreferenceString("pass",#pass)
;Åñëè ñîâïàëè - ïîòîê ïåðåçàïóñêàòü íå òðåáóåòñÿ, èíà÷å - ôëàã äëÿ ïåðåçàïóñêà ïîòîêà
If email.s <> email2
th=1
cod=0
ElseIf pass.s <> pass2.s
th=1
cod=0
Else
th = 2
EndIf
;Íàñòðîéêè äëÿ àâòîçàãðóçêè
; If GetGadgetState(#CheckBox_autorun) = 0
; autorun.s = "0"
; If IsProgramRunAtStartup(1,1,"SF messager")
; DelProgramAtStartup(1,1,"SF messager")
; EndIf
; Else
; autorun.s = "1"
; RunProgramAtStartup(1,1,"SF messager",ProgramFilename())
; EndIf
;Îæèäàíèå
delay2.s = delay.s
delay_a2.s = delay_a.s
delay.s = GetGadgetText(#String_mon_time)
delay_a.s = GetGadgetText(#String_mon_ac_time)
;Åñëè îæèäàíèÿ èçìåíèëèñü, òî ôëàã íà ïåðåçàïóñê ïîòîêà
If delay2.s <> delay.s
th=1
ElseIf delay_a.s <> delay_a2.s
th=1
EndIf
;Çàïèñûâàåì âñå â ôàéë íàñòðîåê
WritePreferenceString("email",email.s)
WritePreferenceString("pass",pass.s)
WritePreferenceString("autorun",autorun.s)
WritePreferenceString("delay",delay.s)
WritePreferenceString("delay_a",delay_a.s)
If GetGadgetText(#ComboBox_lang) = "Eng. lang."
;lang("eng")
WritePreferenceString("lang","eng")
ElseIf GetGadgetText(#ComboBox_lang) = "Ðóñ. ÿçûê"
;lang("rus")
WritePreferenceString("lang","rus")
EndIf
ClosePreferences();Çàêðûâàåì ôàéë íàñòðîåê
;Âûäàåì â òðåå èíôîðìàöèþ, î òîì ÷òî íàñòðîéêè ñîõðàíåíû
; Dobavit uvedomlenie o sohranenii nastroek
HideWindow(#Window_0,1);Ïðÿ÷åì îêíî
;Ïðîâåðÿåì ôëàã (íà òî, íóæíî ëè ïåðåçàïóñêàòü ïîòîê (åñëè ââåäåí íîâûé ïàðîëü è\èëè åìåéë) )
If th=1
If IsThread(mon)
KillThread(mon)
EndIf
mon = CreateThread(@monitoring(),0)
th = 2
EndIf
ElseIf EventGadget = #Button_back ; íàçàä
HideWindow(#Window_0,1)
ElseIf EventGadget = #ComboBox_lang
EndIf
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
Case #PB_Event_SysTray ; Ñîáûòèÿ â òðåå
If EventType() = #PB_EventType_LeftDoubleClick ; Åñëè äâîéíîé ëåâûé êëèê ïðîèçîøåë
If s = 1 ; Åñëè ïðîãðàììà àêòèâíà
If IsThread(mon) ; Åñëè ïîòîê çàïóùåí
KillThread(mon) ; Ãðîõàåì ïîòîê
EndIf
s=0;Óêàçûâàåì ÷òî ïðîãðàììà òåïåðü íåêòèâíà
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico00))); Ìåíÿåì èêîíêó íà íåàêòèâíóþ
ElseIf s = 0 ; Åñëè ïðîãðàììà íåàêòèâíà
mon = CreateThread(@monitoring(),0) ; Ñîçäàåì ïîòîê
ChangeSysTrayIcon(Icon,ImageID(CatchImage(#PB_Any,?ico0))); Ìåíÿåì èêîíêó íà àêòèâíóþ
s=1;Óêàçûâàåì ÷òî ïðîãðàììà òåïåðü àêòèâíà
EndIf
EndIf
If EventType() = #PB_EventType_LeftClick ; Åñëè ëåâûé êëèê ïðîèçîøåë
f=0;Óáèðàåì íàïîìèíàíèå(âûñòàâëÿåì ôëàã âûõîäà èç ïðîöåäóðû îïîâåùåíèÿ î íîâûõ ñîîáùåíèÿõ)
f2=0;Óáèðàåì íàïîìèíàíèå(âûñòàâëÿåì ôëàã âûõîäà èç ïðîöåäóðû îïîâåùåíèÿ î íîâîé àêòèâíîñòè)
EndIf
If EventType() = #PB_EventType_RightClick ; Åñëè ïðàâûé êëèê ïðîèçîøåë
DisplayPopupMenu(0,WindowID(#Window_0)); Ïîêàçûâàåì ìåíþ
EndIf
Case #PB_Event_Menu ; Ñîáûòèÿ ñ ìåíþ â òðåå
Select EventMenu()
Case 0; Íàñòðîéêè
HideWindow(#Window_0,0)
Case 2; Î ïðîãðàììå
MessageRequester(l_about,l_about_text.s)
Case 1 ; Help
RunProgram("readme.txt")
Case 3; Âûõîä
End
EndSelect
EndSelect
ForEver
End
;+++++++ End
;Datasection
DataSection
ico00:IncludeBinary "00icon.png"
ico0: IncludeBinary "0icon.png"
ico1: IncludeBinary "1icon.png"
ico11: IncludeBinary "11icon.png"
ico2: IncludeBinary "2icon.png"
mus: IncludeBinary "mail.wav"
EndDataSection